[PATCH] D50716: [Support] Add a basic C API for llvm::Error.

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 09:37:22 PDT 2018


labath added a comment.

It seems to me this will not handle multi-error objects correctly, but I don't know much about your use case to know whether that is an issue or not.



================
Comment at: include/llvm/Support/Error.h:1191
+  handleAllErrors(std::move(Err), [&EIB](std::unique_ptr<ErrorInfoBase> EIB2) {
+    EIB = std::move(EIB2);
+  });
----------------
In case `Err` contains more than one error message, this will preserve just the last one. Are you worried about that?


================
Comment at: lib/Support/Error.cpp:132
+LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err) {
+  return const_cast<void *>(
+      reinterpret_cast<ErrorInfoBase *>(Err)->dynamicClassID());
----------------
Any chance LLVMErrorTypeId could be a `const void *`  (to avoid the const cast)?


Repository:
  rL LLVM

https://reviews.llvm.org/D50716





More information about the llvm-commits mailing list