Skip to content

ShlKan/CPP_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP_Analysis: A Analyzer of c or c++

The tool is built on ClangIR.

1. Build

CPP_Analysis depends on LLVM. So before building CPP_Analysis, LLVM should be build and add the find_package CMAKE_PREFIX_PATH.

1.1 Building LLVM

The important thing the following parameter: Add LLVM_ENABLE_PROJECTS="clang;mlir". Because we need to use clang frontend and mlir.

For instance, an command to build llvm could be:

cmake -DCMAKE_BUILD_TYPE=Debug
      -DLLVM_ENABLE_PROJECTS=clang;mlir
      -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE 
      -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang
      -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++
      --no-warn-unused-cli 
      -S/Users/shuanglong/projects/llvm-project/llvm 
      -B/Users/shuanglong/projects/llvm-project/build 
      -G Ninja 
      path/to/cmakefile

Attention: The llvm now needs to change a little bit see Fix issues of ClangIR

1.2 Building CPP_Analysis

You can use the following command to compile CPP_Analysis project.

cmake -DCMAKE_BUILD_TYPE=Debug 
	  -DCMAKE_PREFIX_PATH=/path/to/llvm-project/build 
	  -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE 
	  -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang 
	  -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ 
	  --no-warn-unused-cli 
	  -S/Users/shuanglong/projects/CPP_ANALYSIS 
	  -B/Users/shuanglong/projects/CPP_Analysis/build 
	  -G Ninja

CMAKE_PREFIX_PATH must be the path to the llvm build directory you just compiled.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages