diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 10 | ||||
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 26 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 4 |
4 files changed, 17 insertions, 28 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index c7160316771..423f23d4e08 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -3605,13 +3605,13 @@ Decl *ASTNodeImporter::VisitObjCClassDecl(ObjCClassDecl *D) { // Import the location of this declaration. SourceLocation Loc = Importer.Import(D->getLocation()); - ObjCClassDecl::ObjCClassRef *From = D->getForwardDecl(); ObjCInterfaceDecl *ToIface - = cast_or_null<ObjCInterfaceDecl>(Importer.Import(From->getInterface())); + = cast_or_null<ObjCInterfaceDecl>( + Importer.Import(D->getForwardInterfaceDecl())); ObjCClassDecl *ToClass = ObjCClassDecl::Create(Importer.getToContext(), DC, - Loc, - ToIface, - Importer.Import(From->getLocation())); + Loc, + ToIface, + Importer.Import(D->getNameLoc())); ToClass->setLexicalDeclContext(LexicalDC); LexicalDC->addDeclInternal(ToClass); diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 2157762e7fd..38efadf3b58 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -942,31 +942,21 @@ void ObjCProtocolDecl::completedForwardDecl() { //===----------------------------------------------------------------------===// ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L, - ObjCInterfaceDecl *const Elt, - const SourceLocation Loc, - ASTContext &C) - : Decl(ObjCClass, DC, L) { - setClass(C, Elt, Loc); + ObjCInterfaceDecl *Interface, + SourceLocation InterfaceLoc) + : Decl(ObjCClass, DC, L), Interface(Interface), InterfaceLoc(InterfaceLoc) +{ } ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, - ObjCInterfaceDecl *const Elt, - const SourceLocation Loc) { - return new (C) ObjCClassDecl(DC, L, Elt, Loc, C); + ObjCInterfaceDecl *Interface, + SourceLocation InterfaceLoc) { + return new (C) ObjCClassDecl(DC, L, Interface, InterfaceLoc); } -void ObjCClassDecl::setClass(ASTContext &C, ObjCInterfaceDecl*const Cls, - const SourceLocation Loc) { - - ForwardDecl = (ObjCClassRef*) C.Allocate(sizeof(ObjCClassRef), - llvm::alignOf<ObjCClassRef>()); - new (ForwardDecl) ObjCClassRef(Cls, Loc); -} - SourceRange ObjCClassDecl::getSourceRange() const { - // FIXME: We should include the semicolon - return SourceRange(getLocation(), ForwardDecl->getLocation()); + return SourceRange(getLocation(), InterfaceLoc); } //===----------------------------------------------------------------------===// diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 0641b855019..bdedf8ac7e1 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -629,9 +629,8 @@ void ASTDeclReader::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *FD) { void ASTDeclReader::VisitObjCClassDecl(ObjCClassDecl *CD) { VisitDecl(CD); - ObjCInterfaceDecl *ClassRef = ReadDeclAs<ObjCInterfaceDecl>(Record, Idx); - SourceLocation SLoc = ReadSourceLocation(Record, Idx); - CD->setClass(Reader.getContext(), ClassRef, SLoc); + CD->Interface = ReadDeclAs<ObjCInterfaceDecl>(Record, Idx); + CD->InterfaceLoc = ReadSourceLocation(Record, Idx); } void ASTDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) { diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 99df3ea6746..1448e59fb61 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -526,8 +526,8 @@ void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) { void ASTDeclWriter::VisitObjCClassDecl(ObjCClassDecl *D) { VisitDecl(D); - Writer.AddDeclRef(D->getForwardInterfaceDecl(), Record); - Writer.AddSourceLocation(D->getForwardDecl()->getLocation(), Record); + Writer.AddDeclRef(D->Interface, Record); + Writer.AddSourceLocation(D->InterfaceLoc, Record); Code = serialization::DECL_OBJC_CLASS; } |