Mangling support for typeinfo names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 0b00c17..e644ff3 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -56,6 +56,7 @@
     void mangleCXXCtorVtable(const CXXRecordDecl *RD, int64_t Offset,
                              const CXXRecordDecl *Type);
     void mangleCXXRtti(QualType Ty);
+    void mangleCXXRttiName(QualType Ty);
     void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type);
     void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type);
 
@@ -236,6 +237,13 @@
   mangleType(Ty);
 }
 
+void CXXNameMangler::mangleCXXRttiName(QualType Ty) {
+  // <special-name> ::= TS <type>  # typeinfo name (null terminated byte string)
+  Out << "_ZTS";
+
+  mangleType(Ty);
+}
+
 void CXXNameMangler::mangleGuardVariable(const VarDecl *D) {
   //  <special-name> ::= GV <object name>       # Guard variable for one-time
   //                                            # initialization
@@ -1480,4 +1488,12 @@
 
     os.flush();
   }
+
+  void mangleCXXRttiName(MangleContext &Context, QualType Ty,
+                         llvm::raw_ostream &os) {
+    CXXNameMangler Mangler(Context, os);
+    Mangler.mangleCXXRttiName(Ty);
+
+    os.flush();
+  }
 }