[all-commits] [llvm/llvm-project] 4b70d1: [clang-repl] Names declared in if conditions and f...
Stefan Gränitz via All-commits
all-commits at lists.llvm.org
Thu Mar 7 05:27:27 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4b70d17bcffaffd75a5d8c420396f8dc755b4652
https://github.com/llvm/llvm-project/commit/4b70d17bcffaffd75a5d8c420396f8dc755b4652
Author: Stefan Gränitz <stefan.graenitz at gmail.com>
Date: 2024-03-07 (Thu, 07 Mar 2024)
Changed paths:
M clang/include/clang/AST/Decl.h
M clang/include/clang/AST/DeclBase.h
M clang/include/clang/Basic/DeclNodes.td
M clang/include/clang/Sema/Sema.h
M clang/lib/AST/Decl.cpp
M clang/lib/AST/DeclBase.cpp
M clang/lib/Parse/ParseDecl.cpp
M clang/lib/Sema/SemaDecl.cpp
M clang/test/Interpreter/execute-stmts.cpp
Log Message:
-----------
[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: Vassil Vassilev <v.g.vassilev at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list