[patch][pr17624] Consider hidden decls for isUsed checks

Richard Smith richard at metafoo.co.uk
Tue Oct 22 14:25:53 PDT 2013


Patch LGTM.

I share your concern that we could do with a more comprehensive check for
similar bugs. That said, in this case, it seems to me that the root cause
is that a per-Decl 'used' flag doesn't really make much sense in the way we
use it now. I think we should either track whether that particular
declaration is used (with isUsed scanning the entire redecl chain), or we
should only have one flag for the entire redeclaration chain (perhaps by
always looking at the flag on either the most recent decl or the canonical
decl). Modeling it as "is this declaration or any previous declaration
used" is weird, and requires contortions like the loop at the end of
Sema::MarkFunctionReferenced.


On Tue, Oct 22, 2013 at 12:41 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> Rebased patch attached.
>
> On 19 October 2013 18:51, Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> wrote:
> > Hi Richard,
> >
> > The attached patch fixes pr17624, but I worry there might be more bugs
> > like this. Some analysis must ignore hidden decls so that, for
> > example, we accept
> >
> > void f4() {
> >   void g4(int a, int b = 7);
> >   {
> >     void g4(int a, int b = 5);
> >   }
> >   void g4(int a = 5, int b);
> > }
> >
> > but is isUsed really the only check that has to consider the true most
> > recent decl?
> >
> > Cheers,
> > Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131022/c4506ac6/attachment.html>


More information about the cfe-commits mailing list