Mangle VarDecls correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68320 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 1c84f28..6e62fcf 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -109,6 +109,16 @@
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
     return mangleFunctionDecl(FD);
   
+  if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
+    if (!Context.getLangOptions().CPlusPlus ||
+        isInCLinkageSpecification(D))
+      return false;
+    
+    Out << "_Z";
+    mangleName(VD);
+    return true;
+  }
+  
   return false;
 }