Don't crash when trying to mangle function templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82872 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 69e73e7..e07c38f 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -335,7 +335,7 @@
   if (mangleSubstitution(ND))
     return;
   
-  mangleUnscopedName(ND);
+  mangleUnscopedName(ND->getTemplatedDecl());
   addSubstitution(ND);
 }
 
@@ -532,7 +532,7 @@
   // FIXME: <substitution> and <template-param>
   
   manglePrefix(ND->getDeclContext());
-  mangleUnqualifiedName(ND);
+  mangleUnqualifiedName(ND->getTemplatedDecl());
 }
 
 void