aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/new.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-02 22:21:47 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-02 22:21:47 +0000
commit70cbf3cc09eb21db1108396d30a414ea66d842cc (patch)
tree616162322cc763100a3285634585fcadab7c6b2c /test/Analysis/new.cpp
parent879a4334e4c4cab0c22ba91492ffc2838bbc21fc (diff)
[analyzer] Introduce CXXAllocatorCall to handle placement arg invalidation.
This is NOT full-blown support for operator new, but removes some nasty duplicated code introduced in r158784. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/new.cpp')
-rw-r--r--test/Analysis/new.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/test/Analysis/new.cpp b/test/Analysis/new.cpp
index 723d033bc7..5dad9430c6 100644
--- a/test/Analysis/new.cpp
+++ b/test/Analysis/new.cpp
@@ -49,6 +49,16 @@ void *testCustomNew() {
return y; // no-warning
}
+void *operator new(size_t, void *, void *);
+void *testCustomNewMalloc() {
+ int *x = (int *)malloc(sizeof(int));
+
+ // Should be no-warning (the custom allocator could have freed x).
+ void *y = new (0, x) int; // no-warning
+
+ return y;
+}
+
//--------------------------------
// Incorrectly-modelled behavior
@@ -69,14 +79,3 @@ void testValueInitialization() {
clang_analyzer_eval(*n == 3); // expected-warning{{UNKNOWN}}
}
-
-void *operator new(size_t, void *, void *);
-void *testCustomNewMalloc() {
- int *x = (int *)malloc(sizeof(int));
-
- // Should be no-warning (the custom allocator could have freed x).
- void *y = new (0, x) int; // expected-warning{{leak of memory pointed to by 'x'}}
-
- return y;
-}
-