astyle formatting

This commit is contained in:
Daniel Marjamäki 2021-03-20 18:54:00 +01:00
parent b2691bda88
commit 51564504a8
2 changed files with 12 additions and 12 deletions

View File

@ -9928,9 +9928,9 @@ static bool isAlignAttribute(const Token * tok)
static const Token* skipCPPOrAlignAttribute(const Token * tok)
{
if(isCPPAttribute(tok)) {
if (isCPPAttribute(tok)) {
return tok->link();
}else if(isAlignAttribute(tok)) {
} else if (isAlignAttribute(tok)) {
return tok->next()->link();
}
return tok;
@ -10199,7 +10199,7 @@ void Tokenizer::findGarbageCode() const
continue;
}
// skip C++ attributes [[...]]
if (isCPP11 && (isCPPAttribute(tok) || isAlignAttribute(tok)) ) {
if (isCPP11 && (isCPPAttribute(tok) || isAlignAttribute(tok))) {
tok = skipCPPOrAlignAttribute(tok);
continue;
}
@ -10842,10 +10842,10 @@ void Tokenizer::simplifyCPPAttribute()
return;
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (!isCPPAttribute(tok) && !isAlignAttribute(tok)){
if (!isCPPAttribute(tok) && !isAlignAttribute(tok)) {
continue;
}
if(isCPPAttribute(tok)){
if (isCPPAttribute(tok)) {
if (Token::findsimplematch(tok->tokAt(2), "noreturn", tok->link())) {
const Token * head = skipCPPOrAlignAttribute(tok);
while (isCPPAttribute(head) || isAlignAttribute(head))
@ -10854,7 +10854,7 @@ void Tokenizer::simplifyCPPAttribute()
while (Token::Match(head, "%name%|::|*|&|<|>|,")) // skip return type
head = head->next();
if (head && head->str() == "(" && isFunctionHead(head, "{|;")) {
head->previous()->isAttributeNoreturn(true);
head->previous()->isAttributeNoreturn(true);
}
} else if (Token::findsimplematch(tok->tokAt(2), "nodiscard", tok->link())) {
const Token * head = skipCPPOrAlignAttribute(tok);
@ -10864,7 +10864,7 @@ void Tokenizer::simplifyCPPAttribute()
while (Token::Match(head, "%name%|::|*|&|<|>|,"))
head = head->next();
if (head && head->str() == "(" && isFunctionHead(head, "{|;")) {
head->previous()->isAttributeNodiscard(true);
head->previous()->isAttributeNodiscard(true);
}
} else if (Token::findsimplematch(tok->tokAt(2), "maybe_unused", tok->link())) {
const Token* head = skipCPPOrAlignAttribute(tok);
@ -10901,10 +10901,10 @@ void Tokenizer::simplifyCPPAttribute()
}
Token::eraseTokens(tok, skipCPPOrAlignAttribute(tok)->next());
// fix iterator after removing
if(tok->previous()){
if (tok->previous()) {
tok = tok->previous();
tok->next()->deleteThis();
}else{
} else {
tok->deleteThis();
tok = list.front();
}

View File

@ -4693,8 +4693,8 @@ private:
void symboldatabase93() { // alignas attribute
GET_SYMBOL_DB("struct alignas(int) A{\n"
"};\n"
);
"};\n"
);
ASSERT(db != nullptr);
const Scope* scope = db->findScopeByName("A");
ASSERT(scope);
@ -6669,7 +6669,7 @@ private:
"template <class T> [[nodiscard]] int func4() { }"
"std::pair<bool, char> [[nodiscard]] func5();\n"
"[[nodiscard]] std::pair<bool, char> func6();\n"
);
);
ASSERT_EQUALS("", errout.str());
ASSERT_EQUALS(true, db != nullptr); // not null