* Fix #11725 Hang in simplifyTypedef() with extra parentheses * Amend test
This commit is contained in:
parent
00733893e0
commit
33f728df14
|
@ -695,7 +695,7 @@ namespace {
|
|||
mRangeAfterVar.second = mEndToken;
|
||||
return;
|
||||
}
|
||||
if (Token::Match(type, "%name% (") && Token::simpleMatch(type->linkAt(1), ") ;") && !type->isStandardType()) {
|
||||
if (Token::Match(type, "%name% ( !!(") && Token::simpleMatch(type->linkAt(1), ") ;") && !type->isStandardType()) {
|
||||
mNameToken = type;
|
||||
mEndToken = type->linkAt(1)->next();
|
||||
mRangeType.first = start;
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
TEST_CASE(cfp4);
|
||||
TEST_CASE(cfp5);
|
||||
TEST_CASE(cfp6);
|
||||
TEST_CASE(cfp7);
|
||||
TEST_CASE(carray1);
|
||||
TEST_CASE(carray2);
|
||||
TEST_CASE(cdonotreplace1);
|
||||
|
@ -438,6 +439,13 @@ private:
|
|||
ASSERT_EQUALS("void ( * a [ 10 ] ) ( void ) ;", simplifyTypedef(code));
|
||||
}
|
||||
|
||||
void cfp7() {
|
||||
const char code[] = "typedef uint32_t ((*fp)(uint32_t n));\n" // #11725
|
||||
"uint32_t g();\n"
|
||||
"fp f;\n";
|
||||
ASSERT_EQUALS("uint32_t g ( ) ; uint32_t ( * f ) ( uint32_t n ) ;", simplifyTypedef(code));
|
||||
}
|
||||
|
||||
void carray1() {
|
||||
const char code[] = "typedef int t[20];\n"
|
||||
"t x;";
|
||||
|
|
Loading…
Reference in New Issue