[cfe-commits] r82119 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/function-template-specialization.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Wed Sep 16 21:02:31 PDT 2009
Author: andersca
Date: Wed Sep 16 23:02:31 2009
New Revision: 82119
URL: http://llvm.org/viewvc/llvm-project?rev=82119&view=rev
Log:
Substitute unscoped template names.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/function-template-specialization.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82119&r1=82118&r2=82119&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Sep 16 23:02:31 2009
@@ -276,7 +276,11 @@
void CXXNameMangler::mangleUnscopedTemplateName(const FunctionDecl *FD) {
// <unscoped-template-name> ::= <unscoped-name>
// ::= <substitution>
+ if (mangleSubstitution(FD))
+ return;
+
mangleUnscopedName(FD);
+ addSubstitution(FD);
}
void CXXNameMangler::mangleCalloffset(int64_t nv, int64_t v) {
Modified: cfe/trunk/test/CodeGenCXX/function-template-specialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/function-template-specialization.cpp?rev=82119&r1=82118&r2=82119&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/function-template-specialization.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/function-template-specialization.cpp Wed Sep 16 23:02:31 2009
@@ -8,12 +8,10 @@
}
void test(int *iptr, float *fptr, int diff) {
- // FIXME: should be "_Z4nextIiiEPT_S1_RKT0_"
- // CHECK: _Z4nextIiiEPT_S0_RKT0_
+ // CHECK: _Z4nextIiiEPT_S1_RKT0_
iptr = next(iptr, diff);
- // FIXME: should be "_Z4nextIfiEPT_S1_RKT0_"
- // CHECK: _Z4nextIfiEPT_S0_RKT0_
-
+
+ // CHECK: _Z4nextIfiEPT_S1_RKT0_
fptr = next(fptr, diff);
}
@@ -22,7 +20,7 @@
void test2(int *iptr, double *dptr, int diff) {
iptr = next(iptr, diff);
- // FIXME: should be "_Z4nextIdiEPT_S1_RKT0_"
- // CHECK: _Z4nextIiiEPT_S0_RKT0_
+
+ // CHECK: _Z4nextIdiEPT_S1_RKT0_
dptr = next(dptr, diff);
}
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=82119&r1=82118&r2=82119&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Wed Sep 16 23:02:31 2009
@@ -88,9 +88,14 @@
// CHECK: define void @_Z1fi
void f(const int) { }
-// CHECK: define linkonce_odr void @_Z2tfIidEvT0_T_
-template<typename T, typename U> void tf(U u, T t) { }
+template<typename T, typename U> void ft1(U u, T t) { }
+
+template<typename T> void ft2(T t, void (*)(T), void (*)(T)) { }
void g() {
- tf<int, double>(1, 0);
+ // CHECK: @_Z3ft1IidEvT0_T_
+ ft1<int, double>(1, 0);
+
+ // CHECK: @_Z3ft2IcEvT_PFvS0_ES2_
+ ft2<char>(1, 0, 0);
}
More information about the cfe-commits
mailing list