Index: clang/lib/Sema/SemaDeclObjC.cpp =================================================================== --- clang/lib/Sema/SemaDeclObjC.cpp +++ clang/lib/Sema/SemaDeclObjC.cpp @@ -4836,6 +4836,10 @@ cast(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) 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]; +}