Formatting

This commit is contained in:
Paul 2020-09-08 21:55:53 -05:00
parent 382408f59e
commit 965fea370f
3 changed files with 12 additions and 9 deletions

View File

@ -5957,7 +5957,8 @@ static void valueFlowSmartPointer(TokenList *tokenlist, ErrorLogger * errorLogge
if (!var->isSmartPointer()) if (!var->isSmartPointer())
continue; continue;
if (var->nameToken() == tok) { if (var->nameToken() == tok) {
if (Token::Match(tok, "%var% (|{") && tok->next()->astOperand2() && tok->next()->astOperand2()->str() != ",") { if (Token::Match(tok, "%var% (|{") && tok->next()->astOperand2() &&
tok->next()->astOperand2()->str() != ",") {
Token* inTok = tok->next()->astOperand2(); Token* inTok = tok->next()->astOperand2();
std::list<ValueFlow::Value> values = inTok->values(); std::list<ValueFlow::Value> values = inTok->values();
const bool constValue = inTok->isNumber(); const bool constValue = inTok->isNumber();
@ -5993,7 +5994,8 @@ static void valueFlowSmartPointer(TokenList *tokenlist, ErrorLogger * errorLogge
values.push_back(v); values.push_back(v);
valueFlowForwardAssign(tok->tokAt(4), var, values, false, false, tokenlist, errorLogger, settings); 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<const Token*> args = getArguments(tok); std::vector<const Token*> args = getArguments(tok);
if (args.empty()) if (args.empty())
continue; continue;

View File

@ -2866,7 +2866,8 @@ private:
"}\n" "}\n"
"void g() {\n" "void g() {\n"
" int a = *f();\n" " int a = *f();\n"
"}\n", true); "}\n",
true);
ASSERT_EQUALS("[test.cpp:5]: (error) Null pointer dereference: f()\n", errout.str()); ASSERT_EQUALS("[test.cpp:5]: (error) Null pointer dereference: f()\n", errout.str());
} }

View File

@ -1153,8 +1153,8 @@ private:
ASSERT_EQUALS(expected, tok(code, false)); ASSERT_EQUALS(expected, tok(code, false));
ASSERT_EQUALS_WITHOUT_LINENUMBERS( ASSERT_EQUALS_WITHOUT_LINENUMBERS(
"[test.cpp:31]: (debug) valueflow.cpp:3109:valueFlowFunctionReturn bailout: function return; nontrivial function body\n" "[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" "[test.cpp:28]: (debug) valueflow.cpp:3109:valueFlowFunctionReturn bailout: function return; nontrivial function body\n",
, errout.str()); errout.str());
} }
void simplifyTypedef36() { void simplifyTypedef36() {