[PATCH] D22693: More strongly separate the PDB reading interfaces and PDB writing interfaces

Adrian McCarthy via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 12:01:24 PDT 2016


amccarth added a comment.

At a high level, this seems reasonable to me.  At an API level, I find it surprising that the write interfaces are const.


================
Comment at: include/llvm/DebugInfo/Msf/StreamInterface.h:45
@@ -44,3 +44,3 @@
   // only writes into existing allocated space.
   virtual Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const = 0;
 
----------------
It's surprising that the `writeBytes` method is const.  I understand why this works, but as a user of the API, it's surprising.

================
Comment at: lib/DebugInfo/Msf/MappedBlockStream.cpp:191
@@ -162,4 +190,3 @@
   uint32_t NumAdditionalBlocks =
-      llvm::alignTo(Size - BytesFromFirstBlock, Msf.getBlockSize()) /
-      Msf.getBlockSize();
+      llvm::alignTo(Size - BytesFromFirstBlock, BlockSize) / BlockSize;
 
----------------
Is this correct?  If `Size` is two blocks and `BytesFromFirstBlock` is less than `BlockSize`, then we'll get two additional blocks instead of one.


https://reviews.llvm.org/D22693





More information about the llvm-commits mailing list