diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-10-15 15:34:43 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-10-17 16:21:13 -0400 |
commit | fd59b10e7149026658d8dcdedfef0b3810fea226 (patch) | |
tree | b6948757d824a3da8a90d849d5dc88813722ee92 | |
parent | 6dd2b365596c08b4799e0ebec92333519aac283a (diff) | |
download | cmake-fd59b10e7149026658d8dcdedfef0b3810fea226.tar.gz |
GenEx: Add some more asserts to verify code-sanity.
-rw-r--r-- | Source/cmGeneratorExpressionParser.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 64d992a315..7a8fc510d6 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -106,6 +106,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( startToken->Content, this->it->Content - startToken->Content + this->it->Length); + assert(this->it != this->Tokens.end()); ++this->it; --this->NestingLevel; content->SetIdentifier(identifier); @@ -122,6 +123,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( { colonToken = this->it; parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); ++this->it; while (this->it != this->Tokens.end() && @@ -129,12 +131,14 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( { commaTokens.push_back(this->it); parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); ++this->it; } while (this->it != this->Tokens.end() && this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) { extendText(*(parameters.end() - 1), this->it); + assert(this->it != this->Tokens.end()); ++this->it; } while (this->it != this->Tokens.end() && @@ -150,12 +154,14 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( { commaTokens.push_back(this->it); parameters.resize(parameters.size() + 1); + assert(this->it != this->Tokens.end()); ++this->it; } while (this->it != this->Tokens.end() && this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) { extendText(*(parameters.end() - 1), this->it); + assert(this->it != this->Tokens.end()); ++this->it; } } @@ -163,6 +169,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( && this->it->TokenType == cmGeneratorExpressionToken::EndExpression) { --this->NestingLevel; + assert(this->it != this->Tokens.end()); ++this->it; } } @@ -185,6 +192,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( parameters.end(); std::vector<TokenVector::const_iterator>::const_iterator commaIt = commaTokens.begin(); + assert(parameters.size() > commaTokens.size()); for ( ; pit != pend; ++pit, ++commaIt) { extendResult(result, *pit); @@ -232,6 +240,7 @@ void cmGeneratorExpressionParser::ParseContent( TextContent *textContent = static_cast<TextContent*>(*(result.end() - 1)); textContent->Extend(this->it->Length); + assert(this->it != this->Tokens.end()); ++this->it; return; } @@ -239,10 +248,12 @@ void cmGeneratorExpressionParser::ParseContent( cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content, this->it->Length); result.push_back(n); + assert(this->it != this->Tokens.end()); ++this->it; return ; } case cmGeneratorExpressionToken::BeginExpression: + assert(this->it != this->Tokens.end()); ++this->it; this->ParseGeneratorExpression(result); return; @@ -257,6 +268,7 @@ void cmGeneratorExpressionParser::ParseContent( { assert(!"Got unexpected syntax token."); } + assert(this->it != this->Tokens.end()); ++this->it; return; } |