[cfe-commits] r82833 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Fri Sep 25 19:26:03 PDT 2009
Author: andersca
Date: Fri Sep 25 21:26:02 2009
New Revision: 82833
URL: http://llvm.org/viewvc/llvm-project?rev=82833&view=rev
Log:
Improve mangling of typename types.
Modified:
cfe/trunk/lib/CodeGen/Mangle.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=82833&r1=82832&r2=82833&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Sep 25 21:26:02 2009
@@ -911,7 +911,22 @@
}
void CXXNameMangler::mangleType(const TypenameType *T) {
- assert(false && "can't mangle dependent typenames yet");
+ // Typename types are always nested
+ Out << 'N';
+
+ const Type *QTy = T->getQualifier()->getAsType();
+ if (const TemplateSpecializationType *TST =
+ dyn_cast<TemplateSpecializationType>(QTy)) {
+ TemplateDecl *TD = TST->getTemplateName().getAsTemplateDecl();
+
+ mangleTemplatePrefix(TD);
+ mangleTemplateArgs(TST->getArgs(), TST->getNumArgs());
+ } else
+ assert(false && "Unhandled type!");
+
+ mangleSourceName(T->getIdentifier());
+
+ Out << 'E';
}
void CXXNameMangler::mangleExpression(const Expr *E) {
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=82833&r1=82832&r2=82833&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Fri Sep 25 21:26:02 2009
@@ -147,3 +147,11 @@
// CHECK: @_ZNK5DebuglsEj
int main(void) { dbg << 32 ;}
}
+
+template<typename T> struct S6 {
+ typedef int B;
+};
+
+template<typename T> void ft5(typename S6<T>::B) { }
+// CHECK: @_Z3ft5IiEvN2S6IT_E1BE
+template void ft5<int>(int);
More information about the cfe-commits
mailing list