Parse: Don't parse after the eof has been consumed
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 18 Dec 2014 09:57:31 +0000 (09:57 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 18 Dec 2014 09:57:31 +0000 (09:57 +0000)
commit2d3663e559916c6992a2c0bc2927b2b0a27be7e2
tree6f05a6acb32e6448b34fb085c0b82482acd6958d
parent7cb17890114fa63ecdc440e1e2376726cc8fce19
Parse: Don't parse after the eof has been consumed

ParseCXXNonStaticMemberInitializer stashes away all the tokens for the
initializer and an additional EOF token to denote where the initializer
ends.  However, it is possible for ParseLexedMemberInitializer to get
its hands on the "real" EOF token; since the two tokens are
indistinguishable, we end up consuming the EOF and descend into madness.

Instead, make it possible to tell which EOF token we are looking at.

This fixes PR21872.

llvm-svn: 224505
clang/include/clang/Lex/Token.h
clang/lib/Parse/ParseCXXInlineMethods.cpp
clang/test/Parser/PR21872.cpp [new file with mode: 0644]