Skip to content
Prev Previous commit
Next Next commit
fixup! Try to fix #83028
Add TopLevelStmtDecl to outer DeclContext (and push new scopes afterwards)
  • Loading branch information
weliveindetail committed Mar 6, 2024
commit 27341ab72c084ee0264ea5bbee025ff8c4d313d5
5 changes: 3 additions & 2 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20521,17 +20521,18 @@ Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr,

TopLevelStmtDecl *Sema::ActOnStartTopLevelStmtDecl(Scope *S) {
auto *New = TopLevelStmtDecl::Create(Context, /*Statement=*/nullptr);
CurContext->addDecl(New);
PushDeclContext(S, New);
PushFunctionScope();
PushCompoundScope(false);
PushDeclContext(S, New);
return New;
}

void Sema::ActOnFinishTopLevelStmtDecl(TopLevelStmtDecl *D, Stmt *Statement) {
D->setStmt(Statement);
PopDeclContext();
PopCompoundScope();
PopFunctionScopeInfo();
PopDeclContext();
}

void Sema::ActOnPragmaRedefineExtname(IdentifierInfo* Name,
Expand Down