Skip to content

Commit cc0e2c9

Browse files
authored
Advice on auto-formatting C++ code (#2104)
1 parent 49afa1d commit cc0e2c9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/conventions.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@ pass the <!-- date-check: nov 2022 --> `--edition=2021` argument yourself when c
2727
[fmt]: https://github.com/rust-dev-tools/fmt-rfcs
2828
[`rustfmt`]:https://github.com/rust-lang/rustfmt
2929

30+
## Formatting C++ code
31+
32+
The compiler contains some C++ code for interfacing with parts of LLVM that
33+
don't have a stable C API.
34+
When modifying that code, use this command to format it:
35+
36+
```sh
37+
./x test tidy --extra-checks=cpp:fmt --bless
38+
```
39+
40+
This uses a pinned version of `clang-format`, to avoid relying on the local
41+
environment.
42+
3043
<a name="copyright"></a>
3144

3245
<!-- REUSE-IgnoreStart -->
3346
<!-- Prevent REUSE from interpreting the heading as a copyright notice -->
34-
### Copyright notice
47+
## Copyright notice
3548
<!-- REUSE-IgnoreEnd -->
3649

3750
In the past, files began with a copyright and license notice. Please **omit**

0 commit comments

Comments
 (0)