This commit is contained in:
parent
aca6c47024
commit
1ffff8dc06
|
@ -665,14 +665,14 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Token* type = start; Token::Match(type, "%name%|*|&"); type = type->next()) {
|
for (Token* type = start; Token::Match(type, "%name%|*|&"); type = type->next()) {
|
||||||
if (Token::Match(type, "%name% ;") && !type->isStandardType()) {
|
if (type != start && Token::Match(type, "%name% ;") && !type->isStandardType()) {
|
||||||
mRangeType.first = start;
|
mRangeType.first = start;
|
||||||
mRangeType.second = type;
|
mRangeType.second = type;
|
||||||
mNameToken = type;
|
mNameToken = type;
|
||||||
mEndToken = mNameToken->next();
|
mEndToken = mNameToken->next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Token::Match(type, "%name% [")) {
|
if (type != start && Token::Match(type, "%name% [")) {
|
||||||
Token* end = type->linkAt(1);
|
Token* end = type->linkAt(1);
|
||||||
while (Token::simpleMatch(end, "] ["))
|
while (Token::simpleMatch(end, "] ["))
|
||||||
end = end->linkAt(1);
|
end = end->linkAt(1);
|
||||||
|
|
|
@ -3352,6 +3352,19 @@ private:
|
||||||
" a** p = new a * [N];\n"
|
" a** p = new a * [N];\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
TODO_ASSERT_EQUALS("does not compile", "void f ( int N ) { int ( * * p ) [ 7 ] ; p = new int ( * ) [ N ] [ 7 ] ; }", tok(code));
|
TODO_ASSERT_EQUALS("does not compile", "void f ( int N ) { int ( * * p ) [ 7 ] ; p = new int ( * ) [ N ] [ 7 ] ; }", tok(code));
|
||||||
|
|
||||||
|
// #11772
|
||||||
|
code = "typedef t;\n" // don't crash on implicit int
|
||||||
|
"void g() {\n"
|
||||||
|
" sizeof(t);\n"
|
||||||
|
"}\n";
|
||||||
|
ASSERT_EQUALS("void g ( ) { sizeof ( t ) ; }", tok(code)); // TODO: handle implicit int
|
||||||
|
|
||||||
|
code = "typedef t[3];\n"
|
||||||
|
"void g() {\n"
|
||||||
|
" sizeof(t);\n"
|
||||||
|
"}\n";
|
||||||
|
ASSERT_EQUALS("void g ( ) { sizeof ( t ) ; }", tok(code)); // TODO: handle implicit int
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyTypedefFunction1() {
|
void simplifyTypedefFunction1() {
|
||||||
|
|
Loading…
Reference in New Issue