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.

llvm-svn: 99012
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index a40a5fb..ad97d08 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -569,13 +569,13 @@
     isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method);
   
   llvm::StringRef MethodName = getFunctionName(Method);
-  llvm::StringRef MethodLinkageName;
   llvm::DIType MethodTy = getOrCreateMethodType(Method, Unit);
   
   // Since a single ctor/dtor corresponds to multiple functions, it doesn't
   // make sense to give a single ctor/dtor a linkage name.
+  MangleBuffer MethodLinkageName;
   if (!IsCtorOrDtor)
-    MethodLinkageName = CGM.getMangledName(Method);
+    CGM.getMangledName(MethodLinkageName, Method);
 
   SourceManager &SM = CGM.getContext().getSourceManager();
 
@@ -1307,7 +1307,7 @@
                                     CGBuilderTy &Builder) {
 
   llvm::StringRef Name;
-  llvm::StringRef LinkageName;
+  MangleBuffer LinkageName;
 
   const Decl *D = GD.getDecl();
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
@@ -1326,11 +1326,11 @@
     if (!Name.empty() && Name[0] == '\01')
       Name = Name.substr(1);
     // Use mangled name as linkage name for c/c++ functions.
-    LinkageName = CGM.getMangledName(GD);
+    CGM.getMangledName(LinkageName, GD);
   } else {
     // Use llvm function name as linkage name.
     Name = Fn->getName();
-    LinkageName = Name;
+    LinkageName.setString(Name);
     if (!Name.empty() && Name[0] == '\01')
       Name = Name.substr(1);
   }