diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp index acd63d3b0ad..f89362d88cd 100644 --- a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp +++ b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp @@ -223,9 +223,10 @@ public: std::string CPPVar = Check->getHeaderGuard(FileName); std::string CPPVarUnder = CPPVar + '_'; // Allow a trailing underscore. - // If there is a header guard macro but it's not in the topmost position - // emit a plain warning without fix-its. This often happens when the guard - // macro is preceeded by includes. + // If there's a macro with a name that follows the header guard convention + // but was not recognized by the preprocessor as a header guard there must + // be code outside of the guarded area. Emit a plain warning without + // fix-its. // FIXME: Can we move it into the right spot? bool SeenMacro = false; for (const auto &MacroEntry : Macros) { @@ -233,9 +234,8 @@ public: SourceLocation DefineLoc = MacroEntry.first.getLocation(); if ((Name == CPPVar || Name == CPPVarUnder) && SM.isWrittenInSameFile(StartLoc, DefineLoc)) { - Check->diag( - DefineLoc, - "Header guard after code/includes. Consider moving it up."); + Check->diag(DefineLoc, "code/includes outside of area guarded by " + "header guard; consider moving it"); SeenMacro = true; break; } |