[llvm] r219682 - [llvm-symbolizer] Minor typedef cleanup. NFC.

Alexander Potapenko glider at google.com
Tue Oct 14 06:40:44 PDT 2014


Author: glider
Date: Tue Oct 14 08:40:44 2014
New Revision: 219682

URL: http://llvm.org/viewvc/llvm-project?rev=219682&view=rev
Log:
[llvm-symbolizer] Minor typedef cleanup. NFC.

Modified:
    llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
    llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h

Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp?rev=219682&r1=219681&r2=219682&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp Tue Oct 14 08:40:44 2014
@@ -85,7 +85,7 @@ void ModuleInfo::addSymbol(const SymbolR
     SymbolName = SymbolName.drop_front();
   // FIXME: If a function has alias, there are two entries in symbol table
   // with same address size. Make sure we choose the correct one.
-  SymbolMapTy &M = SymbolType == SymbolRef::ST_Function ? Functions : Objects;
+  auto &M = SymbolType == SymbolRef::ST_Function ? Functions : Objects;
   SymbolDesc SD = { SymbolAddress, SymbolSize };
   M.insert(std::make_pair(SD, SymbolName));
 }
@@ -93,19 +93,20 @@ void ModuleInfo::addSymbol(const SymbolR
 bool ModuleInfo::getNameFromSymbolTable(SymbolRef::Type Type, uint64_t Address,
                                         std::string &Name, uint64_t &Addr,
                                         uint64_t &Size) const {
-  const SymbolMapTy &M = Type == SymbolRef::ST_Function ? Functions : Objects;
-  if (M.empty())
+  const auto &SymbolMap = Type == SymbolRef::ST_Function ? Functions : Objects;
+  if (SymbolMap.empty())
     return false;
   SymbolDesc SD = { Address, Address };
-  SymbolMapTy::const_iterator it = M.upper_bound(SD);
-  if (it == M.begin())
+  auto SymbolIterator = SymbolMap.upper_bound(SD);
+  if (SymbolIterator == SymbolMap.begin())
     return false;
-  --it;
-  if (it->first.Size != 0 && it->first.Addr + it->first.Size <= Address)
+  --SymbolIterator;
+  if (SymbolIterator->first.Size != 0 &&
+      SymbolIterator->first.Addr + SymbolIterator->first.Size <= Address)
     return false;
-  Name = it->second.str();
-  Addr = it->first.Addr;
-  Size = it->first.Size;
+  Name = SymbolIterator->second.str();
+  Addr = SymbolIterator->first.Addr;
+  Size = SymbolIterator->first.Size;
   return true;
 }
 
@@ -295,7 +296,7 @@ static bool getGNUDebuglinkContents(cons
 
 LLVMSymbolizer::BinaryPair
 LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
-  BinaryMapTy::iterator I = BinaryForPath.find(Path);
+  const auto &I = BinaryForPath.find(Path);
   if (I != BinaryForPath.end())
     return I->second;
   Binary *Bin = nullptr;
@@ -348,7 +349,7 @@ LLVMSymbolizer::getObjectFileFromBinary(
     return nullptr;
   ObjectFile *Res = nullptr;
   if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(Bin)) {
-    ObjectFileForArchMapTy::iterator I = ObjectFileForArch.find(
+    const auto &I = ObjectFileForArch.find(
         std::make_pair(UB, ArchName));
     if (I != ObjectFileForArch.end())
       return I->second;
@@ -367,7 +368,7 @@ LLVMSymbolizer::getObjectFileFromBinary(
 
 ModuleInfo *
 LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
-  ModuleMapTy::iterator I = Modules.find(ModuleName);
+  const auto &I = Modules.find(ModuleName);
   if (I != Modules.end())
     return I->second;
   std::string BinaryName = ModuleName;

Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h?rev=219682&r1=219681&r2=219682&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h Tue Oct 14 08:40:44 2014
@@ -82,13 +82,10 @@ private:
   }
 
   // Owns module info objects.
-  typedef std::map<std::string, ModuleInfo *> ModuleMapTy;
-  ModuleMapTy Modules;
-  typedef std::map<std::string, BinaryPair> BinaryMapTy;
-  BinaryMapTy BinaryForPath;
-  typedef std::map<std::pair<MachOUniversalBinary *, std::string>, ObjectFile *>
-      ObjectFileForArchMapTy;
-  ObjectFileForArchMapTy ObjectFileForArch;
+  std::map<std::string, ModuleInfo *> Modules;
+  std::map<std::string, BinaryPair> BinaryForPath;
+  std::map<std::pair<MachOUniversalBinary *, std::string>, ObjectFile *>
+      ObjectFileForArch;
 
   Options Opts;
   static const char kBadString[];
@@ -122,9 +119,8 @@ private:
       return s1.Addr < s2.Addr;
     }
   };
-  typedef std::map<SymbolDesc, StringRef> SymbolMapTy;
-  SymbolMapTy Functions;
-  SymbolMapTy Objects;
+  std::map<SymbolDesc, StringRef> Functions;
+  std::map<SymbolDesc, StringRef> Objects;
 };
 
 } // namespace symbolize





More information about the llvm-commits mailing list