[PATCH] D86763: RedeclarePropertyAccessor (clang/lib/Sema/SemaObjCProperty.cpp shipped with https://reviews.llvm.org/rG2073dd2da702baca447efaf1879cb6151e8c6100) create a synthesized property accessor

2020-08-27 Thread 殿 via Phabricator via cfe-commits
sunbohong created this revision.
Herald added subscribers: cfe-commits, yaxunl.
Herald added a project: clang.
sunbohong requested review of this revision.

...metadata in RewriteModernObjC.cpp.

This commit will fix https://bugs.llvm.org/show_bug.cgi?id=47330 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86763

Files:
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp


Index: clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
===
--- clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -7024,27 +7024,6 @@
 
   // Build _objc_method_list for class's instance methods if needed
   SmallVector InstanceMethods(IDecl->instance_methods());
-
-  // If any of our property implementations have associated getters or
-  // setters, produce metadata for them as well.
-  for (const auto *Prop : IDecl->property_impls()) {
-if (Prop->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
-  continue;
-if (!Prop->getPropertyIvarDecl())
-  continue;
-ObjCPropertyDecl *PD = Prop->getPropertyDecl();
-if (!PD)
-  continue;
-if (ObjCMethodDecl *Getter = Prop->getGetterMethodDecl())
-  if (mustSynthesizeSetterGetterMethod(IDecl, PD, true /*getter*/))
-InstanceMethods.push_back(Getter);
-if (PD->isReadOnly())
-  continue;
-if (ObjCMethodDecl *Setter = Prop->getSetterMethodDecl())
-  if (mustSynthesizeSetterGetterMethod(IDecl, PD, false /*setter*/))
-InstanceMethods.push_back(Setter);
-  }
-
   Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
   "_OBJC_$_INSTANCE_METHODS_",
   IDecl->getNameAsString(), true);


Index: clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
===
--- clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -7024,27 +7024,6 @@
 
   // Build _objc_method_list for class's instance methods if needed
   SmallVector InstanceMethods(IDecl->instance_methods());
-
-  // If any of our property implementations have associated getters or
-  // setters, produce metadata for them as well.
-  for (const auto *Prop : IDecl->property_impls()) {
-if (Prop->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
-  continue;
-if (!Prop->getPropertyIvarDecl())
-  continue;
-ObjCPropertyDecl *PD = Prop->getPropertyDecl();
-if (!PD)
-  continue;
-if (ObjCMethodDecl *Getter = Prop->getGetterMethodDecl())
-  if (mustSynthesizeSetterGetterMethod(IDecl, PD, true /*getter*/))
-InstanceMethods.push_back(Getter);
-if (PD->isReadOnly())
-  continue;
-if (ObjCMethodDecl *Setter = Prop->getSetterMethodDecl())
-  if (mustSynthesizeSetterGetterMethod(IDecl, PD, false /*setter*/))
-InstanceMethods.push_back(Setter);
-  }
-
   Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
   "_OBJC_$_INSTANCE_METHODS_",
   IDecl->getNameAsString(), true);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86780: Copy blocks in variadic methods

2020-08-28 Thread 殿 via Phabricator via cfe-commits
sunbohong created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
sunbohong requested review of this revision.

This commit will fix https://bugs.llvm.org/show_bug.cgi?id=46399.


Repository:
  rG LLVM Github Monorepo

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
@@ -1777,6 +1777,17 @@
 }
   }
 
+  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);
 
   // Do additional checkings on method.


Index: clang/lib/Sema/SemaExprObjC.cpp
===
--- clang/lib/Sema/SemaExprObjC.cpp
+++ clang/lib/Sema/SemaExprObjC.cpp
@@ -1777,6 +1777,17 @@
 }
   }
 
+  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);
 
   // Do additional checkings on method.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86780: Copy blocks in variadic methods

2020-08-30 Thread 殿 via Phabricator via cfe-commits
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);
 


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);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits