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

Sebastian Redl sebastian.redl at getdesigned.at
Sat Dec 27 01:18:51 PST 2008


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.

Great work on the patch. I have nothing to add to Doug's comments.

Sebastian



More information about the cfe-dev mailing list