Here's a test presented as a diff to test/CodeGenCXX/mangle-ms.cpp the FIXME lines are the unsatisfied checks, NOW is how these variables are mangled today. diff --git test/CodeGenCXX/mangle-ms.cpp test/CodeGenCXX/mangle-ms.cpp index 8798a7d..8440d68 100644 --- test/CodeGenCXX/mangle-ms.cpp +++ test/CodeGenCXX/mangle-ms.cpp @@ -2,6 +2,11 @@ // CHECK: @"\01?a@@3HA" // CHECK: @"\01?b@N@@3HA" +// CHECK: @"\01?s1@N@@3PADA" +// FIXME: @"\01?s2@N@@3QBDB" +// NOW: @"\01?s2@N@@3PBDA" +// FIXME: @"\01?s3@N@@3QBDB" +// NOW: @"\01?s3@N@@3PBDA" // CHECK: @c // CHECK: @"\01?d@foo@@0FB" // CHECK: @"\01?e@foo@@1JC" @@ -18,10 +23,17 @@ int a; -namespace N { int b; } +namespace N { + int b; + extern char s1[]; + extern const char s2[]; + extern const char s3[42]; +} static int c; -int _c(void) {return c;} +int _c(void) { + return N::s1[0] + N::s2[0] + N::s3[0] + c; +} // CHECK: @"\01?_c@@YAHXZ" class foo {
I haven't been able to fix this so far and maybe won't be doing that for some time, so feel free to take over.
Thanks for the heads up. I'm also not sure when I'll be able to look into this, so if someone else wants to do it, feel free :)
Taking this PR.
One more broken thing: extern RGB const color3[5] = {}; should be mangled as "\01?color3@@3QAY02$$CBNA" but currently it is "\01?color3@@3PBY02NA"
FTR, most of these problems were fixed by r163110. The only remaining one is mentioned in comment #4. I'm un-assigning it from myself as this is not a top issue for me anymore, feel free to take over!
I'm working on a fix for this (and a number of other mangling bugs).
Fixed by r180250.