From: Eli Friedman Date: Sat, 2 Jan 2010 21:44:36 +0000 (+0000) Subject: Eliminate dead code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a349947e5d4ba6bd16d775ce17cf9c9d181bc39;p=clang Eliminate dead code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92424 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 0dbf21961f..bff47519a7 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/lib/Sema/IdentifierResolver.cpp @@ -46,22 +46,6 @@ public: // IdDeclInfo Implementation //===----------------------------------------------------------------------===// -/// AddShadowed - Add a decl by putting it directly above the 'Shadow' decl. -/// Later lookups will find the 'Shadow' decl first. The 'Shadow' decl must -/// be already added to the scope chain and must be in the same context as -/// the decl that we want to add. -void IdentifierResolver::IdDeclInfo::AddShadowed(NamedDecl *D, - NamedDecl *Shadow) { - for (DeclsTy::iterator I = Decls.end(); I != Decls.begin(); --I) { - if (Shadow == *(I-1)) { - Decls.insert(I-1, D); - return; - } - } - - assert(0 && "Shadow wasn't in scope chain!"); -} - /// RemoveDecl - Remove the decl from the scope chain. /// The decl must already be part of the decl chain. void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) { @@ -160,32 +144,6 @@ void IdentifierResolver::AddDecl(NamedDecl *D) { IDI->AddDecl(D); } -/// AddShadowedDecl - Link the decl to its shadowed decl chain putting it -/// after the decl that the iterator points to, thus the 'Shadow' decl will be -/// encountered before the 'D' decl. -void IdentifierResolver::AddShadowedDecl(NamedDecl *D, NamedDecl *Shadow) { - assert(D->getDeclName() == Shadow->getDeclName() && "Different ids!"); - - DeclarationName Name = D->getDeclName(); - void *Ptr = Name.getFETokenInfo(); - assert(Ptr && "No decl from Ptr ?"); - - IdDeclInfo *IDI; - - if (isDeclPtr(Ptr)) { - Name.setFETokenInfo(NULL); - IDI = &(*IdDeclInfos)[Name]; - NamedDecl *PrevD = static_cast(Ptr); - assert(PrevD == Shadow && "Invalid shadow decl ?"); - IDI->AddDecl(D); - IDI->AddDecl(PrevD); - return; - } - - IDI = toIdDeclInfo(Ptr); - IDI->AddShadowed(D, Shadow); -} - /// RemoveDecl - Unlink the decl from its shadowed decl chain. /// The decl must already be part of the decl chain. void IdentifierResolver::RemoveDecl(NamedDecl *D) { diff --git a/lib/Sema/IdentifierResolver.h b/lib/Sema/IdentifierResolver.h index 65f3256c21..59bd834073 100644 --- a/lib/Sema/IdentifierResolver.h +++ b/lib/Sema/IdentifierResolver.h @@ -41,12 +41,6 @@ class IdentifierResolver { void AddDecl(NamedDecl *D) { Decls.push_back(D); } - /// AddShadowed - Add a decl by putting it directly above the 'Shadow' decl. - /// Later lookups will find the 'Shadow' decl first. The 'Shadow' decl must - /// be already added to the scope chain and must be in the same context as - /// the decl that we want to add. - void AddShadowed(NamedDecl *D, NamedDecl *Shadow); - /// RemoveDecl - Remove the decl from the scope chain. /// The decl must already be part of the decl chain. void RemoveDecl(NamedDecl *D); @@ -163,11 +157,6 @@ public: /// AddDecl - Link the decl to its shadowed decl chain. void AddDecl(NamedDecl *D); - /// AddShadowedDecl - Link the decl to its shadowed decl chain putting it - /// after the decl that the iterator points to, thus the 'Shadow' decl will be - /// encountered before the 'D' decl. - void AddShadowedDecl(NamedDecl *D, NamedDecl *Shadow); - /// RemoveDecl - Unlink the decl from its shadowed decl chain. /// The decl must already be part of the decl chain. void RemoveDecl(NamedDecl *D); diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 4cecee46e4..3e7cb0c28c 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -561,8 +561,6 @@ public: const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc); - QualType ObjCGetTypeForMethodDefinition(DeclPtrTy D); - bool UnwrapSimilarPointerTypes(QualType& T1, QualType& T2); virtual TypeResult ActOnTypeName(Scope *S, Declarator &D); diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index ed30229e95..86ad0a0a73 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1461,34 +1461,6 @@ void LocInfoType::getAsStringInternal(std::string &Str, " GetTypeFromParser"); } -/// ObjCGetTypeForMethodDefinition - Builds the type for a method definition -/// declarator -QualType Sema::ObjCGetTypeForMethodDefinition(DeclPtrTy D) { - ObjCMethodDecl *MDecl = cast(D.getAs()); - QualType T = MDecl->getResultType(); - llvm::SmallVector ArgTys; - - // Add the first two invisible argument types for self and _cmd. - if (MDecl->isInstanceMethod()) { - QualType selfTy = Context.getObjCInterfaceType(MDecl->getClassInterface()); - selfTy = Context.getPointerType(selfTy); - ArgTys.push_back(selfTy); - } else - ArgTys.push_back(Context.getObjCIdType()); - ArgTys.push_back(Context.getObjCSelType()); - - for (ObjCMethodDecl::param_iterator PI = MDecl->param_begin(), - E = MDecl->param_end(); PI != E; ++PI) { - QualType ArgTy = (*PI)->getType(); - assert(!ArgTy.isNull() && "Couldn't parse type?"); - ArgTy = adjustParameterType(ArgTy); - ArgTys.push_back(ArgTy); - } - T = Context.getFunctionType(T, &ArgTys[0], ArgTys.size(), - MDecl->isVariadic(), 0); - return T; -} - /// UnwrapSimilarPointerTypes - If T1 and T2 are pointer types that /// may be similar (C++ 4.4), replaces T1 and T2 with the type that /// they point to and return true. If T1 and T2 aren't pointer types