[PATCH] D77507: [clangd] Fix HitMapping assertion in Tokens.cpp

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 08:06:21 PDT 2020


sammccall added a comment.

Oh dear, this seems like a design bug.

TokenBuffer only attempts to record "top-level" expansions, i.e. `FOO(BAR(BAZ))` will record the expansion of FOO, and say the tokens `FOO ( BAR ( BAZ ) )` were expanded into `some other thing` in an essentially-opaque way.
The problem is this conflates two notions of "top-level"

- macro use is in main file (this is what the PPCallbacks checks)
- tokens emitted by the expansion are in the final expanded token stream (this is what makes the code correct, and I think what we're asserting)

The second seems more fundamental, so we should try patching the code to avoid the former. But I worry there are subtle assumptions of this scattered through...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77507





More information about the cfe-commits mailing list