[clang] [clang] Add CLANG_ENABLE_NEW_CONST_INTERP_BY_DEFAULT cmake option (PR #199396)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Sat May 23 22:36:06 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/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.
>From bf21e67d77275561b5a4c803134a33371a283365 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sun, 24 May 2026 07:33:35 +0200
Subject: [PATCH] [clang] Add CLANG_ENABLE_NEW_CONST_INTERP_BY_DEFAULT cmake
option
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.
---
clang/CMakeLists.txt | 3 +++
clang/include/clang/Basic/LangOptions.def | 2 +-
clang/include/clang/Config/config.h.cmake | 4 ++++
clang/lib/Basic/LangOptions.cpp | 1 +
4 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 40506fc8a1546..e0ad8de149bbc 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_ENABLE_NEW_CONST_INTERP_BY_DEFAULT
+ "Enable the experimental new constant interpreter by default." 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..0e8acc6e67924 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_ENABLE_NEW_CONST_INTERP_BY_DEFAULT, 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..758fd0e1165c7 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_ENABLE_NEW_CONST_INTERP_BY_DEFAULT
+
#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;
More information about the cfe-commits
mailing list