[cfe-commits] Clang change to detect and warn about unused private members

Daniel Jasper djasper at google.com
Tue May 22 15:17:48 PDT 2012


On Fri, May 11, 2012 at 12:37 AM, Jordan Rose <jediknil at belkadan.com> wrote:

>
> On May 10, 2012, at 18:12, Daniel Jasper wrote:
>
> > Ok, I now reuse Sema::RecordDeclSetTy.
> >
> > As for putting a bit into FieldDecl as opposed to the UnusedPrivateField
> SetVector: It seems like FieldDecl is carefully crafted for size. Just
> adding another bit for this use case doesn't seem right.
> >
> > Please find the new version attached.
>
> CachedFieldIndex is just the index of the field in the record; there's no
> way that'll reach 2^31 anyway. (For comparison, C++11 [implimits] suggests
> a minimum of 4096 members.)
>
> Also, it looks like Decl already has an isUsed() predicate. Are we already
> marking FieldDecls this way?


I have been looking into this some more. Marking the fields as used works
fine, but I didn't find an easy way to iterate over all of the FieldDecls
in a translation unit at the end. Thus, I suggest to stick with the
previous version of my patch. Should also neither be a big performance nor
memory impact. What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120523/458d2e19/attachment.html>


More information about the cfe-commits mailing list