[clang] 1928da1 - [clang][Interp] Don't run functions immediately after compiling them

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 01:22:18 PDT 2022


Author: Timm Bäder
Date: 2022-10-14T10:21:53+02:00
New Revision: 1928da1ef73c383ea4daeffb41691882bdb074c2

URL: https://github.com/llvm/llvm-project/commit/1928da1ef73c383ea4daeffb41691882bdb074c2
DIFF: https://github.com/llvm/llvm-project/commit/1928da1ef73c383ea4daeffb41691882bdb074c2.diff

LOG: [clang][Interp] Don't run functions immediately after compiling them

This doesn't make much sense with functions that expect valid parameters
and/or a certain call stack on the caller side like This/RVO pointers.

Differential Revision: https://reviews.llvm.org/D135569

Added: 
    

Modified: 
    clang/lib/AST/Interp/Context.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp
index 9f3f5542fe83..7ce3397e6a4f 100644
--- a/clang/lib/AST/Interp/Context.cpp
+++ b/clang/lib/AST/Interp/Context.cpp
@@ -39,11 +39,7 @@ bool Context::isPotentialConstantExpr(State &Parent, const FunctionDecl *FD) {
     }
   }
 
-  if (!Func->isConstexpr())
-    return false;
-
-  APValue Dummy;
-  return Run(Parent, Func, Dummy);
+  return Func->isConstexpr();
 }
 
 bool Context::evaluateAsRValue(State &Parent, const Expr *E, APValue &Result) {


        


More information about the cfe-commits mailing list