Skip to content

Conversation

@vbvictor
Copy link
Contributor

After #118553, emacs tag is no longer needed in LLVM files: https://llvm.org/docs/CodingStandards.html#file-headers.
This patch removes it from add_new_check.py lowering complexity we need to maintain.

@llvmbot
Copy link
Member

llvmbot commented Aug 16, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Baranov Victor (vbvictor)

Changes

After #118553, emacs tag is no longer needed in LLVM files: https://llvm.org/docs/CodingStandards.html#file-headers.
This patch removes it from add_new_check.py lowering complexity we need to maintain.


Full diff: https://github.com/llvm/llvm-project/pull/153942.diff

1 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/add_new_check.py (+2-10)
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
index e366f10053535..2b51a1dc40ebc 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -89,13 +89,9 @@ def write_header(
             + check_name_camel.upper()
             + "_H"
         )
-        f.write("//===--- ")
-        f.write(os.path.basename(filename))
-        f.write(" - clang-tidy ")
-        f.write("-" * max(0, 42 - len(os.path.basename(filename))))
-        f.write("*- C++ -*-===//")
         f.write(
             """
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -145,13 +141,9 @@ def write_implementation(
     filename = os.path.join(module_path, check_name_camel) + ".cpp"
     print("Creating %s..." % filename)
     with io.open(filename, "w", encoding="utf8", newline="\n") as f:
-        f.write("//===--- ")
-        f.write(os.path.basename(filename))
-        f.write(" - clang-tidy ")
-        f.write("-" * max(0, 51 - len(os.path.basename(filename))))
-        f.write("-===//")
         f.write(
             """
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

@llvmbot
Copy link
Member

llvmbot commented Aug 16, 2025

@llvm/pr-subscribers-clang-tidy

Author: Baranov Victor (vbvictor)

Changes

After #118553, emacs tag is no longer needed in LLVM files: https://llvm.org/docs/CodingStandards.html#file-headers.
This patch removes it from add_new_check.py lowering complexity we need to maintain.


Full diff: https://github.com/llvm/llvm-project/pull/153942.diff

1 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/add_new_check.py (+2-10)
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
index e366f10053535..2b51a1dc40ebc 100755
--- a/clang-tools-extra/clang-tidy/add_new_check.py
+++ b/clang-tools-extra/clang-tidy/add_new_check.py
@@ -89,13 +89,9 @@ def write_header(
             + check_name_camel.upper()
             + "_H"
         )
-        f.write("//===--- ")
-        f.write(os.path.basename(filename))
-        f.write(" - clang-tidy ")
-        f.write("-" * max(0, 42 - len(os.path.basename(filename))))
-        f.write("*- C++ -*-===//")
         f.write(
             """
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -145,13 +141,9 @@ def write_implementation(
     filename = os.path.join(module_path, check_name_camel) + ".cpp"
     print("Creating %s..." % filename)
     with io.open(filename, "w", encoding="utf8", newline="\n") as f:
-        f.write("//===--- ")
-        f.write(os.path.basename(filename))
-        f.write(" - clang-tidy ")
-        f.write("-" * max(0, 51 - len(os.path.basename(filename))))
-        f.write("-===//")
         f.write(
             """
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

@EugeneZelenko
Copy link
Contributor

How about replacement in existing code? We should also ask for similar changes in open pull requests.

@vbvictor
Copy link
Contributor Author

We should also ask for similar changes in open pull requests.

This is a low priority task so I wouldn't bother contributors to manually correct files.

For replacement - I need to write a script for bulk update and I didn't have time. So I'd do that in another PR. Maybe someone else would be interested in updating files.

Copy link
Contributor

@carlosgalvezp carlosgalvezp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I agree cleaning existing code shall be done in another PR, via some automated script.

@vbvictor vbvictor merged commit 378d240 into llvm:main Aug 18, 2025
12 checks passed
@vbvictor vbvictor deleted the remove-cpp-tag-from-headers branch August 18, 2025 19:49
localspook added a commit that referenced this pull request Sep 14, 2025
As decided in #118553 and following up #153942.

`rename_check.py` has small logic changes, everything else is a
mechanical replacement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants