The LLILC project is structured as a subproject of LLVM so we are using the same coding conventions as LLVM. See the coding convention document for more details. To maintain these conventions, we require all contributors to run our code formatting script over their changes before submitting a pull request. The code formatting script is found at LLILC\utils\ccformat.py.
- Binaries for clang-format and clang-tidy are required to run ccformat.py.
- clang-format is available in the clang repository. It can either be downloaded from LLVM, or built from clang source tree.
- clang-tidy is available in the clang-tools-extra repository. It should be built from the MS branch of the clang-tools-extra repository.
- Set the INCLUDE=. On Windows, this can be done by executing
"%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
- Provide a full path to the following locations via the corresponding environment settings or command line arguments.
Description | Environment Variable | Argument to ccFormat.py |
---|---|---|
LLVM source directory | LLVMSOURCE | --llvm-source <path> |
LLVM build directory | LLVMBUILD | --llvm-build <path> |
CoreClr build directory | CORECLRBUILD | --coreclr-build <path> |
clang-format binary | /< on path/> | --clang-format <path> |
clang-tidy binary | /< on path/> | --clang-tidy <path> |
To check if a submission conforms to coding conventions, contributors should run from their main LLILC enlistment directory:
utils\ccformat.py
By default, ccFormat will run both clang-format and clang-tidy checks. To disable clang-format checks, run:
utils\ccformat.py --noformat
To disable clang-tidy checks, run:
utils\ccformat.py --untidy
If you do not want to see the diffs generated by clang-format (but only want to check if there are any formatting errors), run:
utils\ccformat.py --hide-diffs
If ccformat.py informs you that there are diffs between your code and the formatted version returned by clang-format, contributors need to run with --fix to automatically fix formatting errors:
utils\ccformat.py --fix
For further information, please run:
utils\ccformat.py --help