-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Define -DLLVM_BUILD_TELEMETRY to be used in ifdef #126746
Conversation
How does this relate to #126715 (which defines the macro in lldb code)? I think that defining some sort of a macro in llvm code makes sense, but this probably not the way to do that. Docs for
I.e.,, this creates a very inconsistent state where e.g. |
I thought it might be better to define the macro at llvm level (because there might be other users of llvm::Telemetry, in which case, we don't want to have them defining different macros to mean the same thing) |
Done - added the def to config.h. |
Makes sense.
In that case, could you also delete the definition in llvm/lib/CMakeLists.txt and the one introduced in #126715 ? |
Yes, thanks. I'm sorry this didn't occur to me. |
@llvm/pr-subscribers-lldb Author: Vy Nguyen (oontvoo) ChangesBackground: Telemetry code isn't always built (controlled by this LLVM_BUILD_TELEMETRY cmake flag) Full diff: https://github.com/llvm/llvm-project/pull/126746.diff 3 Files Affected:
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da4894a..82fb5f42f9f4b9e 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -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
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 629977cc11d6836..239f9dd3f38db18 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -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
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index d0a2bc929438179..08e3d7ddb8c12c7 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -43,6 +43,7 @@ add_subdirectory(TargetParser)
add_subdirectory(TextAPI)
if (LLVM_BUILD_TELEMETRY)
add_subdirectory(Telemetry)
+ add_definitions(-DLLDB_BUILD_TELEMETRY)
endif()
add_subdirectory(ToolDrivers)
add_subdirectory(XRay)
|
done |
.. and fix the code so that it uses the new macro name ? (You'll need to include llvm-config.h before you can use the macro, and I'd recommend doing a build with telemetry disabled to check that everything works as it should) |
Done. (also tested with explicitly specifying |
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.
LGTM, thanks!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2277 Here is the relevant piece of the build log for the reference
|
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.
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.
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.