[PATCH] Fix DeclRefExpr::getFoundDecl() for non-call references.

Richard Smith richard at metafoo.co.uk
Wed Mar 20 14:55:56 PDT 2013


On Wed, Mar 20, 2013 at 2:37 PM, Daniel Jasper <djasper at google.com> wrote:

> ================
> Comment at: lib/Sema/SemaExpr.cpp:2363-2364
> @@ -2362,4 +2362,4 @@
>    if (!NeedsADL && R.isSingleResult() &&
> !R.getAsSingle<FunctionTemplateDecl>())
> -    return BuildDeclarationNameExpr(SS, R.getLookupNameInfo(),
> -                                    R.getFoundDecl());
> +    return BuildDeclarationNameExpr(SS, R.getLookupNameInfo(),
> R.getFoundDecl(),
> +                                    R.getRepresentativeDecl());
>
> ----------------
> Richard Smith wrote:
> > These arguments appear to be reversed from the declaration of
> BuildDeclarationNameExpr. Is that intentional?
> I hope I am getting this right. I think they just mean different things.
> The confusion is about FoundD(ecl).
>
> In the context of a DeclRefExpr, it seems to mean the actually referenced
> Decl, i.e. the UsingShadowDecl if it references through it. In the context
> of a LookupResult, the getFoundDecl() returns the underlying decl and
> getRepresentativeDecl() returns what would be the
> DeclRefExpr::getFoundDecl().
>

I see. That's some unfortunate naming choices :-/

On Wed, Mar 20, 2013 at 2:45 PM, Daniel Jasper <djasper at google.com> wrote:

>
>   Looking at how/where to add a test, would
> clang/test/Misc/ast-dump-stmt.c be a good place?


SGTM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130320/2f4194a3/attachment.html>


More information about the cfe-commits mailing list