[MS ABI] Correctly mangle classes without names for linkage purposes

A class without a name for linkage purposes gets a name along the lines
of <unnamed-type-foo> where foo is either the name of a declarator which
defined it (like a variable or field) or a
typedef-name (like a typedef or alias-declaration).

We handled the declarator case correctly but it would fall down during
template instantiation if the declarator didn't share the tag's type.
We failed to handle the typedef-name case at all.

Instead, keep track of the association between the two and keep it up to
date in the face of template instantiation.

llvm-svn: 246469
diff --git a/clang/lib/AST/CXXABI.h b/clang/lib/AST/CXXABI.h
index dad2264..c23b919 100644
--- a/clang/lib/AST/CXXABI.h
+++ b/clang/lib/AST/CXXABI.h
@@ -21,6 +21,7 @@
 
 class ASTContext;
 class CXXConstructorDecl;
+class DeclaratorDecl;
 class Expr;
 class MemberPointerType;
 class MangleNumberingContext;
@@ -57,6 +58,17 @@
 
   virtual Expr *getDefaultArgExprForConstructor(const CXXConstructorDecl *CD,
                                                 unsigned ParmIdx) = 0;
+
+  virtual void addTypedefNameForUnnamedTagDecl(TagDecl *TD,
+                                               TypedefNameDecl *DD) = 0;
+
+  virtual TypedefNameDecl *
+  getTypedefNameForUnnamedTagDecl(const TagDecl *TD) = 0;
+
+  virtual void addDeclaratorForUnnamedTagDecl(TagDecl *TD,
+                                              DeclaratorDecl *DD) = 0;
+
+  virtual DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD) = 0;
 };
 
 /// Creates an instance of a C++ ABI class.