[lld] r310438 - [PDB] Merge Global and Publics Builders.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 21:23:25 PDT 2017


Author: zturner
Date: Tue Aug  8 21:23:25 2017
New Revision: 310438

URL: http://llvm.org/viewvc/llvm-project?rev=310438&view=rev
Log:
[PDB] Merge Global and Publics Builders.

The publics stream and globals stream are very similar. They both
contain a list of hash buckets that refer into a single shared stream,
the symbol record stream. Because of the need for each builder to manage
both an independent hash stream as well as a single shared record
stream, making the two builders be independent entities is not the right
design. This patch merges them into a single class, of which only a
single instance is needed to create all 3 streams.  PublicsStreamBuilder
and GlobalsStreamBuilder are now merged into the single GSIStreamBuilder
class, which writes all 3 streams at once.

Note that this patch does not contain any functionality change. So we're
still not yet writing any records to the globals stream. All we're doing
is making it so that when we do start writing records to the globals,
this refactor won't have to be part of that patch.

Differential Revision: https://reviews.llvm.org/D36489

Modified:
    lld/trunk/COFF/PDB.cpp
    lld/trunk/test/COFF/pdb-diff.test

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=310438&r1=310437&r2=310438&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Tue Aug  8 21:23:25 2017
@@ -30,13 +30,13 @@
 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h"
 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
 #include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h"
+#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
 #include "llvm/DebugInfo/PDB/Native/InfoStream.h"
 #include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h"
 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
 #include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h"
 #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
-#include "llvm/DebugInfo/PDB/Native/PublicsStreamBuilder.h"
 #include "llvm/DebugInfo/PDB/Native/TpiHashing.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
@@ -641,14 +641,10 @@ void PDBLinker::addObjectsToPDB() {
               [](const PublicSym32 &L, const PublicSym32 &R) {
                 return L.Name < R.Name;
               });
-    auto &PublicsBuilder = Builder.getPublicsBuilder();
+    auto &GsiBuilder = Builder.getGsiBuilder();
     for (const PublicSym32 &Pub : Publics)
-      PublicsBuilder.addPublicSymbol(Pub);
+      GsiBuilder.addPublicSymbol(Pub);
   }
-  // Add globals stream.  For now we don't actually write any thing useful to
-  // the globals stream, but the act of "getting" it also creates it lazily so
-  // that we write an empty stream.
-  (void)Builder.getGlobalsBuilder();
 }
 
 static void addLinkerModuleSymbols(StringRef Path,

Modified: lld/trunk/test/COFF/pdb-diff.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-diff.test?rev=310438&r1=310437&r2=310438&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-diff.test (original)
+++ lld/trunk/test/COFF/pdb-diff.test Tue Aug  8 21:23:25 2017
@@ -55,10 +55,10 @@ CHECK-NEXT:   |                     IPI
 CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   |           Public Symbol Hash | {{[EI]}} |
 CHECK-NEXT:   |------------------------------+---|
-CHECK-NEXT:   |        Public Symbol Records | {{[EI]}} |
-CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   |           Global Symbol Hash | {{[EI]}} |
 CHECK-NEXT:   |------------------------------+---|
+CHECK-NEXT:   |        Public Symbol Records | {{[EI]}} |
+CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   ------------------------------------
 CHECK-NEXT:   |           String Table           |
 CHECK-NEXT:   |------------------------------+---|




More information about the llvm-commits mailing list