[PATCH] D22308: [pdb] Introduce an MsfBuilder class for laying out PDB files

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 13:16:59 PDT 2016


zturner added inline comments.

================
Comment at: lib/DebugInfo/PDB/Raw/MsfBuilder.cpp:27-28
@@ +26,4 @@
+Error MsfBuilder::initialize(uint32_t BlockSize, uint32_t MinBlockCount,
+                             bool CanGrow) {
+  assert(!IsInitialized && "MsfBuilder is already initialized!");
+
----------------
ruiu wrote:
> zturner wrote:
> > ruiu wrote:
> > > So you don't like it, Zach?
> > You mean merging it with the constructor?  The problem is that it's possible to pass an invalid block size, so I didn't want to make it possible to construct an instance of an `MsfBuilder` with an incorrect block size.  If you use the constructor, there is no way to pass the error back to the user.  I could make an enum for the block size, but I wasn't convinced that was better.
> You could make the ctor private and instead provide a static member function (say, `create`) which verifies all parameters and then call the constructor. In this way you can return an error or a new instance.
Ahh, yea actually that's not a bad idea.  Thanks for the suggestion!


https://reviews.llvm.org/D22308





More information about the llvm-commits mailing list