From: Will Wilson Date: Wed, 5 Nov 2014 13:54:21 +0000 (+0000) Subject: MS ABI: Correctly mangle CV qualifiers from typedefs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63c7eb807c2852e89b80e0874c0e4138a01b1080;p=clang MS ABI: Correctly mangle CV qualifiers from typedefs git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221344 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index ca16db4cdd..9fedcf5d5d 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -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); } } diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp index bf61d8b127..662278b303 100644 --- a/test/CodeGenCXX/mangle-ms.cpp +++ b/test/CodeGenCXX/mangle-ms.cpp @@ -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() {}