diff options
author | dim <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
commit | ea266cad53e3d49771fa38103913d3ec7a166694 (patch) | |
tree | 8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/Analysis/NewDelete-custom.cpp | |
parent | c72c57c9e9b69944e3e009cd5e209634839581d3 (diff) | |
download | FreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.zip FreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.tar.gz |
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3
release):
http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final@183502
Diffstat (limited to 'test/Analysis/NewDelete-custom.cpp')
-rw-r--r-- | test/Analysis/NewDelete-custom.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/test/Analysis/NewDelete-custom.cpp b/test/Analysis/NewDelete-custom.cpp index 7d7796b..c64bfce 100644 --- a/test/Analysis/NewDelete-custom.cpp +++ b/test/Analysis/NewDelete-custom.cpp @@ -1,6 +1,12 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.cplusplus.NewDelete,unix.Malloc -analyzer-store region -std=c++11 -fblocks -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.NewDelete,unix.Malloc -std=c++11 -fblocks -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.NewDelete,alpha.cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -DLEAKS -fblocks -verify %s #include "Inputs/system-header-simulator-cxx.h" +#ifndef LEAKS +// expected-no-diagnostics +#endif + + void *allocator(std::size_t size); void *operator new[](std::size_t size) throw() { return allocator(size); } @@ -19,7 +25,10 @@ void testNewMethod() { C *p2 = new C; // no warn C *c3 = ::new C; -} // expected-warning{{Memory is never released; potential leak}} +} +#ifdef LEAKS +// expected-warning@-2{{Potential leak of memory pointed to by 'c3'}} +#endif void testOpNewArray() { void *p = operator new[](0); // call is inlined, no warn @@ -27,7 +36,11 @@ void testOpNewArray() { void testNewExprArray() { int *p = new int[0]; -} // expected-warning{{Memory is never released; potential leak}} +} +#ifdef LEAKS +// expected-warning@-2{{Potential leak of memory pointed to by 'p'}} +#endif + //----- Custom non-placement operators void testOpNew() { @@ -36,16 +49,26 @@ void testOpNew() { void testNewExpr() { int *p = new int; -} // expected-warning{{Memory is never released; potential leak}} +} +#ifdef LEAKS +// expected-warning@-2{{Potential leak of memory pointed to by 'p'}} +#endif + //----- Custom NoThrow placement operators void testOpNewNoThrow() { void *p = operator new(0, std::nothrow); -} // expected-warning{{Memory is never released; potential leak}} +} +#ifdef LEAKS +// expected-warning@-2{{Potential leak of memory pointed to by 'p'}} +#endif void testNewExprNoThrow() { int *p = new(std::nothrow) int; -} // expected-warning{{Memory is never released; potential leak}} +} +#ifdef LEAKS +// expected-warning@-2{{Potential leak of memory pointed to by 'p'}} +#endif //----- Custom placement operators void testOpNewPlacement() { |