aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-16 22:37:11 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-16 22:37:11 +0000
commitfd002a7027e47ddd4bc9f32b158b18ab0ebd29c7 (patch)
treea4e6408fb31cd6e81baf842b7e5a4ae07d59798a /lib/AST/DeclObjC.cpp
parent7ec59c78f1e19157767648cbe3f0e3630ca1afe7 (diff)
Make sure we're always setting the previous declaration of an ObjCInterfaceDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 02cc988d82..18be26def9 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -683,28 +683,29 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
SourceLocation ClassLoc,
bool isInternal){
ObjCInterfaceDecl *Result = new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc,
- isInternal);
+ PrevDecl, 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);
+ 0, false);
}
ObjCInterfaceDecl::
ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id,
- SourceLocation CLoc, bool isInternal)
+ SourceLocation CLoc, ObjCInterfaceDecl *PrevDecl,
+ bool isInternal)
: ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, atLoc),
TypeForDecl(0), Data()
{
+ setPreviousDeclaration(PrevDecl);
+
+ // Copy the 'data' pointer over.
+ if (PrevDecl)
+ Data = PrevDecl->Data;
+
setImplicit(isInternal);
}