https://github.com/rengolin updated https://github.com/llvm/llvm-project/pull/200848
>From d5e9cd9aaa2068b25eedd56ceb803ab1af450cba Mon Sep 17 00:00:00 2001 From: Renato Golin <[email protected]> Date: Mon, 1 Jun 2026 16:45:40 +0100 Subject: [PATCH 1/4] [Docs] Update coding standard for TD files 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/). --- llvm/docs/CodingStandards.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst index 12704ce606e08..43d1035eea9cd 100644 --- a/llvm/docs/CodingStandards.rst +++ b/llvm/docs/CodingStandards.rst @@ -463,6 +463,15 @@ for it (vs something else, like 90 columns). However, documentation files are not source code files, and instead of fitting into 80 columns, they must be formatted to one sentence per line. 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. +Another exception are table gen files. +There are no tools that can parse, verify and edit them to match our coding style, so they are excluded from this limit. +It is still good practice to try to fit them into 80 columns, but it is not a requirement. +As with other changes, if you patch a TD file, do not reformat the entire file, but only the lines you are changing. + +If your reformatting is causing unnecessary changes in subsequent lines, please just follow the existing formatting. +Unecessary changes in TD files cause unnecessary churn in the file history and force recompilation of many unnecessary files. +It also causes unnecessary changes in forks working on the same TD files, which makes it harder to rebase and merge later. + Whitespace ^^^^^^^^^^ >From fd84d6edb2fb1faf0bc2da142fa03b2fc7f7309f Mon Sep 17 00:00:00 2001 From: Renato Golin <[email protected]> Date: Mon, 1 Jun 2026 17:28:24 +0100 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Vlad Serebrennikov <[email protected]> --- llvm/docs/CodingStandards.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst index 43d1035eea9cd..d1629f8c37989 100644 --- a/llvm/docs/CodingStandards.rst +++ b/llvm/docs/CodingStandards.rst @@ -463,8 +463,8 @@ for it (vs something else, like 90 columns). However, documentation files are not source code files, and instead of fitting into 80 columns, they must be formatted to one sentence per line. 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. -Another exception are table gen files. -There are no tools that can parse, verify and edit them to match our coding style, so they are excluded from this limit. +Another exception are TableGen files (*.td). +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. It is still good practice to try to fit them into 80 columns, but it is not a requirement. As with other changes, if you patch a TD file, do not reformat the entire file, but only the lines you are changing. >From 664e5b899551ba3524fc820e7fa1ac0fc631059f Mon Sep 17 00:00:00 2001 From: Renato Golin <[email protected]> Date: Mon, 1 Jun 2026 20:43:48 +0100 Subject: [PATCH 3/4] fix doc error --- llvm/docs/CodingStandards.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst index d1629f8c37989..2cffcdd96b1dd 100644 --- a/llvm/docs/CodingStandards.rst +++ b/llvm/docs/CodingStandards.rst @@ -463,7 +463,7 @@ for it (vs something else, like 90 columns). However, documentation files are not source code files, and instead of fitting into 80 columns, they must be formatted to one sentence per line. 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. -Another exception are TableGen files (*.td). +Another exception are TableGen files (.td). 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. It is still good practice to try to fit them into 80 columns, but it is not a requirement. As with other changes, if you patch a TD file, do not reformat the entire file, but only the lines you are changing. >From 5bafcd355701794dd33b1791c407399fac40f7ce Mon Sep 17 00:00:00 2001 From: Renato Golin <[email protected]> Date: Mon, 1 Jun 2026 20:49:34 +0100 Subject: [PATCH 4/4] Move Clang's clang-format-ignore to the base dir --- .clang-format-ignore | 3 +++ clang/.clang-format-ignore | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 clang/.clang-format-ignore diff --git a/.clang-format-ignore b/.clang-format-ignore index e69de29bb2d1d..1fb0c9558af83 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -0,0 +1,3 @@ +# Do not attempt to format .td files; we have too many formatting needs across +# the various files to allow automatic formatting. +**/*.td diff --git a/clang/.clang-format-ignore b/clang/.clang-format-ignore deleted file mode 100644 index 1fb0c9558af83..0000000000000 --- a/clang/.clang-format-ignore +++ /dev/null @@ -1,3 +0,0 @@ -# Do not attempt to format .td files; we have too many formatting needs across -# the various files to allow automatic formatting. -**/*.td _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
