libclang: Merge multiple platform availability declarations

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

libclang: Merge multiple platform availability declarations

Victor Leschuk via cfe-dev
Hi,

I’m working on a tool to list all deprecated APIs on macOS and using libclang's `clang_getCursorPlatformAvailability`. On macOS 10.12, the APIs are marked (to best of my knowledge) deprecated using the following  macro __OSX_DEPRECATED(_start, _dep, _msg)

Which is defined as

__OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)

These macros expand to something like

__attribute__((availability(macosx,introduced=_start))) __attribute__((availability(macosx,deprecated=_dep,message=_msg)))

This appears to cause `clang_getCursorPlatformAvailability` to populate the array with two separate CXPlatformAvailability instances. Would it not be desirable to merge these two declarations as if it was defined as just  __attribute__((availability(macosx,introduced=_start,deprecated=_dep,message=_msg)))?

Thank you,

Ron

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: libclang: Merge multiple platform availability declarations

Victor Leschuk via cfe-dev


On 16 May 2017 at 19:16, Ronald Wampler via cfe-dev <[hidden email]> wrote:
Hi,

I’m working on a tool to list all deprecated APIs on macOS and using libclang's `clang_getCursorPlatformAvailability`. On macOS 10.12, the APIs are marked (to best of my knowledge) deprecated using the following  macro __OSX_DEPRECATED(_start, _dep, _msg)

Which is defined as

__OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)

These macros expand to something like

__attribute__((availability(macosx,introduced=_start))) __attribute__((availability(macosx,deprecated=_dep,message=_msg)))

This appears to cause `clang_getCursorPlatformAvailability` to populate the array with two separate CXPlatformAvailability instances. Would it not be desirable to merge these two declarations as if it was defined as just  __attribute__((availability(macosx,introduced=_start,deprecated=_dep,message=_msg)))?


Yes, right now the API populates the CXPlatformAvailability array based on the exact attributes specified in the source. IMHO, it makes sense to keep things simple in libclang and to map directly to the AST representation if possible, which we kind of end up doing here. But your argument makes sense too, at least from the perspective of a libclang user. I would encourage you to create a patch that merges these availability instances in libclang and send it to the list for review if you are interested in seeing this fixed.

Alex
 
Thank you,

Ron

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: libclang: Merge multiple platform availability declarations

Victor Leschuk via cfe-dev

> On May 17, 2017, at 7:21 AM, Alex L <[hidden email]> wrote:
>
>
>
> On 16 May 2017 at 19:16, Ronald Wampler via cfe-dev <[hidden email]> wrote:
> Hi,
>
> I’m working on a tool to list all deprecated APIs on macOS and using libclang's `clang_getCursorPlatformAvailability`. On macOS 10.12, the APIs are marked (to best of my knowledge) deprecated using the following  macro __OSX_DEPRECATED(_start, _dep, _msg)
>
> Which is defined as
>
> __OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)
>
> These macros expand to something like
>
> __attribute__((availability(macosx,introduced=_start))) __attribute__((availability(macosx,deprecated=_dep,message=_msg)))
>
> This appears to cause `clang_getCursorPlatformAvailability` to populate the array with two separate CXPlatformAvailability instances. Would it not be desirable to merge these two declarations as if it was defined as just  __attribute__((availability(macosx,introduced=_start,deprecated=_dep,message=_msg)))?
>
>
> Yes, right now the API populates the CXPlatformAvailability array based on the exact attributes specified in the source. IMHO, it makes sense to keep things simple in libclang and to map directly to the AST representation if possible, which we kind of end up doing here. But your argument makes sense too, at least from the perspective of a libclang user. I would encourage you to create a patch that merges these availability instances in libclang and send it to the list for review if you are interested in seeing this fixed.

Thanks. I'll try to get a patch together shortly and see how it turns out.

Ron

>
> Alex
>  
> Thank you,
>
> Ron
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...