astyle formatting
This commit is contained in:
parent
b2691bda88
commit
51564504a8
|
@ -9928,9 +9928,9 @@ static bool isAlignAttribute(const Token * tok)
|
||||||
|
|
||||||
static const Token* skipCPPOrAlignAttribute(const Token * tok)
|
static const Token* skipCPPOrAlignAttribute(const Token * tok)
|
||||||
{
|
{
|
||||||
if(isCPPAttribute(tok)) {
|
if (isCPPAttribute(tok)) {
|
||||||
return tok->link();
|
return tok->link();
|
||||||
}else if(isAlignAttribute(tok)) {
|
} else if (isAlignAttribute(tok)) {
|
||||||
return tok->next()->link();
|
return tok->next()->link();
|
||||||
}
|
}
|
||||||
return tok;
|
return tok;
|
||||||
|
@ -10199,7 +10199,7 @@ void Tokenizer::findGarbageCode() const
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// skip C++ attributes [[...]]
|
// skip C++ attributes [[...]]
|
||||||
if (isCPP11 && (isCPPAttribute(tok) || isAlignAttribute(tok)) ) {
|
if (isCPP11 && (isCPPAttribute(tok) || isAlignAttribute(tok))) {
|
||||||
tok = skipCPPOrAlignAttribute(tok);
|
tok = skipCPPOrAlignAttribute(tok);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -10842,10 +10842,10 @@ void Tokenizer::simplifyCPPAttribute()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (!isCPPAttribute(tok) && !isAlignAttribute(tok)){
|
if (!isCPPAttribute(tok) && !isAlignAttribute(tok)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(isCPPAttribute(tok)){
|
if (isCPPAttribute(tok)) {
|
||||||
if (Token::findsimplematch(tok->tokAt(2), "noreturn", tok->link())) {
|
if (Token::findsimplematch(tok->tokAt(2), "noreturn", tok->link())) {
|
||||||
const Token * head = skipCPPOrAlignAttribute(tok);
|
const Token * head = skipCPPOrAlignAttribute(tok);
|
||||||
while (isCPPAttribute(head) || isAlignAttribute(head))
|
while (isCPPAttribute(head) || isAlignAttribute(head))
|
||||||
|
@ -10854,7 +10854,7 @@ void Tokenizer::simplifyCPPAttribute()
|
||||||
while (Token::Match(head, "%name%|::|*|&|<|>|,")) // skip return type
|
while (Token::Match(head, "%name%|::|*|&|<|>|,")) // skip return type
|
||||||
head = head->next();
|
head = head->next();
|
||||||
if (head && head->str() == "(" && isFunctionHead(head, "{|;")) {
|
if (head && head->str() == "(" && isFunctionHead(head, "{|;")) {
|
||||||
head->previous()->isAttributeNoreturn(true);
|
head->previous()->isAttributeNoreturn(true);
|
||||||
}
|
}
|
||||||
} else if (Token::findsimplematch(tok->tokAt(2), "nodiscard", tok->link())) {
|
} else if (Token::findsimplematch(tok->tokAt(2), "nodiscard", tok->link())) {
|
||||||
const Token * head = skipCPPOrAlignAttribute(tok);
|
const Token * head = skipCPPOrAlignAttribute(tok);
|
||||||
|
@ -10864,7 +10864,7 @@ void Tokenizer::simplifyCPPAttribute()
|
||||||
while (Token::Match(head, "%name%|::|*|&|<|>|,"))
|
while (Token::Match(head, "%name%|::|*|&|<|>|,"))
|
||||||
head = head->next();
|
head = head->next();
|
||||||
if (head && head->str() == "(" && isFunctionHead(head, "{|;")) {
|
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())) {
|
} else if (Token::findsimplematch(tok->tokAt(2), "maybe_unused", tok->link())) {
|
||||||
const Token* head = skipCPPOrAlignAttribute(tok);
|
const Token* head = skipCPPOrAlignAttribute(tok);
|
||||||
|
@ -10901,10 +10901,10 @@ void Tokenizer::simplifyCPPAttribute()
|
||||||
}
|
}
|
||||||
Token::eraseTokens(tok, skipCPPOrAlignAttribute(tok)->next());
|
Token::eraseTokens(tok, skipCPPOrAlignAttribute(tok)->next());
|
||||||
// fix iterator after removing
|
// fix iterator after removing
|
||||||
if(tok->previous()){
|
if (tok->previous()) {
|
||||||
tok = tok->previous();
|
tok = tok->previous();
|
||||||
tok->next()->deleteThis();
|
tok->next()->deleteThis();
|
||||||
}else{
|
} else {
|
||||||
tok->deleteThis();
|
tok->deleteThis();
|
||||||
tok = list.front();
|
tok = list.front();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4693,8 +4693,8 @@ private:
|
||||||
|
|
||||||
void symboldatabase93() { // alignas attribute
|
void symboldatabase93() { // alignas attribute
|
||||||
GET_SYMBOL_DB("struct alignas(int) A{\n"
|
GET_SYMBOL_DB("struct alignas(int) A{\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
);
|
);
|
||||||
ASSERT(db != nullptr);
|
ASSERT(db != nullptr);
|
||||||
const Scope* scope = db->findScopeByName("A");
|
const Scope* scope = db->findScopeByName("A");
|
||||||
ASSERT(scope);
|
ASSERT(scope);
|
||||||
|
@ -6669,7 +6669,7 @@ private:
|
||||||
"template <class T> [[nodiscard]] int func4() { }"
|
"template <class T> [[nodiscard]] int func4() { }"
|
||||||
"std::pair<bool, char> [[nodiscard]] func5();\n"
|
"std::pair<bool, char> [[nodiscard]] func5();\n"
|
||||||
"[[nodiscard]] std::pair<bool, char> func6();\n"
|
"[[nodiscard]] std::pair<bool, char> func6();\n"
|
||||||
);
|
);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
ASSERT_EQUALS(true, db != nullptr); // not null
|
ASSERT_EQUALS(true, db != nullptr); // not null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue