[PATCH] D34126: [PDB] Add a module descriptor for every object file

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 08:47:56 PDT 2017


rnk added inline comments.


================
Comment at: lld/COFF/PDB.cpp:113-115
+    auto ExpectedModDesc = Builder.getDbiBuilder().addModuleInfo(Path);
+    if (Error E = ExpectedModDesc.takeError())
+      fatal(E, "failed to add module to DBI stream");
----------------
zturner wrote:
> A slightly cleaner way to do this would be to make an `ExitOnError` outside of this for loop, then just write `auto &MD = Err(Builder.getDbiBuilder().addModuleInfo(Path);`
> 
> ```
> ExitOnError Err("Error while adding objects to PDB");
> for (...) {
>   auto &MD = Err(Builder.getDbiBuilder().addModuleInfo(Path));
> ```
(forgot to respond to this) Thanks, I tried `check()` first, but that doesn't work because it isn't overloaded for `Expected<T&>`.


https://reviews.llvm.org/D34126





More information about the llvm-commits mailing list