<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">It looks like you may also need to update the module.modulemap for building with -DLLVM_ENABLE_MODULES=On:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">While building module 'LLVM_Utils' imported from ../lib/Support/APSInt.cpp:15:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">In file included from <module-includes>:77:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">In file included from ../include/llvm/Support/BinaryStreamError.h:14:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">../include/llvm/Support/Error.h:17:2: </b></span><span style="font-variant-ligatures: no-common-ligatures; color: #c814c9" class=""><b class="">warning: </b></span><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">missing submodule 'LLVM_C.Error' [-Wincomplete-umbrella]</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">#include "llvm-c/Error.h"</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(47, 180, 29); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""> ^       ~~~~~~~~~~~~~~~~</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">1 warning generated.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">thanks,</span></div><div class="">adrian</div><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 15, 2018, at 11:42 AM, Lang Hames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: lhames<br class="">Date: Wed Aug 15 11:42:11 2018<br class="">New Revision: 339802<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=339802&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=339802&view=rev</a><br class="">Log:<br class="">[Support] Add a basic C API for llvm::Error.<br class=""><br class="">Summary:<br class="">The C-API supports consuming errors, converting an error to a string error<br class="">message, and querying an error's type. Other LLVM C APIs that wish to use<br class="">llvm::Error can supply error-type-id checkers and custom<br class="">error-to-structured-type converters for any custom errors they provide.<br class=""><br class="">Reviewers: bogner, zturner, labath, dblaikie<br class=""><br class="">Subscribers: llvm-commits<br class=""><br class="">Differential Revision: <a href="https://reviews.llvm.org/D50716" class="">https://reviews.llvm.org/D50716</a><br class=""><br class="">Added:<br class="">    llvm/trunk/include/llvm-c/Error.h<br class="">Modified:<br class="">    llvm/trunk/include/llvm/Support/Error.h<br class="">    llvm/trunk/lib/Support/Error.cpp<br class="">    llvm/trunk/unittests/Support/ErrorTest.cpp<br class=""><br class="">Added: llvm/trunk/include/llvm-c/Error.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Error.h?rev=339802&view=auto" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Error.h?rev=339802&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm-c/Error.h (added)<br class="">+++ llvm/trunk/include/llvm-c/Error.h Wed Aug 15 11:42:11 2018<br class="">@@ -0,0 +1,65 @@<br class="">+/*===------- llvm-c/Error.h - llvm::Error class C Interface -------*- C -*-===*\<br class="">+|*                                                                            *|<br class="">+|*                     The LLVM Compiler Infrastructure                       *|<br class="">+|*                                                                            *|<br class="">+|* This file is distributed under the University of Illinois Open Source      *|<br class="">+|* License. See LICENSE.TXT for details.                                      *|<br class="">+|*                                                                            *|<br class="">+|*===----------------------------------------------------------------------===*|<br class="">+|*                                                                            *|<br class="">+|* This file defines the C interface to LLVM's Error class.                   *|<br class="">+|*                                                                            *|<br class="">+\*===----------------------------------------------------------------------===*/<br class="">+<br class="">+#ifndef LLVM_C_ERROR_H<br class="">+#define LLVM_C_ERROR_H<br class="">+<br class="">+#ifdef __cplusplus<br class="">+extern "C" {<br class="">+#endif<br class="">+<br class="">+/**<br class="">+ * Opaque reference to an error instance. Null serves as the 'success' value.<br class="">+ */<br class="">+typedef struct LLVMOpaqueError *LLVMErrorRef;<br class="">+<br class="">+/**<br class="">+ * Error type identifier.<br class="">+ */<br class="">+typedef const void *LLVMErrorTypeId;<br class="">+<br class="">+/**<br class="">+ * Returns the type id for the given error instance, which must be a failure<br class="">+ * value (i.e. non-null).<br class="">+ */<br class="">+LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);<br class="">+<br class="">+/**<br class="">+ * Dispose of the given error without handling it. This operation consumes the<br class="">+ * error, and the given LLVMErrorRef value is not usable once this call returns.<br class="">+ * Note: This method *only* needs to be called if the error is not being passed<br class="">+ * to some other consuming operation, e.g. LLVMGetErrorMessage.<br class="">+ */<br class="">+void LLVMConsumeError(LLVMErrorRef Err);<br class="">+<br class="">+/**<br class="">+ * Returns the given string's error message. This operation consumes the error,<br class="">+ * and the given LLVMErrorRef value is not usable once this call returns.<br class="">+ */<br class="">+char *LLVMGetErrorMessage(LLVMErrorRef Err);<br class="">+<br class="">+/**<br class="">+ * Dispose of the given error message.<br class="">+ */<br class="">+void LLVMDisposeErrorMessage(char *ErrMsg);<br class="">+<br class="">+/**<br class="">+ * Returns the type id for llvm StringError.<br class="">+ */<br class="">+LLVMErrorTypeId LLVMGetStringErrorTypeId();<br class="">+<br class="">+#ifdef __cplusplus<br class="">+}<br class="">+#endif<br class="">+<br class="">+#endif<br class=""><br class="">Modified: llvm/trunk/include/llvm/Support/Error.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=339802&r1=339801&r2=339802&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=339802&r1=339801&r2=339802&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/Support/Error.h (original)<br class="">+++ llvm/trunk/include/llvm/Support/Error.h Wed Aug 15 11:42:11 2018<br class="">@@ -14,8 +14,9 @@<br class=""> #ifndef LLVM_SUPPORT_ERROR_H<br class=""> #define LLVM_SUPPORT_ERROR_H<br class=""><br class="">-#include "llvm/ADT/SmallVector.h"<br class="">+#include "llvm-c/Error.h"<br class=""> #include "llvm/ADT/STLExtras.h"<br class="">+#include "llvm/ADT/SmallVector.h"<br class=""> #include "llvm/ADT/StringExtras.h"<br class=""> #include "llvm/ADT/Twine.h"<br class=""> #include "llvm/Config/abi-breaking.h"<br class="">@@ -167,6 +168,9 @@ class LLVM_NODISCARD Error {<br class="">   // error.<br class="">   template <typename T> friend class Expected;<br class=""><br class="">+  // wrap needs to be able to steal the payload.<br class="">+  friend LLVMErrorRef wrap(Error);<br class="">+<br class=""> protected:<br class="">   /// Create a success value. Prefer using 'Error::success()' for readability<br class="">   Error() {<br class="">@@ -1183,6 +1187,17 @@ private:<br class="">   std::function<int(const Error &)> GetExitCode;<br class=""> };<br class=""><br class="">+/// Conversion from Error to LLVMErrorRef for C error bindings.<br class="">+inline LLVMErrorRef wrap(Error Err) {<br class="">+  return reinterpret_cast<LLVMErrorRef>(Err.takePayload().release());<br class="">+}<br class="">+<br class="">+/// Conversion from LLVMErrorRef to Error for C error bindings.<br class="">+inline Error unwrap(LLVMErrorRef ErrRef) {<br class="">+  return Error(std::unique_ptr<ErrorInfoBase>(<br class="">+      reinterpret_cast<ErrorInfoBase *>(ErrRef)));<br class="">+}<br class="">+<br class=""> } // end namespace llvm<br class=""><br class=""> #endif // LLVM_SUPPORT_ERROR_H<br class=""><br class="">Modified: llvm/trunk/lib/Support/Error.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Error.cpp?rev=339802&r1=339801&r2=339802&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Error.cpp?rev=339802&r1=339801&r2=339802&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Support/Error.cpp (original)<br class="">+++ llvm/trunk/lib/Support/Error.cpp Wed Aug 15 11:42:11 2018<br class="">@@ -126,6 +126,26 @@ void report_fatal_error(Error Err, bool<br class="">   report_fatal_error(ErrMsg);<br class=""> }<br class=""><br class="">+} // end namespace llvm<br class="">+<br class="">+LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err) {<br class="">+  return reinterpret_cast<ErrorInfoBase *>(Err)->dynamicClassID();<br class="">+}<br class="">+<br class="">+void LLVMConsumeError(LLVMErrorRef Err) { consumeError(unwrap(Err)); }<br class="">+<br class="">+char *LLVMGetErrorMessage(LLVMErrorRef Err) {<br class="">+  std::string Tmp = toString(unwrap(Err));<br class="">+  char *ErrMsg = new char[Tmp.size() + 1];<br class="">+  memcpy(ErrMsg, Tmp.data(), Tmp.size());<br class="">+  ErrMsg[Tmp.size()] = '\0';<br class="">+  return ErrMsg;<br class="">+}<br class="">+<br class="">+void LLVMDisposeErrorMessage(char *ErrMsg) { delete[] ErrMsg; }<br class="">+<br class="">+LLVMErrorTypeId LLVMGetStringErrorTypeId() {<br class="">+  return reinterpret_cast<void *>(&StringError::ID);<br class=""> }<br class=""><br class=""> #ifndef _MSC_VER<br class=""><br class="">Modified: llvm/trunk/unittests/Support/ErrorTest.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ErrorTest.cpp?rev=339802&r1=339801&r2=339802&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ErrorTest.cpp?rev=339802&r1=339801&r2=339802&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/unittests/Support/ErrorTest.cpp (original)<br class="">+++ llvm/trunk/unittests/Support/ErrorTest.cpp Wed Aug 15 11:42:11 2018<br class="">@@ -8,6 +8,7 @@<br class=""> //===----------------------------------------------------------------------===//<br class=""><br class=""> #include "llvm/Support/Error.h"<br class="">+#include "llvm-c/Error.h"<br class=""><br class=""> #include "llvm/ADT/Twine.h"<br class=""> #include "llvm/Support/Errc.h"<br class="">@@ -832,4 +833,35 @@ TEST(Error, ErrorMatchers) {<br class="">       "  Actual: failed  (CustomError {0})");<br class=""> }<br class=""><br class="">+TEST(Error, C_API) {<br class="">+  EXPECT_THAT_ERROR(unwrap(wrap(Error::success())), Succeeded())<br class="">+      << "Failed to round-trip Error success value via C API";<br class="">+  EXPECT_THAT_ERROR(unwrap(wrap(make_error<CustomError>(0))),<br class="">+                    Failed<CustomError>())<br class="">+      << "Failed to round-trip Error failure value via C API";<br class="">+<br class="">+  auto Err =<br class="">+      wrap(make_error<StringError>("test message", inconvertibleErrorCode()));<br class="">+  EXPECT_EQ(LLVMGetErrorTypeId(Err), LLVMGetStringErrorTypeId())<br class="">+      << "Failed to match error type ids via C API";<br class="">+  char *ErrMsg = LLVMGetErrorMessage(Err);<br class="">+  EXPECT_STREQ(ErrMsg, "test message")<br class="">+      << "Failed to roundtrip StringError error message via C API";<br class="">+  LLVMDisposeErrorMessage(ErrMsg);<br class="">+<br class="">+  bool GotCSE = false;<br class="">+  bool GotCE = false;<br class="">+  handleAllErrors(<br class="">+    unwrap(wrap(joinErrors(make_error<CustomSubError>(42, 7),<br class="">+                           make_error<CustomError>(42)))),<br class="">+    [&](CustomSubError &CSE) {<br class="">+      GotCSE = true;<br class="">+    },<br class="">+    [&](CustomError &CE) {<br class="">+      GotCE = true;<br class="">+    });<br class="">+  EXPECT_TRUE(GotCSE) << "Failed to round-trip ErrorList via C API";<br class="">+  EXPECT_TRUE(GotCE) << "Failed to round-trip ErrorList via C API";<br class="">+}<br class="">+<br class=""> } // end anon namespace<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>