r218232 - Add some documentation stating that the memory allocated by the ASTContext.h placement new does not need to be explicitly freed

Ehsan Akhgari ehsan.akhgari at gmail.com
Sun Sep 21 19:26:17 PDT 2014


Author: ehsan
Date: Sun Sep 21 21:26:17 2014
New Revision: 218232

URL: http://llvm.org/viewvc/llvm-project?rev=218232&view=rev
Log:
Add some documentation stating that the memory allocated by the ASTContext.h placement new does not need to be explicitly freed

Reviewers: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5392

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=218232&r1=218231&r2=218232&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sun Sep 21 21:26:17 2014
@@ -2355,9 +2355,9 @@ static inline Selector GetUnarySelector(
 /// // Specific alignment
 /// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
 /// @endcode
-/// Please note that you cannot use delete on the pointer; it must be
-/// deallocated using an explicit destructor call followed by
-/// @c Context.Deallocate(Ptr).
+/// Memory allocated through this placement new operator does not need to be
+/// explicitly freed, as ASTContext will free all of this memory when it gets
+/// destroyed. Please note that you cannot use delete on the pointer.
 ///
 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
 /// @param C The ASTContext that provides the allocator.
@@ -2392,9 +2392,9 @@ inline void operator delete(void *Ptr, c
 /// // Specific alignment
 /// char *data = new (Context, 4) char[10];
 /// @endcode
-/// Please note that you cannot use delete on the pointer; it must be
-/// deallocated using an explicit destructor call followed by
-/// @c Context.Deallocate(Ptr).
+/// Memory allocated through this placement new[] operator does not need to be
+/// explicitly freed, as ASTContext will free all of this memory when it gets
+/// destroyed. Please note that you cannot use delete on the pointer.
 ///
 /// @param Bytes The number of bytes to allocate. Calculated by the compiler.
 /// @param C The ASTContext that provides the allocator.





More information about the cfe-commits mailing list