Clang Project

clang_source_code/test/Analysis/cxxnewexpr-callback-noinline.cpp
1// 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
2
3#include "Inputs/system-header-simulator-cxx.h"
4
5namespace std {
6  void *malloc(size_t);
7}
8
9void *operator new(size_t size) { return std::malloc(size); }
10
11struct S {
12  S() {}
13};
14
15void foo();
16
17void test() {
18  S *s = new S();
19  foo();
20}
21
22// CHECK:      PreCall (S::S)
23// CHECK-NEXT: PostCall (S::S)
24// CHECK-NEXT: PreStmt<CXXNewExpr>
25// CHECK-NEXT: PostStmt<CXXNewExpr>
26// CHECK-NEXT: PreCall (foo)
27// CHECK-NEXT: PostCall (foo)
28// CHECK-NEXT: PreCall (std::malloc)
29// CHECK-NEXT: PostCall (std::malloc)
30