File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -268,18 +268,24 @@ ASTSourceFileScope::ASTSourceFileScope(SourceFile *SF,
268268 scopeCreator(scopeCreator) {
269269 if (auto enclosingSF = SF->getEnclosingSourceFile ()) {
270270 SourceLoc parentLoc;
271- auto macroRole = SF->getFulfilledMacroRole ();
272-
273- // Determine the parent source location based on the macro role.
274- AbstractFunctionDecl *bodyForDecl = nullptr ;
275271
276272 if (SF->Kind == SourceFileKind::DefaultArgument) {
277273 auto genInfo = *SF->getASTContext ().SourceMgr .getGeneratedSourceInfo (
278274 *SF->getBufferID ());
279275 parentLoc = ASTNode::getFromOpaqueValue (genInfo.astNode ).getStartLoc ();
280- goto setParent;
276+ if (auto parentScope =
277+ findStartingScopeForLookup (enclosingSF, parentLoc)) {
278+ parentAndWasExpanded.setPointer (
279+ const_cast <ASTScopeImpl *>(parentScope));
280+ }
281+ return ;
281282 }
282283
284+ auto macroRole = SF->getFulfilledMacroRole ();
285+
286+ // Determine the parent source location based on the macro role.
287+ AbstractFunctionDecl *bodyForDecl = nullptr ;
288+
283289 switch (*macroRole) {
284290 case MacroRole::Expression:
285291 case MacroRole::Declaration:
@@ -309,7 +315,6 @@ ASTSourceFileScope::ASTSourceFileScope(SourceFile *SF,
309315 }
310316 }
311317
312- setParent:
313318 if (auto parentScope = findStartingScopeForLookup (enclosingSF, parentLoc)) {
314319 if (bodyForDecl) {
315320 auto bodyScope = new (bodyForDecl->getASTContext ()) FunctionBodyScope (bodyForDecl);
You can’t perform that action at this time.
0 commit comments