[clang-tools-extra] [llvm] [clang-tidy] New check `misc-header-guard` (PR #177315)
Thorsten Klein via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 6 01:24:51 PST 2026
================
@@ -0,0 +1,7 @@
+#ifndef CORRECT_HPP
+#define CORRECT_HPP
+#endif
+
+// RUN: %check_clang_tidy %s misc-header-guard correct -export-fixes=%t.yaml > %t.msg 2>&1
+// RUN: FileCheck -input-file=%t.msg -check-prefix=CHECK-MSG %s
+// CHECK-MSG: warning: code/includes outside of area guarded by header guard; consider moving it [misc-header-guard]
----------------
thorsten-klein wrote:
I think this is a bug within `utils/HeaderGuard.cpp`. I am not quite sure how to fix it.
This should not be detected
```
#ifndef CORRECT_HPP
#define CORRECT_HPP
// RUN: %check_clang_tidy %s misc-header-guard correct -export-fixes=%t.yaml > %t.msg 2>&1
// RUN: FileCheck -input-file=%t.msg -check-prefix=CHECK-MSG %s
// CHECK-MSG-NOT: warning:
#endif
```
Can you please hint me?
https://github.com/llvm/llvm-project/pull/177315
More information about the cfe-commits
mailing list