@@ -146,7 +146,7 @@ static bool isInObjCImpl(const ValueDecl *VD) {
146
146
// / be complete (for example, when printing a .swiftinterface). In other
147
147
// / contexts, though, triggering type checking could cause re-entrancy and
148
148
// / should be avoided.
149
- static bool shouldTypeCheck (const PrintOptions &options) {
149
+ static bool shouldPrintAllSemanticDetails (const PrintOptions &options) {
150
150
if (options.IsForSwiftInterface )
151
151
return true ;
152
152
@@ -1150,7 +1150,11 @@ void PrintAST::printAttributes(const Decl *D) {
1150
1150
if (Options.SkipAttributes )
1151
1151
return ;
1152
1152
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 ();
1154
1158
1155
1159
// Save the current number of exclude attrs to restore once we're done.
1156
1160
unsigned originalExcludeAttrCount = Options.ExcludeAttrList .size ();
@@ -2259,7 +2263,7 @@ void PrintAST::printAccessors(const AbstractStorageDecl *ASD) {
2259
2263
}
2260
2264
2261
2265
// Force implicit accessors to be created if they haven't been already.
2262
- if (shouldTypeCheck (Options)) {
2266
+ if (shouldPrintAllSemanticDetails (Options)) {
2263
2267
ASD->visitEmittedAccessors ([](AccessorDecl *accessor) {
2264
2268
(void )accessor;
2265
2269
});
@@ -3900,7 +3904,7 @@ void PrintAST::visitPatternBindingDecl(PatternBindingDecl *decl) {
3900
3904
auto *pattern = decl->getPattern (idx);
3901
3905
3902
3906
// Force the entry to be typechecked before attempting to print.
3903
- if (shouldTypeCheck (Options) && !pattern->hasType ())
3907
+ if (shouldPrintAllSemanticDetails (Options) && !pattern->hasType ())
3904
3908
(void )decl->getCheckedPatternBindingEntry (idx);
3905
3909
3906
3910
if (!shouldPrintPattern (pattern))
0 commit comments