[cfe-commits] r74717 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp

Fariborz Jahanian fjahanian at apple.com
Thu Jul 2 14:31:44 PDT 2009


On Jul 2, 2009, at 12:58 PM, Chris Lattner wrote:

> On Jul 2, 2009, at 11:26 AM, Fariborz Jahanian wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=74717&view=rev
>> Log:
>> Patch to allocate list of bases in CXXRecordDecl
>> using ASTContxt allocation.
>>
>> +++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Jul  2 13:26:15 2009
>> @@ -44,11 +44,16 @@
>> }
>>
>> CXXRecordDecl::~CXXRecordDecl() {
>> -  delete [] Bases;
>> +}
>> +
>> +void CXXRecordDecl::Destroy(ASTContext &C) {
>> +  C.Deallocate(Bases);
>> +  this->RecordDecl::Destroy(C);
>> }
>
> Random thought: is Deallocate safe for array new allocations?

According to this commented routine in ASTContext.h it should be  
(unless I am
misreading the comment).

/// This operator is just a companion to the new[] above. There is no  
way of
/// invoking it directly; see the new[] operator for more details.  
This operator
/// is called implicitly by the compiler if a placement new[]  
expression using
/// the ASTContext throws in the object constructor.
inline void operator delete[](void *Ptr, clang::ASTContext &C) throw  
() {
   C.Deallocate(Ptr);
}

- Fariborz




>
>
> -Chris
>
>>



More information about the cfe-commits mailing list