[clang] Add CLANG_ENABLE_NEW_CONST_INTERP_BY_DEFAULT cmake option#199396
Open
tbaederr wants to merge 1 commit into
Open
[clang] Add CLANG_ENABLE_NEW_CONST_INTERP_BY_DEFAULT cmake option#199396tbaederr wants to merge 1 commit into
tbaederr wants to merge 1 commit into
Conversation
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.
Contributor
Author
|
I was a bit split on the naming here, the cmake option misses the "experimental" bit, which is quite imporant. |
|
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) ChangesTo 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. Full diff: https://github.com/llvm/llvm-project/pull/199396.diff 4 Files Affected:
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;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.