sammccall added a comment.

Yeah SelectionTree is the right place to solve this but it's a harder problem 
there.

In general we *don't* only want to trigger on the single token returned by 
getLocation().
The strategy SelectionTree uses is to attribute tokens to an outer node unless 
they're associated with an inner node or ignored.

Your test cases show two problems with this strategy:

- we ignore comments and semicolons, but not preprocessor directives (or 
disabled preprocessor regions). I think we can fix this by asking TokenBuffer 
if a spelled token is part of a region that maps to no (PP-)expanded tokens.
- in the case of syntax errors, tokens are emitted by the preprocessor but then 
no AST node is built from them, and we associate them with the parent by 
default. Maybe we don't need to fix this case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83508



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to