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);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to