Skip to content

Commit 724fe1d

Browse files
committed
Add TODO
1 parent c1bb384 commit 724fe1d

File tree

1 file changed

+18
-35
lines changed

1 file changed

+18
-35
lines changed

test/testvalueflow.cpp

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,22 @@ class TestValueFlow : public TestFixture {
17261726
ASSERT_EQUALS(1U, values.size());
17271727
ASSERT_EQUALS(-1, values.back().intvalue);
17281728
ASSERT_EQUALS_ENUM(ValueFlow::Value::ValueKind::Impossible, values.back().valueKind);
1729+
1730+
code = "struct E;\n"
1731+
"struct B {\n"
1732+
" E* e;\n"
1733+
" B* b;\n"
1734+
"};\n"
1735+
"struct D : B {};\n"
1736+
"struct E : B {\n"
1737+
" B* be;\n"
1738+
"};\n"
1739+
"int f() {\n"
1740+
" return sizeof(D);\n"
1741+
"}";
1742+
values = tokenValues(code, "( D )");
1743+
ASSERT_EQUALS(1U, values.size());
1744+
TODO_ASSERT_EQUALS(2 * settings.platform.sizeof_pointer, 1, values.back().intvalue);
17291745
}
17301746

17311747
void valueFlowComma()
@@ -7457,32 +7473,6 @@ class TestValueFlow : public TestFixture {
74577473
"}";
74587474
ASSERT_EQUALS(true, testValueOfX(code, 4U, 100, ValueFlow::Value::ValueType::BUFFER_SIZE));
74597475

7460-
code = "struct A {};\n" // #14305
7461-
"void* f() {\n"
7462-
" A* x = new A();\n"
7463-
" return x;\n"
7464-
"}";
7465-
ASSERT_EQUALS(true, testValueOfX(code, 4U, 1, ValueFlow::Value::ValueType::BUFFER_SIZE));
7466-
7467-
code = "struct A {};\n"
7468-
"void* f() {\n"
7469-
" void* x = new A;\n"
7470-
" return x;\n"
7471-
"}";
7472-
{
7473-
auto values = tokenValues(code, "x ; }");
7474-
ASSERT_EQUALS(1, values.size());
7475-
ASSERT(values.front().isSymbolicValue());
7476-
// TODO: add BUFFER_SIZE value = 1
7477-
}
7478-
7479-
code = "struct B { int32_t i; };\n"
7480-
"void* f() {\n"
7481-
" B* x = new B();\n"
7482-
" return x;\n"
7483-
"}";
7484-
ASSERT_EQUALS(true, testValueOfX(code, 4U, 4, ValueFlow::Value::ValueType::BUFFER_SIZE));
7485-
74867476
settings = settingsOld;
74877477
}
74887478

@@ -9092,8 +9082,8 @@ class TestValueFlow : public TestFixture {
90929082
ASSERT_EQUALS(false, testValueOfX(code, 5U, 0));
90939083
}
90949084

9095-
void valueFlowBailoutIncompleteVar() {
9096-
bailout( // #12526
9085+
void valueFlowBailoutIncompleteVar() { // #12526
9086+
bailout(
90979087
"int f1() {\n"
90989088
" return VALUE_1;\n"
90999089
"}\n"
@@ -9106,13 +9096,6 @@ class TestValueFlow : public TestFixture {
91069096
"[test.cpp:2]: (debug) valueFlowConditionExpressions bailout: Skipping function due to incomplete variable VALUE_1\n"
91079097
"[test.cpp:6]: (debug) valueFlowConditionExpressions bailout: Skipping function due to incomplete variable VALUE_2\n",
91089098
errout_str());
9109-
9110-
bailout(
9111-
"std::string_view f() {\n"
9112-
" return \"abc\"sv;\n"
9113-
"}\n"
9114-
);
9115-
ASSERT_EQUALS_WITHOUT_LINENUMBERS("", errout_str());
91169099
}
91179100

91189101
void valueFlowBailoutNoreturn() { // #13718

0 commit comments

Comments
 (0)