@@ -416,22 +416,25 @@ class DeclAndTypePrinter::Implementation
416416
417417 os << ' \n ' ;
418418 os << " enum class cases {" ;
419- llvm::interleave (elementTagMapping, os, [&](const auto &pair){
420- os << " \n " ;
421- syntaxPrinter.printIdentifier (pair.first ->getNameStr ());
422- }, " ," );
419+ llvm::interleave (
420+ elementTagMapping, os,
421+ [&](const auto &pair) {
422+ os << " \n " ;
423+ syntaxPrinter.printIdentifier (pair.first ->getNameStr ());
424+ },
425+ " ," );
423426 // TODO: allow custom name for this special case
424427 auto resilientUnknownDefaultCaseName = " unknownDefault" ;
425428 if (ED->isResilient ()) {
426429 os << " ,\n " << resilientUnknownDefaultCaseName;
427430 }
428431 os << " \n };\n\n " ; // enum class cases' closing bracket
429-
432+
430433 // Printing struct, is, and get functions for each case
431434 DeclAndTypeClangFunctionPrinter clangFuncPrinter (
432435 os, owningPrinter.prologueOS , owningPrinter.typeMapping ,
433436 owningPrinter.interopContext );
434-
437+
435438 auto printIsFunction = [&](StringRef caseName, EnumDecl *ED) {
436439 os << " inline bool is" ;
437440 std::string name;
@@ -446,7 +449,7 @@ class DeclAndTypePrinter::Implementation
446449 os << " ;\n " ;
447450 os << " }\n " ;
448451 };
449-
452+
450453 auto printGetFunction = [&](EnumElementDecl *elementDecl) {
451454 auto associatedValueList = elementDecl->getParameterList ();
452455 // TODO: add tuple type support
@@ -458,10 +461,10 @@ class DeclAndTypePrinter::Implementation
458461 OptionalTypeKind optKind;
459462 std::tie (firstType, optKind) =
460463 getObjectTypeAndOptionality (firstTypeDecl, firstType);
461-
464+
462465 auto name = elementDecl->getNameStr ().str ();
463466 name[0 ] = std::toupper (name[0 ]);
464-
467+
465468 // FIXME: may have to forward declare return type
466469 os << " inline " ;
467470 clangFuncPrinter.printClangFunctionReturnType (
@@ -492,7 +495,8 @@ class DeclAndTypePrinter::Implementation
492495 } else {
493496 os << " return " ;
494497 syntaxPrinter.printModuleNamespaceQualifiersIfNeeded (
495- firstTypeDecl->getModuleContext (), elementDecl->getParentEnum ()->getModuleContext ());
498+ firstTypeDecl->getModuleContext (),
499+ elementDecl->getParentEnum ()->getModuleContext ());
496500 os << cxx_synthesis::getCxxImplNamespaceName ();
497501 os << " ::" ;
498502 ClangValueTypePrinter::printCxxImplClassName (os, firstTypeDecl);
@@ -503,9 +507,9 @@ class DeclAndTypePrinter::Implementation
503507 os << " ::initializeWithTake(result, payloadFromDestruction);\n " ;
504508 os << " });\n " ;
505509 }
506- os << " }\n " ; // closing bracket of get function
510+ os << " }\n " ; // closing bracket of get function
507511 };
508-
512+
509513 auto printStruct = [&](StringRef caseName, EnumElementDecl *elementDecl) {
510514 os << " static struct { // impl struct for case " << caseName << ' \n ' ;
511515 os << " inline constexpr operator cases() const {\n " ;
@@ -519,7 +523,7 @@ class DeclAndTypePrinter::Implementation
519523 os << " operator()(" ;
520524 // TODO: implement parameter for associated value
521525 os << " ) const {\n " ;
522- // TODO: print _make for now; need to implement actual code making an enum
526+ // TODO: print _make for now; need to print actual code making an enum
523527 os << " return " ;
524528 syntaxPrinter.printBaseName (elementDecl->getParentEnum ());
525529 os << " ::_make();\n " ;
@@ -541,7 +545,7 @@ class DeclAndTypePrinter::Implementation
541545 }
542546 os << ' \n ' ;
543547 }
544-
548+
545549 if (ED->isResilient ()) {
546550 // Printing struct for unknownDefault
547551 printStruct (resilientUnknownDefaultCaseName, /* elementDecl */ nullptr );
@@ -550,7 +554,7 @@ class DeclAndTypePrinter::Implementation
550554 os << ' \n ' ;
551555 }
552556 os << ' \n ' ;
553-
557+
554558 // Printing operator cases()
555559 os << " inline operator cases() const {\n " ;
556560 if (ED->isResilient ()) {
@@ -573,7 +577,7 @@ class DeclAndTypePrinter::Implementation
573577 os << " default: abort();\n " ;
574578 os << " }\n " ; // switch's closing bracket
575579 }
576- os << " }\n " ; // operator cases()'s closing bracket
580+ os << " }\n " ; // operator cases()'s closing bracket
577581 os << " \n " ;
578582 });
579583 os << outOfLineDefinitions;
0 commit comments