From 5acd9709d79e3c80e92a0d43884c671a034e2a01 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 22 Sep 2014 02:26:17 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218232 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ASTContext.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 6b2a3bac3f..4da5be876a 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -2355,9 +2355,9 @@ static inline Selector GetUnarySelector(StringRef name, ASTContext& Ctx) { /// // 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, const clang::ASTContext &C, size_t) { /// // 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. -- 2.40.0