[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:26:05 PDT 2017
ilya-biryukov added a comment.
I've also stumbled upon this crash. Here is an even simpler repro that crashes for me (does not involve includes):
#ifndef HEADER_GUARD
#define FOO(X) int fhjdfhsdjkfhjkshfjk;
FOO(base)
struct X {
int a;
};
int test() {
X v;
v.
}
#endif
================
Comment at: lib/Parse/Parser.cpp:519
ConsumeToken();
-
- PP.replayPreambleConditionalStack();
+ if (!PP.isCurrentLexer(nullptr))
+ PP.replayPreambleConditionalStack();
----------------
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`?
https://reviews.llvm.org/D36458
More information about the cfe-commits
mailing list