[cfe-commits] r97103 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/unused.m

Ted Kremenek kremenek at apple.com
Thu Feb 25 10:21:51 PST 2010


On Feb 25, 2010, at 10:11 AM, Fariborz Jahanian wrote:

> 
> On Feb 25, 2010, at 10:01 AM, Ted Kremenek wrote:
> 
>> Right now it is only used by the static analyzer, but I think the question is a bit ill-phrased.
>> 
>> By the compiler, are you taking about code generation or warnings?  Right now this attribute is only consulted for the purpose of omitting warnings.  In this
> I meant warnings. I can't see how code generation can be involved here.
> 
>> regards the static analyzer is just a more advanced tool for issuing warnings than the compiler, so there is no reason the compiler couldn't use it for this purpose as well if the need came up.  I'm not being hypothetical here; I'm just saying this was added for the sake of better warnings.
> 
> I am not sure how static analyzer can issue warning and not having many false positives. You need whole program analysis
> to see all implementations (of class and its categories).

For ivars, most of the time categories are declared within the same .m file as the @implementation.  It's a heuristic, but it works fairly well.  Yes there are false positives, but those are acceptable in the static analyzer as long as the false positive rate is reasonable.

As for whole-program analysis, we will eventually get there.

> Also, ivars maybe be accessed through properties. Does
> static analyzer consider this?

Yes it does.  This check has been around for a long time.  People would have severely complained if that wasn't the case.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100225/85d32453/attachment.html>


More information about the cfe-commits mailing list