ilya-biryukov wrote: I second everything that @HighCommander4 said. It would be really useful to add an assertion that we never get out-of-bounds here, but this indicates a logic error somewhere in the code that should be fixed.
I am slightly suspicious of source locations pointing at `eof` in the AST in the first place, even in invalid code. I wonder if we would be better off just having an invalid source location there instead of pointing at `eof`. Asserting that `tok::eof` should not be passed to `spelledForExpandedToken` and returning `nullopt` in `spelledForExpanded` looks like a reasonable workaround until we fix this. (The semantics looks reasonable as we don't really have a spelled token we can map `eof` back to). https://github.com/llvm/llvm-project/pull/69849 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits