[cfe-commits] r83557 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-subst-std.cpp
Anders Carlsson
andersca at mac.com
Thu Oct 8 10:20:26 PDT 2009
Author: andersca
Date: Thu Oct 8 12:20:26 2009
New Revision: 83557
URL: http://llvm.org/viewvc/llvm-project?rev=83557&view=rev
Log:
Mangle std::basic_ostream<char, std::char_traits<char>> as So.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=83557&r1=83556&r2=83557&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Thu Oct 8 12:20:26 2009
@@ -1291,6 +1291,24 @@
Out << "Ss";
return true;
}
+
+ // <substitution> ::= So # ::std::basic_ostream<char,
+ // ::std::char_traits<char> >
+ if (SD->getIdentifier()->isStr("basic_ostream")) {
+ const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
+
+ if (TemplateArgs.size() != 2)
+ return false;
+
+ if (!isCharType(TemplateArgs[0].getAsType()))
+ return false;
+
+ if (!isCharSpecialization(TemplateArgs[1].getAsType(), "char_traits"))
+ return false;
+
+ Out << "So";
+ return true;
+ }
}
return false;
}
Modified: cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp?rev=83557&r1=83556&r2=83557&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp Thu Oct 8 12:20:26 2009
@@ -9,24 +9,31 @@
};
namespace std {
- template<typename T> struct allocator { };
+ template<typename> struct allocator { };
}
// CHECK: define void @_Z1fSaIcESaIiE
void f(std::allocator<char>, std::allocator<int>) { }
namespace std {
- template<typename T, typename U, typename V> struct basic_string { };
+ template<typename, typename, typename> struct basic_string { };
}
// CHECK: define void @_Z1fSbIcciE
void f(std::basic_string<char, char, int>) { }
namespace std {
- template<typename T> struct char_traits { };
+ template<typename> struct char_traits { };
typedef std::basic_string<char, std::char_traits<char>, std::allocator<char> > string;
}
// CHECK: _Z1fSs
void f(std::string) { }
+
+namespace std {
+ template<typename, typename> struct basic_ostream { };
+}
+
+// CHECK: _Z1fSo
+void f(std::basic_ostream<char, std::char_traits<char> >) { }
More information about the cfe-commits
mailing list