]> granicus.if.org Git - clang/commitdiff
Remove some redundant Decl -> Decl castings.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Feb 2009 20:23:54 +0000 (20:23 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Feb 2009 20:23:54 +0000 (20:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64804 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
lib/CodeGen/ModuleBuilder.cpp
lib/Sema/SemaDecl.cpp

index 3da42ff0765bc0c8fd94b3146dc949b13e0c6960..696aa00ed77b5a454f4310057ebdd38fb1d46186 100644 (file)
@@ -244,13 +244,13 @@ public:
   const Decl* getSolitaryDecl() const {
     assert (hasSolitaryDecl() &&
             "Caller assumes this DeclStmt points to one Decl*");
-    return llvm::cast<Decl>(*DG.begin());
+    return *DG.begin();
   }
   
   Decl* getSolitaryDecl() {
     assert (hasSolitaryDecl() &&
             "Caller assumes this DeclStmt points to one Decl*");
-    return llvm::cast<Decl>(*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<Decl>(*I);
+      return *I;
     }
   };
     
@@ -297,7 +297,7 @@ public:
       return R.I != I;
     }
     Decl* operator*() const {
-      return llvm::cast<Decl>(*I);
+      return *I;
     }
   };
   
index 9afdc0368c41da8f5bf716429b591b63e8b6cad6..3e3f5e463f53c799a4cd0abce6019633cc4ddf76 100644 (file)
@@ -68,12 +68,8 @@ namespace {
     
     virtual void HandleTopLevelDecl(Decl *D) {
       // Make sure to emit all elements of a Decl.
-      if (Decl *SD = dyn_cast<Decl>(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
index 5eb2e6a95ba52c711860ddb031a8103320dd738b..0d4f562db1897c789282bac124a6916b88e0f924 100644 (file)
@@ -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<Decl*>(group);
-  if (GroupDecl == 0)
+  Decl *Group = static_cast<Decl*>(group);
+  if (Group == 0)
     return 0;
   
-  Decl *Group = dyn_cast<Decl>(GroupDecl);
   Decl *NewGroup = 0;
   if (Group->getNextDeclarator() == 0) 
     NewGroup = Group;