aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseCXXInlineMethods.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-03-31 00:38:09 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-03-31 00:38:09 +0000
commitc50a5e09c6c49577ecee7fb49ece97dc38ee1219 (patch)
tree9ae55637e381d05a6d21357cc9e68555f2dc9909 /lib/Parse/ParseCXXInlineMethods.cpp
parentb57c757a80532a610d949c2eeb9d9e05c76f543f (diff)
Add a few asserts to be on the safe side.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index 44a14c3315..87e22fa9dc 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/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)