Skip to content

Commit 8b66d82

Browse files
rengolinEndilll
andauthored
[Docs] Update coding standard for TD files (#200848)
This PR proposes an update to the coding standards document to make explicit that we do not want unnecessary formatting changes to TD files. This is in response to this merged PR (#199346), which lead to this RFC (https://discourse.llvm.org/t/80-column-limit-for-td-files/90950/). --------- Co-authored-by: Vlad Serebrennikov <[email protected]>
1 parent 385ba88 commit 8b66d82

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

.clang-format-ignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Do not attempt to format .td files; we have too many formatting needs across
2+
# the various files to allow automatic formatting.
3+
**/*.td

clang/.clang-format-ignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

llvm/docs/CodingStandards.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,15 @@ for it (vs something else, like 90 columns).
463463
However, documentation files are not source code files, and instead of fitting into 80 columns, they must be formatted to one sentence per line.
464464
This way a change in the middle of a paragraph doesn't cause unnecessary changes in subsequent lines, making it easier for reviewers to see what has changed when documentation is updated.
465465

466+
Another exception are TableGen files (.td).
467+
There are no tools that can parse, verify and edit them to match our coding style, including clang-format, so they are excluded from this limit.
468+
It is still good practice to try to fit them into 80 columns, but it is not a requirement.
469+
As with other changes, if you patch a TD file, do not reformat the entire file, but only the lines you are changing.
470+
471+
If your reformatting is causing unnecessary changes in subsequent lines, please just follow the existing formatting.
472+
Unecessary changes in TD files cause unnecessary churn in the file history and force recompilation of many unnecessary files.
473+
It also causes unnecessary changes in forks working on the same TD files, which makes it harder to rebase and merge later.
474+
466475
Whitespace
467476
^^^^^^^^^^
468477

0 commit comments

Comments
 (0)