This is an archive of the discontinued LLVM Phabricator instance.

[clang][tooling] Fix early termination when there are nested expansions
ClosedPublic

Authored by kadircet on Jul 3 2023, 4:40 AM.

Details

Summary

This also does some cleanups, I am happy to undo them (or send as
separate patches):

  • Change the early exit to stop only once we hit an expansion inside the main file, to make sure we keep following the nested expansions.
  • Add more tests to cover all the cases mentioned in the implementation
  • Drop the adjustments for prev/next tokens. We do the final checks based on the expansion locations anyway, so any intermediate mapping was a no-op.

Diff Detail

Event Timeline

kadircet created this revision.Jul 3 2023, 4:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 4:40 AM
Herald added a subscriber: arphaman. · View Herald Transcript
kadircet requested review of this revision.Jul 3 2023, 4:40 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 3 2023, 4:40 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall accepted this revision.Jul 3 2023, 7:26 AM
sammccall added inline comments.
clang/lib/Tooling/Syntax/Tokens.cpp
116

(no action needed)

we had extensive discussion of why this change is a no-op, and how to prove it, and what comments to leave.
However in the end I don't think such a comment is necessary, because the code makes sense in isolation, and equivalence-to-previous-version isn't very interesting!

This revision is now accepted and ready to land.Jul 3 2023, 7:26 AM
This revision was landed with ongoing or failed builds.Jul 3 2023, 7:58 AM
This revision was automatically updated to reflect the committed changes.