[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 03:38:59 PST 2024


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


https://github.com/vgvassilev commented:

Thanks for this PR!

I think it is a good idea to make the `TopLevelStmtDecl` a `DeclContext` because if we have a statement that defines variables they should be attached to the `TopLevelDeclContext`. This PR makes the `TopLevelStmtDecl` looking more like a FunctionDecl and that's fine because the FunctionDecl is very close in terms of semantics. 

Although fixes the problems we have in described in the issue, I wanted to ping @zygoloid and @AaronBallman if they think of a more elegant or standard-compliant solution.

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


More information about the cfe-commits mailing list