astyle formatting

This commit is contained in:
Daniel Marjamäki 2021-05-01 07:35:03 +02:00
parent d3035c246f
commit 07c1f28035
6 changed files with 74 additions and 72 deletions

View File

@ -78,11 +78,10 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
static const Token* skipScopeIdentifiers(const Token* tok)
{
if (tok && tok->str() == "::") {
if (Token::Match(tok, ":: %name%"))
tok = tok->next();
}
while (Token::Match(tok, "%name% ::") ||
(Token::Match(tok, "%name% <") && Token::simpleMatch(tok->linkAt(1), "> ::"))) {
(Token::Match(tok, "%name% <") && Token::Match(tok->linkAt(1), ">|>> ::"))) {
if (tok->strAt(1) == "::")
tok = tok->tokAt(2);
else
@ -2633,10 +2632,7 @@ static bool isUnknownType(const Token* start, const Token* end)
{
while (Token::Match(start, "const|volatile"))
start = start->next();
if (Token::Match(start, ":: %name%"))
start = start->next();
while (Token::Match(start, "%name% :: %name%"))
start = start->tokAt(2);
start = skipScopeIdentifiers(start);
if (start->tokAt(1) == end && !start->type() && !start->isStandardType())
return true;
// TODO: Try to deduce the type of the expression

View File

@ -10822,19 +10822,23 @@ void Tokenizer::simplifyAttributeList()
if (attrlist->str() == ",") {
attrlist->insertToken(")"); newInnerRightBr = attrlist->next();
attrlist->insertToken(")");
newInnerRightBr = attrlist->next();
Token::createMutualLinks(innerLeftBr, newInnerRightBr);
newInnerRightBr->insertToken(")"); newOuterRightBr = newInnerRightBr->next();
newInnerRightBr->insertToken(")");
newOuterRightBr = newInnerRightBr->next();
Token::createMutualLinks(outerLeftBr, newOuterRightBr);
newOuterRightBr->insertToken(tok->str());
newtok = newOuterRightBr->next();
newtok->insertToken("("); newOuterLeftBr = newtok->next();
newtok->insertToken("(");
newOuterLeftBr = newtok->next();
Token::createMutualLinks(newOuterLeftBr, outerRightBr);
newOuterLeftBr->insertToken("("); newInnerLeftBr = newOuterLeftBr->next();
newOuterLeftBr->insertToken("(");
newInnerLeftBr = newOuterLeftBr->next();
Token::createMutualLinks(newInnerLeftBr, innerRightBr);
tok = newtok;

View File

@ -2799,7 +2799,9 @@ static std::vector<LifetimeToken> getLifetimeTokens(const Token* tok,
std::vector<LifetimeToken> getLifetimeTokens(const Token* tok, bool escape, ValueFlow::Value::ErrorPath errorPath)
{
return getLifetimeTokens(tok, escape, std::move(errorPath), [](const Token*) { return false; });
return getLifetimeTokens(tok, escape, std::move(errorPath), [](const Token*) {
return false;
});
}
bool hasLifetimeToken(const Token* tok, const Token* lifetime)