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.
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();
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 {
}
}
-VarDecl *VarDecl::getFirstDeclaration() {
- VarDecl *First = this;
- while (First->getPreviousDeclaration())
- First = First->getPreviousDeclaration();
-
- return First;
-}
-
VarDecl *VarDecl::getCanonicalDecl() {
VarDecl *Var = this;
while (Var->getPreviousDeclaration())
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 {
}
}
-FunctionDecl *FunctionDecl::getFirstDeclaration() {
- FunctionDecl *First = this;
- while (First->getPreviousDeclaration())
- First = First->getPreviousDeclaration();
-
- return First;
-}
-
FunctionDecl *FunctionDecl::getCanonicalDecl() {
FunctionDecl *FD = this;
while (FD->getPreviousDeclaration())