astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2019-10-14 19:41:51 +02:00
parent 8c5c070d6a
commit 62d972061b
3 changed files with 28 additions and 29 deletions

View File

@ -1544,11 +1544,11 @@ void Tokenizer::simplifyTypedef()
tok2 = tok2->tokAt(2);
// skip over function parameters
if (tok2->str() == "(" )
tok2 = tok2->link();
if (tok2->str() == "(")
tok2 = tok2->link();
if (tok2->strAt(1) == "(")
tok2 = tok2->linkAt(1);
tok2 = tok2->linkAt(1);
// skip over const/noexcept
while (Token::Match(tok2->next(), "const|noexcept"))

View File

@ -1231,8 +1231,7 @@ private:
ASSERT_EQUALS("", errout.str());
}
void returnReference14()
{
void returnReference14() {
check("struct C { void* m; };\n"
"struct A { void* &f(); };\n"
"C* g() {\n"

View File

@ -2545,44 +2545,44 @@ private:
ASSERT_EQUALS(exp, tok(code, false));
}
void simplifyTypedef129() {
void simplifyTypedef129() {
{
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo &f ;\n"
"};";
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo &f ;\n"
"};";
const char exp [] = "class c { char ( & f ) [ 4 ] ; } ;";
ASSERT_EQUALS(exp, tok(code, false));
}
{
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" const foo &f;\n"
"};";
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" const foo &f;\n"
"};";
const char exp [] = "class c { const char ( & f ) [ 4 ] ; } ;";
ASSERT_EQUALS(exp, tok(code, false));
}
{
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo _a;\n"
" constexpr const foo &c_str() const noexcept { return _a; }\n"
"};";
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo _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 ; } } ;";
ASSERT_EQUALS(exp, tok(code, false));
}
{
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo _a;\n"
" constexpr operator foo &() const noexcept { return _a; }\n"
"};";
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo _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 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"
" typedef char foo[4];\n"
" foo _a;\n"
" constexpr operator const foo &() const noexcept { return _a; }\n"
"};";
const char code[] = "class c {\n"
" typedef char foo[4];\n"
" foo _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 exp [] = "class c { char _a [ 4 ] ; const operator const char ( & ( ) const noexcept ) [ 4 ] { return _a ; } } ;";