forked from OSchip/llvm-project
Add protocol redefinition to the current scope/context
Not doing so causes the AST writter to assert since the decl in question never gets emitted. This is fine when modules is not used, but otherwise we need to serialize something other than garbage. rdar://problem/39844933 Differential Revision: https://reviews.llvm.org/D47297 llvm-svn: 336031
This commit is contained in:
parent
7c557f804d
commit
7dcf23ed83
|
@ -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) {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
@protocol Foo
|
||||
- (void)someMethodOnFoo;
|
||||
@end
|
|
@ -0,0 +1,4 @@
|
|||
framework module Base {
|
||||
header "Base.h"
|
||||
export *
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#import <Base/Base.h>
|
||||
|
||||
// REDECLARATION
|
||||
@protocol Foo
|
||||
- (void)someMethodOnFoo;
|
||||
@end
|
|
@ -0,0 +1,4 @@
|
|||
framework module Kit {
|
||||
header "Kit.h"
|
||||
export *
|
||||
}
|
|
@ -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;
|
Loading…
Reference in New Issue