Skip to content

Commit

Permalink
Define -DLLVM_BUILD_TELEMETRY to be used in ifdef (#126746)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oontvoo authored Feb 12, 2025
1 parent 96ce8ca commit fc4d871
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion lldb/source/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lldb/source/Core/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -71,4 +73,4 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
} // namespace telemetry
} // namespace lldb_private

#endif // LLDB_BUILD_TELEMETRY
#endif // LLVM_BUILD_TELEMETRY
3 changes: 3 additions & 0 deletions llvm/include/llvm/Config/llvm-config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fc4d871

Please sign in to comment.