]> granicus.if.org Git - clang/commitdiff
Remove getFirstDeclaration/getLatestDeclaration from FunctionDecl and VarDecl.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 18 Jul 2009 00:34:35 +0000 (00:34 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 18 Jul 2009 00:34:35 +0000 (00:34 +0000)
Their usefulness is questionable since redecl_iterator was introduced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76275 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index a35638f3157d07fd08962e19fb80bfcf7251ecb1..e95f9bb11b10f2e38ace42a7e224695f3095dc75 100644 (file)
@@ -422,21 +422,6 @@ public:
 
   void setPreviousDeclaration(VarDecl *PrevDecl);
 
-  /// \brief For multiple redeclarations returns the first one, otherwise
-  /// returns itself.
-  VarDecl *getFirstDeclaration();
-  const VarDecl *getFirstDeclaration() const {
-    return const_cast<VarDecl *>(this)->getFirstDeclaration();
-  }
-
-  /// \brief For multiple redeclarations returns the latest, otherwise
-  /// returns itself.
-  const VarDecl *getLatestDeclaration() const {
-    const VarDecl *First = getFirstDeclaration();
-    assert(First->PreviousDeclaration.getInt() == 1 && "Expected first");
-    return First->PreviousDeclaration.getPointer();
-  }
-
   virtual VarDecl *getCanonicalDecl();
 
   /// \brief Iterates through all the redeclarations of the same var decl.
@@ -891,21 +876,6 @@ public:
     return const_cast<FunctionDecl *>(this)->getPreviousDeclaration();
   }
 
-  /// \brief For multiple redeclarations returns the first one, otherwise
-  /// returns itself.
-  FunctionDecl *getFirstDeclaration();
-  const FunctionDecl *getFirstDeclaration() const {
-    return const_cast<FunctionDecl *>(this)->getFirstDeclaration();
-  }
-
-  /// \brief For multiple redeclarations returns the latest, otherwise
-  /// returns itself.
-  const FunctionDecl *getLatestDeclaration() const {
-    const FunctionDecl *First = getFirstDeclaration();
-    assert(First->PreviousDeclaration.getInt() == 1 && "Expected first");
-    return First->PreviousDeclaration.getPointer();
-  }
-
   void setPreviousDeclaration(FunctionDecl * PrevDecl);
 
   virtual FunctionDecl *getCanonicalDecl();
index 0a6f28d3fb7a29ef5e7601c96e22ea0b2e1ec620..23782d62236610fc3746e3b9c95666158e501667 100644 (file)
@@ -369,7 +369,8 @@ void VarDecl::setPreviousDeclaration(VarDecl *PrevDecl) {
     PreviousDeclaration.setInt(0);
     
     // First one will point to this one as latest.
-    VarDecl *First = PrevDecl->getFirstDeclaration();
+    // getCanonicalDecl returns the first one.
+    VarDecl *First = PrevDecl->getCanonicalDecl();
     assert(First->PreviousDeclaration.getInt() == 1 && "Expected first");
     First->PreviousDeclaration.setPointer(this);
   } else {
@@ -379,14 +380,6 @@ void VarDecl::setPreviousDeclaration(VarDecl *PrevDecl) {
   }
 }
 
-VarDecl *VarDecl::getFirstDeclaration() {
-  VarDecl *First = this;
-  while (First->getPreviousDeclaration())
-    First = First->getPreviousDeclaration();
-
-  return First;
-}
-
 VarDecl *VarDecl::getCanonicalDecl() {
   VarDecl *Var = this;
   while (Var->getPreviousDeclaration())
@@ -599,7 +592,8 @@ FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) {
     PreviousDeclaration.setInt(0);
     
     // First one will point to this one as latest.
-    FunctionDecl *First = PrevDecl->getFirstDeclaration();
+    // getCanonicalDecl returns the first one.
+    FunctionDecl *First = PrevDecl->getCanonicalDecl();
     assert(First->PreviousDeclaration.getInt() == 1 && "Expected first");
     First->PreviousDeclaration.setPointer(this);
   } else {
@@ -616,14 +610,6 @@ FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) {
   }
 }
 
-FunctionDecl *FunctionDecl::getFirstDeclaration() {
-  FunctionDecl *First = this;
-  while (First->getPreviousDeclaration())
-    First = First->getPreviousDeclaration();
-
-  return First;
-}
-
 FunctionDecl *FunctionDecl::getCanonicalDecl() {
   FunctionDecl *FD = this;
   while (FD->getPreviousDeclaration())