blob: 5ce9e3c53531fb844256e0366de360856de36f09 [file] [log] [blame]
Jordan Rosee449edc2013-04-05 17:55:07 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete -std=c++11 -verify %s
2// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete,alpha.cplusplus.NewDeleteLeaks -std=c++11 -verify %s
Anton Yartsev648cb712013-04-04 23:46:29 +00003
4typedef __typeof(sizeof(int)) size_t;
5void *malloc(size_t);
6void free(void *);
7
8//-------------------------------------------------------------------
Jordan Rosee85deb32013-04-05 17:55:00 +00009// Check that unix.Malloc + cplusplus.NewDelete does not enable
Anton Yartsev648cb712013-04-04 23:46:29 +000010// warnings produced by unix.MismatchedDeallocator.
11//-------------------------------------------------------------------
12void testMismatchedDeallocator() {
13 int *p = (int *)malloc(sizeof(int));
14 delete p;
15} // expected-warning{{Memory is never released; potential leak of memory pointed to by 'p'}}