[PATCH] D68885: Add a Ranges field to Diagnostic struct

Joe Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 3 21:47:06 PST 2019


compositeprimes marked 3 inline comments as done.
compositeprimes added a comment.

Sorry for the delay; I got caught up in some other work.

I moved this to https://reviews.llvm.org/D69782 using arc diff.

@gribozavr: I'm not sure how to merge this with the other commit, because it's in clang-tidy; do you think you could share how this might be done?

Thanks!



================
Comment at: include/clang/Tooling/Core/Diagnostic.h:92
+  /// `Message` field, but if `Ranges` is nonempty, they will be preferred
+  /// representation of the source code associated with the diagnostic.
+  ArrayRef<CharSourceRange> Ranges;
----------------
gribozavr wrote:
> I don't understand the "preferred" wording here. What do you mean?
> 
> Also, this is a departure from how compiler warnings and ClangTidy messages work. Additional ranges are used to highlight parts of the code relevant to the problem, not to reposition the diagnostic.
Reworded to make this more generic


================
Comment at: include/clang/Tooling/Core/Diagnostic.h:93
+  /// representation of the source code associated with the diagnostic.
+  ArrayRef<CharSourceRange> Ranges;
 };
----------------
alexfh wrote:
> Please add YAML serialization/deserialization code for this. See include/clang/Tooling/DiagnosticsYaml.h
How to I add Yaml support for CharSourceRange? Should I add the relevant `template <> struct MappingTraits`, and if so where would this go?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68885/new/

https://reviews.llvm.org/D68885





More information about the cfe-commits mailing list