From d311f376c364e5a6c88b63b1d5c53f560ea5e650 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 17 Feb 2009 20:23:54 +0000 Subject: [PATCH] Remove some redundant Decl -> Decl castings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64804 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Stmt.h | 8 ++++---- lib/CodeGen/ModuleBuilder.cpp | 6 +----- lib/Sema/SemaDecl.cpp | 5 ++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 3da42ff076..696aa00ed7 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -244,13 +244,13 @@ public: const Decl* getSolitaryDecl() const { assert (hasSolitaryDecl() && "Caller assumes this DeclStmt points to one Decl*"); - return llvm::cast(*DG.begin()); + return *DG.begin(); } Decl* getSolitaryDecl() { assert (hasSolitaryDecl() && "Caller assumes this DeclStmt points to one Decl*"); - return llvm::cast(*DG.begin()); + return *DG.begin(); } SourceLocation getStartLoc() const { return StartLoc; } @@ -281,7 +281,7 @@ public: return R.I != I; } Decl* operator*() const { - return llvm::cast(*I); + return *I; } }; @@ -297,7 +297,7 @@ public: return R.I != I; } Decl* operator*() const { - return llvm::cast(*I); + return *I; } }; diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 9afdc0368c..3e3f5e463f 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -68,12 +68,8 @@ namespace { virtual void HandleTopLevelDecl(Decl *D) { // Make sure to emit all elements of a Decl. - if (Decl *SD = dyn_cast(D)) { - for (; SD; SD = SD->getNextDeclarator()) - Builder->EmitTopLevelDecl(SD); - } else { + for (; D; D = D->getNextDeclarator()) Builder->EmitTopLevelDecl(D); - } } /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5eb2e6a95b..0d4f562db1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2552,11 +2552,10 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) { /// The declarators are chained together backwards, reverse the list. Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) { // Often we have single declarators, handle them quickly. - Decl *GroupDecl = static_cast(group); - if (GroupDecl == 0) + Decl *Group = static_cast(group); + if (Group == 0) return 0; - Decl *Group = dyn_cast(GroupDecl); Decl *NewGroup = 0; if (Group->getNextDeclarator() == 0) NewGroup = Group; -- 2.40.0