Fixed #1341 (false positive 'uninitialized variable' when using Exception specifications)
This commit is contained in:
parent
a5dd99bc8c
commit
4ec94116f5
|
@ -5710,9 +5710,9 @@ void Tokenizer::removeExceptionSpecifications(Token *tok) const
|
|||
else if (tok->str() == "}")
|
||||
break;
|
||||
|
||||
else if (Token::Match(tok, ") throw ("))
|
||||
else if (Token::simpleMatch(tok, ") throw ("))
|
||||
{
|
||||
while (tok->next() && !Token::Match(tok->next(), "[;{]"))
|
||||
Token::eraseTokens(tok, tok->tokAt(2)->link());
|
||||
tok->deleteNext();
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,8 @@ private:
|
|||
TEST_CASE(createLinks);
|
||||
TEST_CASE(signed1);
|
||||
|
||||
TEST_CASE(removeExceptionSpecification);
|
||||
TEST_CASE(removeExceptionSpecification1);
|
||||
TEST_CASE(removeExceptionSpecification2);
|
||||
|
||||
TEST_CASE(gt); // use "<" comparisons instead of ">"
|
||||
|
||||
|
@ -2783,7 +2784,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void removeExceptionSpecification()
|
||||
void removeExceptionSpecification1()
|
||||
{
|
||||
const char code[] = "class A\n"
|
||||
"{\n"
|
||||
|
@ -2804,6 +2805,31 @@ private:
|
|||
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void removeExceptionSpecification2()
|
||||
{
|
||||
const char code[] = "class A\n"
|
||||
"{\n"
|
||||
"private:\n"
|
||||
" int value;\n"
|
||||
"public:\n"
|
||||
" A::A() throw ()\n"
|
||||
" : value(0)\n"
|
||||
" { }\n"
|
||||
"};\n";
|
||||
|
||||
const char expected[] = "class A\n"
|
||||
"{\n"
|
||||
"private:\n"
|
||||
"int value ;\n"
|
||||
"public:\n"
|
||||
"A :: A ( )\n"
|
||||
": value ( 0 )\n"
|
||||
"{ }\n"
|
||||
"} ;";
|
||||
|
||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
|
||||
void gt()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue