Skip to content

Commit bf2d4eb

Browse files
authored
[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.
1 parent dd59198 commit bf2d4eb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lldb/source/Core/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if (LLDB_ENABLE_CURSES)
1717
endif()
1818

1919
if (LLVM_BUILD_TELEMETRY)
20-
set(TELEMETRY_SOURCES Telemetry.cpp)
2120
set(TELEMETRY_DEPS Telemetry)
21+
add_definitions(-DLLDB_BUILD_TELEMETRY)
2222
endif()
2323

2424
# TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore
@@ -57,11 +57,10 @@ add_lldb_library(lldbCore
5757
SourceLocationSpec.cpp
5858
SourceManager.cpp
5959
StreamAsynchronousIO.cpp
60+
Telemetry.cpp
6061
ThreadedCommunication.cpp
6162
UserSettingsController.cpp
6263
Value.cpp
63-
${TELEMETRY_SOURCES}
64-
PARTIAL_SOURCES_INTENDED
6564
DEPENDS
6665
clang-tablegen-targets
6766

lldb/source/Core/Telemetry.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
9+
#ifdef LLDB_BUILD_TELEMETRY
10+
811
#include "lldb/Core/Telemetry.h"
912
#include "lldb/Core/Debugger.h"
1013
#include "lldb/Utility/LLDBLog.h"
@@ -67,3 +70,5 @@ llvm::Error TelemetryManager::preDispatch(TelemetryInfo *entry) {
6770

6871
} // namespace telemetry
6972
} // namespace lldb_private
73+
74+
#endif // LLDB_BUILD_TELEMETRY

0 commit comments

Comments
 (0)