forked from OSchip/llvm-project
parent
9691f7fa35
commit
ecc32f1be0
|
@ -51,11 +51,6 @@ class IdentifierResolver {
|
|||
/// The decl must already be part of the decl chain.
|
||||
void RemoveDecl(NamedDecl *D);
|
||||
|
||||
/// Replaces the Old declaration with the New declaration. If the
|
||||
/// replacement is successful, returns true. If the old
|
||||
/// declaration was not found, returns false.
|
||||
bool ReplaceDecl(NamedDecl *Old, NamedDecl *New);
|
||||
|
||||
/// \brief Insert the given declaration at the given position in the list.
|
||||
void InsertDecl(DeclsTy::iterator Pos, NamedDecl *D) {
|
||||
Decls.insert(Pos, D);
|
||||
|
@ -168,11 +163,6 @@ public:
|
|||
/// The decl must already be part of the decl chain.
|
||||
void RemoveDecl(NamedDecl *D);
|
||||
|
||||
/// Replace the decl Old with the new declaration New on its
|
||||
/// identifier chain. Returns true if the old declaration was found
|
||||
/// (and, therefore, replaced).
|
||||
bool ReplaceDecl(NamedDecl *Old, NamedDecl *New);
|
||||
|
||||
/// \brief Insert the given declaration after the given iterator
|
||||
/// position.
|
||||
void InsertDeclAfter(iterator Pos, NamedDecl *D);
|
||||
|
|
|
@ -78,19 +78,6 @@ void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) {
|
|||
llvm_unreachable("Didn't find this decl on its identifier's chain!");
|
||||
}
|
||||
|
||||
bool
|
||||
IdentifierResolver::IdDeclInfo::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
|
||||
for (DeclsTy::iterator I = Decls.end(); I != Decls.begin(); --I) {
|
||||
if (Old == *(I-1)) {
|
||||
*(I - 1) = New;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// IdentifierResolver Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -235,30 +222,6 @@ void IdentifierResolver::RemoveDecl(NamedDecl *D) {
|
|||
return toIdDeclInfo(Ptr)->RemoveDecl(D);
|
||||
}
|
||||
|
||||
bool IdentifierResolver::ReplaceDecl(NamedDecl *Old, NamedDecl *New) {
|
||||
assert(Old->getDeclName() == New->getDeclName() &&
|
||||
"Cannot replace a decl with another decl of a different name");
|
||||
|
||||
DeclarationName Name = Old->getDeclName();
|
||||
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
|
||||
updatingIdentifier(*II);
|
||||
|
||||
void *Ptr = Name.getFETokenInfo<void>();
|
||||
|
||||
if (!Ptr)
|
||||
return false;
|
||||
|
||||
if (isDeclPtr(Ptr)) {
|
||||
if (Ptr == Old) {
|
||||
Name.setFETokenInfo(New);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return toIdDeclInfo(Ptr)->ReplaceDecl(Old, New);
|
||||
}
|
||||
|
||||
/// begin - Returns an iterator for decls with name 'Name'.
|
||||
IdentifierResolver::iterator
|
||||
IdentifierResolver::begin(DeclarationName Name) {
|
||||
|
|
Loading…
Reference in New Issue