From 1744cbaf66157007e538b72a83b9dba5319a269f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 19 Dec 2020 08:56:46 +0100 Subject: [PATCH] astyle formatting [ci skip] --- lib/checkunusedvar.cpp | 8 +++----- lib/valueflow.cpp | 2 +- test/testvalueflow.cpp | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index 7c41a9798..b170ad977 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -1611,8 +1611,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To bool sideEffectReturnFound = false; std::set pointersToGlobals; for (Token* bodyToken = func.functionScope->bodyStart->next(); bodyToken != func.functionScope->bodyEnd; - bodyToken = bodyToken->next()) - { + bodyToken = bodyToken->next()) { // check variable inside function body const Variable* bodyVariable = bodyToken->variable(); if (bodyVariable) { @@ -1620,7 +1619,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To return false; } // check if global variable is changed - if (bodyVariable->isGlobal() || (pointersToGlobals.find(bodyVariable) != pointersToGlobals.end()) ) { + if (bodyVariable->isGlobal() || (pointersToGlobals.find(bodyVariable) != pointersToGlobals.end())) { if (bodyVariable->isPointer() || bodyVariable->isArray()) { return false; // TODO: Update astutils.cpp:1544 isVariableChanged() and remove this. Unhandled case: `*(global_arr + 1) = new_val` } @@ -1631,8 +1630,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To // check if pointer to global variable assigned to another variable (another_var = &global_var) if (Token::simpleMatch(bodyToken->tokAt(-1), "&") && Token::simpleMatch(bodyToken->tokAt(-2), "=")) { const Token* assigned_var_token = bodyToken->tokAt(-3); - if (assigned_var_token && assigned_var_token->variable()) - { + if (assigned_var_token && assigned_var_token->variable()) { pointersToGlobals.insert(assigned_var_token->variable()); } } diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 0adda53ef..fc62d90c4 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3125,7 +3125,7 @@ static void valueFlowForwardLifetime(Token * tok, TokenList *tokenlist, ErrorLog std::list values = tok->values(); // Only forward lifetime values values.remove_if(&isNotLifetimeValue); - for(const ValueFlow::Value& value:values) + for (const ValueFlow::Value& value:values) setTokenValue(parent, value, tokenlist->getSettings()); valueFlowForwardLifetime(parent, tokenlist, errorLogger, settings); } diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 2fab4fdf5..7f4809e8b 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -384,7 +384,7 @@ private: const Token *tok = Token::findmatch(tokenizer.tokens(), tokstr); if (!tok) return result; - for(const ValueFlow::Value& value:tok->values()) { + for (const ValueFlow::Value& value:tok->values()) { if (!value.isLifetimeValue()) continue; if (!value.tokvalue)