summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2018-06-30 00:49:27 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2018-06-30 00:49:27 +0000
commit7dcf23ed83d0094386aa438db3b47ec0aacf149d (patch)
treeaa8f4a5fd24b4cd7e3d933b547c26cd3a25ec272 /clang/lib/Sema
parent7c557f804d3a0b797e78722bebb285923bf8548c (diff)
downloadbcm5719-llvm-7dcf23ed83d0094386aa438db3b47ec0aacf149d.tar.gz
bcm5719-llvm-7dcf23ed83d0094386aa438db3b47ec0aacf149d.zip
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
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp5
1 files changed, 5 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) {
OpenPOWER on IntegriCloud