From deafd0b2a42b16568f416fbe218db82d56e2d89d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 27 Dec 2011 22:43:10 +0000 Subject: Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299 --- clang/lib/AST/ASTImporter.cpp | 30 ------------------------------ clang/lib/AST/DeclBase.cpp | 6 ------ clang/lib/AST/DeclObjC.cpp | 22 ---------------------- clang/lib/AST/DeclPrinter.cpp | 5 ----- clang/lib/AST/DumpXML.cpp | 5 ----- 5 files changed, 68 deletions(-) (limited to 'clang/lib/AST') diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index a95c941e02e..67045059cfd 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -128,7 +128,6 @@ namespace clang { Decl *VisitObjCPropertyDecl(ObjCPropertyDecl *D); Decl *VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D); Decl *VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D); - Decl *VisitObjCClassDecl(ObjCClassDecl *D); Decl *VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D); Decl *VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D); Decl *VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D); @@ -3605,35 +3604,6 @@ ASTNodeImporter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) { return ToForward; } -Decl *ASTNodeImporter::VisitObjCClassDecl(ObjCClassDecl *D) { - // Import the context of this declaration. - DeclContext *DC = Importer.ImportContext(D->getDeclContext()); - if (!DC) - return 0; - - DeclContext *LexicalDC = DC; - if (D->getDeclContext() != D->getLexicalDeclContext()) { - LexicalDC = Importer.ImportContext(D->getLexicalDeclContext()); - if (!LexicalDC) - return 0; - } - - // Import the location of this declaration. - SourceLocation Loc = Importer.Import(D->getLocation()); - ObjCInterfaceDecl *ToIface - = cast_or_null( - Importer.Import(D->getForwardInterfaceDecl())); - ObjCClassDecl *ToClass = ObjCClassDecl::Create(Importer.getToContext(), DC, - Loc, - ToIface, - Importer.Import(D->getNameLoc())); - - ToClass->setLexicalDeclContext(LexicalDC); - LexicalDC->addDeclInternal(ToClass); - Importer.Imported(D, ToClass); - return ToClass; -} - Decl *ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { // For template arguments, we adopt the translation unit as our declaration // context. This context will be fixed when the actual template declaration diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 024f370c56d..983673fec8f 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -495,7 +495,6 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case LinkageSpec: case FileScopeAsm: case StaticAssert: - case ObjCClass: case ObjCPropertyImpl: case ObjCForwardProtocol: case Block: @@ -1062,11 +1061,6 @@ void DeclContext::buildLookup(DeclContext *DCtx) { if (D->getDeclContext() == DCtx) makeDeclVisibleInContextImpl(ND, false); - // Insert any forward-declared Objective-C interface into the lookup - // data structure. - if (ObjCClassDecl *Class = dyn_cast(*D)) - makeDeclVisibleInContextImpl(Class->getForwardInterfaceDecl(), false); - // If this declaration is itself a transparent declaration context or // inline namespace, add its members (recursively). if (DeclContext *InnerCtx = dyn_cast(*D)) diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index a204e45bac9..75100ecb3cb 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -1010,28 +1010,6 @@ void ObjCProtocolDecl::completedForwardDecl() { L->CompletedObjCForwardRef(this); } -//===----------------------------------------------------------------------===// -// ObjCClassDecl -//===----------------------------------------------------------------------===// - -ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L, - ObjCInterfaceDecl *Interface, - SourceLocation InterfaceLoc) - : Decl(ObjCClass, DC, L), Interface(Interface), InterfaceLoc(InterfaceLoc) -{ -} - -ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC, - SourceLocation L, - ObjCInterfaceDecl *Interface, - SourceLocation InterfaceLoc) { - return new (C) ObjCClassDecl(DC, L, Interface, InterfaceLoc); -} - -SourceRange ObjCClassDecl::getSourceRange() const { - return SourceRange(getLocation(), InterfaceLoc); -} - //===----------------------------------------------------------------------===// // ObjCForwardProtocolDecl //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 03a69a04185..9b72bb416af 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -70,7 +70,6 @@ namespace { void VisitFunctionTemplateDecl(FunctionTemplateDecl *D); void VisitClassTemplateDecl(ClassTemplateDecl *D); void VisitObjCMethodDecl(ObjCMethodDecl *D); - void VisitObjCClassDecl(ObjCClassDecl *D); void VisitObjCImplementationDecl(ObjCImplementationDecl *D); void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D); void VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D); @@ -847,10 +846,6 @@ void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) { // Objective-C declarations //---------------------------------------------------------------------------- -void DeclPrinter::VisitObjCClassDecl(ObjCClassDecl *D) { - Out << "@class " << *D->getForwardInterfaceDecl(); -} - void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) { if (OMD->isInstanceMethod()) Out << "- "; diff --git a/clang/lib/AST/DumpXML.cpp b/clang/lib/AST/DumpXML.cpp index e0ea612dc29..959bbcbb174 100644 --- a/clang/lib/AST/DumpXML.cpp +++ b/clang/lib/AST/DumpXML.cpp @@ -740,11 +740,6 @@ struct XMLDumper : public XMLDeclVisitor, visitDeclContext(D); } - // ObjCClassDecl - void visitObjCClassDeclChildren(ObjCClassDecl *D) { - visitDeclRef(D->getForwardInterfaceDecl()); - } - // ObjCInterfaceDecl void visitCategoryList(ObjCCategoryDecl *D) { if (!D) return; -- cgit v1.2.3