User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

cprover_coding_style_with_clang-format [2014/03/21 10:57] (current)
bjowac created
Line 1: Line 1:
 +=== CProver-conformant formatting with Clang ===
 +There are two formatting aspects of the CProver coding guidelines:
 +  - 2 spaces indent, no tabs
 +  - Put matching { } into the same column
 +Working with an external developer, I found it useful to
 +automate the formatting step, rather than doing it manually.
 +To this end, clang-format can be used.
 +The tool is part of the Ubuntu packages.
 +Clang-format can be customised by providing a style file,
 +which I have given below.
 +clang-format -style=file example.cpp
 +== Style file ==
 +BasedOnStyle:​ LLVM
 +IndentWidth:​ 2
 +UseTab: Never
 +BreakBeforeBraces:​ Allman
 +AllowShortIfStatementsOnASingleLine:​ true
 +IndentCaseLabels:​ false
cprover_coding_style_with_clang-format.txt ยท Last modified: 2014/03/21 10:57 by bjowac