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

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 11:49:24 PDT 2018


lhames added a comment.

In https://reviews.llvm.org/D50716#1199212, @labath wrote:

> 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.


I think I can make a partial fix for this bug, but honestly I have been uncomfortable with the builtin compound error for a long time. I wasn't planning to support it via the C API initially, and I'm wondering whether we should not remove it entirely and force people to build their own custom compound errors.



================
Comment at: lib/Support/Error.cpp:132
+LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err) {
+  return const_cast<void *>(
+      reinterpret_cast<ErrorInfoBase *>(Err)->dynamicClassID());
----------------
labath wrote:
> Any chance LLVMErrorTypeId could be a `const void *`  (to avoid the const cast)?
Absolutely. I forgot we don't have to support ancient C compilers. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D50716





More information about the llvm-commits mailing list