[PATCH] D36235: [pdb/lld] Write a valid FPM

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 13:07:19 PDT 2017


rnk added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/MSF/MSFCommon.h:115
+    // One interval every BlockSize blocks.
+    return alignTo(L.SB->NumBlocks, L.SB->BlockSize) / L.SB->BlockSize;
+  }
----------------
Can you refactor this `alignTo(X, Y) / Y` pattern into a helper like `divideRoundUp` or `divideCeil`? The usual way to do that is `(X + Y - 1) / Y`. `alignTo` does stuff we don't need.


================
Comment at: llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp:158
 
+void PDBFileBuilder::commitFpm(WritableBinaryStream &MsfBuffer,
+                               const MSFLayout &Layout) {
----------------
Why not make this part of MSFBuilder? This doesn't use any PDBFileBuilder state, just an MSFLayout.


================
Comment at: llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp:167-169
+  FpmStream =
+      WritableMappedBlockStream::createFpmStream(Layout, MsfBuffer, Allocator);
+  FpmWriter = BinaryStreamWriter(*FpmStream);
----------------
Why do you need to recreate the stream and writer?


https://reviews.llvm.org/D36235





More information about the llvm-commits mailing list