aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/new.cpp
diff options
context:
space:
mode:
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;
-}
-