Skip to content

Commit c955216

Browse files
Update clang/test/Analysis/NewDeleteLeaks-PR60896.cpp
LIT tests updates to reflect the heuristic behaviour in the tests Co-authored-by: Donát Nagy <[email protected]>
1 parent f41c0bc commit c955216

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/test/Analysis/NewDeleteLeaks-PR60896.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ template <typename T>
1515
struct unique_ptr {
1616
T* ptr;
1717
unique_ptr(T* p) : ptr(p) {}
18-
~unique_ptr() { delete ptr; }
18+
~unique_ptr() {
19+
// This destructor intentionally doesn't delete 'ptr' to validate that the
20+
// heuristic trusts that smart pointers (based on their class name) will
21+
// release the pointee even if it doesn't understand their destructor.
22+
}
1923
unique_ptr(unique_ptr&& other) : ptr(other.ptr) { other.ptr = nullptr; }
2024
T* get() const { return ptr; }
2125
};

0 commit comments

Comments
 (0)