[clang] [llvm] [CMake][NFC] Don't use uninitialized LLVM_REQUIRES_* (PR #175554)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 07:03:59 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Alexis Engelke (aengelke)
<details>
<summary>Changes</summary>
LLVM_REQUIRES_* are per-target flags that are never set globally. Yet, some files used these (undefined) flags for some logic. This patch emoves these dead checks/unconditionally executes the logic. Note that the referenced *.exports files are empty, so there is no need to make related logic conditional on MSVC.
---
Full diff: https://github.com/llvm/llvm-project/pull/175554.diff
4 Files Affected:
- (modified) clang/examples/LLVMPrintFunctionNames/CMakeLists.txt (+2-10)
- (modified) clang/examples/PrintFunctionNames/CMakeLists.txt (+2-10)
- (modified) llvm/tools/bugpoint-passes/CMakeLists.txt (+2-7)
- (modified) offload/unittests/Conformance/lib/CMakeLists.txt (-4)
``````````diff
diff --git a/clang/examples/LLVMPrintFunctionNames/CMakeLists.txt b/clang/examples/LLVMPrintFunctionNames/CMakeLists.txt
index 61e7a7842e2f3..fbab0f8773bc8 100644
--- a/clang/examples/LLVMPrintFunctionNames/CMakeLists.txt
+++ b/clang/examples/LLVMPrintFunctionNames/CMakeLists.txt
@@ -1,13 +1,5 @@
-# If we don't need RTTI or EH, there's no reason to export anything
-# from the plugin.
-if(NOT MSVC) # MSVC mangles symbols differently, and
- # PrintLLVMFunctionNames.export contains C++ symbols.
- if(NOT LLVM_REQUIRES_RTTI)
- if(NOT LLVM_REQUIRES_EH)
- set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LLVMPrintFunctionNames.exports)
- endif()
- endif()
-endif()
+# There's no reason to export anything from the plugin.
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LLVMPrintFunctionNames.exports)
add_llvm_library(LLVMPrintFunctionNames MODULE LLVMPrintFunctionNames.cpp PLUGIN_TOOL clang)
diff --git a/clang/examples/PrintFunctionNames/CMakeLists.txt b/clang/examples/PrintFunctionNames/CMakeLists.txt
index 28da363729f3a..3668a3cdccf8e 100644
--- a/clang/examples/PrintFunctionNames/CMakeLists.txt
+++ b/clang/examples/PrintFunctionNames/CMakeLists.txt
@@ -1,13 +1,5 @@
-# If we don't need RTTI or EH, there's no reason to export anything
-# from the plugin.
-if( NOT MSVC ) # MSVC mangles symbols differently, and
- # PrintFunctionNames.export contains C++ symbols.
- if( NOT LLVM_REQUIRES_RTTI )
- if( NOT LLVM_REQUIRES_EH )
- set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/PrintFunctionNames.exports)
- endif()
- endif()
-endif()
+# There's no reason to export anything from the plugin.
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/PrintFunctionNames.exports)
add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
diff --git a/llvm/tools/bugpoint-passes/CMakeLists.txt b/llvm/tools/bugpoint-passes/CMakeLists.txt
index 60fc1bde51371..53587a51c5081 100644
--- a/llvm/tools/bugpoint-passes/CMakeLists.txt
+++ b/llvm/tools/bugpoint-passes/CMakeLists.txt
@@ -2,13 +2,8 @@ if( NOT LLVM_BUILD_TOOLS )
set(EXCLUDE_FROM_ALL ON)
endif()
-# If we don't need RTTI or EH, there's no reason to export anything
-# from this plugin.
-if( NOT LLVM_REQUIRES_RTTI )
- if( NOT LLVM_REQUIRES_EH )
- set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/bugpoint.exports)
- endif()
-endif()
+# There's no reason to export anything from the plugin.
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/bugpoint.exports)
if(WIN32 OR CYGWIN OR ZOS)
set(LLVM_LINK_COMPONENTS Core Support)
diff --git a/offload/unittests/Conformance/lib/CMakeLists.txt b/offload/unittests/Conformance/lib/CMakeLists.txt
index 8e86f101729ad..0d042ead4b5ac 100644
--- a/offload/unittests/Conformance/lib/CMakeLists.txt
+++ b/offload/unittests/Conformance/lib/CMakeLists.txt
@@ -3,9 +3,5 @@ add_library(MathTest STATIC
target_include_directories(MathTest PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include")
-if(NOT LLVM_REQUIRES_RTTI)
- target_compile_options(MathTest PUBLIC -fno-rtti)
-endif()
-
include(FindLibcCommonUtils)
target_link_libraries(MathTest PUBLIC LLVMOffload LLVMSupport LLVMDemangle llvm-libc-common-utilities)
``````````
</details>
https://github.com/llvm/llvm-project/pull/175554
More information about the cfe-commits
mailing list