Skip to content

Commit 27341ab

Browse files
fixup! Try to fix #83028
Add TopLevelStmtDecl to outer DeclContext (and push new scopes afterwards)
1 parent 83265cf commit 27341ab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/Sema/SemaDecl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -20521,17 +20521,18 @@ Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr,
2052120521

2052220522
TopLevelStmtDecl *Sema::ActOnStartTopLevelStmtDecl(Scope *S) {
2052320523
auto *New = TopLevelStmtDecl::Create(Context, /*Statement=*/nullptr);
20524+
CurContext->addDecl(New);
20525+
PushDeclContext(S, New);
2052420526
PushFunctionScope();
2052520527
PushCompoundScope(false);
20526-
PushDeclContext(S, New);
2052720528
return New;
2052820529
}
2052920530

2053020531
void Sema::ActOnFinishTopLevelStmtDecl(TopLevelStmtDecl *D, Stmt *Statement) {
2053120532
D->setStmt(Statement);
20532-
PopDeclContext();
2053320533
PopCompoundScope();
2053420534
PopFunctionScopeInfo();
20535+
PopDeclContext();
2053520536
}
2053620537

2053720538
void Sema::ActOnPragmaRedefineExtname(IdentifierInfo* Name,

0 commit comments

Comments
 (0)