Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice on auto-formatting C++ code #2104

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down