summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-01 20:30:41 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-01 20:30:41 +0000
commit32c17577303d28236489c9a6be250de376578636 (patch)
tree56c833f1697ff1cf930c1aa6a3305e7ba7ecbeaa /clang/lib/AST/DeclObjC.cpp
parentb910984458e74cdeec519371c38a9dc83424ec3f (diff)
downloadbcm5719-llvm-32c17577303d28236489c9a6be250de376578636.tar.gz
bcm5719-llvm-32c17577303d28236489c9a6be250de376578636.zip
Wire up redeclaration chains for Objective-C protocols, so that both
forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 341f0f5e937..27da21a18f8 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -967,12 +967,32 @@ ObjCAtDefsFieldDecl
void ObjCProtocolDecl::anchor() { }
+ObjCProtocolDecl::ObjCProtocolDecl(DeclContext *DC, IdentifierInfo *Id,
+ SourceLocation nameLoc,
+ SourceLocation atStartLoc,
+ ObjCProtocolDecl *PrevDecl,
+ bool isForwardDecl)
+ : ObjCContainerDecl(ObjCProtocol, DC, Id, nameLoc, atStartLoc),
+ Data(0),
+ InitiallyForwardDecl(isForwardDecl),
+ isForwardProtoDecl(isForwardDecl)
+{
+ setPreviousDeclaration(PrevDecl);
+ if (PrevDecl)
+ Data = PrevDecl->Data;
+}
+
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
IdentifierInfo *Id,
SourceLocation nameLoc,
SourceLocation atStartLoc,
+ ObjCProtocolDecl *PrevDecl,
bool isForwardDecl) {
- return new (C) ObjCProtocolDecl(DC, Id, nameLoc, atStartLoc, isForwardDecl);
+ ObjCProtocolDecl *Result
+ = new (C) ObjCProtocolDecl(DC, Id, nameLoc, atStartLoc, PrevDecl,
+ isForwardDecl);
+
+ return Result;
}
ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) {
@@ -1016,12 +1036,7 @@ void ObjCProtocolDecl::startDefinition() {
for (redecl_iterator RD = redecls_begin(), RDEnd = redecls_end();
RD != RDEnd; ++RD)
RD->Data = this->Data;
-}
-
-void ObjCProtocolDecl::completedForwardDecl() {
- assert(!hasDefinition() && "Only valid to call for forward refs");
- isForwardProtoDecl = false;
- startDefinition();
+
if (ASTMutationListener *L = getASTContext().getASTMutationListener())
L->CompletedObjCForwardRef(this);
}
OpenPOWER on IntegriCloud