Reader small image

You're reading from  Clang Compiler Frontend

Product typeBook
Published inMar 2024
PublisherPackt
ISBN-139781837630981
Edition1st Edition
Right arrow
Author (1)
Ivan Murashko
Ivan Murashko
author image
Ivan Murashko

Ivan V. Murashko is a C++ software engineer: He got his PhD from Peter the Great St.Petersburg Polytechnic University and has over 20 years of C++ programming experience; since 2020 he has worked with LLVM compilers. His area of interest includes clang compiler frontend and clang tools (clang-tidy, clangd).
Read more about Ivan Murashko

Right arrow

4.6 Clang plugin project

The goal of the test project is to create a clang plugin that will estimate class complexity. Specifically, a class is deemed complex if the number of its methods exceeds a certain threshold. We will leverage all the knowledge we have acquired thus far for this project. This will include the use of a recursive visitor and Clang diagnostics. Additionally, we will create a LIT test for our project. Developing the plugin will necessitate a unique build configuration for LLVM, which will be our initial step.

4.6.1 Environment setup

The plugin will be created as a shared object, and our LLVM installation should be built with support for shared libraries (see Section 1.3.1, Configuration with CMake):

cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../install -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_USE_SPLIT_DWARF=ON -DBUILD_SHARED_LIBS=ON ../llvm

Figure 4.31: CMake configuration used for...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Clang Compiler Frontend
Published in: Mar 2024Publisher: PacktISBN-13: 9781837630981

Author (1)

author image
Ivan Murashko

Ivan V. Murashko is a C++ software engineer: He got his PhD from Peter the Great St.Petersburg Polytechnic University and has over 20 years of C++ programming experience; since 2020 he has worked with LLVM compilers. His area of interest includes clang compiler frontend and clang tools (clang-tidy, clangd).
Read more about Ivan Murashko