From cc0e2c9ed35046623600ebc288828a3b1c35e99f Mon Sep 17 00:00:00 2001 From: Stuart Cook Date: Fri, 25 Oct 2024 15:17:44 +1100 Subject: [PATCH] Advice on auto-formatting C++ code (#2104) --- src/conventions.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/conventions.md b/src/conventions.md index 1c963c66..e7a8d00c 100644 --- a/src/conventions.md +++ b/src/conventions.md @@ -27,11 +27,24 @@ pass the `--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. + -### Copyright notice +## Copyright notice In the past, files began with a copyright and license notice. Please **omit**