[PATCH] D41688: [Lex] Fix crash on code completion in comment in included file.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 17:37:31 PST 2018

vsapsai added a comment.

A few approaches that I've considered but decided not to pursue:

- Change code completion in comment so we don't exit file early but more gracefully. Decided not to do it because I believe early exit is important for code completion performance. And `CurLexer`/`CurLexerKind` discrepancy would remain anyway, which is not good.
- Use `RemoveTopOfLexerStack` instead of `recomputeCurLexerKind`. It works but I'm not confident it doesn't have undesired consequences. And I don't like that after removing the top of lexer stack, pushing back tokens would happen on top of includer, not on top of includee. But it might be totally OK.
- Add assertion in `InCachingLexMode` that returned value is in sync with `CurLexerKind`. It works but I suspect there might be legitimate reasons for them to be out of sync for some time. Though it can be a mistake and assertion can help to catch it.


More information about the cfe-commits mailing list