This is an archive of the discontinued LLVM Phabricator instance.

Add srcloc output to clang-query
ClosedPublic

Authored by steveire on Dec 15 2020, 11:20 AM.

Diff Detail

Event Timeline

steveire requested review of this revision.Dec 15 2020, 11:20 AM
steveire created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 15 2020, 11:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Thank you for this, it looks really useful!

clang-tools-extra/clang-query/Query.cpp
92
95

It should be named Locs per the usual coding conventions.

(I'll hold my nose on the use of auto here, but if it got spelled out since you're touching the line anyway, that would not be a terrible thing.)

97

it -> Iter

104

SourceLocations -> source locations ?

106

CommonLoc and the type should definitely be spelled out.

107

Scout

121

it -> Iter

134

SourceRanges -> source ranges ?

137–138

Same here as above.

Given how common this code seems to be with the first block of code, would it make sense to turn some of this code into a lambda?

150

it -> Iter

163

SourceRange -> source range ?

166–167

More names to correct for conventions. Can you also spell out at least the location datatype?

yuvalmo removed a subscriber: yuvalmo.
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2021, 3:47 AM
Herald added a subscriber: mgorny. · View Herald Transcript
steveire marked 12 inline comments as done.Apr 23 2021, 8:18 AM
njames93 added inline comments.Apr 23 2021, 8:35 AM
clang-tools-extra/clang-query/Query.cpp
106–108

nit: Elide braces.

122

Can this be brought out the loop and re-used for each of the 3 loops?

clang-tools-extra/clang-query/QueryParser.cpp
128

Can worry about detecting Introspection support in a follow-up

aaron.ballman accepted this revision.Apr 23 2021, 8:55 AM

LGTM aside from the nits from @njames93 and I.

clang-tools-extra/clang-query/Query.cpp
96
This revision is now accepted and ready to land.Apr 23 2021, 8:55 AM
This revision was landed with ongoing or failed builds.Apr 25 2021, 4:24 AM
This revision was automatically updated to reflect the committed changes.