[cfe-dev] UsingShadowDecl everywhere?

John McCall rjmccall at apple.com
Fri Dec 17 15:05:59 PST 2010


On Dec 17, 2010, at 2:42 PM, Craig Silverstein wrote:
> } Shadow declarations should only show up in "found" declarations,
> } which I think are only ever stored as part of a DeclAccessPair.
> } Otherwise we should already have looked through the shadow decl.
> 
> Is there a way to summarize how they might be exposed through methods
> on AST classes?

1)  Lookups can find shadow declarations, and they exist in the decl hierarchy.  So the lookup and iteration methods on DeclContext can find them.
2)  Anything that's specifically storing a raw lookup result might point to a shadow declaration.  Generally this will be obvious because you'll actually be working with a DeclAccessPair.
3)  Everything else will have already looked through the using declaration.

>  Like would redecls_begin()/end() show a using shadow decl?

No.

>  I don't see DeclAccessPair as part of the API for AST nodes, so
> I'm guessing this is at a layer that's hidden from end users (like
> myself).

It's part of the API.  I'm not surprised you haven't seen it before, because there are relatively few places that need to store a raw lookup result, but it's there.

IIRC, the only places which need it are:
 - MemberExpr (which needs to store the raw lookup result for a resolved lookup with a dependent base type, e.g. T().A::foo)
 - UnresolvedLookupExpr
 - UnresolvedMemberExpr

OverloadExpr::decls_iterator's operator* returns a NamedDecl* for convenience, but it's really an iterator over DeclAccessPairs.

John.



More information about the cfe-dev mailing list