r179438 - Use MapVector rather than simulating it.

Richard Smith richard-llvm at metafoo.co.uk
Fri Apr 12 18:28:19 PDT 2013


Author: rsmith
Date: Fri Apr 12 20:28:18 2013
New Revision: 179438

URL: http://llvm.org/viewvc/llvm-project?rev=179438&view=rev
Log:
Use MapVector rather than simulating it.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=179438&r1=179437&r2=179438&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Apr 12 20:28:18 2013
@@ -1748,8 +1748,6 @@ void CodeGenModule::MaybeHandleStaticInE
   // in extern "C" regions, none of them gets that name.
   if (!R.second)
     R.first->second = 0;
-  else
-    StaticExternCIdents.push_back(D->getIdentifier());
 }
 
 void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
@@ -2958,9 +2956,11 @@ static void EmitGlobalDeclMetadata(CodeG
 /// to such functions with an unmangled name from inline assembly within the
 /// same translation unit.
 void CodeGenModule::EmitStaticExternCAliases() {
-  for (unsigned I = 0, N = StaticExternCIdents.size(); I != N; ++I) {
-    IdentifierInfo *Name = StaticExternCIdents[I];
-    llvm::GlobalValue *Val = StaticExternCValues[Name];
+  for (StaticExternCMap::iterator I = StaticExternCValues.begin(),
+                                  E = StaticExternCValues.end();
+       I != E; ++I) {
+    IdentifierInfo *Name = I->first;
+    llvm::GlobalValue *Val = I->second;
     if (Val && !getModule().getNamedValue(Name->getName()))
       AddUsedGlobal(new llvm::GlobalAlias(Val->getType(), Val->getLinkage(),
                                           Name->getName(), Val, &getModule()));

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=179438&r1=179437&r2=179438&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Apr 12 20:28:18 2013
@@ -307,10 +307,9 @@ class CodeGenModule : public CodeGenType
 
   /// Map used to track internal linkage functions declared within
   /// extern "C" regions.
-  typedef llvm::DenseMap<IdentifierInfo *,
-                         llvm::GlobalValue *> StaticExternCMap;
+  typedef llvm::MapVector<IdentifierInfo *,
+                          llvm::GlobalValue *> StaticExternCMap;
   StaticExternCMap StaticExternCValues;
-  std::vector<IdentifierInfo*> StaticExternCIdents;
 
   /// CXXGlobalInits - Global variables with initializers that need to run
   /// before main.





More information about the cfe-commits mailing list