[PATCH] D84009: [Syntax] expose API for expansions overlapping a spelled token range.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 04:01:44 PDT 2020


sammccall added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:431
+std::vector<TokenBuffer::Expansion>
+TokenBuffer::expansionsAffecting(llvm::ArrayRef<syntax::Token> Spelled) const {
+  if (Spelled.empty())
----------------
ArcsinX wrote:
> Will it be useful to have similar API with FileID/MarkedFile parameter?
> For example, we already have FileID in `SelectionTester::SelectionTester`.
FileID is a bit awkward: then you have to have some way to specify which expansions you're interested in (or get those for the whole file and filter them yourself).

We could add an overload for this, but I think Buf.expansionsAffecting(Buf.spelledTokens(FID)) is pretty acceptable for this case.

(MarkedFile can't be used in an API because it's private)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84009/new/

https://reviews.llvm.org/D84009





More information about the cfe-commits mailing list