[llvm-branch-commits] [lld] b14ad90 - [LLD][COFF] Simplify function. NFC.

Alexandre Ganea via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 7 19:42:19 PST 2021


Author: Alexandre Ganea
Date: 2021-01-07T22:37:11-05:00
New Revision: b14ad90b137980125170b64fdf6be270811e5fc7

URL: https://github.com/llvm/llvm-project/commit/b14ad90b137980125170b64fdf6be270811e5fc7
DIFF: https://github.com/llvm/llvm-project/commit/b14ad90b137980125170b64fdf6be270811e5fc7.diff

LOG: [LLD][COFF] Simplify function. NFC.

Added: 
    

Modified: 
    lld/COFF/DebugTypes.cpp
    lld/COFF/DebugTypes.h

Removed: 
    


################################################################################
diff  --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index d3996eabca7d..52c24aaf214f 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -696,7 +696,7 @@ void TpiSource::mergeUniqueTypeRecords(ArrayRef<uint8_t> typeRecords,
 
 void TpiSource::remapTpiWithGHashes(GHashState *g) {
   assert(config->debugGHashes && "ghashes must be enabled");
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   tpiMap = indexMapStorage;
   ipiMap = indexMapStorage;
   mergeUniqueTypeRecords(file->debugTypes);
@@ -761,13 +761,13 @@ void TypeServerSource::remapTpiWithGHashes(GHashState *g) {
   // propagate errors, those should've been handled during ghash loading.
   pdb::PDBFile &pdbFile = pdbInputFile->session->getPDBFile();
   pdb::TpiStream &tpi = check(pdbFile.getPDBTpiStream());
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   tpiMap = indexMapStorage;
   mergeUniqueTypeRecords(typeArrayToBytes(tpi.typeArray()));
   if (pdbFile.hasPDBIpiStream()) {
     pdb::TpiStream &ipi = check(pdbFile.getPDBIpiStream());
     ipiSrc->indexMapStorage.resize(ipiSrc->ghashes.size());
-    ipiSrc->fillMapFromGHashes(g, ipiSrc->indexMapStorage);
+    ipiSrc->fillMapFromGHashes(g);
     ipiMap = ipiSrc->indexMapStorage;
     ipiSrc->tpiMap = tpiMap;
     ipiSrc->ipiMap = ipiMap;
@@ -842,7 +842,7 @@ void UsePrecompSource::loadGHashes() {
 }
 
 void UsePrecompSource::remapTpiWithGHashes(GHashState *g) {
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   // This object was compiled with /Yu, so process the corresponding
   // precompiled headers object (/Yc) first. Some type indices in the current
   // object are referencing data in the precompiled headers object, so we need
@@ -1149,14 +1149,14 @@ static TypeIndex loadPdbTypeIndexFromCell(GHashState *g,
 
 // Fill in a TPI or IPI index map using ghashes. For each source type, use its
 // ghash to lookup its final type index in the PDB, and store that in the map.
-void TpiSource::fillMapFromGHashes(GHashState *g,
-                                   SmallVectorImpl<TypeIndex> &mapToFill) {
+void TpiSource::fillMapFromGHashes(GHashState *g) {
   for (size_t i = 0, e = ghashes.size(); i < e; ++i) {
     TypeIndex fakeCellIndex = indexMapStorage[i];
     if (fakeCellIndex.isSimple())
-      mapToFill[i] = fakeCellIndex;
+      indexMapStorage[i] = fakeCellIndex;
     else
-      mapToFill[i] = loadPdbTypeIndexFromCell(g, fakeCellIndex.toArrayIndex());
+      indexMapStorage[i] =
+          loadPdbTypeIndexFromCell(g, fakeCellIndex.toArrayIndex());
   }
 }
 

diff  --git a/lld/COFF/DebugTypes.h b/lld/COFF/DebugTypes.h
index 42485df06f87..faad30b141e9 100644
--- a/lld/COFF/DebugTypes.h
+++ b/lld/COFF/DebugTypes.h
@@ -83,8 +83,7 @@ class TpiSource {
 
   // Use the ghash table to construct a map from source type index to
   // destination PDB type index. Usable for either TPI or IPI.
-  void fillMapFromGHashes(GHashState *m,
-                          llvm::SmallVectorImpl<TypeIndex> &indexMap);
+  void fillMapFromGHashes(GHashState *m);
 
   // Copies ghashes from a vector into an array. These are long lived, so it's
   // worth the time to copy these into an appropriately sized vector to reduce


        


More information about the llvm-branch-commits mailing list