[Lldb-commits] [lldb] bf2d4eb - [lldb] Use preprocessor guard for `LLVM_BUILD_TELEMETRY` (#126715)

via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 11 06:22:49 PST 2025


Author: Michał Górny
Date: 2025-02-11T14:22:44Z
New Revision: bf2d4eb7030b809004dd1e6d0cc15a94a9e18c88

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

LOG: [lldb] Use preprocessor guard for `LLVM_BUILD_TELEMETRY` (#126715)

Use a preprocessor `#ifdef LLVM_BUILD_TELEMETRY` guard rather than
`PARTIAL_SOURCES_INTENDED` for the `Telemetry.cpp` file, to fix building
with telemetry disabled. `PARTIAL_SOURCES_INTENDED` does not currently
work in `lldb_add_library()`, and while it could be fixed, it seems to
be used contrary to its purpose — in other parts of LLVM project, the
option is used to indicate that the sources found in the directory are
split between different targets (e.g. a library and a tool), not to
include sources conditionally.

Added: 
    

Modified: 
    lldb/source/Core/CMakeLists.txt
    lldb/source/Core/Telemetry.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index 4b1f418162016..cf5f6ac9da489 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -17,8 +17,8 @@ if (LLDB_ENABLE_CURSES)
 endif()
 
 if (LLVM_BUILD_TELEMETRY)
-   set(TELEMETRY_SOURCES Telemetry.cpp)
    set(TELEMETRY_DEPS Telemetry)
+   add_definitions(-DLLDB_BUILD_TELEMETRY)
 endif()
 
 # TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore
@@ -57,11 +57,10 @@ add_lldb_library(lldbCore
   SourceLocationSpec.cpp
   SourceManager.cpp
   StreamAsynchronousIO.cpp
+  Telemetry.cpp
   ThreadedCommunication.cpp
   UserSettingsController.cpp
   Value.cpp
-  ${TELEMETRY_SOURCES}
-  PARTIAL_SOURCES_INTENDED
   DEPENDS
     clang-tablegen-targets
 

diff  --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp
index d479488bbc399..99f5d43ccbaf0 100644
--- a/lldb/source/Core/Telemetry.cpp
+++ b/lldb/source/Core/Telemetry.cpp
@@ -5,6 +5,9 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+
+#ifdef LLDB_BUILD_TELEMETRY
+
 #include "lldb/Core/Telemetry.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Utility/LLDBLog.h"
@@ -67,3 +70,5 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
 
 } // namespace telemetry
 } // namespace lldb_private
+
+#endif // LLDB_BUILD_TELEMETRY


        


More information about the lldb-commits mailing list