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
94
97

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.)

99

it -> Iter

106

SourceLocations -> source locations ?

108

CommonLoc and the type should definitely be spelled out.

109

Scout

123

it -> Iter

136

SourceRanges -> source ranges ?

139–140

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?

152

it -> Iter

165

SourceRange -> source range ?

168–169

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
108–110

nit: Elide braces.

124

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
98
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.