[cfe-dev] C++ using-directive parsing

Piotr Rak piotr.rak at gmail.com
Sat Dec 27 21:41:37 PST 2008


2008/12/27 Sebastian Redl <sebastian.redl at getdesigned.at>:
> Douglas Gregor wrote:
>>
>> Hi Piotr,
>>
>> On Dec 26, 2008, at 8:01 PM, Piotr Rak wrote:
>>  +// Defined out-of-line here because of dependecy on AttributeList
>> +Action::DeclTy *Action::ActOnUsingDirective(Scope *CurScope,
>> +                                            SourceLocation UsingLoc,
>> +                                            SourceLocation  NamespaceLoc,
>> +                                            const CXXScopeSpec &SS,
>> +                                            DeclTy *Namespace,
>> +                                            AttributeList *AttrList) {
>> +
>> +  // FIXME: Parser seems to assume that Action::ActOn* takes  ownership
>> over
>> +  // passed AttributeList, however other actions don't free it, is it
>> +  // temporary state or bug?
>> +  delete AttrList;
>> +  return 0;
>> +}
>>
>> We're still working on the ownership issues with the Parse-Sema
>>  interaction (with Sebastian Redl leading the charge), so this is a  good
>> FIXME to leave in place to remind us to deal with these issues.
>>
>>
>
> AttributeList ... interesting. So it's defined out-of-line since the delete
> needs the full definition, while all existing uses of AttributeList leak the
> object and thus are satisfied with the declaration.
> I'll add AttributeList to the things that need to have their ownership
> straightened out.
>
I have changes fixing this leakages by delete'ing in my local branch.
Maybe just use llvm::OwningPtr<AttributeList> instead plain C pointers
in ActOn*.
This would enforce taking ownership by Action. If this is ok, please
let me know and I  will submit this change.

Piotr



More information about the cfe-dev mailing list