[PATCH] D92808: [ObjC][ARC] Annotate calls with attributes instead of emitting retainRV or claimRV calls in the IR

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 20 15:17:04 PST 2021


rjmccall added a comment.

I think the plan should be to use this code pattern on all targets, but starting it with arm64 seems fine.



================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2342
+    attrs = attrs.addAttribute(CGF.getLLVMContext(),
+                               llvm::AttributeList::ReturnIndex, "rv_marker");
+    callBase->setAttributes(attrs);
----------------
It's weird that these attributes use two different capitalization styles.  Also, why are they both needed?  Did you consider making the role (retain/claim) be the value of the attribute rather than a separate attribute?

Should the attribute be namespaced, like `clang.arc.rv_marker`?

Let's go ahead and add globals for these strings so we can refer to them symbolically, like you did with `retainRVMarkerKey`.  Is there an LLVM header for ARC optimization we could reasonably pull them from, or are we doomed to repeat ourselves across projects?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92808



More information about the cfe-commits mailing list