From c72c57c9e9b69944e3e009cd5e209634839581d3 Mon Sep 17 00:00:00 2001 From: dim <dim@FreeBSD.org> Date: Mon, 8 Apr 2013 18:45:10 +0000 Subject: Vendor import of clang trunk r178860: http://llvm.org/svn/llvm-project/cfe/trunk@178860 --- test/Analysis/Malloc+NewDelete_intersections.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/Analysis/Malloc+NewDelete_intersections.cpp (limited to 'test/Analysis/Malloc+NewDelete_intersections.cpp') diff --git a/test/Analysis/Malloc+NewDelete_intersections.cpp b/test/Analysis/Malloc+NewDelete_intersections.cpp new file mode 100644 index 0000000..7a0ef8e --- /dev/null +++ b/test/Analysis/Malloc+NewDelete_intersections.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,alpha.cplusplus.NewDelete -analyzer-store region -std=c++11 -verify %s + +typedef __typeof(sizeof(int)) size_t; +void *malloc(size_t); +void free(void *); + +//------------------------------------------------------------------- +// Check that unix.Malloc + alpha.cplusplus.NewDelete does not enable +// warnings produced by unix.MismatchedDeallocator. +//------------------------------------------------------------------- +void testMismatchedDeallocator() { + int *p = (int *)malloc(sizeof(int)); + delete p; +} // expected-warning{{Memory is never released; potential leak of memory pointed to by 'p'}} -- cgit v1.1