]> granicus.if.org Git - clang/commitdiff
MS ABI: Correctly mangle CV qualifiers from typedefs
authorWill Wilson <will@indefiant.com>
Wed, 5 Nov 2014 13:54:21 +0000 (13:54 +0000)
committerWill Wilson <will@indefiant.com>
Wed, 5 Nov 2014 13:54:21 +0000 (13:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221344 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms.cpp

index ca16db4cdd08e501f382e937dbb2b314d074e6b2..9fedcf5d5d1fc550e9114f88fe5c05842f3ff106 100644 (file)
@@ -441,7 +441,7 @@ void MicrosoftCXXNameMangler::mangleVariableEncoding(const VarDecl *VD) {
       mangleQualifiers(Ty.getQualifiers(), false);
   } else {
     mangleType(Ty, SR, QMM_Drop);
-    mangleQualifiers(Ty.getLocalQualifiers(), false);
+    mangleQualifiers(Ty.getQualifiers(), false);
   }
 }
 
index bf61d8b127b7d8b3e64d44464500815f30cd3305..662278b3034f9fd5b3bae2f397a0bf0d602febb7 100644 (file)
@@ -117,6 +117,19 @@ const volatile char foo2::*k;
 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() {}