@@ -275,7 +275,8 @@ class ASTExtInfoBuilder {
275275 : bits(bits), clangTypeInfo(clangTypeInfo) {}
276276
277277public:
278- // Constructor with all defaults.
278+ // / An ExtInfoBuilder for a typical Swift function: @convention(swift),
279+ // / @escaping, non-throwing, non-differentiable.
279280 ASTExtInfoBuilder ()
280281 : ASTExtInfoBuilder(Representation::Swift, false , false ,
281282 DifferentiabilityKind::NonDifferentiable, nullptr ) {}
@@ -447,6 +448,8 @@ class ASTExtInfo {
447448 };
448449
449450public:
451+ // / An ExtInfo for a typical Swift function: @convention(swift), @escaping,
452+ // / non-throwing, non-differentiable.
450453 ASTExtInfo () : builder() { builder.checkInvariants (); };
451454
452455 // / Create a builder with the same state as \c this.
@@ -598,17 +601,22 @@ class SILExtInfoBuilder {
598601 }
599602
600603public:
601- // Constructor with all defaults.
602- SILExtInfoBuilder () : SILExtInfoBuilder(0 , ClangTypeInfo(nullptr )) {}
604+ // / An ExtInfoBuilder for a typical Swift function: thick, @escaping,
605+ // / non-pseudogeneric, non-differentiable.
606+ SILExtInfoBuilder ()
607+ : SILExtInfoBuilder(makeBits(SILFunctionTypeRepresentation::Thick, false ,
608+ false , false ,
609+ DifferentiabilityKind::NonDifferentiable),
610+ ClangTypeInfo (nullptr )) {}
603611
604- // Constructor for polymorphic type.
605612 SILExtInfoBuilder (Representation rep, bool isPseudogeneric, bool isNoEscape,
606613 bool isAsync, DifferentiabilityKind diffKind,
607614 const clang::Type *type)
608615 : SILExtInfoBuilder(makeBits(rep, isPseudogeneric, isNoEscape, isAsync,
609616 diffKind),
610617 ClangTypeInfo(type)) {}
611618
619+ // Constructor for polymorphic type.
612620 SILExtInfoBuilder (ASTExtInfoBuilder info, bool isPseudogeneric)
613621 : SILExtInfoBuilder(makeBits(info.getSILRepresentation(), isPseudogeneric,
614622 info.isNoEscape(), info.isAsync(),
@@ -686,25 +694,30 @@ class SILExtInfoBuilder {
686694
687695 // Note that we don't have setters. That is by design, use
688696 // the following with methods instead of mutating these objects.
697+ LLVM_NODISCARD
689698 SILExtInfoBuilder withRepresentation (Representation rep) const {
690699 return SILExtInfoBuilder ((bits & ~RepresentationMask) | (unsigned )rep,
691700 shouldStoreClangType (rep) ? clangTypeInfo
692701 : ClangTypeInfo ());
693702 }
703+ LLVM_NODISCARD
694704 SILExtInfoBuilder withIsPseudogeneric (bool isPseudogeneric = true ) const {
695705 return SILExtInfoBuilder (isPseudogeneric ? (bits | PseudogenericMask)
696706 : (bits & ~PseudogenericMask),
697707 clangTypeInfo);
698708 }
709+ LLVM_NODISCARD
699710 SILExtInfoBuilder withNoEscape (bool noEscape = true ) const {
700711 return SILExtInfoBuilder (noEscape ? (bits | NoEscapeMask)
701712 : (bits & ~NoEscapeMask),
702713 clangTypeInfo);
703714 }
715+ LLVM_NODISCARD
704716 SILExtInfoBuilder withAsync (bool isAsync = true ) const {
705717 return SILExtInfoBuilder (isAsync ? (bits | AsyncMask) : (bits & ~AsyncMask),
706718 clangTypeInfo);
707719 }
720+ LLVM_NODISCARD
708721 SILExtInfoBuilder
709722 withDifferentiabilityKind (DifferentiabilityKind differentiability) const {
710723 return SILExtInfoBuilder (
@@ -750,13 +763,16 @@ class SILExtInfo {
750763 };
751764
752765public:
766+ // / An ExtInfo for a typical Swift function: thick, @escaping,
767+ // / non-pseudogeneric, non-differentiable.
753768 SILExtInfo () : builder() { builder.checkInvariants (); };
754769
755770 SILExtInfo (ASTExtInfo info, bool isPseudogeneric)
756771 : builder(info.intoBuilder(), isPseudogeneric) {
757772 builder.checkInvariants ();
758773 }
759774
775+ // / A default ExtInfo but with a Thin convention.
760776 static SILExtInfo getThin () {
761777 return SILExtInfoBuilder (SILExtInfoBuilder::Representation::Thin, false ,
762778 false , false ,
0 commit comments