parent
1d3955bd92
commit
7eb1da9ffc
|
@ -1360,7 +1360,7 @@ void Tokenizer::simplifyTypedef()
|
||||||
const bool sameStartEnd = (typeStart == typeEnd);
|
const bool sameStartEnd = (typeStart == typeEnd);
|
||||||
|
|
||||||
// check for derived class: class A : some_typedef {
|
// check for derived class: class A : some_typedef {
|
||||||
const bool isDerived = Token::Match(tok2->previous(), "public|protected|private %type% {|,");
|
const bool isDerived = Token::Match(tok2->previous(), "public|protected|private|: %type% {|,");
|
||||||
|
|
||||||
// check for cast: (some_typedef) A or static_cast<some_typedef>(A)
|
// check for cast: (some_typedef) A or static_cast<some_typedef>(A)
|
||||||
// todo: check for more complicated casts like: (const some_typedef *)A
|
// todo: check for more complicated casts like: (const some_typedef *)A
|
||||||
|
|
|
@ -189,6 +189,7 @@ private:
|
||||||
TEST_CASE(simplifyTypedef140); // #10798
|
TEST_CASE(simplifyTypedef140); // #10798
|
||||||
TEST_CASE(simplifyTypedef141); // #10144
|
TEST_CASE(simplifyTypedef141); // #10144
|
||||||
TEST_CASE(simplifyTypedef142); // T() when T is a pointer type
|
TEST_CASE(simplifyTypedef142); // T() when T is a pointer type
|
||||||
|
TEST_CASE(simplifyTypedef143); // #11506
|
||||||
TEST_CASE(simplifyTypedef144); // #9353
|
TEST_CASE(simplifyTypedef144); // #9353
|
||||||
|
|
||||||
TEST_CASE(simplifyTypedefFunction1);
|
TEST_CASE(simplifyTypedefFunction1);
|
||||||
|
@ -3071,6 +3072,16 @@ private:
|
||||||
ASSERT_EQUALS("void f ( int * = ( int * ) 0 ) { }", tok(code2));
|
ASSERT_EQUALS("void f ( int * = ( int * ) 0 ) { }", tok(code2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyTypedef143() { // #11506
|
||||||
|
const char code[] = "typedef struct { int i; } B;\n"
|
||||||
|
"void f() {\n"
|
||||||
|
" struct D : B {\n"
|
||||||
|
" char c;\n"
|
||||||
|
" };\n"
|
||||||
|
"}\n";
|
||||||
|
ASSERT_EQUALS("struct B { int i ; } ; void f ( ) { struct D : B { char c ; } ; }", tok(code));
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyTypedef144() { // #9353
|
void simplifyTypedef144() { // #9353
|
||||||
const char code[] = "typedef struct {} X;\n"
|
const char code[] = "typedef struct {} X;\n"
|
||||||
"std::vector<X> v;\n";
|
"std::vector<X> v;\n";
|
||||||
|
|
Loading…
Reference in New Issue