This is an archive of the discontinued LLVM Phabricator instance.

Add a Ranges field to Diagnostic struct
AbandonedPublic

Authored by compositeprimes on Oct 11 2019, 1:22 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Restricted Project
Summary

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

Diff Detail

Repository
rC Clang

Event Timeline

Please upload patches with context in future (arc diff will do that for you).

Please also merge this patch with the user, https://reviews.llvm.org/D68887. No need to add untested code.

include/clang/Tooling/Core/Diagnostic.h
88

Extra empty line.

92

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.

alexfh added a subscriber: alexfh.Oct 18 2019, 7:10 AM
alexfh added inline comments.
include/clang/Tooling/Core/Diagnostic.h
93

Please add YAML serialization/deserialization code for this. See include/clang/Tooling/DiagnosticsYaml.h

compositeprimes marked 3 inline comments as done.Nov 3 2019, 9:43 PM

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!

include/clang/Tooling/Core/Diagnostic.h
92

Reworded to make this more generic

93

How to I add Yaml support for CharSourceRange? Should I add the relevant template <> struct MappingTraits, and if so where would this go?

compositeprimes abandoned this revision.Feb 27 2020, 11:16 AM