[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 rL336031: Add protocol redefinition to the current scope/context (authored by bruno, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47297?vs=148308&id=153604#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47297

Files:
  cfe/trunk/lib/Sema/SemaDeclObjC.cpp
  cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
  cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
  cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
  cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
  cfe/trunk/test/Modules/protocol-redefinition.m


Index: cfe/trunk/test/Modules/protocol-redefinition.m
===================================================================
--- cfe/trunk/test/Modules/protocol-redefinition.m
+++ cfe/trunk/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: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
===================================================================
--- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
+++ cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Headers/Base.h
@@ -0,0 +1,3 @@
+ at protocol Foo
+- (void)someMethodOnFoo;
+ at end
Index: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
===================================================================
--- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Base.framework/Modules/module.modulemap
+++ cfe/trunk/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: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
===================================================================
--- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Headers/Kit.h
+++ cfe/trunk/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: cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
===================================================================
--- cfe/trunk/test/Modules/Inputs/protocol-redefinition/Kit.framework/Modules/module.modulemap
+++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp
+++ cfe/trunk/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.153604.patch
Type: text/x-patch
Size: 2874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180630/e772849e/attachment.bin>


More information about the cfe-commits mailing list