Author: Timm Baeder
Date: 2026-05-30T06:07:14+02:00
New Revision: 08d281fe7a907089789be2c6ca6577cf3aac5629

URL: 
https://github.com/llvm/llvm-project/commit/08d281fe7a907089789be2c6ca6577cf3aac5629
DIFF: 
https://github.com/llvm/llvm-project/commit/08d281fe7a907089789be2c6ca6577cf3aac5629.diff

LOG: [clang] Add CLANG_USE_EXPERIMENTAL_CONST_INTERP cmake option (#199396)

To enable the new constant interpreter by default at configure time.

I don't expect any distributions to set this for now but it's useful for
testing and I think we need it eventually.

Added: 
    

Modified: 
    clang/CMakeLists.txt
    clang/include/clang/Basic/LangOptions.def
    clang/include/clang/Config/config.h.cmake
    clang/lib/Basic/LangOptions.cpp

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 40506fc8a1546..bbd0041fc9e32 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -489,6 +489,9 @@ option(CLANG_ENABLE_STATIC_ANALYZER
 
 option(CLANG_ENABLE_PROTO_FUZZER "Build Clang protobuf fuzzer." OFF)
 
+option(CLANG_USE_EXPERIMENTAL_CONST_INTERP
+  "Use the new experimental constant interpreter for compile-time evaluation." 
OFF)
+
 if (DEFINED CLANG_ENABLE_ARCMT)
   set(CLANG_ENABLE_OBJC_REWRITER ${CLANG_ENABLE_ARCMT})
   message(DEPRECATION "'CLANG_ENABLE_ARCMT' is deprecated as ARCMigrate has 
been removed from Clang. Please use 'CLANG_ENABLE_OBJC_REWRITER' instead to 
enable or disable the Objective-C rewriter.")

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 3bbb40ba09f05..4a3e3b7c04822 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -385,7 +385,7 @@ LANGOPT(ConstexprCallDepth, 32, 512, Benign,
         "maximum constexpr call depth")
 LANGOPT(ConstexprStepLimit, 32, 1048576, Benign,
         "maximum constexpr evaluation steps")
-LANGOPT(EnableNewConstInterp, 1, 0, Benign,
+LANGOPT(EnableNewConstInterp, 1, CLANG_USE_EXPERIMENTAL_CONST_INTERP, Benign,
         "enable the experimental new constant interpreter")
 LANGOPT(BracketDepth, 32, 256, Benign,
         "maximum bracket nesting depth")

diff  --git a/clang/include/clang/Config/config.h.cmake 
b/clang/include/clang/Config/config.h.cmake
index 05e4deb671a7e..11b4096726f67 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -91,4 +91,8 @@
 /* Policy to use for xcselect */
 #cmakedefine CLANG_XCSELECT_HOST_SDK_POLICY ${CLANG_XCSELECT_HOST_SDK_POLICY}
 
+
+/* Enable the experimental new constant interpreter by default */
+#cmakedefine01 CLANG_USE_EXPERIMENTAL_CONST_INTERP
+
 #endif

diff  --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp
index 40cdc646780e3..7e75bf1221eb7 100644
--- a/clang/lib/Basic/LangOptions.cpp
+++ b/clang/lib/Basic/LangOptions.cpp
@@ -12,6 +12,7 @@
 
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LangStandard.h"
+#include "clang/Config/config.h"
 #include "llvm/Support/Path.h"
 
 using namespace clang;


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to