[PATCH] D86780: Copy blocks in variadic methods

酷酷的哀殿 via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 30 06:33:36 PDT 2020


sunbohong updated this revision to Diff 288853.
sunbohong added a comment.
Herald added a subscriber: danielkiss.

Update copy blocks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86780

Files:
  clang/lib/Sema/SemaExprObjC.cpp


Index: clang/lib/Sema/SemaExprObjC.cpp
===================================================================
--- clang/lib/Sema/SemaExprObjC.cpp
+++ clang/lib/Sema/SemaExprObjC.cpp
@@ -1776,6 +1776,18 @@
                          Args.back()->getEndLoc());
     }
   }
+  if (!IsError) {
+    for (unsigned i = NumNamedArgs, e = Args.size(); i < e; ++i) {
+      if (Args[i]->isTypeDependent())
+        continue;
+      // copy blocks [NSArray arrayWithObjects:^(){NSLog(@"blk0:%d", val);},^(){NSLog(@"blk1:%d", val);}, nil];
+      if (Args[i]->getType()->isBlockPointerType()) {
+        ExprResult arg = Args[i];
+        maybeExtendBlockObject(arg);
+        Args[i] = arg.get();
+      }
+    }
+  }
 
   DiagnoseSentinelCalls(Method, SelLoc, Args);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86780.288853.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200830/17aedd06/attachment.bin>


More information about the cfe-commits mailing list