[lld] r328164 - Replace a std::pair with a struct.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 15:32:17 PDT 2018


Author: rafael
Date: Wed Mar 21 15:32:17 2018
New Revision: 328164

URL: http://llvm.org/viewvc/llvm-project?rev=328164&view=rev
Log:
Replace a std::pair with a struct.

This is more readable and should reduce the noise in a followup patch.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputFiles.h

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=328164&r1=328163&r2=328164&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Mar 21 15:32:17 2018
@@ -183,11 +183,11 @@ ObjFile<ELFT>::getVariableLoc(StringRef
   // Take file name string from line table.
   std::string FileName;
   if (!LT->getFileNameByIndex(
-          It->second.first /* File */, nullptr,
+          It->second.File, nullptr,
           DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FileName))
     return None;
 
-  return std::make_pair(FileName, It->second.second /*Line*/);
+  return std::make_pair(FileName, It->second.Line);
 }
 
 // Returns source line information for a given offset

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=328164&r1=328163&r2=328164&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Wed Mar 21 15:32:17 2018
@@ -216,7 +216,11 @@ private:
   // single object file, so we cache debugging information in order to
   // parse it only once for each object file we link.
   std::unique_ptr<llvm::DWARFDebugLine> DwarfLine;
-  llvm::DenseMap<StringRef, std::pair<unsigned, unsigned>> VariableLoc;
+  struct VarLoc {
+    unsigned File;
+    unsigned Line;
+  };
+  llvm::DenseMap<StringRef, VarLoc> VariableLoc;
   llvm::once_flag InitDwarfLine;
 };
 




More information about the llvm-commits mailing list