[cfe-commits] r162163 - in /cfe/trunk: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle-template.cpp
John McCall
rjmccall at apple.com
Fri Aug 17 21:51:52 PDT 2012
Author: rjmccall
Date: Fri Aug 17 23:51:52 2012
New Revision: 162163
URL: http://llvm.org/viewvc/llvm-project?rev=162163&view=rev
Log:
When mangling a negative number, remember that negating it does not
always yield a positive number. Just print the negated result as an
unsigned number.
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-template.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=162163&r1=162162&r2=162163&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Fri Aug 17 23:51:52 2012
@@ -693,9 +693,10 @@
void CXXNameMangler::mangleNumber(const llvm::APSInt &Value) {
if (Value.isSigned() && Value.isNegative()) {
Out << 'n';
- Value.abs().print(Out, true);
- } else
- Value.print(Out, Value.isSigned());
+ Value.abs().print(Out, /*signed*/ false);
+ } else {
+ Value.print(Out, /*signed*/ false);
+ }
}
void CXXNameMangler::mangleNumber(int64_t Number) {
Modified: cfe/trunk/test/CodeGenCXX/mangle-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-template.cpp?rev=162163&r1=162162&r2=162163&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-template.cpp Fri Aug 17 23:51:52 2012
@@ -170,3 +170,15 @@
test<const int&, n>();
}
}
+
+// rdar://problem/12072531
+// Test the boundary condition of minimal signed integers.
+namespace test13 {
+ template <char c> char returnChar() { return c; }
+ template char returnChar<-128>();
+ // CHECK: @_ZN6test1310returnCharILcn128EEEcv()
+
+ template <short s> short returnShort() { return s; }
+ template short returnShort<-32768>();
+ // CHECK: @_ZN6test1311returnShortILsn32768EEEsv()
+}
More information about the cfe-commits
mailing list