[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / NewDelete-custom.cpp
blob8c4d9a663a31b9fbc02b115ac5f3dd753cf86bb7
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -fblocks -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -fblocks -verify %s -analyzer-config c++-allocator-inlining=false
3 #include "Inputs/system-header-simulator-cxx.h"
5 // expected-no-diagnostics
8 void *allocator(std::size_t size);
10 void *operator new[](std::size_t size) throw() { return allocator(size); }
11 void *operator new(std::size_t size) throw() { return allocator(size); }
12 void *operator new(std::size_t size, const std::nothrow_t &nothrow) throw() { return allocator(size); }
13 void *operator new(std::size_t, double d);
15 class C {
16 public:
17 void *operator new(std::size_t);
20 void testNewMethod() {
21 void *p1 = C::operator new(0); // no warn
23 C *p2 = new C; // no-warning
25 C *c3 = ::new C; // no-warning
28 void testOpNewArray() {
29 void *p = operator new[](0); // call is inlined, no warn
32 void testNewExprArray() {
33 int *p = new int[0]; // no-warning
37 //----- Custom non-placement operators
38 void testOpNew() {
39 void *p = operator new(0); // call is inlined, no warn
42 void testNewExpr() {
43 int *p = new int; // no-warning
46 //----- Custom NoThrow placement operators
47 void testOpNewNoThrow() {
48 void *p = operator new(0, std::nothrow); // call is inlined, no warn
51 void testNewExprNoThrow() {
52 int *p = new(std::nothrow) int; // no-warning
55 //----- Custom placement operators
56 void testOpNewPlacement() {
57 void *p = operator new(0, 0.1); // no warn
60 void testNewExprPlacement() {
61 int *p = new(0.1) int; // no warn