During deserialization clang is currently missing the merging of
protocols into the canonical interface for the class extension.
This merging only currently happens during parsing and should also
be considered during deserialization.
rdar://problem/
38724303
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331063
91177308-0d34-0410-b5e6-
96231b3b80d8
ProtoLocs.push_back(ReadSourceLocation());
CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(),
Reader.getContext());
+
+ // Protocols in the class extension belong to the class.
+ if (NumProtoRefs > 0 && CD->ClassInterface && CD->IsClassExtension())
+ CD->ClassInterface->mergeClassExtensionProtocolList(
+ (ObjCProtocolDecl *const *)ProtoRefs.data(), NumProtoRefs,
+ Reader.getContext());
}
void ASTDeclReader::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *CAD) {
--- /dev/null
+#import "a.h"
+#import "a-proto.h"
+
+@interface A () <AProto>
+@end
--- /dev/null
+@protocol NSObject
+@end
+
+@protocol AProto <NSObject>
+@property (nonatomic, readwrite, assign) int p0;
+@property (nonatomic, readwrite, assign) int p1;
+@end
--- /dev/null
+@interface NSObject
+@end
+
+@interface A : NSObject
+@end
--- /dev/null
+
+module A {
+ header "a.h"
+ header "a-proto.h"
+ export *
+}
+
+module AP {
+ header "a-private.h"
+ export *
+}
--- /dev/null
+// RUN: rm -rf %t.cache
+// RUN: %clang_cc1 %s -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.cache -I%S/Inputs/class-extension -verify
+// expected-no-diagnostics
+
+#import "a-private.h"
+
+int foo(A *X) {
+ return X.p0 + X.p1;
+}