[clang] ad82d1c - [clang][Interp][NFC] Move a lambda declaration into its closest scope
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 01:13:10 PDT 2024
Author: Timm Bäder
Date: 2024-07-09T10:12:53+02:00
New Revision: ad82d1c53f089937c05af11ff45798ceb5ca894e
URL: https://github.com/llvm/llvm-project/commit/ad82d1c53f089937c05af11ff45798ceb5ca894e
DIFF: https://github.com/llvm/llvm-project/commit/ad82d1c53f089937c05af11ff45798ceb5ca894e.diff
LOG: [clang][Interp][NFC] Move a lambda declaration into its closest scope
Added:
Modified:
clang/lib/AST/Interp/Compiler.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Compiler.cpp b/clang/lib/AST/Interp/Compiler.cpp
index 3d9a0358c5487..613bf4af137b6 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -3552,12 +3552,12 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Topleve
const Expr *Init = VD->getInit();
std::optional<PrimType> VarT = classify(VD->getType());
- auto checkDecl = [&]() -> bool {
- bool NeedsOp = !Toplevel && VD->isLocalVarDecl() && VD->isStaticLocal();
- return !NeedsOp || this->emitCheckDecl(VD, VD);
- };
-
if (Context::shouldBeGloballyIndexed(VD)) {
+ auto checkDecl = [&]() -> bool {
+ bool NeedsOp = !Toplevel && VD->isLocalVarDecl() && VD->isStaticLocal();
+ return !NeedsOp || this->emitCheckDecl(VD, VD);
+ };
+
auto initGlobal = [&](unsigned GlobalIndex) -> bool {
assert(Init);
DeclScope<Emitter> LocalScope(this, VD);
More information about the cfe-commits
mailing list