summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/cxxnewexpr-callback-inline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/cxxnewexpr-callback-inline.cpp')
-rw-r--r--clang/test/Analysis/cxxnewexpr-callback-inline.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/Analysis/cxxnewexpr-callback-inline.cpp b/clang/test/Analysis/cxxnewexpr-callback-inline.cpp
new file mode 100644
index 00000000000..c823de85821
--- /dev/null
+++ b/clang/test/Analysis/cxxnewexpr-callback-inline.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder -analyzer-config c++-allocator-inlining=true,debug.AnalysisOrder:PreStmtCXXNewExpr=true,debug.AnalysisOrder:PostStmtCXXNewExpr=true,debug.AnalysisOrder:PreCall=true,debug.AnalysisOrder:PostCall=true,debug.AnalysisOrder:NewAllocator=true %s 2>&1 | FileCheck %s
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+namespace std {
+ void *malloc(size_t);
+}
+
+void *operator new(size_t size) { return std::malloc(size); }
+
+struct S {
+ S() {}
+};
+
+void foo();
+
+void test() {
+ S *s = new S();
+ foo();
+}
+
+// CHECK: PreCall (operator new)
+// CHECK-NEXT: PreCall (std::malloc)
+// CHECK-NEXT: PostCall (std::malloc)
+// CHECK-NEXT: PostCall (operator new)
+// CHECK-NEXT: NewAllocator
+// CHECK-NEXT: PreCall (S::S)
+// CHECK-NEXT: PostCall (S::S)
+// CHECK-NEXT: PreStmt<CXXNewExpr>
+// CHECK-NEXT: PostStmt<CXXNewExpr>
+// CHECK-NEXT: PreCall (foo)
+// CHECK-NEXT: PostCall (foo)
OpenPOWER on IntegriCloud