]> granicus.if.org Git - clang/commitdiff
Use DenseMap on IdentifierInfo instead of StringMap.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 25 Aug 2008 06:18:57 +0000 (06:18 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 25 Aug 2008 06:18:57 +0000 (06:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55303 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h

index bea92ce7d3251a2ca84faee51a7ad0e65c30a951..51428c07ac81f0654f4c97c955c2621918ad5806 100644 (file)
@@ -250,7 +250,7 @@ void CodeGenModule::EmitStatics() {
       // Check if we have used a decl with the same name
       // FIXME: The AST should have some sort of aggregate decls or
       // global symbol map.
-      if (!GlobalDeclMap.count(D->getName()))
+      if (!GlobalDeclMap.count(D->getIdentifier()))
         continue;
 
       // Emit the definition.
@@ -362,7 +362,7 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) {
   const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
 
   // Lookup the entry, lazily creating it if necessary.
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry)
     Entry = new llvm::GlobalVariable(Ty, false, 
                                      llvm::GlobalValue::ExternalLinkage,
@@ -396,7 +396,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
   }
   const llvm::Type* InitType = Init->getType();
 
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   llvm::GlobalVariable *GV = cast_or_null<llvm::GlobalVariable>(Entry);
   
   if (!GV) {
@@ -542,7 +542,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(const FunctionDecl *D) {
   const llvm::Type *PTy = llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
   
   // Lookup the entry, lazily creating it if necessary.
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry)
     Entry = EmitForwardFunctionDefinition(D);
 
@@ -550,7 +550,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(const FunctionDecl *D) {
 }
 
 void CodeGenModule::EmitGlobalFunctionDefinition(const FunctionDecl *D) {
-  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getName()];
+  llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
   if (!Entry) {
     Entry = EmitForwardFunctionDefinition(D);
   } else {
index e77e6ebf3b446ea1a5eaabcdf824ec7da09e2ae3..7501fd461e6c0312f974be73f5f74d78d9591229 100644 (file)
@@ -31,6 +31,7 @@ namespace llvm {
 namespace clang {
   class ASTContext;
   class FunctionDecl;
+  class IdentifierInfo;
   class ObjCMethodDecl;
   class ObjCImplementationDecl;
   class ObjCCategoryImplDecl;
@@ -76,7 +77,7 @@ class CodeGenModule {
   /// decl, they should be bitcasted on retrieval. Also note that the
   /// globals are keyed on their source name, not the global name
   /// (which may change with attributes such as asm-labels).
-  llvm::StringMap<llvm::GlobalValue*> GlobalDeclMap;
+  llvm::DenseMap<IdentifierInfo*, llvm::GlobalValue*> GlobalDeclMap;
 
   /// List of static global for which code generation is delayed. When
   /// the translation unit has been fully processed we will lazily