[Lldb-commits] [lldb] [llvm] Define -DLLVM_BUILD_TELEMETRY to be used in ifdef (PR #126746)
Vy Nguyen via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 12 06:32:03 PST 2025
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/126746
>From 008537373cd928fea9ac04b1aed39c2ecafec65a Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Tue, 11 Feb 2025 10:36:06 -0500
Subject: [PATCH 1/5] Define -DLLVM_BUILD_TELEMETRY to be used in ifdef (by
users of Telemetry)
---
llvm/lib/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index d0a2bc9294381..08e3d7ddb8c12 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -43,6 +43,7 @@ add_subdirectory(TargetParser)
add_subdirectory(TextAPI)
if (LLVM_BUILD_TELEMETRY)
add_subdirectory(Telemetry)
+ add_definitions(-DLLDB_BUILD_TELEMETRY)
endif()
add_subdirectory(ToolDrivers)
add_subdirectory(XRay)
>From f2a3822291d7153359286bd5efc4c080c21adedd Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Tue, 11 Feb 2025 11:22:36 -0500
Subject: [PATCH 2/5] add macro def in llvm-config.h
---
llvm/include/llvm/Config/llvm-config.h.cmake | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 629977cc11d68..239f9dd3f38db 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -201,4 +201,7 @@
/* Define if logf128 is available */
#cmakedefine LLVM_HAS_LOGF128
+/* Define if building LLVM with LLVM_BUILD_TELEMETRY */
+#cmakedefine LLVM_BUILD_TELEMETRY ${LLVM_BUILD_TELEMETRY}
+
#endif
>From 1bec761f06f79fac21a063a1e5c222e274dd3ddb Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Tue, 11 Feb 2025 13:07:12 -0500
Subject: [PATCH 3/5] remove macro from lldb/soruce/Core/CMakeLists.txt
---
lldb/source/Core/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..82fb5f42f9f4b 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -18,7 +18,6 @@ endif()
if (LLVM_BUILD_TELEMETRY)
set(TELEMETRY_DEPS Telemetry)
- add_definitions(-DLLDB_BUILD_TELEMETRY)
endif()
# TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore
>From 88cdb5ac5f7b6f8cb8bb539a7c1291a302632ec5 Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Tue, 11 Feb 2025 13:08:12 -0500
Subject: [PATCH 4/5] remove macro from llvm/CMakeLists.txt
---
llvm/lib/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index 08e3d7ddb8c12..d0a2bc9294381 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -43,7 +43,6 @@ add_subdirectory(TargetParser)
add_subdirectory(TextAPI)
if (LLVM_BUILD_TELEMETRY)
add_subdirectory(Telemetry)
- add_definitions(-DLLDB_BUILD_TELEMETRY)
endif()
add_subdirectory(ToolDrivers)
add_subdirectory(XRay)
>From fe6c66535eb5feb9060b0c450840c74ad49bcc1f Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Tue, 11 Feb 2025 14:17:35 -0500
Subject: [PATCH 5/5] include config.h header and use new LLVM_BUILD_TELEMETRY
macro
---
lldb/source/Core/Telemetry.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp
index 99f5d43ccbaf0..0d0d7c1df3bb9 100644
--- a/lldb/source/Core/Telemetry.cpp
+++ b/lldb/source/Core/Telemetry.cpp
@@ -6,7 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#ifdef LLDB_BUILD_TELEMETRY
+#include "llvm/Config/llvm-config.h"
+
+#ifdef LLVM_BUILD_TELEMETRY
#include "lldb/Core/Telemetry.h"
#include "lldb/Core/Debugger.h"
@@ -71,4 +73,4 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
} // namespace telemetry
} // namespace lldb_private
-#endif // LLDB_BUILD_TELEMETRY
+#endif // LLVM_BUILD_TELEMETRY
More information about the lldb-commits
mailing list