Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code.

This commit is contained in:
Martin Ettl 2014-01-01 19:15:32 +01:00
parent 0dccd3a632
commit 5a5277f2fa
2 changed files with 4 additions and 3 deletions

View File

@ -5465,7 +5465,7 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
} }
break; break;
} }
if (tok2)
tok2 = tok2->next(); tok2 = tok2->next();
} }
} }

View File

@ -997,6 +997,7 @@ private:
void garbageCode7() { void garbageCode7() {
tokenizeAndStringify("1 (int j) { return return (c) * sizeof } y[1];", /*simplify=*/true); tokenizeAndStringify("1 (int j) { return return (c) * sizeof } y[1];", /*simplify=*/true);
tokenizeAndStringify("foo(Args&&...) fn void = { } auto template<typename... bar(Args&&...)", /*simplify=*/true);
} }
void simplifyFileAndLineMacro() { // tokenize 'return - __LINE__' correctly void simplifyFileAndLineMacro() { // tokenize 'return - __LINE__' correctly