diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-03-31 00:38:09 +0000 | 
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-03-31 00:38:09 +0000 | 
| commit | 0204197d53e0094ff0b3c1225514cfbbf31375cc (patch) | |
| tree | 07fc3693c27c535bcf15e5dff02fbb2faa454c41 /clang | |
| parent | 90ab3b7779b16e95181ab55aa887290abef7a7c3 (diff) | |
| download | bcm5719-llvm-0204197d53e0094ff0b3c1225514cfbbf31375cc.tar.gz bcm5719-llvm-0204197d53e0094ff0b3c1225514cfbbf31375cc.zip  | |
Add a few asserts to be on the safe side.
llvm-svn: 99973
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 44a14c33159..87e22fa9dce 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -189,6 +189,9 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {      if (LM.TemplateScope)        Actions.ActOnReenterTemplateScope(CurScope, LM.D); +    // Save the current token position. +    SourceLocation origLoc = Tok.getLocation(); +      assert(!LM.Toks.empty() && "Empty body!");      // Append the current token at the end of the new token stream so that it      // doesn't get lost. @@ -207,6 +210,11 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {      if (Tok.is(tok::kw_try)) {        ParseFunctionTryBlock(LM.D); +      assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc, +                                                           Tok.getLocation()) && +             "ParseFunctionTryBlock went over the cached tokens!"); +      assert(Tok.getLocation() == origLoc && +             "ParseFunctionTryBlock left tokens in the token stream!");        continue;      }      if (Tok.is(tok::colon)) @@ -216,6 +224,11 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {      // FIXME: What if ParseConstructorInitializer doesn't leave us with a '{'??      ParseFunctionStatementBody(LM.D); +    assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc, +                                                           Tok.getLocation()) && +           "We consumed more than the cached tokens!"); +    assert(Tok.getLocation() == origLoc && +           "Tokens were left in the token stream!");    }    for (unsigned I = 0, N = Class.NestedClasses.size(); I != N; ++I)  | 

