Skip to content

Commit a869788

Browse files
author
Daniel Kroening
authored
Merge pull request #4196 from diffblue/update-clang-format-docs
Update version of clang format in CODING_STANDARDs
2 parents 8e322b3 + 4a005d9 commit a869788

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

CODING_STANDARD.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,13 @@ To avoid waiting until you've made a PR to find formatting issues, you can
315315
install clang-format locally and run it against your code as you are working.
316316

317317
Different versions of clang-format have slightly different behaviors. CBMC uses
318-
clang-format-3.8 as it is available the repositories for Ubuntu 16.04 and
318+
clang-format-7 as it is available the repositories for Ubuntu 18.04 and
319319
Homebrew.
320320
To install on a Unix-like system, try installing using the system package
321321
manager:
322322
```
323-
apt-get install clang-format-3.8 # Run this on Ubuntu, Debian etc.
324-
brew install clang-format@3.8 # Run this on a Mac with Homebrew installed
323+
apt-get install clang-format-7 # Run this on Ubuntu, Debian etc.
324+
brew install clang-format@7 # Run this on a Mac with Homebrew installed
325325
```
326326

327327
If your platform doesn't have a package for clang-format, you can download a
@@ -333,18 +333,23 @@ the [LLVM Snapshot Builds page](http://llvm.org/builds/).
333333

334334
### FORMATTING A RANGE OF COMMITS
335335

336-
Clang-format is distributed with a driver script called git-clang-format-3.8.
336+
Clang-format is distributed with a driver script called git-clang-format-7.
337337
This script can be used to format git diffs (rather than entire files).
338338

339339
After committing some code, it is recommended to run:
340340
```
341-
git-clang-format-3.8 upstream/develop
341+
git-clang-format-7 upstream/develop
342342
```
343343
*Important:* If your branch is based on a branch other than `upstream/develop`,
344344
use the name or checksum of that branch instead. It is strongly recommended to
345345
rebase your work onto the tip of the branch it's based on before running
346346
`git-clang-format` in this way.
347347

348+
Note: By default, git-clang-format uses the git config variable
349+
`clangformat.binary`. If you have multiple versions of clang-format installed,
350+
you might need to update this, or explicitly specify the binary to use via
351+
`--binary clang-format-7`.
352+
348353
### RETROACTIVELY FORMATTING INDIVIDUAL COMMITS
349354

350355
If your works spans several commits and you'd like to keep the formatting
@@ -355,7 +360,7 @@ The following command will stop at each commit in the range and run
355360
clang-format on the diff at that point. This rewrites git history, so it's
356361
*unsafe*, and you should back up your branch before running this command:
357362
```
358-
git filter-branch --tree-filter 'git-clang-format-3.8 upstream/develop' \
363+
git filter-branch --tree-filter 'git-clang-format-7 upstream/develop' \
359364
-- upstream/develop..HEAD
360365
```
361366
*Important*: `upstream/develop` should be changed in *both* places in the

0 commit comments

Comments
 (0)