fix #2718 (Analysis failed. If the code is valid then please report this failure.)
This commit is contained in:
parent
257197bdd1
commit
75e5353b6d
|
@ -1040,8 +1040,6 @@ void Tokenizer::simplifyTypedef()
|
|||
Token *typeDef = tok;
|
||||
Token *argFuncRetStart = 0;
|
||||
Token *argFuncRetEnd = 0;
|
||||
Token *const1 = 0;
|
||||
Token *const2 = 0;
|
||||
Token *funcStart = 0;
|
||||
Token *funcEnd = 0;
|
||||
int offset = 1;
|
||||
|
@ -1681,17 +1679,6 @@ void Tokenizer::simplifyTypedef()
|
|||
tok2 = tok2->next();
|
||||
}
|
||||
|
||||
if (const1)
|
||||
{
|
||||
tok2->insertToken(const1->str());
|
||||
tok2 = tok2->next();
|
||||
if (const2)
|
||||
{
|
||||
tok2->insertToken(const2->str());
|
||||
tok2 = tok2->next();
|
||||
}
|
||||
}
|
||||
|
||||
if (!inCast)
|
||||
tok2 = processFunc(tok2, inOperator);
|
||||
|
||||
|
@ -1851,10 +1838,17 @@ void Tokenizer::simplifyTypedef()
|
|||
{
|
||||
tok2 = tok2->previous();
|
||||
tok2->insertToken("(");
|
||||
tok2 = tok2->tokAt(3);
|
||||
Token *tok3 = tok2->next();
|
||||
|
||||
// handle missing variable name
|
||||
if (tok2->strAt(3) == ")" || tok2->strAt(3) == ",")
|
||||
tok2 = tok2->tokAt(2);
|
||||
else
|
||||
tok2 = tok2->tokAt(3);
|
||||
|
||||
tok2->insertToken(")");
|
||||
tok2 = tok2->next();
|
||||
Token::createMutualLinks(tok2, tok2->tokAt(-3));
|
||||
Token::createMutualLinks(tok2, tok3);
|
||||
}
|
||||
|
||||
tok2 = copyTokens(tok2, arrayStart, arrayEnd);
|
||||
|
|
|
@ -253,6 +253,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef87); // ticket #2651
|
||||
TEST_CASE(simplifyTypedef88); // ticket #2675
|
||||
TEST_CASE(simplifyTypedef89); // ticket #2717
|
||||
TEST_CASE(simplifyTypedef90); // ticket #2718
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -5100,6 +5101,16 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedef90() // ticket #2718
|
||||
{
|
||||
const char code[] = "typedef int IA[2];\n"
|
||||
"void f(const IA&) {};\n";
|
||||
const char expected[] = "; void f ( const int ( & ) [ 2 ] ) { } ;";
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS(expected, sizeof_(code));
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue