@@ -315,13 +315,13 @@ To avoid waiting until you've made a PR to find formatting issues, you can
315
315
install clang-format locally and run it against your code as you are working.
316
316
317
317
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
319
319
Homebrew.
320
320
To install on a Unix-like system, try installing using the system package
321
321
manager:
322
322
```
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
325
325
```
326
326
327
327
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/).
333
333
334
334
### FORMATTING A RANGE OF COMMITS
335
335
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 .
337
337
This script can be used to format git diffs (rather than entire files).
338
338
339
339
After committing some code, it is recommended to run:
340
340
```
341
- git-clang-format-3.8 upstream/develop
341
+ git-clang-format-7 upstream/develop
342
342
```
343
343
* Important:* If your branch is based on a branch other than ` upstream/develop ` ,
344
344
use the name or checksum of that branch instead. It is strongly recommended to
345
345
rebase your work onto the tip of the branch it's based on before running
346
346
` git-clang-format ` in this way.
347
347
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
+
348
353
### RETROACTIVELY FORMATTING INDIVIDUAL COMMITS
349
354
350
355
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
355
360
clang-format on the diff at that point. This rewrites git history, so it's
356
361
* unsafe* , and you should back up your branch before running this command:
357
362
```
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' \
359
364
-- upstream/develop..HEAD
360
365
```
361
366
* Important* : ` upstream/develop ` should be changed in * both* places in the
0 commit comments