[llvm-branch-commits] [llvm] [ObjC] Support objc_claimAutoreleasedReturnValue (PR #138696)

Florian Hahn via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 6 12:47:35 PDT 2025


================
@@ -160,10 +160,7 @@ static bool lowerObjCCall(Function &F, const char *NewFn,
     auto *CB = cast<CallBase>(U.getUser());
 
     if (CB->getCalledFunction() != &F) {
-      objcarc::ARCInstKind Kind = objcarc::getAttachedARCFunctionKind(CB);
-      (void)Kind;
-      assert((Kind == objcarc::ARCInstKind::RetainRV ||
-              Kind == objcarc::ARCInstKind::UnsafeClaimRV) &&
+      assert((*objcarc::getAttachedARCFunction(CB) == &F) &&
----------------
fhahn wrote:

I *think* you don't need to dereference the std::optional for the compare, below should work

```suggestion
      assert(objcarc::getAttachedARCFunction(CB) == &F &&
```

https://github.com/llvm/llvm-project/pull/138696


More information about the llvm-branch-commits mailing list