[cfe-commits] r52051 - in /cfe/trunk/lib/AST: DeclObjC.cpp TranslationUnit.cpp

Fariborz Jahanian fjahanian at apple.com
Fri Jun 6 10:50:05 PDT 2008


On Jun 6, 2008, at 10:41 AM, Ted Kremenek wrote:

>
> On Jun 6, 2008, at 10:31 AM, Fariborz Jahanian wrote:
>
>>
>> On Jun 6, 2008, at 10:21 AM, Ted Kremenek wrote:
>>
>>> Author: kremenek
>>> Date: Fri Jun  6 12:21:42 2008
>>> New Revision: 52051
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=52051&view=rev
>>> Log:
>>> Because of a lack of a clear ownership role between  
>>> ObjCInterfaceDecls and
>>> ObjCPropertyDecls, have TranslationUnit destroy ObjCPropertyDecls.  
>>> This is a
>>
>> I am not sure what you meant by ownership role? ObjCInterfaceDecls  
>> has the list of properties declared for the class. This is no  
>> different than ivars, methods, etc.
>>
>> - Fariborz
>
>
> From what I can tell, the PropertyDecls array in ObjCInterfaceDecl  
> contains both ObjCPropertyDecls created for the specific class as  
> well as the ObjCPropertyDecls in the parent class.  I may be  
> mistaken about this, but

We are merging properties declared in class's protocol into those for  
current class. Look at:

/// MergeOneProtocolPropertiesIntoClass - This routine goes thru the  
list
/// of properties declared in a protocol and adds them to the list
/// of properties for current class if it is not there already.
void
Sema::MergeOneProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
                                           ObjCProtocolDecl *PDecl)

- fariborz



> when I tried to simply destroy ObjCPropertyDecls when iterating over  
> the PropertyDecls array I get double-free errors (a test case failed  
> in the test suite).  With this horrible hack (having TranslationUnit  
> keep track of the ObjCPropertyDecls released), the error goes away.   
> The only way that should make a difference is if two  
> ObjCInterfaceDecls have references to the same ObjCPropertyDecl,  
> which implies a lack of a clear ownership policy.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080606/8ffc362b/attachment.html>


More information about the cfe-commits mailing list