[PATCH] D36458: Fix crash when current lexer is nullptr

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 02:36:43 PDT 2017

ilya-biryukov added inline comments.

Comment at: lib/Parse/Parser.cpp:519
-  PP.replayPreambleConditionalStack();
+  if (!PP.isCurrentLexer(nullptr))
+    PP.replayPreambleConditionalStack();
ilya-biryukov wrote:
> This certainly fixes the crash, but aren't we breaking other things if we don't run `replayConditionalStack`?
> I.e. won't we get spurious errors on `#endif`?
I get a spurious `#endif without #if` error with your fix. We need to figure out the right place to run `replayPreambleConditionalStack`.

@erikjv, any ideas?


More information about the cfe-commits mailing list