[llvm] 3e52350 - [DLCov] Move DebugLoc coverage macro to llvm-config.h (#137787)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 02:23:33 PDT 2025


Author: Stephen Tozer
Date: 2025-04-30T10:23:30+01:00
New Revision: 3e523502a15944c0da8067bad93ab1fc1bac47b7

URL: https://github.com/llvm/llvm-project/commit/3e523502a15944c0da8067bad93ab1fc1bac47b7
DIFF: https://github.com/llvm/llvm-project/commit/3e523502a15944c0da8067bad93ab1fc1bac47b7.diff

LOG: [DLCov] Move DebugLoc coverage macro to llvm-config.h (#137787)

This patch follows the reversion of #107279, which caused errors by
including `llvm/Config/config.h` in a public header. In order to reapply
that patch, this PR moves the definition of the config option to the
`llvm-config.h` header instead, so that it can be used publicly. This
patch also adds `LLVM_` as a prefix to the define, since it is now in a
public header.

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake
    llvm/include/llvm/Config/config.h.cmake
    llvm/include/llvm/Config/llvm-config.h.cmake
    llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
    utils/bazel/llvm_configs/config.h.cmake
    utils/bazel/llvm_configs/llvm-config.h.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 185c9b63aada3..8b3303fe9f3d2 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -199,7 +199,7 @@ endif()
 string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING)
 
 if( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE" )
-  set( ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
+  set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
 elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "DISABLED" OR NOT DEFINED LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING )
   # The DISABLED setting is default and requires no additional defines.
 else()

diff  --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 835201f2a45b0..7efac55ab0352 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -19,10 +19,6 @@
 /* Define to 1 to enable crash memory dumps, and to 0 otherwise. */
 #cmakedefine01 LLVM_ENABLE_CRASH_DUMPS
 
-/* Define to 1 to enable expensive checks for debug location coverage checking,
-   and to 0 otherwise. */
-#cmakedefine01 ENABLE_DEBUGLOC_COVERAGE_TRACKING
-
 /* Define to 1 to prefer forward slashes on Windows, and to 0 prefer
    backslashes. */
 #cmakedefine01 LLVM_WINDOWS_PREFER_FORWARD_SLASH

diff  --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 97f996338bc0c..dbc882937b4f4 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -129,4 +129,8 @@
 /* Define if building LLVM with LLVM_ENABLE_TELEMETRY */
 #cmakedefine01 LLVM_ENABLE_TELEMETRY
 
+/* Define to 1 to enable expensive checks for debug location coverage checking,
+   and to 0 otherwise. */
+#cmakedefine01 LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
+
 #endif

diff  --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 36ec4a2c6faec..7edf10fbe0b11 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -84,7 +84,7 @@ write_cmake_config("config") {
   values = [
     "BUG_REPORT_URL=https://github.com/llvm/llvm-project/issues/",
     "ENABLE_BACKTRACES=1",
-    "ENABLE_DEBUGLOC_COVERAGE_TRACKING=",
+    "LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING=",
     "ENABLE_CRASH_OVERRIDES=1",
     "BACKTRACE_HEADER=execinfo.h",
     "HAVE_BUILTIN_THREAD_POINTER=",

diff  --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake
index 835201f2a45b0..7efac55ab0352 100644
--- a/utils/bazel/llvm_configs/config.h.cmake
+++ b/utils/bazel/llvm_configs/config.h.cmake
@@ -19,10 +19,6 @@
 /* Define to 1 to enable crash memory dumps, and to 0 otherwise. */
 #cmakedefine01 LLVM_ENABLE_CRASH_DUMPS
 
-/* Define to 1 to enable expensive checks for debug location coverage checking,
-   and to 0 otherwise. */
-#cmakedefine01 ENABLE_DEBUGLOC_COVERAGE_TRACKING
-
 /* Define to 1 to prefer forward slashes on Windows, and to 0 prefer
    backslashes. */
 #cmakedefine01 LLVM_WINDOWS_PREFER_FORWARD_SLASH

diff  --git a/utils/bazel/llvm_configs/llvm-config.h.cmake b/utils/bazel/llvm_configs/llvm-config.h.cmake
index 97f996338bc0c..dbc882937b4f4 100644
--- a/utils/bazel/llvm_configs/llvm-config.h.cmake
+++ b/utils/bazel/llvm_configs/llvm-config.h.cmake
@@ -129,4 +129,8 @@
 /* Define if building LLVM with LLVM_ENABLE_TELEMETRY */
 #cmakedefine01 LLVM_ENABLE_TELEMETRY
 
+/* Define to 1 to enable expensive checks for debug location coverage checking,
+   and to 0 otherwise. */
+#cmakedefine01 LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
+
 #endif


        


More information about the llvm-commits mailing list