[cfe-dev] libclang: Merge multiple platform availability declarations
Alex L via cfe-dev
cfe-dev at lists.llvm.org
Wed May 17 04:21:04 PDT 2017
On 16 May 2017 at 19:16, Ronald Wampler via cfe-dev <cfe-dev at lists.llvm.org>
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
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170517/f44d413b/attachment.html>
More information about the cfe-dev
mailing list