]> granicus.if.org Git - clang/commitdiff
Cure for Doug's insomnia.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 19 Jun 2010 19:58:34 +0000 (19:58 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 19 Jun 2010 19:58:34 +0000 (19:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106394 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp

index e765a06087d1ad2cdf2ffeece8ec2eab88bd7700..bc95049ec5bf981836506cf0ea89849f95aa9430 100644 (file)
@@ -151,7 +151,7 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
                "ParseAssignmentExpression went over the default arg tokens!");
         // There could be leftover tokens (e.g. because of an error).
         // Skip through until we reach the original token position.
-        while (Tok.getLocation() != origLoc)
+        while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
           ConsumeAnyToken();
 
         delete Toks;
@@ -218,7 +218,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
              "ParseFunctionTryBlock went over the cached tokens!");
       // There could be leftover tokens (e.g. because of an error).
       // Skip through until we reach the original token position.
-      while (Tok.getLocation() != origLoc)
+      while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
         ConsumeAnyToken();
       continue;
     }
@@ -243,7 +243,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
       // expensive isBeforeInTranslationUnit call.
       if (PP.getSourceManager().isBeforeInTranslationUnit(Tok.getLocation(),
                                                           origLoc))
-        while (Tok.getLocation() != origLoc)
+        while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
           ConsumeAnyToken();
 
     }