Author: Alexis Engelke
Date: 2026-02-20T17:50:17Z
New Revision: 978e150d6638ede3a7d5b3f902627187425d34cc

URL: 
https://github.com/llvm/llvm-project/commit/978e150d6638ede3a7d5b3f902627187425d34cc
DIFF: 
https://github.com/llvm/llvm-project/commit/978e150d6638ede3a7d5b3f902627187425d34cc.diff

LOG: [clang-tools] Fix cl::opt usage with Clang+PCH+dylib

Clang instantiates the vtable but not the method compare() of
OptionValueCopy<std::string> when using PCH. compare() is instantiated
as past of libLLVM.so, but due to -fvisibility-inlines-hidden, the
function is not visible when linking the tool. This might be a Clang
bug.

In any case, avoid this problem by disabling PCH.

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/tool/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/tool/CMakeLists.txt 
b/clang-tools-extra/include-cleaner/tool/CMakeLists.txt
index f48907f9ae68a..085c0a81e0475 100644
--- a/clang-tools-extra/include-cleaner/tool/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/tool/CMakeLists.txt
@@ -1,7 +1,9 @@
 set(LLVM_LINK_COMPONENTS Support)
 
 include_directories("../lib") # FIXME: use public APIs instead.
-add_clang_tool(clang-include-cleaner IncludeCleaner.cpp)
+# Disable PCH reuse due to Clang issue where cl::opt<std::string> template
+# instantiation is incomplete.
+add_clang_tool(clang-include-cleaner IncludeCleaner.cpp DISABLE_PCH_REUSE)
 clang_target_link_libraries(clang-include-cleaner PRIVATE
   clangBasic
   clangFrontend


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to