[PATCH] D30977: [CodeGen] Emit a CoreFoundation link guard when @available is used

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 09:48:11 PDT 2017

rjmccall added inline comments.

Comment at: lib/CodeGen/CGObjC.cpp:3423
+    return;
+  if (!IsOSVersionAtLeastFn)
+    return;
Reverse these checks, please; IsOSVersionAtLeastFn is much cheaper to check and will predominantly be null.

Comment at: lib/CodeGen/CGObjC.cpp:3428
+  // CoreFoundation is not used in the code, the linker won't link the
+  // framework.
+  auto &Context = getLLVMContext();
Can you explain why compiler-rt has to load the symbol at runtime?  Is this just some compiler-rt testing thing?  Because it seems like a shame to pay a code-size cost — even a negligible one — for something like that.



More information about the cfe-commits mailing list