diff options
author | John McCall <rjmccall@apple.com> | 2010-03-19 23:29:14 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-19 23:29:14 +0000 |
commit | f746aa6a8f538be914173a4aef2d9a2fd9f99d17 (patch) | |
tree | 25c8b976658fc372fd816f4162208201cd61c607 /lib/CodeGen/CGDecl.cpp | |
parent | c6fbbedb3e90ff2f04828c36fd839e01468679f5 (diff) |
Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap. Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board. We'll see how it plays out.
Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 1dc083f387..4eb95af8ff 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -103,13 +103,18 @@ void CodeGenFunction::EmitBlockVarDecl(const VarDecl &D) { static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, const char *Separator) { CodeGenModule &CGM = CGF.CGM; - if (CGF.getContext().getLangOptions().CPlusPlus) - return CGM.getMangledName(&D); + if (CGF.getContext().getLangOptions().CPlusPlus) { + MangleBuffer Name; + CGM.getMangledName(Name, &D); + return Name.getString().str(); + } std::string ContextName; - if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) - ContextName = CGM.getMangledName(FD); - else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl)) + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) { + MangleBuffer Name; + CGM.getMangledName(Name, FD); + ContextName = Name.getString().str(); + } else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl)) ContextName = CGF.CurFn->getName(); else // FIXME: What about in a block?? |