[PATCH] D30136: [compiler-rt][builtins][WIP] Add _IsOSVersionAtLeast, to be used by ObjC's @available
Erik Pilkington via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 18 10:40:49 PST 2017
erik.pilkington created this revision.
Herald added subscribers: mgorny, dberris.
This patch adds the function `_IsOSVersionAtLeast`, which uses of Objective-C's `@available` will compile into. This function uses the Core Foundation API to parse the SystemVersion.plist file, which contains the marketing OS version, which is used by @available, as recommended here: https://reviews.llvm.org/D27827.
The API that I used for this requires at least macOS 10.6/iOS 4.0. Is this far enough back? We could provide to a conservative mapping from darwin versions to marketing versions (as suggested by Alex Lorenz) if this is too new.
Inb4 this patch doesn't have a testcase! I can't figure out how to run the builtins tests, looks like they're not attached to the cmake check-all target, as mentioned in `test/CMakeLists.txt:8`, and the shell script at `test/builtins/Unit/test` errors out on me (it can't find the darwin_fat directory), and looks like it hasn't been touched since 2010. How are these tests run? Is there any place where this is documented?
I did test this on my own machine, and works as intended on iOS simulators and macOS.
This patch is part of a feature I proposed last summer:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html
Thanks for taking a look!
Erik
https://reviews.llvm.org/D30136
Files:
lib/builtins/CMakeLists.txt
lib/builtins/os_version_check.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30136.89027.patch
Type: text/x-patch
Size: 3804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170218/c03cdd4a/attachment.bin>
More information about the llvm-commits
mailing list