[PATCH] D47297: [Modules][ObjC] Add protocol redefinition to the current scope/context
Bruno Cardoso Lopes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 29 17:54:23 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC336031: Add protocol redefinition to the current scope/context (authored by bruno, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D47297
Files:
lib/Sema/SemaDeclObjC.cpp
test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
test/Modules/protocol-redefinition.m
Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
===================================================================
--- test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
+++ test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
@@ -0,0 +1,3 @@
+ at protocol Foo
+- (void)someMethodOnFoo;
+ at end
Index: test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
===================================================================
--- test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
+++ 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
Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
===================================================================
--- test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
+++ 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
Index: test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
===================================================================
--- test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
+++ test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
@@ -0,0 +1,6 @@
+#import <Base/Base.h>
+
+// REDECLARATION
+ at protocol Foo
+- (void)someMethodOnFoo;
+ at end
Index: test/Modules/protocol-redefinition.m
===================================================================
--- test/Modules/protocol-redefinition.m
+++ 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
+
+ at import Kit;
Index: lib/Sema/SemaDeclObjC.cpp
===================================================================
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -1210,6 +1210,11 @@
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47297.153605.patch
Type: text/x-patch
Size: 2694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180630/7edef29d/attachment-0001.bin>
More information about the cfe-commits
mailing list