summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index f5828fcb4ce..341f0f5e937 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -1005,11 +1005,17 @@ ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel,
void ObjCProtocolDecl::allocateDefinitionData() {
assert(!Data && "Protocol already has a definition!");
- Data = new (getASTContext()) DefinitionData;
+ Data = new (getASTContext()) DefinitionData;
+ Data->Definition = this;
}
void ObjCProtocolDecl::startDefinition() {
allocateDefinitionData();
+
+ // Update all of the declarations with a pointer to the definition.
+ for (redecl_iterator RD = redecls_begin(), RDEnd = redecls_end();
+ RD != RDEnd; ++RD)
+ RD->Data = this->Data;
}
void ObjCProtocolDecl::completedForwardDecl() {
OpenPOWER on IntegriCloud