kadircet added inline comments.

================
Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:372
+  // useful while finding expanded tokens in a 'token range'.
+  llvm::DenseMap<SourceLocation, unsigned> ExpandedTokIndex;
   llvm::DenseMap<FileID, MarkedFile> Files;
----------------
this definitely makes sense, but most of the users of `TokenBuffers` are 
currently invoking `expandedTokens(Range)` only once, so i am not sure if this 
is a huge benefit on their-side, whereas they'll likely end up seeing some 
short-lived memory consumption (and an extra traversal of all the expanded 
tokens).

Any reasons for not moving this logic to the application? `expandedTokens()` 
endpoint will return all the tokens, no questions asked. Then the application 
can build whatever acceleration structure it wants. If you think there are 
in-tree use cases that can benefit from this caching, maybe even provide that 
as a separate helper?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99086

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

Reply via email to