[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / new-ctor-malloc.cpp
blobe38433e3374c8efd900120433bbc177e35932b42
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection,unix.Malloc -analyzer-config c++-allocator-inlining=true -analyzer-output=text -std=c++11 -verify %s
3 void clang_analyzer_eval(bool);
5 typedef __typeof__(sizeof(int)) size_t;
7 void *malloc(size_t size);
9 void *operator new(size_t size) throw() {
10 void *x = malloc(size); // expected-note {{Memory is allocated}}
11 if (!x) // expected-note {{Assuming 'x' is non-null}}
12 // expected-note@-1 {{Taking false branch}}
13 return nullptr;
14 // expected-warning@-1 {{null returned from function that requires a non-null return value}}
15 return x;
18 void checkNewAndConstructorInlining() {
19 int *s = new int; // expected-note {{Calling 'operator new'}}
20 // expected-note@-1{{Returning from 'operator new'}}
21 } // expected-warning {{Potential leak of memory pointed to by 's'}}
22 // expected-note@-1 {{Potential leak of memory pointed to by 's'}}