[cfe-commits] r82885 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-subst.cpp
Anders Carlsson
andersca at mac.com
Sat Sep 26 18:06:07 PDT 2009
Author: andersca
Date: Sat Sep 26 20:06:07 2009
New Revision: 82885
URL: http://llvm.org/viewvc/llvm-project?rev=82885&view=rev
Log:
Look for substitutions when mangling TypenameTypes.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-subst.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=82885&r1=82884&r2=82885&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Sat Sep 26 20:06:07 2009
@@ -920,10 +920,13 @@
const Type *QTy = T->getQualifier()->getAsType();
if (const TemplateSpecializationType *TST =
dyn_cast<TemplateSpecializationType>(QTy)) {
- TemplateDecl *TD = TST->getTemplateName().getAsTemplateDecl();
+ if (!mangleSubstitution(QualType(TST, 0))) {
+ TemplateDecl *TD = TST->getTemplateName().getAsTemplateDecl();
- mangleTemplatePrefix(TD);
- mangleTemplateArgs(TST->getArgs(), TST->getNumArgs());
+ mangleTemplatePrefix(TD);
+ mangleTemplateArgs(TST->getArgs(), TST->getNumArgs());
+ addSubstitution(QualType(TST, 0));
+ }
} else if (const TemplateTypeParmType *TTPT =
dyn_cast<TemplateTypeParmType>(QTy)) {
// We use the QualType mangle type variant here because it handles
Modified: cfe/trunk/test/CodeGenCXX/mangle-subst.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-subst.cpp?rev=82885&r1=82884&r2=82885&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst.cpp Sat Sep 26 20:06:07 2009
@@ -31,3 +31,18 @@
// CHECK: define void @_Z1fN1C1DERS_PS_S1_(
void f(C::D, C&, C*, C&) { }
+
+template<typename T>
+struct V {
+ typedef int U;
+};
+
+template <typename T> void f1(typename V<T>::U, V<T>) { }
+
+// CHECK: @_Z2f1IiEvN1VIT_E1UES2_
+template void f1<int>(int, V<int>);
+
+template <typename T> void f2(V<T>, typename V<T>::U) { }
+
+// CHECK: @_Z2f2IiEv1VIT_ENS2_1UE
+template void f2<int>(V<int>, int);
More information about the cfe-commits
mailing list