diff options
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/ASTImporter.cpp | 1 | ||||
-rw-r--r-- | lib/AST/DeclObjC.cpp | 36 | ||||
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 10 | ||||
-rw-r--r-- | lib/AST/DumpXML.cpp | 2 | ||||
-rw-r--r-- | lib/AST/RecordLayoutBuilder.cpp | 2 | ||||
-rw-r--r-- | lib/AST/Type.cpp | 2 |
6 files changed, 30 insertions, 23 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 949db7972a..ac3b536ace 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -3183,7 +3183,6 @@ Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) { ToIface = ObjCInterfaceDecl::Create(Importer.getToContext(), DC, Importer.Import(D->getAtStartLoc()), Name.getAsIdentifierInfo(), Loc, - D->isInitiallyForwardDecl(), D->isImplicitInterfaceDecl()); ToIface->setLexicalDeclContext(LexicalDC); LexicalDC->addDeclInternal(ToIface); diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index e088c66229..d420b2be49 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -675,16 +675,15 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C, SourceLocation atLoc, IdentifierInfo *Id, SourceLocation ClassLoc, - bool ForwardDecl, bool isInternal){ - return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, ForwardDecl, - isInternal); + bool isInternal){ + return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, isInternal); } ObjCInterfaceDecl:: ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, - SourceLocation CLoc, bool FD, bool isInternal) + SourceLocation CLoc, bool isInternal) : ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, atLoc), - TypeForDecl(0), Data(), InitiallyForwardDecl(FD) + TypeForDecl(0), Data() { setImplicit(isInternal); } @@ -705,19 +704,20 @@ void ObjCInterfaceDecl::setExternallyCompleted() { } ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation() const { + if (const ObjCInterfaceDecl *Def = getDefinition()) { + if (data().ExternallyCompleted) + LoadExternalDefinition(); + + return getASTContext().getObjCImplementation( + const_cast<ObjCInterfaceDecl*>(Def)); + } + // FIXME: Should make sure no callers ever do this. - if (!hasDefinition()) - return 0; - - if (data().ExternallyCompleted) - LoadExternalDefinition(); - - return getASTContext().getObjCImplementation( - const_cast<ObjCInterfaceDecl*>(this)); + return 0; } void ObjCInterfaceDecl::setImplementation(ObjCImplementationDecl *ImplD) { - getASTContext().setObjCImplementation(this, ImplD); + getASTContext().setObjCImplementation(getDefinition(), ImplD); } /// all_declared_ivar_begin - return first ivar declared in this class, @@ -851,6 +851,14 @@ 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 //===----------------------------------------------------------------------===// diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index ec7d6de71a..03a69a0418 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -900,16 +900,16 @@ void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) { std::string I = OID->getNameAsString(); ObjCInterfaceDecl *SID = OID->getSuperClass(); + if (!OID->isThisDeclarationADefinition()) { + Out << "@class " << I << ";"; + return; + } + if (SID) Out << "@interface " << I << " : " << *SID; else Out << "@interface " << I; - if (OID->isForwardDecl()) { - Out << "@end"; - return; - } - // Protocols? const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols(); if (!Protocols.empty()) { diff --git a/lib/AST/DumpXML.cpp b/lib/AST/DumpXML.cpp index 2568adaa5a..e0ea612dc2 100644 --- a/lib/AST/DumpXML.cpp +++ b/lib/AST/DumpXML.cpp @@ -755,7 +755,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>, } void visitObjCInterfaceDeclAttrs(ObjCInterfaceDecl *D) { setPointer("typeptr", D->getTypeForDecl()); - setFlag("forward_decl", D->isForwardDecl()); + setFlag("forward_decl", !D->isThisDeclarationADefinition()); setFlag("implicit_interface", D->isImplicitInterfaceDecl()); } void visitObjCInterfaceDeclChildren(ObjCInterfaceDecl *D) { diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index 3e413befd8..a47bd4afb4 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -2161,7 +2161,7 @@ const CXXMethodDecl *ASTContext::getKeyFunction(const CXXRecordDecl *RD) { const ASTRecordLayout & ASTContext::getObjCLayout(const ObjCInterfaceDecl *D, const ObjCImplementationDecl *Impl) const { - assert(!D->isForwardDecl() && "Invalid interface decl!"); + assert(D->isThisDeclarationADefinition() && "Invalid interface decl!"); // Look up this layout, if already laid out, return what we have. ObjCContainerDecl *Key = diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index e01346cdb6..d375e7c59d 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -927,7 +927,7 @@ bool Type::isIncompleteType() const { ->isIncompleteType(); case ObjCInterface: // ObjC interfaces are incomplete if they are @class, not @interface. - return cast<ObjCInterfaceType>(CanonicalType)->getDecl()->isForwardDecl(); + return !cast<ObjCInterfaceType>(CanonicalType)->getDecl()->hasDefinition(); } } |