Fix 10723: Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer() (#3755)
* Fix 10723: Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer() * Format
This commit is contained in:
parent
c132235a76
commit
1a949c00b0
|
@ -717,6 +717,9 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
|||
// syntax error?
|
||||
if (!scope)
|
||||
mTokenizer->syntaxError(tok);
|
||||
// End of scope or list should be handled above
|
||||
if (tok->str() == "}")
|
||||
mTokenizer->syntaxError(tok);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3046,11 +3049,9 @@ void SymbolDatabase::addNewFunction(Scope **scope, const Token **tok)
|
|||
// find start of function '{'
|
||||
bool foundInitList = false;
|
||||
while (tok1 && tok1->str() != "{" && tok1->str() != ";") {
|
||||
if (tok1->link() && Token::Match(tok1, "(|<")) {
|
||||
if (tok1->link() && Token::Match(tok1, "(|[|<")) {
|
||||
tok1 = tok1->link();
|
||||
} else if (foundInitList &&
|
||||
Token::Match(tok1, "%name%|> {") &&
|
||||
Token::Match(tok1->linkAt(1), "} ,|{")) {
|
||||
} else if (foundInitList && Token::Match(tok1, "%name%|> {") && Token::Match(tok1->linkAt(1), "} ,|{")) {
|
||||
tok1 = tok1->linkAt(1);
|
||||
} else {
|
||||
if (tok1->str() == ":")
|
||||
|
|
|
@ -6226,6 +6226,21 @@ private:
|
|||
" }\n"
|
||||
"};\n";
|
||||
valueOfTok(code, "e");
|
||||
|
||||
code = "struct a {\n"
|
||||
" struct b {\n"
|
||||
" std::unique_ptr<a> c;\n"
|
||||
" };\n"
|
||||
" void d(int, void *);\n"
|
||||
" void e() {\n"
|
||||
" d(0, [f = b{}] { return f.c.get(); }());\n"
|
||||
" }\n"
|
||||
" void g() {\n"
|
||||
" if (b *h = 0)\n"
|
||||
" h->c.get();\n"
|
||||
" }\n"
|
||||
"};\n";
|
||||
valueOfTok(code, "f.c");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue