[clang-tools-extra] [llvm] New check `misc-header-guard` (PR #177315)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 23:43:59 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,hpp,h -- clang-tools-extra/clang-tidy/misc/HeaderGuardCheck.cpp clang-tools-extra/clang-tidy/misc/HeaderGuardCheck.h clang-tools-extra/test/clang-tidy/checkers/misc/header-guard.cpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/correct.hpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/missing.hpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/other/correct.hpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/other/missing.hpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/other/wrong.hpp clang-tools-extra/test/clang-tidy/checkers/misc/header-guard/include/wrong.hpp clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 27cda7fd6..8523031ef 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -54,8 +54,7 @@ public:
         "misc-coroutine-hostile-raii");
     CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
         "misc-definitions-in-headers");
-    CheckFactories.registerCheck<HeaderGuardCheck>(
-        "misc-header-guard");
+    CheckFactories.registerCheck<HeaderGuardCheck>("misc-header-guard");
     CheckFactories.registerCheck<HeaderIncludeCycleCheck>(
         "misc-header-include-cycle");
     CheckFactories.registerCheck<IncludeCleanerCheck>("misc-include-cleaner");

``````````

</details>


https://github.com/llvm/llvm-project/pull/177315


More information about the llvm-commits mailing list