[clang-tools-extra] 071002f - [clang-tidy] Copy the Ranges field from the Diagnostic when creating the ClangTidyError

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 03:39:24 PST 2020


Author: Joe Turner
Date: 2020-03-02T12:39:16+01:00
New Revision: 071002ffdb3f13fa3006618e7ee8277a75792df5

URL: https://github.com/llvm/llvm-project/commit/071002ffdb3f13fa3006618e7ee8277a75792df5
DIFF: https://github.com/llvm/llvm-project/commit/071002ffdb3f13fa3006618e7ee8277a75792df5.diff

LOG: [clang-tidy] Copy the Ranges field from the Diagnostic when creating the ClangTidyError

Differential Revision: https://reviews.llvm.org/D68887

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 5a4021c97b0f..7a807280d9b1 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -62,6 +62,9 @@ class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
     }
     assert(Error.Message.Message.empty() && "Overwriting a diagnostic message");
     Error.Message = TidyMessage;
+    for (const CharSourceRange &SourceRange : Ranges) {
+      Error.Ranges.emplace_back(Loc.getManager(), SourceRange);
+    }
   }
 
   void emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc,


        


More information about the cfe-commits mailing list