This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] TransformerClangTidyCheck: change choice of location for diagnostic message.
ClosedPublic

Authored by ymandel on Aug 23 2019, 12:37 PM.

Details

Summary

This patch changes the location specified to`ClangTidyCheck::diag()`.
Currently, the beginning of the matched range is used. This patch uses the
beginning of the first fix's range. This change both simplifies the code and
(hopefully) gives a more intuitive result: the reported location aligns with
the fix(es) provided, rather than the (arbitrary) range of the rule's match.

N.B. this patch will break the line offset numbers in lit tests if the first fix
is not at the beginning of the match.

Diff Detail

Repository
rL LLVM

Event Timeline

ymandel created this revision.Aug 23 2019, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2019, 12:37 PM
Herald added a subscriber: xazax.hun. · View Herald Transcript
ymandel edited the summary of this revision. (Show Details)Aug 26 2019, 5:18 AM
gribozavr added inline comments.Aug 26 2019, 6:09 AM
clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
106 ↗(On Diff #216926)

Sorry, I don't quite understand the comment -- the test has two replacements (both arguments to the macro are replaced), but the comment says that we only expect one.

ymandel updated this revision to Diff 217146.Aug 26 2019, 7:14 AM

fixed comment.

ymandel marked an inline comment as done.Aug 26 2019, 7:15 AM
ymandel added inline comments.
clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
106 ↗(On Diff #216926)

Right, that comment needs to be updated. It's leftover from while the fix wasn't done yet...

ymandel marked an inline comment as done.Aug 26 2019, 7:15 AM
gribozavr accepted this revision.Aug 26 2019, 7:31 AM

I see, it all makes sense now.

This revision is now accepted and ready to land.Aug 26 2019, 7:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2019, 8:20 AM