This is an archive of the discontinued LLVM Phabricator instance.

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

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

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

macro directives -> preprocessor directives?

207

nit: "pragma"

207

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

209

also mention #include?

214

maybe mention # as it's the other common case

216

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

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

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