[cfe-dev] Identifiying (successfully resolved) overloaded function references.

John McCall rjmccall at apple.com
Fri Sep 30 02:57:54 PDT 2011


On Sep 30, 2011, at 2:19 AM, Enea Zaffanella wrote:
> We would like to identify the DeclRefExpr and MemberExpr AST nodes
> that have been created by looking up an overloaded function reference.
> As far as we can tell, there is no way to extract this information
> from the current AST. (Is such an impression correct?)

Yes, this information is lost because the OverloadExpr is thrown
away during resolution.  It wouldn't be difficult to preserve it, though,
maybe in some sort of side table on the ASTContext.

That won't catch every instance of overload resolution, though,
because operators are resolved without creating intermediate notes.
Is that acceptable?

> Hence, we would add a Boolean bitfield flag to AST nodes
>    DeclRefExpr and MemberExpr
> so as to be able to recognize those that originally were
>    UnresolvedLookupExpr and UnresolvedMemberExpr
> and have been changed by Sema method
>    Sema::FixOverloadedFunctionReference().
> 
> The new bitfield will be called, e.g.,
> IsResolvedOverloadedFunctionReference.
> 
> The addition of the Boolean flag is not going to impact on the memory
> footprint of the AST, because for both DeclRefExpr and MemberExpr nodes
> the new flag can be packed with 3 already existing Boolean bitfields.

I have no problem with this.

John.



More information about the cfe-dev mailing list