[clang] [clang-repl] Names declared in if conditions and for-init statements are local to the inner context (C++ 3.3.2p4) (PR #84150)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 05:19:13 PST 2024


Stefan =?utf-8?q?Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>,
Stefan =?utf-8?q?Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/84150 at github.com>


================
@@ -20446,12 +20446,22 @@ Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr,
   return New;
 }
 
-Decl *Sema::ActOnTopLevelStmtDecl(Stmt *Statement) {
-  auto *New = TopLevelStmtDecl::Create(Context, Statement);
-  Context.getTranslationUnitDecl()->addDecl(New);
+TopLevelStmtDecl *Sema::ActOnStartTopLevelStmtDecl(Scope *S) {
+  auto *New = TopLevelStmtDecl::Create(Context, /*Statement=*/nullptr);
+  CurContext->addDecl(New);
----------------
vgvassilev wrote:

Ah, overlooked that! Makes sense. 

https://github.com/llvm/llvm-project/pull/84150


More information about the cfe-commits mailing list