Unverified Commit 4b70d17b authored by Stefan Gränitz's avatar Stefan Gränitz Committed by GitHub
Browse files

[clang-repl] Names declared in if conditions and for-init statements are local...


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

Make TopLevelStmtDecl a DeclContext so that variables defined in statements
are attached to the TopLevelDeclContext. This fixes redefinition errors
from variables declared in if conditions and for-init statements. These
must be local to the inner context (C++ 3.3.2p4), but they had generated
definitions on global scope instead.

This PR makes the TopLevelStmtDecl looking more like a FunctionDecl and
that's fine because the FunctionDecl is very close in terms of semantics.

Additionally, ActOnForStmt() requires a CompoundScope when processing a
NullStmt body.

---------

Co-authored-by: default avatarVassil Vassilev <v.g.vassilev@gmail.com>
parent 464d9d96
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment