[cfe-commits] r82880 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-subst-std.cpp
Anders Carlsson
andersca at mac.com
Sat Sep 26 16:10:05 PDT 2009
Author: andersca
Date: Sat Sep 26 18:10:05 2009
New Revision: 82880
URL: http://llvm.org/viewvc/llvm-project?rev=82880&view=rev
Log:
Mangle ::std::allocator as Sa.
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=82880&r1=82879&r2=82880&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Sat Sep 26 18:10:05 2009
@@ -1132,18 +1132,26 @@
bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) {
// <substitution> ::= St # ::std::
+ if (const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
+ if (NS->getParent()->isTranslationUnit() &&
+ NS->getOriginalNamespace()->getIdentifier()->isStr("std")) {
+ Out << "St";
+ return true;
+ }
+ }
+
+ if (const ClassTemplateDecl *TD = dyn_cast<ClassTemplateDecl>(ND)) {
+ if (!isStdNamespace(TD->getDeclContext()))
+ return false;
+
+ // <substitution> ::= Sa # ::std::allocator
+ if (TD->getIdentifier()->isStr("allocator")) {
+ Out << "Sa";
+ return true;
+ }
+ }
- const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND);
- if (!NS)
- return false;
- if (!NS->getParent()->isTranslationUnit())
- return false;
-
- if (!NS->getOriginalNamespace()->getIdentifier()->isStr("std"))
- return false;
-
- Out << "St";
- return true;
+ return false;
}
void CXXNameMangler::addSubstitution(QualType T) {
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=82880&r1=82879&r2=82880&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp Sat Sep 26 18:10:05 2009
@@ -7,3 +7,12 @@
// CHECK: define void @_ZNSt1AC2Ev
A::A() { }
};
+
+namespace std {
+ template<typename T> struct allocator { allocator(); };
+}
+
+// FIXME: typename is really not allowed here, but it's kept
+// as a workaround for PR5061.
+// CHECK: define void @_Z1fSaIcESaIiE
+void f(typename std::allocator<char>, typename std::allocator<int>) { }
More information about the cfe-commits
mailing list