// If we have an implementation, import it as well.
if (D->getImplementation()) {
ObjCCategoryImplDecl *Impl
- = cast<ObjCCategoryImplDecl>(Importer.Import(D->getImplementation()));
+ = cast_or_null<ObjCCategoryImplDecl>(
+ Importer.Import(D->getImplementation()));
if (!Impl)
return 0;
}
Importer.Imported(D, ToImpl);
- ImportDeclContext(ToImpl);
+ ImportDeclContext(D);
return ToImpl;
}
@interface I2 (Cat3)
@end
+@implementation I2 (Cat3)
+@end
+
// Category with implementation
@interface I2 (Cat4)
@end
+@implementation I2 (Cat4)
+@end
+
+// Category with mismatched implementation
+@interface I2 (Cat6)
+@end
+
+@implementation I2 (Cat6)
+- (float)blah { return 0; }
+@end
+
@interface I2 (Cat3)
@end
+@implementation I2 (Cat3)
+@end
+
// Category with implementation
@interface I2 (Cat5)
@end
+
+@implementation I2 (Cat5)
+@end
+
+// Category with mismatched implementation
+@interface I2 (Cat6)
+@end
+
+@implementation I2 (Cat6)
+- (int)blah { return 0; }
+@end
// CHECK: category1.m:16:1: note: instance method 'method2' also declared here
// CHECK: category2.m:26:1: error: instance method 'method3' has incompatible result types in different translation units ('float' vs. 'int')
// CHECK: category1.m:24:1: note: instance method 'method3' also declared here
-// CHECK: 2 errors generated.
+// CHECK: category2.m:48:1: error: instance method 'blah' has incompatible result types in different translation units ('int' vs. 'float')
+// CHECK: category1.m:46:1: note: instance method 'blah' also declared here
+// CHECK: 3 errors generated.