Add exact number of streams for reserved stream #s.
authorRui Ueyama <ruiu@google.com>
Wed, 5 Oct 2016 22:08:58 +0000 (22:08 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 5 Oct 2016 22:08:58 +0000 (22:08 +0000)
llvm-svn: 283397

lld/COFF/PDB.cpp
lld/test/COFF/pdb.test

index 2b9a39f..6d55d95 100644 (file)
@@ -35,11 +35,10 @@ void coff::createPDB(StringRef Path) {
   pdb::PDBFileBuilder Builder(Alloc);
   ExitOnErr(Builder.initialize(4096)); // 4096 is blocksize
 
-  ExitOnErr(Builder.getMsfBuilder().addStream(1));
-  ExitOnErr(Builder.getMsfBuilder().addStream(1));
-  ExitOnErr(Builder.getMsfBuilder().addStream(1));
-  ExitOnErr(Builder.getMsfBuilder().addStream(1));
-  ExitOnErr(Builder.getMsfBuilder().addStream(1));
+  // Create streams in MSF for predefined streams, namely
+  // PDB, TPI, DBI and IPI.
+  for (int I = 0; I < (int)pdb::kSpecialStreamCount; ++I)
+    ExitOnErr(Builder.getMsfBuilder().addStream(0));
 
   // Add an Info stream.
   auto &InfoBuilder = Builder.getInfoBuilder();
index 83de503..17e24d8 100644 (file)
@@ -7,21 +7,21 @@
 # CHECK-NEXT:   SuperBlock:
 # CHECK-NEXT:     BlockSize:       4096
 # CHECK-NEXT:     FreeBlockMap:
-# CHECK-NEXT:     NumBlocks:       10
-# CHECK-NEXT:     NumDirectoryBytes: 44
+# CHECK-NEXT:     NumBlocks:       8
+# CHECK-NEXT:     NumDirectoryBytes: 36
 # CHECK-NEXT:     Unknown1:        0
 # CHECK-NEXT:     BlockMapAddr:    3
 # CHECK-NEXT:     NumDirectoryBlocks: 1
-# CHECK-NEXT:     DirectoryBlocks: [ 9 ]
+# CHECK-NEXT:     DirectoryBlocks: [ 7 ]
 # CHECK-NEXT:     NumStreams:      5
-# CHECK-NEXT:     FileSize:        40960
-# CHECK-NEXT:   StreamSizes:     [ 1, 48, 56, 1, 56 ]
+# CHECK-NEXT:     FileSize:        32768
+# CHECK-NEXT:   StreamSizes:     [ 0, 48, 56, 0, 56 ]
 # CHECK-NEXT:   StreamMap:
+# CHECK-NEXT:     - Stream:          [ ]
 # CHECK-NEXT:     - Stream:          [ 4 ]
 # CHECK-NEXT:     - Stream:          [ 5 ]
+# CHECK-NEXT:     - Stream:          [ ]
 # CHECK-NEXT:     - Stream:          [ 6 ]
-# CHECK-NEXT:     - Stream:          [ 7 ]
-# CHECK-NEXT:     - Stream:          [ 8 ]
 # CHECK-NEXT:   PdbStream:
 # CHECK-NEXT:     Age:             1
 # CHECK-NEXT:     Guid:            '{00000000-0000-0000-0000-000000000000}'