Author: Timm Baeder
Date: 2025-08-09T18:30:26+02:00
New Revision: 870aa979c4854d23e368845acd459d1e4ff7d2e0

URL: 
https://github.com/llvm/llvm-project/commit/870aa979c4854d23e368845acd459d1e4ff7d2e0
DIFF: 
https://github.com/llvm/llvm-project/commit/870aa979c4854d23e368845acd459d1e4ff7d2e0.diff

LOG: [clang][bytecode] Use visitExpr() in interpretCall (#152857)

This is the correct function to use and it will create a variable scope.

Fixes #152822

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/EvalEmitter.cpp
    clang/test/AST/ByteCode/functions.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp 
b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index 9ed61c7b0be78..68f46c113ff28 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -98,10 +98,7 @@ bool EvalEmitter::interpretCall(const FunctionDecl *FD, 
const Expr *E) {
     this->Params.insert({PD, {0, false}});
   }
 
-  if (!this->visit(E))
-    return false;
-  PrimType T = Ctx.classify(E).value_or(PT_Ptr);
-  return this->emitPop(T, E);
+  return this->visitExpr(E, /*DestroyToplevelScope=*/false);
 }
 
 void EvalEmitter::emitLabel(LabelTy Label) { CurrentLabel = Label; }

diff  --git a/clang/test/AST/ByteCode/functions.cpp 
b/clang/test/AST/ByteCode/functions.cpp
index 36e7bb32b2d86..3c00de0102e5a 100644
--- a/clang/test/AST/ByteCode/functions.cpp
+++ b/clang/test/AST/ByteCode/functions.cpp
@@ -708,3 +708,8 @@ namespace NoDiags {
     return true;
   }
 }
+
+namespace EnableIfWithTemporary {
+  struct A { ~A(); };
+  int &h() __attribute__((enable_if((A(), true), ""))); // both-warning 
{{clang extension}}
+}


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

Reply via email to