[clang-tools-extra] 74add1b - Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"

Jorge Gorbe Moya via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 9 11:29:59 PST 2021


Author: Jorge Gorbe Moya
Date: 2021-11-09T11:28:48-08:00
New Revision: 74add1b6d6d377ab2cdce26699cf798110817e42

URL: https://github.com/llvm/llvm-project/commit/74add1b6d6d377ab2cdce26699cf798110817e42
DIFF: https://github.com/llvm/llvm-project/commit/74add1b6d6d377ab2cdce26699cf798110817e42.diff

LOG: Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"

The change causes multiple clang-tidy tests to fail under ASan.

This reverts commit 00769572025f9b0d36dc832d3c1bc61500091ed5.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index 9771d90de63df..456de0e979dbd 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -374,11 +374,13 @@ static ClangTidyError createNolintError(const ClangTidyContext &Context,
                                         bool IsNolintBegin) {
   ClangTidyError Error("clang-tidy-nolint", ClangTidyError::Error,
                        Context.getCurrentBuildDirectory(), false);
-  auto Message = Twine("unmatched 'NOLINT") +
-                 (IsNolintBegin ? "BEGIN" : "END") + "' comment without a " +
-                 (IsNolintBegin ? "subsequent" : "previous") + " 'NOLINT" +
-                 (IsNolintBegin ? "END" : "BEGIN") + "' comment";
-  Error.Message = tooling::DiagnosticMessage(Message.str(), SM, Loc);
+  StringRef Message =
+      IsNolintBegin
+          ? "unmatched 'NOLINTBEGIN' comment without a subsequent 'NOLINTEND' "
+            "comment"
+          : "unmatched 'NOLINTEND' comment without a previous 'NOLINTBEGIN' "
+            "comment";
+  Error.Message = tooling::DiagnosticMessage(Message, SM, Loc);
   return Error;
 }
 


        


More information about the cfe-commits mailing list