[PATCH] D55349: Convert some ObjC alloc msgSends to runtime calls

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 5 21:51:19 PST 2018


rjmccall added inline comments.


================
Comment at: include/clang/Basic/ObjCRuntime.h:189
+  /// When this method returns true, Clang will turn non-super message sends of
+  /// certain selectors into calls to the correspond entrypoint:
+  ///   alloc => objc_alloc
----------------
"corresponding"


================
Comment at: include/clang/Basic/ObjCRuntime.h:190
+  /// certain selectors into calls to the correspond entrypoint:
+  ///   alloc => objc_alloc
+  bool shouldUseRuntimeFunctionsForAlloc() const {
----------------
The actual code also rewrites `allocWithZone:` (which is why it's reasonable to pluralize "functions" in the method name).


================
Comment at: include/clang/Basic/ObjCRuntime.h:200
+    case WatchOS:
+      return true;
+
----------------
Did we really add this so long ago?  Wow.


================
Comment at: lib/CodeGen/CGObjC.cpp:383
+    // prefix are identified as OMF_alloc but we only want to call the
+    // runtime for this version.
+    if (Runtime.shouldUseRuntimeFunctionsForAlloc() &&
----------------
Using the word "selector" instead of "name" is both more technically accurate and nicely side-steps the difference between "alloc" (which you want to include) and "alloc:" (which you don't).  You have this correct in the code.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55349/new/

https://reviews.llvm.org/D55349





More information about the cfe-commits mailing list