[clang] [clang] Bounds checking on unclosed parentheses, brackets or braces in Expanded Tokens (PR #69849)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 14 00:51:11 PST 2024


HighCommander4 wrote:

> What do you think about this as an alternative: if `spelledForExpanded` receives as input an expanded token range `[firstExpanded, lastExpanded]` where `lastExpanded` is the `eof` token, return the spelled tokens corresponding to `[firstExpanded, lastExpanded - 1]` instead? (In the case where the `eof` token is the only one in the range, we could return nullopt.)
> 
> This would have the advantage of gracefully handling AST nodes like this one whose end location is the `eof`, and return all the spelled tokens actually making up the node.

I wrote this up at https://github.com/llvm/llvm-project/pull/78092

https://github.com/llvm/llvm-project/pull/69849


More information about the cfe-commits mailing list