ValueFlow: Fix crash

This commit is contained in:
Daniel Marjamäki 2022-03-02 21:12:37 +01:00
parent c5b3fafe84
commit 6ef6b02153
2 changed files with 9 additions and 0 deletions

View File

@ -4945,6 +4945,8 @@ static void valueFlowForwardAssign(Token* const tok,
// Skip RHS // Skip RHS
const Token * nextExpression = tok->astParent() ? nextAfterAstRightmostLeaf(tok->astParent()) : tok->next(); const Token * nextExpression = tok->astParent() ? nextAfterAstRightmostLeaf(tok->astParent()) : tok->next();
if (!nextExpression)
return;
for (ValueFlow::Value& value : values) { for (ValueFlow::Value& value : values) {
if (value.isSymbolicValue()) if (value.isSymbolicValue())

View File

@ -6259,6 +6259,13 @@ private:
" }\n" " }\n"
"};\n"; "};\n";
valueOfTok(code, "f.c"); valueOfTok(code, "f.c");
code = "int f(int value) { return 0; }\n"
"std::shared_ptr<Manager> g() {\n"
" static const std::shared_ptr<Manager> x{ new M{} };\n"
" return x;\n"
"}\n";
valueOfTok(code, "x");
} }
void valueFlowHang() { void valueFlowHang() {