Address minor FIXME in RedeclLink to contain a PointerIntPair instead of derive from it.
Use actual factory functions rather than derived classes acting as named constructors/factories.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157588 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 5870fba..cfafc1c 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -1534,7 +1534,7 @@
// We temporarily set the first (canonical) declaration as the previous one
// which is the one that matters and mark the real previous DeclID to be
// loaded & attached later on.
- D->RedeclLink = typename Redeclarable<T>::PreviousDeclLink(FirstDecl);
+ D->RedeclLink = Redeclarable<T>::PreviousDeclLink(FirstDecl);
}
// Note that this declaration has been deserialized.
@@ -1562,8 +1562,7 @@
// Have our redeclaration link point back at the canonical declaration
// of the existing declaration, so that this declaration has the
// appropriate canonical declaration.
- D->RedeclLink
- = typename Redeclarable<T>::PreviousDeclLink(ExistingCanon);
+ D->RedeclLink = Redeclarable<T>::PreviousDeclLink(ExistingCanon);
// When we merge a namespace, update its pointer to the first namespace.
if (NamespaceDecl *Namespace
@@ -1805,22 +1804,22 @@
void ASTDeclReader::attachPreviousDecl(Decl *D, Decl *previous) {
assert(D && previous);
if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
- TD->RedeclLink.setPointer(cast<TagDecl>(previous));
+ TD->RedeclLink.setNext(cast<TagDecl>(previous));
} else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- FD->RedeclLink.setPointer(cast<FunctionDecl>(previous));
+ FD->RedeclLink.setNext(cast<FunctionDecl>(previous));
} else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
- VD->RedeclLink.setPointer(cast<VarDecl>(previous));
+ VD->RedeclLink.setNext(cast<VarDecl>(previous));
} else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) {
- TD->RedeclLink.setPointer(cast<TypedefNameDecl>(previous));
+ TD->RedeclLink.setNext(cast<TypedefNameDecl>(previous));
} else if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) {
- ID->RedeclLink.setPointer(cast<ObjCInterfaceDecl>(previous));
+ ID->RedeclLink.setNext(cast<ObjCInterfaceDecl>(previous));
} else if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) {
- PD->RedeclLink.setPointer(cast<ObjCProtocolDecl>(previous));
+ PD->RedeclLink.setNext(cast<ObjCProtocolDecl>(previous));
} else if (NamespaceDecl *ND = dyn_cast<NamespaceDecl>(D)) {
- ND->RedeclLink.setPointer(cast<NamespaceDecl>(previous));
+ ND->RedeclLink.setNext(cast<NamespaceDecl>(previous));
} else {
RedeclarableTemplateDecl *TD = cast<RedeclarableTemplateDecl>(D);
- TD->RedeclLink.setPointer(cast<RedeclarableTemplateDecl>(previous));
+ TD->RedeclLink.setNext(cast<RedeclarableTemplateDecl>(previous));
}
}