[ELF] Avoid make in elf::writeARMCmseImportLib
[llvm-project.git] / clang / test / Analysis / cxxnewexpr-callback.cpp
blob7df58cfa9ca284389205eb1234b705977db489cf
1 // 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 --check-prefixes=CHECK,CHECK-INLINE
2 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder -analyzer-config c++-allocator-inlining=false,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 --check-prefixes=CHECK,CHECK-NO-INLINE
4 #include "Inputs/system-header-simulator-cxx.h"
6 namespace std {
7 void *malloc(size_t);
8 void free(void *);
9 } // namespace std
11 void *operator new(size_t size) { return std::malloc(size); }
12 void operator delete(void *ptr, size_t size) { std::free(ptr); }
14 struct S {
15 S() {}
16 ~S() {}
19 void foo();
21 void test() {
22 S *s = new S();
23 foo();
24 delete s;
28 void test() {
29 S *s = new S();
30 // CHECK-INLINE: PreCall (operator new)
31 // CHECK-INLINE-NEXT: PreCall (std::malloc)
32 // CHECK-INLINE-NEXT: PostCall (std::malloc)
33 // CHECK-INLINE-NEXT: PostCall (operator new)
34 // CHECK-INLINE-NEXT: NewAllocator
35 // CHECK-NO-INLINE: PreCall (S::S)
36 // CHECK-INLINE-NEXT: PreCall (S::S)
37 // CHECK-NEXT: PostCall (S::S)
38 // CHECK-NEXT: PreStmt<CXXNewExpr>
39 // CHECK-NEXT: PostStmt<CXXNewExpr>
40 foo();
41 // CHECK-NEXT: PreCall (foo)
42 // CHECK-NEXT: PostCall (foo)
43 delete s;
44 // CHECK-NEXT: PreCall (S::~S)
45 // CHECK-NEXT: PostCall (S::~S)
46 // CHECK-NEXT: PreCall (operator delete)
47 // CHECK-INLINE-NEXT: PreCall (std::free)
48 // CHECK-INLINE-NEXT: PostCall (std::free)
49 // CHECK-NEXT: PostCall (operator delete)
52 void operator delete(void *ptr, size_t size) {
53 std::free(ptr);
54 // CHECK-NO-INLINE-NEXT: PreCall (std::free)
55 // CHECK-NO-INLINE-NEXT: PostCall (std::free)
58 void *operator new(size_t size) {
59 return std::malloc(size);
60 // CHECK-NO-INLINE-NEXT: PreCall (std::malloc)
61 // CHECK-NO-INLINE-NEXT: PostCall (std::malloc)