[PATCH] D71091: Make sure that the implicit arguments for direct methods have been setup

Pierre Habouzit via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 14:26:53 PST 2019


MadCoder created this revision.
MadCoder added reviewers: rjmccall, arphaman, dexonsmith.
MadCoder added a project: clang.
Herald added a subscriber: cfe-commits.
MadCoder added a comment.

turns out that I had no codegen check for the call site and that one of the last iteration broke it trivially :'(


Radar-Id: rdar://problem/57661767


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71091

Files:
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/test/CodeGenObjC/direct-method.m


Index: clang/test/CodeGenObjC/direct-method.m
===================================================================
--- clang/test/CodeGenObjC/direct-method.m
+++ clang/test/CodeGenObjC/direct-method.m
@@ -173,3 +173,9 @@
 // CHECK-LABEL: define hidden void @"\01-[Foo setGetDynamic_setDirect:]"(
 // CHECK-LABEL: define internal void @"\01-[Foo .cxx_destruct]"(
 @end
+
+int useRoot(Root *r) {
+  // CHEC-LABEL: define i32 @useRoot
+  // CHECK: %call = call i32 bitcast {{.*}} @"\01-[Root getInt]"
+  return [r getInt];
+}
Index: clang/lib/Sema/SemaDeclObjC.cpp
===================================================================
--- clang/lib/Sema/SemaDeclObjC.cpp
+++ clang/lib/Sema/SemaDeclObjC.cpp
@@ -4836,6 +4836,10 @@
     cast<DeclContext>(ClassDecl)->addDecl(ObjCMethod);
   }
 
+  if (ObjCMethod->isDirectMethod()) {
+    ObjCMethod->createImplicitParams(Context, ObjCMethod->getClassInterface());
+  }
+
   if (PrevMethod) {
     // You can never have two method definitions with the same name.
     Diag(ObjCMethod->getLocation(), diag::err_duplicate_method_decl)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71091.232453.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191205/8fe55e4f/attachment.bin>


More information about the cfe-commits mailing list