Skip to content
Prev Previous commit
Next Next commit
fixup! Try to fix #83028
ActOnForStmt() requires a CompoundScope when processing a NullStmt body
  • Loading branch information
weliveindetail committed Mar 6, 2024
commit 83265cf0101b48b222b40e3a0d3a9ee26234f8f0
2 changes: 2 additions & 0 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20522,13 +20522,15 @@ Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr,
TopLevelStmtDecl *Sema::ActOnStartTopLevelStmtDecl(Scope *S) {
auto *New = TopLevelStmtDecl::Create(Context, /*Statement=*/nullptr);
PushFunctionScope();
PushCompoundScope(false);
PushDeclContext(S, New);
return New;
}

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

Expand Down