From 0c6dc84cbbe22c9064c4525582d6c8aa242589c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 7 Sep 2020 10:56:02 +0200 Subject: [PATCH] astyle formatting [ci skip] --- lib/astutils.cpp | 8 ++++++-- lib/token.h | 4 ++-- lib/valueflow.cpp | 4 ++-- lib/valueflow.h | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 791c5f20d..1f75dd775 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -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; diff --git a/lib/token.h b/lib/token.h index df41a5d89..981f49e4a 100644 --- a/lib/token.h +++ b/lib/token.h @@ -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; diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index cbfa2af6d..3ad0072f4 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3064,7 +3064,7 @@ std::vector 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 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 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, ".|::|[")) { diff --git a/lib/valueflow.h b/lib/valueflow.h index 2357e75a6..5406aa4c2 100644 --- a/lib/valueflow.h +++ b/lib/valueflow.h @@ -365,9 +365,9 @@ struct LifetimeToken { const Token *parseCompareInt(const Token *tok, ValueFlow::Value &true_value, ValueFlow::Value &false_value); std::vector 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);