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

Reid Kleckner rnk at google.com
Thu Sep 18 09:29:43 PDT 2014


Thanks, lgtm!

================
Comment at: include/clang/AST/ASTContext.h:2360-2361
@@ -2360,1 +2359,4 @@
+/// explicitly freed, as ASTContext will free all of this memory when it gets
+/// destroyed. 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).
----------------
Context.Deallocate() is a noop, so I think this last sentence is incorrect. I'd delete it or shorten to "Note that you cannot use delete on the pointer."

================
Comment at: include/clang/AST/ASTContext.h:2399-2400
@@ -2397,1 +2398,4 @@
+/// explicitly freed, as ASTContext will free all of this memory when it gets
+/// destroyed. 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).
----------------
Ditto

http://reviews.llvm.org/D5392






More information about the cfe-commits mailing list