[cfe-dev] Obj-C false positive warning with deprecation and instancetype?

Ted Kremenek kremenek at apple.com
Wed Jan 11 12:35:13 PST 2012

Hi Sean,

As Fariborz suggested, please file a bug so we can dig deeper.  For us the preferred place is bugreporter.apple.com, but an LLVM Bugzilla report is fine too.  We'll likely need preprocessed source or a reduced test case.


On Jan 11, 2012, at 12:24 PM, Sean McBride wrote:

> On Wed, 11 Jan 2012 12:02:32 -0800, jahanian said:
>>>> If alloc is using instancetype then you shouldn't see this warning.
>> Please file a bug report with the pre-processed file.
>>> According to clang doc, "+alloc implicitly has a related result type".
>> So clang should be able to determine what the return type is.
>> Can you point to the document? This can't be part of the 'clang' doc.
>> 'alloc' need to use instancetype for type deduction purposes. Legacy
>> frameworks use 'id' for 'alloc' type.
> It's here:
> <http://clang.llvm.org/docs/LanguageExtensions.html#objc_instancetype>
> "The related result type can also be inferred for some methods. To determine whether a method has an inferred related result type, the first word in the camel-case selector (e.g., "init" in "initWithObjects") is considered....."
> This doc is exactly what's lead me to believe this is a false positive.
> -- 
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com 
> Mac Software Developer              Montréal, Québec, Canada
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list