]> granicus.if.org Git - clang/commitdiff
Use MapVector rather than simulating it.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 13 Apr 2013 01:28:18 +0000 (01:28 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 13 Apr 2013 01:28:18 +0000 (01:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179438 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4126bea295b54e57882a434989a9aed88299ef86..aacabc7867902d8be7d90513416eb6be8e8b7f84 100644 (file)
@@ -1748,8 +1748,6 @@ void CodeGenModule::MaybeHandleStaticInExternC(const SomeDecl *D,
   // 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(CodeGenModule &CGM,
 /// 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()));
index f8b09711f78dd0f67bd76ecb5fc8fdea484db490..1eb0ebb624b6f67973a3d1f1348936975737dd61 100644 (file)
@@ -307,10 +307,9 @@ class CodeGenModule : public CodeGenTypeCache {
 
   /// 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.