Advice on auto-formatting C++ code (#2104)

This commit is contained in:
Stuart Cook 2024-10-25 15:17:44 +11:00 committed by GitHub
parent 49afa1d8df
commit cc0e2c9ed3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 1 deletions

View File

@ -27,11 +27,24 @@ pass the <!-- date-check: nov 2022 --> `--edition=2021` argument yourself when c
[fmt]: https://github.com/rust-dev-tools/fmt-rfcs
[`rustfmt`]:https://github.com/rust-lang/rustfmt
## Formatting C++ code
The compiler contains some C++ code for interfacing with parts of LLVM that
don't have a stable C API.
When modifying that code, use this command to format it:
```sh
./x test tidy --extra-checks=cpp:fmt --bless
```
This uses a pinned version of `clang-format`, to avoid relying on the local
environment.
<a name="copyright"></a>
<!-- REUSE-IgnoreStart -->
<!-- Prevent REUSE from interpreting the heading as a copyright notice -->
### Copyright notice
## Copyright notice
<!-- REUSE-IgnoreEnd -->
In the past, files began with a copyright and license notice. Please **omit**