From e949e6cced1079dbb6eaa7364e6fd5c65864e4c9 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 21 Nov 2009 09:14:52 +0000 Subject: Mangler: Lift shouldMangleDeclName predicate out of CXXNameMangler::mangle. - Sometimes we have to mangle things we wouldn't normally (e.g., because they appear in a template expression). - This also tidies up the predicate to be more obvious what is getting mangled. llvm-svn: 89555 --- clang/lib/CodeGen/CodeGenModule.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8ba3d3261899..5744489f2f53 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -160,18 +160,13 @@ const char *CodeGenModule::getMangledName(const GlobalDecl &GD) { /// the unmangled name. /// const char *CodeGenModule::getMangledName(const NamedDecl *ND) { - // In C, functions with no attributes never need to be mangled. Fastpath them. - if (!getLangOptions().CPlusPlus && !ND->hasAttrs()) { + if (!getMangleContext().shouldMangleDeclName(ND)) { assert(ND->getIdentifier() && "Attempt to mangle unnamed decl."); return ND->getNameAsCString(); } llvm::SmallString<256> Name; - if (!getMangleContext().mangleName(ND, Name)) { - assert(ND->getIdentifier() && "Attempt to mangle unnamed decl."); - return ND->getNameAsCString(); - } - + getMangleContext().mangleName(ND, Name); Name += '\0'; return UniqueMangledName(Name.begin(), Name.end()); } -- cgit v1.2.3