Skip to content

Commit ecac4e8

Browse files
authored
[analyzer][NFC] Remove irrelevant overcomplicated test (#147536)
This commit removes the test file test-member-invalidation.cpp which was recently introduced in 39bc052 by splitting off a test case from new.cpp. In that commit I preserved that test in a slightly modified setting to demonstrate that it wasn't broken by the change; but in this separate commit I'm removing it because I don't think that it "deserves a place" among our tests. The primary issue is that this test examines the values of data members of a deleted object -- which is irrelevant, because code that relies on the value of these members should be reported as a use-after-free bug. (In fact, cplusplus.NewDelete reports it as a use-after-free bug, and the checker family `MallocChecker` sinks the execution path even if that particular frontend is not enabled.) Moreover, a comment claimed that this tests "Invalidate Region even in case of default destructor" while in fact it tested a situaton where the destructor is a plain declared-but-not-defined method. The invalidation of `this` is done by the conservative evaluation, and we don't need this overcomplicated test to validate that very basic behavior.
1 parent 962c421 commit ecac4e8

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

clang/test/Analysis/new.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,3 @@ void testArrayDestr() {
326326
delete[] p;
327327
clang_analyzer_warnIfReached(); // no-warning
328328
}
329-
330-
// See also test-member-invalidation.cpp which validates that calling an
331-
// unknown destructor invalidates the members of an object. This behavior
332-
// cannot be tested in this file because here `MallocChecker.cpp` sinks
333-
// execution paths that refer to members of a deleted object.

clang/test/Analysis/test-member-invalidation.cpp

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)