-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Use preprocessor guard for LLVM_BUILD_TELEMETRY
#126715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-lldb Author: Michał Górny (mgorny) ChangesUse a preprocessor Full diff: https://github.com/llvm/llvm-project/pull/126715.diff 2 Files Affected:
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index 4b1f4181620160..fa79a40ac4bd4f 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(-DLLVM_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 d479488bbc3994..adbef9655fcb62 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 LLVM_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 // LLVM_BUILD_TELEMETRY
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's fine, though I'm still fairly disappointed that we have to do this...
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.
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.
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.
Use a preprocessor
#ifdef LLVM_BUILD_TELEMETRY
guard rather thanPARTIAL_SOURCES_INTENDED
for theTelemetry.cpp
file, to fix building with telemetry disabled.PARTIAL_SOURCES_INTENDED
does not currently work inlldb_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.