Co-authored-by: chrchr-github <chrchr@github>
This commit is contained in:
parent
9dd729e9be
commit
e2082267e2
|
@ -1947,7 +1947,7 @@ void Tokenizer::simplifyTypedefCpp()
|
|||
tok2->str(typeStart->str());
|
||||
|
||||
// restore qualification if it was removed
|
||||
if (typeStart->str() == "struct" || structRemoved) {
|
||||
if (Token::Match(typeStart, "class|struct|union") || structRemoved) {
|
||||
if (structRemoved)
|
||||
tok2 = tok2->previous();
|
||||
|
||||
|
|
|
@ -3454,6 +3454,33 @@ private:
|
|||
" g(sizeof(struct N::S));\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS("namespace N { struct S { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( struct N :: S ) ) ; }", tok(code));
|
||||
|
||||
code = "namespace N {\n"
|
||||
" typedef class C {} C;\n"
|
||||
"}\n"
|
||||
"void g(int);\n"
|
||||
"void f() {\n"
|
||||
" g(sizeof(class N::C));\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS("namespace N { class C { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( class N :: C ) ) ; }", tok(code));
|
||||
|
||||
code = "namespace N {\n"
|
||||
" typedef union U {} U;\n"
|
||||
"}\n"
|
||||
"void g(int);\n"
|
||||
"void f() {\n"
|
||||
" g(sizeof(union N::U));\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS("namespace N { union U { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( union N :: U ) ) ; }", tok(code));
|
||||
|
||||
code = "namespace N {\n"
|
||||
" typedef enum E {} E;\n"
|
||||
"}\n"
|
||||
"void g(int);\n"
|
||||
"void f() {\n"
|
||||
" g(sizeof(enum N::E));\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS("namespace N { enum E { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( enum N :: E ) ) ; }", tok(code));
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1() {
|
||||
|
|
Loading…
Reference in New Issue