Handle substitutions in mangleTemplatePrefix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index c07d903..3db736b 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -531,10 +531,15 @@
   //                   ::= <template-param>
   //                   ::= <substitution>
 
-  // FIXME: <substitution> and <template-param>
+  if (mangleSubstitution(ND))
+    return;
+  
+  // FIXME: <template-param>
   
   manglePrefix(ND->getDeclContext());
   mangleUnqualifiedName(ND->getTemplatedDecl());
+  
+  addSubstitution(ND);
 }
 
 void
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index eb6267b..fffd456 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -162,8 +162,7 @@
 template<typename T> bool operator==(const A<T>&, const A<T>&) { return true; }
 }
 
-// FIXME: This should be _ZN2NSeqIcEEbRK1AIT_ES5_
-// CHECK: @_ZN2NSeqIcEEbRK1AIT_ES4_
+// CHECK: @_ZN2NSeqIcEEbRK1AIT_ES5_
 template bool NS::operator==(const ::A<char>&, const ::A<char>&);
 
 namespace std {