parent
8c5c070d6a
commit
62d972061b
|
@ -1544,11 +1544,11 @@ void Tokenizer::simplifyTypedef()
|
||||||
tok2 = tok2->tokAt(2);
|
tok2 = tok2->tokAt(2);
|
||||||
|
|
||||||
// skip over function parameters
|
// skip over function parameters
|
||||||
if (tok2->str() == "(" )
|
if (tok2->str() == "(")
|
||||||
tok2 = tok2->link();
|
tok2 = tok2->link();
|
||||||
|
|
||||||
if (tok2->strAt(1) == "(")
|
if (tok2->strAt(1) == "(")
|
||||||
tok2 = tok2->linkAt(1);
|
tok2 = tok2->linkAt(1);
|
||||||
|
|
||||||
// skip over const/noexcept
|
// skip over const/noexcept
|
||||||
while (Token::Match(tok2->next(), "const|noexcept"))
|
while (Token::Match(tok2->next(), "const|noexcept"))
|
||||||
|
|
|
@ -1231,8 +1231,7 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void returnReference14()
|
void returnReference14() {
|
||||||
{
|
|
||||||
check("struct C { void* m; };\n"
|
check("struct C { void* m; };\n"
|
||||||
"struct A { void* &f(); };\n"
|
"struct A { void* &f(); };\n"
|
||||||
"C* g() {\n"
|
"C* g() {\n"
|
||||||
|
|
|
@ -2545,44 +2545,44 @@ private:
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyTypedef129() {
|
void simplifyTypedef129() {
|
||||||
{
|
{
|
||||||
const char code[] = "class c {\n"
|
const char code[] = "class c {\n"
|
||||||
" typedef char foo[4];\n"
|
" typedef char foo[4];\n"
|
||||||
" foo &f ;\n"
|
" foo &f ;\n"
|
||||||
"};";
|
"};";
|
||||||
|
|
||||||
const char exp [] = "class c { char ( & f ) [ 4 ] ; } ;";
|
const char exp [] = "class c { char ( & f ) [ 4 ] ; } ;";
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "class c {\n"
|
const char code[] = "class c {\n"
|
||||||
" typedef char foo[4];\n"
|
" typedef char foo[4];\n"
|
||||||
" const foo &f;\n"
|
" const foo &f;\n"
|
||||||
"};";
|
"};";
|
||||||
|
|
||||||
const char exp [] = "class c { const char ( & f ) [ 4 ] ; } ;";
|
const char exp [] = "class c { const char ( & f ) [ 4 ] ; } ;";
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "class c {\n"
|
const char code[] = "class c {\n"
|
||||||
" typedef char foo[4];\n"
|
" typedef char foo[4];\n"
|
||||||
" foo _a;\n"
|
" foo _a;\n"
|
||||||
" constexpr const foo &c_str() const noexcept { return _a; }\n"
|
" constexpr const foo &c_str() const noexcept { return _a; }\n"
|
||||||
"};";
|
"};";
|
||||||
|
|
||||||
const char exp [] = "class c { char _a [ 4 ] ; const const char ( & c_str ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
const char exp [] = "class c { char _a [ 4 ] ; const const char ( & c_str ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
||||||
ASSERT_EQUALS(exp, tok(code, false));
|
ASSERT_EQUALS(exp, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "class c {\n"
|
const char code[] = "class c {\n"
|
||||||
" typedef char foo[4];\n"
|
" typedef char foo[4];\n"
|
||||||
" foo _a;\n"
|
" foo _a;\n"
|
||||||
" constexpr operator foo &() const noexcept { return _a; }\n"
|
" constexpr operator foo &() const noexcept { return _a; }\n"
|
||||||
"};";
|
"};";
|
||||||
|
|
||||||
const char actual [] = "class c { char _a [ 4 ] ; const operatorchar ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
const char actual [] = "class c { char _a [ 4 ] ; const operatorchar ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
||||||
const char exp [] = "class c { char _a [ 4 ] ; const operator char ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
const char exp [] = "class c { char _a [ 4 ] ; const operator char ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
||||||
|
@ -2590,11 +2590,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const char code[] = "class c {\n"
|
const char code[] = "class c {\n"
|
||||||
" typedef char foo[4];\n"
|
" typedef char foo[4];\n"
|
||||||
" foo _a;\n"
|
" foo _a;\n"
|
||||||
" constexpr operator const foo &() const noexcept { return _a; }\n"
|
" constexpr operator const foo &() const noexcept { return _a; }\n"
|
||||||
"};";
|
"};";
|
||||||
|
|
||||||
const char actual [] = "class c { char _a [ 4 ] ; const operatorconstchar ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
const char actual [] = "class c { char _a [ 4 ] ; const operatorconstchar ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
||||||
const char exp [] = "class c { char _a [ 4 ] ; const operator const char ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
const char exp [] = "class c { char _a [ 4 ] ; const operator const char ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";
|
||||||
|
|
Loading…
Reference in New Issue