mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 02:26:27 +08:00
Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
llvm-svn: 105330
This commit is contained in:
@@ -362,12 +362,6 @@ void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) {
|
||||
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 @@ static const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,3 +99,13 @@ void f(not_string) { }
|
||||
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() { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user