[cfe-commits] r167599 - in /cfe/trunk: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/mangle-ms-templates.cpp
Nico Weber
nicolasweber at gmx.de
Thu Nov 8 15:38:59 PST 2012
Author: nico
Date: Thu Nov 8 17:38:59 2012
New Revision: 167599
URL: http://llvm.org/viewvc/llvm-project?rev=167599&view=rev
Log:
[Windows] Fix mangling of number literal '0'
Do this by making the mangleNumber(APSInt) overload look like
the int64_t version. (The latter should probably just delegate
to the former).
Test from Evgeny Eltsin!
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=167599&r1=167598&r2=167599&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Nov 8 17:38:59 2012
@@ -351,10 +351,10 @@
char *CurPtr = EndPtr;
llvm::APSInt NibbleMask(Value.getBitWidth(), Value.isUnsigned());
NibbleMask = 0xf;
- for (int i = 0, e = (Value.getActiveBits() + 3) / 4; i != e; ++i) {
+ do {
*--CurPtr = 'A' + Temp.And(NibbleMask).getLimitedValue(0xf);
Temp = Temp.lshr(4);
- }
+ } while (Temp != 0);
Out.write(CurPtr, EndPtr-CurPtr);
Out << '@';
}
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=167599&r1=167598&r2=167599&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Thu Nov 8 17:38:59 2012
@@ -48,6 +48,9 @@
// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE at XZ"
// CHECK: call {{.*}} @"\01??$Foo at H@?$BoolTemplate@$00@@QAEXH at Z"
+ IntTemplate<0> zero;
+// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0A@@@QAE at XZ"
+
IntTemplate<5> five;
// CHECK: call {{.*}} @"\01??0?$IntTemplate@$04@@QAE at XZ"
More information about the cfe-commits
mailing list