astyle formatting

This commit is contained in:
Daniel Marjamäki 2020-08-23 17:17:33 +02:00
parent ac846b96d1
commit 2bb73840fc
8 changed files with 17 additions and 15 deletions

View File

@ -2024,7 +2024,7 @@ void CheckStl::checkDereferenceInvalidIterator2()
}
// Can iterator point to END or before START?
for(const ValueFlow::Value& value:tok->values()) {
for (const ValueFlow::Value& value:tok->values()) {
if (!printInconclusive && value.isInconclusive())
continue;
if (!value.isIteratorValue())
@ -2488,7 +2488,7 @@ void CheckStl::knownEmptyContainerLoop()
const Token* contTok = splitTok->astOperand2();
if (!contTok)
continue;
for(const ValueFlow::Value& v:contTok->values()) {
for (const ValueFlow::Value& v:contTok->values()) {
if (!v.isKnown())
continue;
if (!v.isContainerSizeValue())

View File

@ -542,8 +542,7 @@ void execute(const Token *expr,
*result = 0;
else
*error = true;
}
else if (Token::Match(expr->tokAt(-3), "%var% . %name% (")) {
} else if (Token::Match(expr->tokAt(-3), "%var% . %name% (")) {
const Token* containerTok = expr->tokAt(-3);
if (astIsContainer(containerTok)) {
Library::Container::Yield yield = containerTok->valueType()->container->getYield(expr->strAt(-1));

View File

@ -1452,10 +1452,10 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
}
// Apply CSE
for(const auto& p:exprs) {
for (const auto& p:exprs) {
const std::vector<Token*>& tokens = p.second;
for(Token* tok1:tokens) {
for(Token* tok2:tokens) {
for (Token* tok1:tokens) {
for (Token* tok2:tokens) {
if (tok1 == tok2)
continue;
if (tok1->exprId() == tok2->exprId())

View File

@ -484,8 +484,7 @@ static Token * skipDecl(Token *tok)
return tok;
} else if (Token::Match(vartok, "%var% [:=(]")) {
return vartok;
}
else if (Token::simpleMatch(vartok, "decltype (")) {
} else if (Token::simpleMatch(vartok, "decltype (")) {
return vartok->linkAt(1)->next();
}
vartok = vartok->next();

View File

@ -5649,7 +5649,9 @@ struct ContainerVariableForwardAnalyzer : VariableForwardAnalyzer {
if (rhs->tokType() == Token::eString)
return Action::Read | Action::Write;
if (rhs->valueType() && rhs->valueType()->container && rhs->valueType()->container->stdStringLike) {
if (std::any_of(rhs->values().begin(), rhs->values().end(), [&](const ValueFlow::Value &rhsval) { return rhsval.isKnown() && rhsval.isContainerSizeValue(); }))
if (std::any_of(rhs->values().begin(), rhs->values().end(), [&](const ValueFlow::Value &rhsval) {
return rhsval.isKnown() && rhsval.isContainerSizeValue();
}))
return Action::Read | Action::Write;
}
} else if (Token::Match(tok, "%name% . %name% (")) {

View File

@ -326,7 +326,9 @@ private:
std::list<ValueFlow::Value> tokenValues(const char code[], const char tokstr[], ValueFlow::Value::ValueType vt, const Settings *s = nullptr) {
std::list<ValueFlow::Value> values = tokenValues(code, tokstr, s);
values.remove_if([&](const ValueFlow::Value& v) { return v.valueType != vt; });
values.remove_if([&](const ValueFlow::Value& v) {
return v.valueType != vt;
});
return values;
}