From a3d846e534acdac7d533343c96788da882ec20b3 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Fri, 25 Oct 2024 14:44:38 +1100 Subject: [PATCH] Advice on auto-formatting C++ code --- src/conventions.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/conventions.md b/src/conventions.md index 1c963c669..e7a8d00cc 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**