From b4d2cdbb46edbaeef6f34971db937c0f8644afb7 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 2 Jun 2010 15:58:27 +0000 Subject: Don't substitute 'St' for 'std' when the namespace is nested inside another namespace. llvm-svn: 105330 --- clang/lib/CodeGen/Mangle.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp index b7d8e2704a4..c246bb50c69 100644 --- a/clang/lib/CodeGen/Mangle.cpp +++ b/clang/lib/CodeGen/Mangle.cpp @@ -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(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(DC)); } -- cgit v1.2.3