summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp5
-rw-r--r--clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h3
-rw-r--r--clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap4
-rw-r--r--clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h6
-rw-r--r--clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap4
-rw-r--r--clang/test/Modules/protocol-redefinition.m6
6 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index d7544ecfaf7..6809b48dc8a 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1210,6 +1210,11 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
ProtocolLoc, AtProtoInterfaceLoc,
/*PrevDecl=*/nullptr);
+
+ // If we are using modules, add the decl to the context in order to
+ // serialize something meaningful.
+ if (getLangOpts().Modules)
+ PushOnScopeChains(PDecl, TUScope);
PDecl->startDefinition();
} else {
if (PrevDecl) {
diff --git a/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h b/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
new file mode 100644
index 00000000000..e3fe33c1bdb
--- /dev/null
+++ b/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
@@ -0,0 +1,3 @@
+@protocol Foo
+- (void)someMethodOnFoo;
+@end
diff --git a/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..0366bb4f039
--- /dev/null
+++ b/clang/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
@@ -0,0 +1,4 @@
+framework module Base {
+ header "Base.h"
+ export *
+} \ No newline at end of file
diff --git a/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h b/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
new file mode 100644
index 00000000000..93384c294f1
--- /dev/null
+++ b/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
@@ -0,0 +1,6 @@
+#import <Base/Base.h>
+
+// REDECLARATION
+@protocol Foo
+- (void)someMethodOnFoo;
+@end
diff --git a/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap b/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
new file mode 100644
index 00000000000..2b790f44965
--- /dev/null
+++ b/clang/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
@@ -0,0 +1,4 @@
+framework module Kit {
+ header "Kit.h"
+ export *
+} \ No newline at end of file
diff --git a/clang/test/Modules/protocol-redefinition.m b/clang/test/Modules/protocol-redefinition.m
new file mode 100644
index 00000000000..85a957bbfd7
--- /dev/null
+++ b/clang/test/Modules/protocol-redefinition.m
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/protocol-redefinition -fsyntax-only %s -Wno-private-module -verify
+
+// expected-no-diagnostics
+
+@import Kit;
OpenPOWER on IntegriCloud