[PATCH] D26430: Bitcode: Change the BitcodeReader to use llvm::Error internally.

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 16:19:36 PST 2016


Thanks Peter.  This is great!

The only thing that i’m not sure about is these methods:

+std::error_code errorToErrorCodeAndEmitErrors(LLVMContext &Ctx, Error Err) {
+  if (Err) {
+    std::error_code EC;
+    handleAllErrors(std::move(Err), [&](ErrorInfoBase &EIB) {
+      EC = EIB.convertToErrorCode();
+      Ctx.emitError(EIB.message());
+    });
+    return EC;
+  }
+  return std::error_code();
 }

I think you can instead just use expectedToError() and errorToErrorCode().  Saying that, you are also logging these to the diagnostic handler and/or context, so perhaps this is special enough that the code you have is the right way to do it.

Will leave it up to you as you know the code better.  These methods are probably only temporary anyway until the rest of the API is converted to Error and Expected.

LGTM.

Cheers,
Pete
> On Nov 8, 2016, at 4:10 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> 
> pcc created this revision.
> pcc added reviewers: lhames, mehdi_amini, pete.
> pcc added a subscriber: llvm-commits.
> 
> https://reviews.llvm.org/D26430
> 
> Files:
>  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
> 
> <D26430.77281.patch>



More information about the llvm-commits mailing list