compositeprimes created this revision.
compositeprimes added reviewers: clang, clang-tools-extra.
compositeprimes added projects: clang, clang-tools-extra.
Herald added a subscriber: cfe-commits.

Part 1 of the change:
The goal is instead of dropping all the ranges associated with a Diagnostic 
when converting them to a ClangTidy error, instead attach them to the 
ClangTidyError, so they can be consumed by other APIs.

I could move this to the ClangTidyError class itself, but I thought it could be 
useful here, as Diagnostic could use a concept of ranges not associated with a 
FixIt


Repository:
  rC Clang

https://reviews.llvm.org/D68885

Files:
  include/clang/Tooling/Core/Diagnostic.h


Index: include/clang/Tooling/Core/Diagnostic.h
===================================================================
--- include/clang/Tooling/Core/Diagnostic.h
+++ include/clang/Tooling/Core/Diagnostic.h
@@ -84,6 +84,13 @@
   ///
   /// Note: it is empty in unittest.
   std::string BuildDirectory;
+
+
+  /// Extra source ranges associated with the diagnostic. By default, the
+  /// diagnostic is only associated with the source location specified in the
+  /// `Message` field, but if `Ranges` is nonempty, they will be preferred
+  /// representation of the source code associated with the diagnostic.
+  ArrayRef<CharSourceRange> Ranges;
 };
 
 /// Collection of Diagnostics generated from a single translation unit.


Index: include/clang/Tooling/Core/Diagnostic.h
===================================================================
--- include/clang/Tooling/Core/Diagnostic.h
+++ include/clang/Tooling/Core/Diagnostic.h
@@ -84,6 +84,13 @@
   ///
   /// Note: it is empty in unittest.
   std::string BuildDirectory;
+
+
+  /// Extra source ranges associated with the diagnostic. By default, the
+  /// diagnostic is only associated with the source location specified in the
+  /// `Message` field, but if `Ranges` is nonempty, they will be preferred
+  /// representation of the source code associated with the diagnostic.
+  ArrayRef<CharSourceRange> Ranges;
 };
 
 /// Collection of Diagnostics generated from a single translation unit.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to