Creating your own clang-based tool – Debugging Using LLVM Tools-3

On Windows, the plugin support is different from Unix, and the required LLVM and clang libraries must be linked in. The following code ensures this:if(WIN32 OR CYGWIN)set(LLVM_LINK_COMPONENTS Support)clang_target_link_libraries(NamingPlugin PRIVATEclangAST clangBasic clangFrontend clangLex)endif() Now, we can configure and build the plugin, assuming that the CMAKE_GENERATOR and CMAKE_BUILD_TYPE environment variables are set:$ cmake -DLLVM_DIR=~/LLVM/llvm-17/lib/cmake/llvm \-DClang_DIR=~/LLVM/llvm-17/lib/cmake/clang \-B build$ cmake –build build These steps …

Adding a new checker to the clang static analyzer – Debugging Using LLVM Tools-5

This finishes the implementation of the new checker. To build the plugin, we also need to create a build description in the CMakeLists.txt file which lives in the same directory as IconvChecker.cpp: Now, we can configure and build the plugin, assuming that the CMAKE_GENERATOR and CMAKE_BUILD_TYPE environment variables are set:$ cmake -DLLVM_DIR=~/LLVM/llvm-17/lib/cmake/llvm \-DClang_DIR=~/LLVM/llvm-17/lib/cmake/clang \-B build$ cmake –build build You can …