diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-12-18 09:57:31 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-18 09:57:31 +0000 |
commit | 2d3663e559916c6992a2c0bc2927b2b0a27be7e2 (patch) | |
tree | 6f05a6acb32e6448b34fb085c0b82482acd6958d /clang/lib/Parse/ParseCXXInlineMethods.cpp | |
parent | 7cb17890114fa63ecdc440e1e2376726cc8fce19 (diff) | |
download | bcm5719-llvm-2d3663e559916c6992a2c0bc2927b2b0a27be7e2.tar.gz bcm5719-llvm-2d3663e559916c6992a2c0bc2927b2b0a27be7e2.zip |
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
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index e1a5b8e9945..96d35bc249c 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -218,6 +218,7 @@ void Parser::ParseCXXNonStaticMemberInitializer(Decl *VarD) { Eof.startToken(); Eof.setKind(tok::eof); Eof.setLocation(Tok.getLocation()); + Eof.setDecl(VarD); Toks.push_back(Eof); } @@ -622,7 +623,9 @@ void Parser::ParseLexedMemberInitializer(LateParsedMemberInitializer &MI) { while (Tok.isNot(tok::eof)) ConsumeAnyToken(); } - ConsumeAnyToken(); + // Make sure this is *our* artificial EOF token. + if (Tok.getDecl() == MI.Field) + ConsumeAnyToken(); } /// ConsumeAndStoreUntil - Consume and store the token at the passed token |