From 09fa33bfe7c7f02bb18c78c5e15522fb99a9f357 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Sat, 6 Oct 2012 17:23:59 +0000 Subject: [PATCH] List of potential checkers: smart pointer checker: actually, unique_ptr will do the right thing for new[] allocated memory. Thanks David! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165365 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/analyzer/potential_checkers.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www/analyzer/potential_checkers.html b/www/analyzer/potential_checkers.html index a2d637548a..025c0a8e16 100644 --- a/www/analyzer/potential_checkers.html +++ b/www/analyzer/potential_checkers.html @@ -270,8 +270,10 @@ void f() throw(int) { (C++)

C++03: auto_ptr should store a pointer to an object obtained via new as allocated memory will be cleaned using delete
-C++11: unique_ptr and shared_ptr allow -to specify a custom deleter to handle the new[]/delete[] case correctly +C++11: one should use unique_ptr<T[]> to keep a pointer to memory +allocated by new[]
+C++11: to keep a pointer to memory allocated by new[] in a shared_ptr one +should use a custom deleter that calls delete[]
 #include <stdlib.h>
 #include <memory>