aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/Mangle.cpp4
-rw-r--r--test/CodeGenCXX/function-template-specialization.cpp12
-rw-r--r--test/CodeGenCXX/mangle.cpp11
3 files changed, 17 insertions, 10 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 6429bd7c46..9b5fd74ad5 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -276,7 +276,11 @@ void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
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) {
diff --git a/test/CodeGenCXX/function-template-specialization.cpp b/test/CodeGenCXX/function-template-specialization.cpp
index 8dbaf2fe4d..677be4cc0f 100644
--- a/test/CodeGenCXX/function-template-specialization.cpp
+++ b/test/CodeGenCXX/function-template-specialization.cpp
@@ -8,12 +8,10 @@ T* next(T* ptr, const U& diff) {
}
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 @@ T* next(T* ptr, const U& diff);
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);
}
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index a4c223e73f..65ef0083e4 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -88,9 +88,14 @@ void f(void (S::*)()) {}
// 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);
}