From 965fea370f80192ccd9a2f50b934e9a38fa653a1 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 8 Sep 2020 21:55:53 -0500 Subject: [PATCH] Formatting --- lib/valueflow.cpp | 14 ++++++++------ test/testnullpointer.cpp | 3 ++- test/testsimplifytypedef.cpp | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index c0931b222..008e4ab88 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5953,12 +5953,13 @@ static void valueFlowSmartPointer(TokenList *tokenlist, ErrorLogger * errorLogge if (!tok->scope()->isExecutable()) continue; if (tok->variable()) { - const Variable * var = tok->variable(); + const Variable* var = tok->variable(); if (!var->isSmartPointer()) continue; if (var->nameToken() == tok) { - if (Token::Match(tok, "%var% (|{") && tok->next()->astOperand2() && tok->next()->astOperand2()->str() != ",") { - Token * inTok = tok->next()->astOperand2(); + if (Token::Match(tok, "%var% (|{") && tok->next()->astOperand2() && + tok->next()->astOperand2()->str() != ",") { + Token* inTok = tok->next()->astOperand2(); std::list values = inTok->values(); const bool constValue = inTok->isNumber(); valueFlowForwardAssign(inTok, var, values, constValue, true, tokenlist, errorLogger, settings); @@ -5979,7 +5980,7 @@ static void valueFlowSmartPointer(TokenList *tokenlist, ErrorLogger * errorLogge valueFlowForwardAssign(tok->tokAt(4), var, values, false, false, tokenlist, errorLogger, settings); } else { tok->removeValues(std::mem_fn(&ValueFlow::Value::isIntValue)); - Token * inTok = tok->tokAt(3)->astOperand2(); + Token* inTok = tok->tokAt(3)->astOperand2(); if (!inTok) continue; std::list values = inTok->values(); @@ -5993,11 +5994,12 @@ static void valueFlowSmartPointer(TokenList *tokenlist, ErrorLogger * errorLogge values.push_back(v); valueFlowForwardAssign(tok->tokAt(4), var, values, false, false, tokenlist, errorLogger, settings); } - } else if (Token::Match(tok->previous(), "%name%|> (|{") && astIsSmartPointer(tok) && astIsSmartPointer(tok->astOperand1())) { + } else if (Token::Match(tok->previous(), "%name%|> (|{") && astIsSmartPointer(tok) && + astIsSmartPointer(tok->astOperand1())) { std::vector args = getArguments(tok); if (args.empty()) continue; - for(const ValueFlow::Value& v:args.front()->values()) + for (const ValueFlow::Value& v : args.front()->values()) setTokenValue(tok, v, settings); } } diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index b7414c57f..11b77f6b0 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2866,7 +2866,8 @@ private: "}\n" "void g() {\n" " int a = *f();\n" - "}\n", true); + "}\n", + true); ASSERT_EQUALS("[test.cpp:5]: (error) Null pointer dereference: f()\n", errout.str()); } diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 0b0478970..1a177dc68 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -1153,8 +1153,8 @@ private: ASSERT_EQUALS(expected, tok(code, false)); ASSERT_EQUALS_WITHOUT_LINENUMBERS( "[test.cpp:31]: (debug) valueflow.cpp:3109:valueFlowFunctionReturn bailout: function return; nontrivial function body\n" - "[test.cpp:28]: (debug) valueflow.cpp:3109:valueFlowFunctionReturn bailout: function return; nontrivial function body\n" - , errout.str()); + "[test.cpp:28]: (debug) valueflow.cpp:3109:valueFlowFunctionReturn bailout: function return; nontrivial function body\n", + errout.str()); } void simplifyTypedef36() {