[PATCH] D116966: [analyzer] Don't specify PLUGIN_TOOL for analyzer plugins

Aleksandr Platonov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 21 01:10:46 PST 2022

ArcsinX added a comment.

Friendly ping.

I am not sure that this patch is clear, so I will try to explain it again:

- clang static analyzer plugins are *NOT* a typical clang plugins: instead of `llvm::Registry<>::Add` usage, these plugins provides `сlang_registerCheckers` and `clang_analyzerAPIVersionString` functions which are called from static analyzer. So, these plugins work ok without anything special on Windows (but typical clang plugins are not and D18826 <https://reviews.llvm.org/D18826> was a try to fix it).
- `PLUGIN_TOOL` together with `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS` (introduced in D18826 <https://reviews.llvm.org/D18826>) is a try to add support for a typical clang plugins as a DLL on Windows. Thus, `PLUGIN_TOOL` does nothing on non-Windows OS.
- `PLUGIN_TOOL` does nothing without  `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=On`, but in clang static analyzer plugins `LLVM_EXPORTED_SYMBOL_FILE`  file is used to specify symbols we want to export (`сlang_registerCheckers` and `clang_analyzerAPIVersionString`)

Thus, for now the only thing `PLUGIN_TOOL` specification for clang static analyzer plugins does is breaking MSVC build when `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=On` (and plugins support enabled with `-DCLANG_PLUGINS_SUPPORT=On -DLLVM_ENABLE_PLUGINS=On`).

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list