astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2020-09-07 10:56:02 +02:00
parent ac67049661
commit 0c6dc84cbb
4 changed files with 13 additions and 9 deletions

View File

@ -957,8 +957,12 @@ bool isOppositeCond(bool isNot, bool cpp, const Token * const cond1, const Token
return false;
if (cond1->str() == "&&" && cond2->str() == "&&") {
for(const Token* tok1:{cond1->astOperand1(), cond1->astOperand2()}) {
for(const Token* tok2:{cond2->astOperand1(), cond2->astOperand2()}) {
for (const Token* tok1: {
cond1->astOperand1(), cond1->astOperand2()
}) {
for (const Token* tok2: {
cond2->astOperand1(), cond2->astOperand2()
}) {
if (isSameExpression(cpp, true, tok1, tok2, library, pure, followVar, errors)) {
if (isOppositeCond(isNot, cpp, tok1->astSibling(), tok2->astSibling(), library, pure, followVar, errors))
return true;

View File

@ -1271,7 +1271,7 @@ public:
else if (this == astParent()->astOperand2())
return astParent()->astOperand1();
return nullptr;
}
const Token * astSibling() const {
if (!astParent())
@ -1281,7 +1281,7 @@ public:
else if (this == astParent()->astOperand2())
return astParent()->astOperand1();
return nullptr;
}
Token *astTop() {
Token *ret = this;

View File

@ -3064,7 +3064,7 @@ std::vector<LifetimeToken> getLifetimeTokens(const Token* tok, bool escape, Valu
lt.errorPath.emplace_back(returnTok, "Return reference.");
lt.errorPath.emplace_back(tok->previous(), "Called function passing '" + argTok->str() + "'.");
std::vector<LifetimeToken> arglts = LifetimeToken::setInconclusive(
getLifetimeTokens(argTok, escape, std::move(lt.errorPath), depth - 1), returns.size() > 1);
getLifetimeTokens(argTok, escape, std::move(lt.errorPath), depth - 1), returns.size() > 1);
result.insert(result.end(), arglts.begin(), arglts.end());
}
}
@ -3076,7 +3076,7 @@ std::vector<LifetimeToken> getLifetimeTokens(const Token* tok, bool escape, Valu
if (y == Library::Container::Yield::AT_INDEX || y == Library::Container::Yield::ITEM) {
errorPath.emplace_back(tok->previous(), "Accessing container.");
return LifetimeToken::setAddressOf(
getLifetimeTokens(tok->tokAt(-2)->astOperand1(), escape, std::move(errorPath), depth - 1), false);
getLifetimeTokens(tok->tokAt(-2)->astOperand1(), escape, std::move(errorPath), depth - 1), false);
}
}
} else if (Token::Match(tok, ".|::|[")) {

View File

@ -365,9 +365,9 @@ struct LifetimeToken {
const Token *parseCompareInt(const Token *tok, ValueFlow::Value &true_value, ValueFlow::Value &false_value);
std::vector<LifetimeToken> getLifetimeTokens(const Token* tok,
bool escape = false,
ValueFlow::Value::ErrorPath errorPath = ValueFlow::Value::ErrorPath{},
int depth = 20);
bool escape = false,
ValueFlow::Value::ErrorPath errorPath = ValueFlow::Value::ErrorPath{},
int depth = 20);
const Variable* getLifetimeVariable(const Token* tok, ValueFlow::Value::ErrorPath& errorPath, bool* addressOf = nullptr);