Fix ValueFlow crash (#4461)
This commit is contained in:
parent
3887d6dde1
commit
e904f7341e
|
@ -4818,8 +4818,10 @@ static void valueFlowAfterMove(TokenList* tokenlist, SymbolDatabase* symboldatab
|
||||||
value.setKnown();
|
value.setKnown();
|
||||||
|
|
||||||
setTokenValue(tok, value, settings);
|
setTokenValue(tok, value, settings);
|
||||||
|
if (var->scope()) {
|
||||||
const Token* const endOfVarScope = var->scope()->bodyEnd;
|
const Token* const endOfVarScope = var->scope()->bodyEnd;
|
||||||
valueFlowForward(tok->next(), endOfVarScope, tok, std::move(value), tokenlist);
|
valueFlowForward(tok->next(), endOfVarScope, tok, std::move(value), tokenlist);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ValueFlow::Value::MoveKind moveKind;
|
ValueFlow::Value::MoveKind moveKind;
|
||||||
|
|
|
@ -6789,6 +6789,15 @@ private:
|
||||||
" for (b c : {b{}, {}}) {}\n"
|
" for (b c : {b{}, {}}) {}\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "c");
|
valueOfTok(code, "c");
|
||||||
|
|
||||||
|
code = "class T {\n"
|
||||||
|
"private slots:\n"
|
||||||
|
" void f() { D& r = dynamic_cast<D&>(*m); }\n"
|
||||||
|
" void g() { m.reset(new D); }\n"
|
||||||
|
"private:\n"
|
||||||
|
" std::shared_ptr<B> m;\n"
|
||||||
|
"};\n";
|
||||||
|
valueOfTok(code, "r");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue