[cfe-dev] libclang clang_getCursorPlatformAvailability fails often

Douglas Gregor dgregor at apple.com
Fri May 10 13:22:47 PDT 2013


On May 10, 2013, at 2:57 AM, ivan <ivasic+clang at gmail.com> wrote:

> Hi all,
> 
> It seems to me that clang_getCursorPlatformAvailability API in libclang
> fails to find availability too often for OSX SDK APIs. Normally, for iOS it
> seems to work much better even for the same Foundation APIs.
> 
> A few random examples (I have many examples) can be:
> 
>  //in NSLayoutConstraint.h
>  - (void)layoutIfNeeded NS_AVAILABLE_MAC(10_7);
> 
>  //in NSWindow.h
>  - (BOOL)preventsApplicationTerminationWhenModal NS_AVAILABLE_MAC(10_6);
> 
> I have a simple test Xcode project that reproduces this behaviour here: 
> http://cl.ly/2B261r2X0H3y <http://cl.ly/2B261r2X0H3y>  
> (Just modify your Xcode path if it's not in standard location and build&run)
> 
> It's possible that I'm doing something wrong but the exact same code works
> pretty well with iOS headers. Also, I'm really not sure about this but it
> seems that it fails finding the availability mostly on methods while
> classes, enums etc.. work okay.
> 

Have you looked at the preprocessed output in both cases? My guess is that the OS X APIs are mapping the availability macros down to unavailable/deprecated/nothing, rather than Clang's 'availability' attribute.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130510/f64924de/attachment.html>


More information about the cfe-dev mailing list