summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-16 03:12:41 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-16 03:12:41 +0000
commitab1ec82e0404d843228a25ad9eab2c235393df47 (patch)
treec514a6f7221ff9156897091f7d8f084dd54eee8f /clang/lib/AST/DeclObjC.cpp
parentca3417e9327dd2dd6f723bb0fcc7cbb9137f2d2f (diff)
downloadbcm5719-llvm-ab1ec82e0404d843228a25ad9eab2c235393df47.tar.gz
bcm5719-llvm-ab1ec82e0404d843228a25ad9eab2c235393df47.zip
Fix chaining of ObjCInterfaceDecl redeclarations
llvm-svn: 146722
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index d420b2be49f..317dc95f540 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -225,18 +225,19 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList(
void ObjCInterfaceDecl::allocateDefinitionData() {
assert(!hasDefinition() && "ObjC class already has a definition");
Data = new (getASTContext()) DefinitionData();
- Data->Definition = this;
-
+ Data->Definition = this;
+}
+
+void ObjCInterfaceDecl::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) {
if (*RD != this)
RD->Data = Data;
}
-}
-void ObjCInterfaceDecl::startDefinition() {
- allocateDefinitionData();
if (ASTMutationListener *L = getASTContext().getASTMutationListener())
L->CompletedObjCForwardRef(this);
}
@@ -674,9 +675,24 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
DeclContext *DC,
SourceLocation atLoc,
IdentifierInfo *Id,
+ ObjCInterfaceDecl *PrevDecl,
SourceLocation ClassLoc,
bool isInternal){
- return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, isInternal);
+ ObjCInterfaceDecl *Result = new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc,
+ isInternal);
+ C.getObjCInterfaceType(Result, PrevDecl);
+
+ if (PrevDecl) {
+ Result->Data = PrevDecl->Data;
+ Result->setPreviousDeclaration(PrevDecl);
+ }
+
+ return Result;
+}
+
+ObjCInterfaceDecl *ObjCInterfaceDecl::CreateEmpty(ASTContext &C) {
+ return new (C) ObjCInterfaceDecl(0, SourceLocation(), 0, SourceLocation(),
+ false);
}
ObjCInterfaceDecl::
@@ -851,14 +867,6 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto,
return false;
}
-void ObjCInterfaceDecl::setPreviousDeclaration(ObjCInterfaceDecl *PrevDecl) {
- redeclarable_base::setPreviousDeclaration(PrevDecl);
-
- // Inherit the 'Data' pointer from the previous declaration.
- if (PrevDecl)
- Data = PrevDecl->Data;
-}
-
//===----------------------------------------------------------------------===//
// ObjCIvarDecl
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud