Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp	(revision 221282)
+++ lib/AST/MicrosoftMangle.cpp	(working copy)
@@ -441,7 +441,7 @@
       mangleQualifiers(Ty.getQualifiers(), false);
   } else {
     mangleType(Ty, SR, QMM_Drop);
-    mangleQualifiers(Ty.getLocalQualifiers(), false);
+    mangleQualifiers(Ty.getQualifiers(), false);
   }
 }
 
Index: test/CodeGenCXX/mangle-ms.cpp
===================================================================
--- test/CodeGenCXX/mangle-ms.cpp	(revision 221282)
+++ test/CodeGenCXX/mangle-ms.cpp	(working copy)
@@ -117,6 +117,19 @@
 int (foo2::*l)(int);
 // CHECK-DAG: @"\01?l@@3P8foo@@AEHH@ZQ1@"
 
+// Ensure typedef CV qualifiers are mangled correctly
+typedef const int cInt;
+typedef volatile int vInt;
+typedef const volatile int cvInt;
+
+extern cInt g_cInt = 1;
+vInt g_vInt = 2;
+cvInt g_cvInt = 3;
+
+// CHECK-DAG: @"\01?g_cInt@@3HB"
+// CHECK-DAG: @"\01?g_vInt@@3HC"
+// CHECK-DAG: @"\01?g_cvInt@@3HD"
+
 // Static functions are mangled, too.
 // Also make sure calling conventions, arglists, and throw specs work.
 static void __stdcall alpha(float a, double b) throw() {}
