OCLint

Compiling and Testing OCLint

To compile OCLint, get a clone on your local machine.

Compiling LLVM/Clang

You need to compile the specified version of LLVM/Clang as submodule of the git repository, please run

./script/llvmClangBuild.sh

We will fetch submodules, configure the compilation, and build LLVM/Clang for you. The custom libclang build will be stored in OCLint_clone_folder/build/llvm folder. (Check out llvmClangBuild.sh from github.)

Compiling OCLint

To build OCLint with unit tests, please run

./script/moBuild.sh

The script will build OCLint main program, its rules, and test program for you, and run unit tests immediately after the build is success. (Check out moBuild.sh from github.)

To build a release version of OCLint, simply run

./script/moInstallationBuild.sh <installation_path>

It will build OCLint binary program, its rules, and copy OCLint related libraries, including its own rule libraries and libclang, to the target installation path. The installations will be separated by build version number. If you get the same version number as this website provides, then it should be exactly same as we build our release version with this script. (Check out moInstallationBuild.sh from github.)

Also, we have moCIBuild.sh to continuously build our source code, test cases, and generate code coverage report with awesome Jenkins CI. Other than these, this script invokes “dogfooding” inspection to scan OCLint source code with OCLint itself as well.

Instead of a clean build, moQuickBuild.sh gives you the ability to build the latest changes based on modification timestamp, to save quite a lot of your precious time.

Testing OCLint

OCLint_clone_folder/build/oclint contains all OCLint related files in a standard CMake build structure. You can find OCLint executable binary, test executable binary in bin folder. Related libraries are stored in lib folder. You can run

./build/bin/oclint_test

to invoke the tests. If build is invoked by CI build script, in addition to llvm and oclint folders, following folders/files will be generated in OCLint_clone_folder/build folder as well.

  • testresult.txt - Test results
  • report - Contains code coverage report generated by lcov
  • sameplesinspection.txt - Results for inspections on some sample files
  • selfinspection.txt - Results for self inspection