[PATCH] D27827: [ObjC] CodeGen support for @available on macOS

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 13:11:16 PST 2017


arphaman added inline comments.


================
Comment at: lib/CodeGen/CodeGenFunction.h:2479
 
+  llvm::Value *EmitObjCIsOSVersionAtLeast(ArrayRef<llvm::Value *> Args);
+
----------------
I think it's better to treat this as a builtin in its own right, without including the ObjC part in the names. This function could be renamed to something like `EmitBuiltinAvailable` and the variable that holds the function pointer should be renamed appropriately as well.


================
Comment at: test/CodeGenObjC/availability-check.m:5
+void use_at_available() {
+  // CHECK: call i32 @_IsOSVersionAtLeast(i32 10, i32 12, i32 0)
+  // CHECK-NEXT: icmp ne
----------------
I think the function name should have the lowercase `is`


================
Comment at: test/CodeGenObjC/availability-check.m:7
+  // CHECK-NEXT: icmp ne
+  if (__builtin_available(macos 10.12, *))
+    ;
----------------
Can you add a call to the builtin that has a non-zero sub-minor version as well?


https://reviews.llvm.org/D27827





More information about the cfe-commits mailing list