Page MenuHomePhabricator

[Syntax] Add a helper to find expansion by its first spelled token
ClosedPublic

Authored by ilya-biryukov on Jun 6 2019, 7:23 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ilya-biryukov created this revision.Jun 6 2019, 7:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2019, 7:23 AM
Herald added a subscriber: kadircet. · View Herald Transcript
sammccall added inline comments.Jun 18 2019, 1:53 AM
clang/include/clang/Tooling/Syntax/Tokens.h
204 ↗(On Diff #203356)

macro directives -> preprocessor directives?

207 ↗(On Diff #203356)

nit: "pragma"

207 ↗(On Diff #203356)

these would be clearer without repeating the text, e.g. "Expands to an empty range"

209 ↗(On Diff #203356)

also mention #include?

214 ↗(On Diff #203356)

maybe mention # as it's the other common case

216 ↗(On Diff #203356)

I think expansionStartingAt would be a clearer name. Given the current name, I would expect to be able to pass any of the tokens within the spelled range

LG but needs tests

ilya-biryukov marked 7 inline comments as done.
  • Address comments.
  • s/findExpansion/expansionStartingAt.
  • Add tests.
clang/include/clang/Tooling/Syntax/Tokens.h
209 ↗(On Diff #203356)

Added an example and a FIXME mentioning this does not work yet.

sammccall accepted this revision.Jun 18 2019, 9:15 AM
sammccall added inline comments.
clang/lib/Tooling/Syntax/Tokens.cpp
207 ↗(On Diff #205352)

This assert could use a message

This revision is now accepted and ready to land.Jun 18 2019, 9:15 AM
ilya-biryukov marked an inline comment as done.
  • Added a message to the assertion
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2019, 9:28 AM