Skip to content

Commit fc4d871

Browse files
authored
Define -DLLVM_BUILD_TELEMETRY to be used in ifdef (llvm#126746)
Background: Telemetry code isn't always built (controlled by this LLVM_BUILD_TELEMETRY cmake flag) This means users of the library may not have the library. So we're definding the `-DLLVM_BUILD_TELEMETRY` to be used in ifdef.
1 parent 96ce8ca commit fc4d871

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lldb/source/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ endif()
1818

1919
if (LLVM_BUILD_TELEMETRY)
2020
set(TELEMETRY_DEPS Telemetry)
21-
add_definitions(-DLLDB_BUILD_TELEMETRY)
2221
endif()
2322

2423
# TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore

lldb/source/Core/Telemetry.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifdef LLDB_BUILD_TELEMETRY
9+
#include "llvm/Config/llvm-config.h"
10+
11+
#ifdef LLVM_BUILD_TELEMETRY
1012

1113
#include "lldb/Core/Telemetry.h"
1214
#include "lldb/Core/Debugger.h"
@@ -71,4 +73,4 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
7173
} // namespace telemetry
7274
} // namespace lldb_private
7375

74-
#endif // LLDB_BUILD_TELEMETRY
76+
#endif // LLVM_BUILD_TELEMETRY

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,7 @@
201201
/* Define if logf128 is available */
202202
#cmakedefine LLVM_HAS_LOGF128
203203

204+
/* Define if building LLVM with LLVM_BUILD_TELEMETRY */
205+
#cmakedefine LLVM_BUILD_TELEMETRY ${LLVM_BUILD_TELEMETRY}
206+
204207
#endif

0 commit comments

Comments
 (0)