diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,15 +116,22 @@ target_link_libraries(${name} ${llvm_system_lib}) endforeach() - if(MSVC) + if(WIN32) target_link_libraries(${name} version.lib) endif() endmacro() +option(CLAZY_STATIC_PLUGIN_LIB "Build plugin into static library" OFF) +set(PLUGIN_LINK_TYPE SHARED) + +if (CLAZY_STATIC_PLUGIN_LIB) + set(PLUGIN_LINK_TYPE STATIC) +endif() + macro(add_clang_plugin name) set(srcs ${ARGN}) - add_library(${name} SHARED ${srcs}) + add_library(${name} ${PLUGIN_LINK_TYPE} ${srcs}) if(SYMBOL_FILE) set_target_properties(${name} PROPERTIES LINK_FlAGS "-exported_symbols_list ${SYMBOL_FILE}") diff --git a/src/Clazy.cpp b/src/Clazy.cpp --- a/src/Clazy.cpp +++ b/src/Clazy.cpp @@ -384,5 +384,7 @@ return unique_ptr(astConsumer); } +volatile int ClazyPluginAnchorSource = 0; + static FrontendPluginRegistry::Add X("clang-lazy", "clang lazy plugin"); diff --git a/src/PreProcessorVisitor.h b/src/PreProcessorVisitor.h --- a/src/PreProcessorVisitor.h +++ b/src/PreProcessorVisitor.h @@ -42,6 +42,8 @@ class MacroArgs; } +using uint = unsigned; + class PreProcessorVisitor : public clang::PPCallbacks { PreProcessorVisitor(const PreProcessorVisitor &) = delete;