================
@@ -55,6 +55,25 @@
#include <set>
#include <system_error>
+#if defined(CLANG_PLUGIN_SUPPORT) && defined(_WIN32)
+#include "clang/Frontend/FrontendPluginRegistry.h"
+
+// Force plugin registry symbols into clang.exe on Windows so plugins can
+// register. These methods exist in libraries but aren't linked by default
+// because they're unreferenced. Taking their addresses forces the linker to
+// include them.
+namespace {
+void ForcePluginRegistrySymbols() {
+ using PluginRegistry = llvm::Registry<clang::PluginASTAction>;
+ // Use volatile to prevent the compiler from optimizing away these references
+ volatile auto add_node_ptr = &PluginRegistry::add_node;
+ volatile auto begin_ptr = &PluginRegistry::begin;
+ (void)add_node_ptr;
+ (void)begin_ptr;
+}
+} // anonymous namespace
+#endif
+
----------------
zmodem wrote:
This doesn't look right to me. I think the plugin registry symbols are used in
clang.exe already, e.g. at
https://github.com/llvm/llvm-project/blob/558d935e93c20fea42fa8af54b401a74962c94c6/clang/lib/Frontend/FrontendAction.cpp#L435
https://github.com/llvm/llvm-project/pull/163391
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits