@@ -146,7 +146,7 @@ static bool isInObjCImpl(const ValueDecl *VD) {
146146// / be complete (for example, when printing a .swiftinterface). In other
147147// / contexts, though, triggering type checking could cause re-entrancy and
148148// / should be avoided.
149- static bool shouldTypeCheck (const PrintOptions &options) {
149+ static bool shouldPrintAllSemanticDetails (const PrintOptions &options) {
150150 if (options.IsForSwiftInterface )
151151 return true ;
152152
@@ -1150,7 +1150,11 @@ void PrintAST::printAttributes(const Decl *D) {
11501150 if (Options.SkipAttributes )
11511151 return ;
11521152
1153- auto attrs = D->getSemanticAttrs ();
1153+ // Force semantic attrs to be computed if appropriate.
1154+ if (shouldPrintAllSemanticDetails (Options))
1155+ (void )D->getSemanticAttrs ();
1156+
1157+ auto attrs = D->getAttrs ();
11541158
11551159 // Save the current number of exclude attrs to restore once we're done.
11561160 unsigned originalExcludeAttrCount = Options.ExcludeAttrList .size ();
@@ -2259,7 +2263,7 @@ void PrintAST::printAccessors(const AbstractStorageDecl *ASD) {
22592263 }
22602264
22612265 // Force implicit accessors to be created if they haven't been already.
2262- if (shouldTypeCheck (Options)) {
2266+ if (shouldPrintAllSemanticDetails (Options)) {
22632267 ASD->visitEmittedAccessors ([](AccessorDecl *accessor) {
22642268 (void )accessor;
22652269 });
@@ -3900,7 +3904,7 @@ void PrintAST::visitPatternBindingDecl(PatternBindingDecl *decl) {
39003904 auto *pattern = decl->getPattern (idx);
39013905
39023906 // Force the entry to be typechecked before attempting to print.
3903- if (shouldTypeCheck (Options) && !pattern->hasType ())
3907+ if (shouldPrintAllSemanticDetails (Options) && !pattern->hasType ())
39043908 (void )decl->getCheckedPatternBindingEntry (idx);
39053909
39063910 if (!shouldPrintPattern (pattern))
0 commit comments