// RUN: %clang_analyze_cc1 -std=c++11 -fblocks %s \
// RUN: -verify=expected,newdelete \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDelete
//
// RUN: %clang_analyze_cc1 -DLEAKS -std=c++11 -fblocks %s \
// RUN: -verify=expected,newdelete,leak \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDelete \
// RUN: -analyzer-checker=cplusplus.NewDeleteLeaks
//
// RUN: %clang_analyze_cc1 -std=c++11 -fblocks -verify %s \
// RUN: -verify=expected,leak \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDeleteLeaks
//
// RUN: %clang_analyze_cc1 -std=c++17 -fblocks %s \
// RUN: -verify=expected,newdelete \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDelete
//
// RUN: %clang_analyze_cc1 -DLEAKS -std=c++17 -fblocks %s \
// RUN: -verify=expected,newdelete,leak \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDelete \
// RUN: -analyzer-checker=cplusplus.NewDeleteLeaks
//
// RUN: %clang_analyze_cc1 -std=c++17 -fblocks -verify %s \
// RUN: -verify=expected,leak \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=cplusplus.NewDeleteLeaks
typedef size_t;
extern "C" void *;
extern "C" void ;
int *global;
//------------------
// check for leaks
//------------------
//----- Standard non-placement operators
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
//----- Standard nothrow placement operators
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
void // leak-warning{{Potential leak of memory pointed to by 'p'}}
//----- Standard pointer placement operators
void
//----- Other cases
void
;
void
//-----------------------------------------
// check for usage of zero-allocated memory
//-----------------------------------------
void
int
void ;
void
//---------------
// other checks
//---------------
;
void ;
void ;
void
void
void
void
void
void
void
void
void
void
void
void
//--------------------------------
// Test escape of newed const pointer. Note, a const pointer can be deleted.
//--------------------------------
;
void ;
void ;
void ;
void ;
void // no-warning
void // no-warning
void // no-warning
void // no-warning
void // no-warning
//============== Test Uninitialized delete delete[]========================
void
void
void
void
void
// Test double delete
;
void
;
void
;
;
Base *
void
void*
void
void // no warn
void // no warn
void
void
void // leak-warning{{Potential leak of memory pointed to by 'p'}}