[cfe-commits] r105330 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-subst-std.cpp
Anders Carlsson
andersca at mac.com
Wed Jun 2 08:58:27 PDT 2010
Author: andersca
Date: Wed Jun 2 10:58:27 2010
New Revision: 105330
URL: http://llvm.org/viewvc/llvm-project?rev=105330&view=rev
Log:
Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
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=105330&r1=105329&r2=105330&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Jun 2 10:58:27 2010
@@ -362,12 +362,6 @@
mangleBareFunctionType(FT, MangleReturnType);
}
-/// isStd - Return whether a given namespace is the 'std' namespace.
-static bool isStd(const NamespaceDecl *NS) {
- const IdentifierInfo *II = NS->getOriginalNamespace()->getIdentifier();
- return II && II->isStr("std");
-}
-
static const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC) {
while (isa<LinkageSpecDecl>(DC)) {
DC = DC->getParent();
@@ -376,15 +370,21 @@
return DC;
}
+/// isStd - Return whether a given namespace is the 'std' namespace.
+static bool isStd(const NamespaceDecl *NS) {
+ if (!IgnoreLinkageSpecDecls(NS->getParent())->isTranslationUnit())
+ return false;
+
+ const IdentifierInfo *II = NS->getOriginalNamespace()->getIdentifier();
+ return II && II->isStr("std");
+}
+
// isStdNamespace - Return whether a given decl context is a toplevel 'std'
// namespace.
static bool isStdNamespace(const DeclContext *DC) {
if (!DC->isNamespace())
return false;
- if (!IgnoreLinkageSpecDecls(DC->getParent())->isTranslationUnit())
- return false;
-
return isStd(cast<NamespaceDecl>(DC));
}
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=105330&r1=105329&r2=105330&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp Wed Jun 2 10:58:27 2010
@@ -99,3 +99,13 @@
void create_streams() {
std::basic_iostream<char> bio(17);
}
+
+// Make sure we don't mangle 'std' as 'St' here.
+namespace N {
+ namespace std {
+ struct A { void f(); };
+
+ // CHECK: define void @_ZN1N3std1A1fEv
+ void A::f() { }
+ }
+}
More information about the cfe-commits
mailing list