[PATCH] D128706: [Clang] Disable clang-format entirely for clang/test tree.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 00:20:12 PDT 2022

mboehme created this revision.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

See discussion here:


We don't generally expect test files to be formatted according to the
style guide. Indeed, some tests may require specific formatting for the
purposes of the test.

When tests intentionally do not conform to the "correct" formatting,
this causes errors in the CI, which can drown out real errors and causes
people to stop trusting the CI over time.

>From the history of the clang/test/.clang-format file, it looks as if
there have been attempts to make clang-format do a subset of formatting
that would be useful for tests. However, it looks as if it's hard to
make clang-format do exactly the right thing -- see the back-and-forth
13316a7 <https://github.com/llvm/llvm-project/commit/13316a77053514be552a0dad932e3455413b4f82>
7b5bddf <https://github.com/llvm/llvm-project/commit/7b5bddfd034ef42c92c67731743399df844d5f43>.

Instead, I think the best choice is to entirely disable clang-format on
the clang/test directory.

  rG LLVM Github Monorepo



Index: clang/test/.clang-format
--- clang/test/.clang-format
+++ clang/test/.clang-format
@@ -1,3 +1 @@
-BasedOnStyle: LLVM
-ColumnLimit: 0
-AlwaysBreakTemplateDeclarations: No
+DisableFormat: true

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128706.440506.patch
Type: text/x-patch
Size: 266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220628/e809c33e/attachment-0001.bin>

More information about the cfe-commits mailing list