[clang] [llvm] [CMake][NFC] Don't use uninitialized LLVM_REQUIRES_* (PR #175554)
Alexis Engelke via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 07:03:25 PST 2026
https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/175554
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.
>From 90fbdd8f9f0a7ce90ec07e99fc7aa86d42c0c484 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Mon, 12 Jan 2026 14:58:36 +0000
Subject: [PATCH] [CMake] Don't use uninitialized LLVM_REQUIRES_*
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.
---
clang/examples/LLVMPrintFunctionNames/CMakeLists.txt | 12 ++----------
clang/examples/PrintFunctionNames/CMakeLists.txt | 12 ++----------
llvm/tools/bugpoint-passes/CMakeLists.txt | 9 ++-------
offload/unittests/Conformance/lib/CMakeLists.txt | 4 ----
4 files changed, 6 insertions(+), 31 deletions(-)
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)
More information about the cfe-commits
mailing list