Bug hunting; Make bughuntingUninit check a bit less noisy about const parameters
This commit is contained in:
parent
99cb65b4b2
commit
6d7ddde1b5
|
@ -2631,13 +2631,15 @@ static ExprEngine::ValuePtr createVariableValue(const Variable &var, Data &data)
|
|||
return value;
|
||||
}
|
||||
if (valueType->type == ValueType::Type::RECORD) {
|
||||
bool init = true;
|
||||
bool uninitData = true;
|
||||
if (var.isLocal() && !var.isStatic()) {
|
||||
init = valueType->typeScope &&
|
||||
valueType->typeScope->definedType &&
|
||||
valueType->typeScope->definedType->needInitialization != Type::NeedInitialization::False;
|
||||
uninitData = !valueType->typeScope ||
|
||||
!valueType->typeScope->definedType ||
|
||||
valueType->typeScope->definedType->needInitialization != Type::NeedInitialization::False;
|
||||
}
|
||||
return createStructVal(valueType->typeScope, init, data);
|
||||
if (var.isArgument() && var.isConst())
|
||||
uninitData = false;
|
||||
return createStructVal(valueType->typeScope, uninitData, data);
|
||||
}
|
||||
if (valueType->smartPointerType) {
|
||||
auto structValue = createStructVal(valueType->smartPointerType->classScope, var.isLocal() && !var.isStatic(), data);
|
||||
|
|
|
@ -222,6 +222,15 @@ private:
|
|||
|
||||
check("void foo(int *p) { if (p) *p=0; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("class C {\n"
|
||||
"public:\n"
|
||||
" C();\n"
|
||||
" int x;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"void foo(const C &c) { int x = c.x; }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninit_malloc() {
|
||||
|
|
Loading…
Reference in New Issue