Skip to content

Commit b2b269f

Browse files
author
tobias.gruber
committed
Include test case with multi-dim array
1 parent d8837ca commit b2b269f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,18 @@ void top() {
156156
EXPECT_EQ(Output, "DescriptiveNameChecker: val_struct_array[0].val\n");
157157
}
158158

159+
TEST(MemRegionDescriptiveNameTest, FieldRegWithSuperMultidimElementReg) {
160+
StringRef Code = R"cpp(
161+
void reportDescriptiveName(int *p);
162+
struct val_struct { int val; };
163+
extern struct val_struct val_struct_array[3][4];
164+
void top() {
165+
reportDescriptiveName(&val_struct_array[1][2].val);
166+
})cpp";
167+
168+
std::string Output;
169+
ASSERT_TRUE(runChecker(Code, Output));
170+
EXPECT_EQ(Output, "DescriptiveNameChecker: val_struct_array[1][2].val\n");
171+
}
172+
159173
} // namespace

0 commit comments

Comments
 (0)