Fix 10931: Assert failure in setSymbolic() (#3967)
* Fix 10931: Assert failure in setSymbolic() * Format
This commit is contained in:
parent
0547cbcd26
commit
39265f8ce0
|
@ -1466,6 +1466,9 @@ void SymbolDatabase::createSymbolDatabaseEscapeFunctions()
|
||||||
|
|
||||||
static bool isExpression(const Token* tok)
|
static bool isExpression(const Token* tok)
|
||||||
{
|
{
|
||||||
|
if (Token::simpleMatch(tok, "{") && tok->scope() && tok->scope()->bodyStart != tok &&
|
||||||
|
(tok->astOperand1() || tok->astOperand2()))
|
||||||
|
return true;
|
||||||
if (!Token::Match(tok, "(|.|[|::|?|:|++|--|%cop%|%assign%"))
|
if (!Token::Match(tok, "(|.|[|::|?|:|++|--|%cop%|%assign%"))
|
||||||
return false;
|
return false;
|
||||||
if (Token::Match(tok, "*|&|&&")) {
|
if (Token::Match(tok, "*|&|&&")) {
|
||||||
|
|
|
@ -3203,7 +3203,8 @@ private:
|
||||||
"A f() {\n"
|
"A f() {\n"
|
||||||
" return A{0};\n"
|
" return A{0};\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
TODO_ASSERT_EQUALS("error", "", errout.str());
|
ASSERT_EQUALS("[test.cpp:8] -> [test.cpp:8]: (error) Returning object that will be invalid when returning.\n",
|
||||||
|
errout.str());
|
||||||
|
|
||||||
check("struct A {\n"
|
check("struct A {\n"
|
||||||
" int n;\n"
|
" int n;\n"
|
||||||
|
|
|
@ -6428,6 +6428,12 @@ private:
|
||||||
" return x;\n"
|
" return x;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "x");
|
valueOfTok(code, "x");
|
||||||
|
|
||||||
|
code = "int* g();\n"
|
||||||
|
"void f() {\n"
|
||||||
|
" std::cout << (void*)(std::shared_ptr<int>{ g() }.get());\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue