aboutsummaryrefslogtreecommitdiff
path: root/deps/lld/Common/ErrorHandler.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-08-04 17:47:16 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-08-04 17:47:16 -0400
commitcfb29f18e476a3d814664a0944699927ce5bf190 (patch)
tree761b59a7f13dd917649ea717507f5f0b9d82926b /deps/lld/Common/ErrorHandler.cpp
parentb48948d6e805cdee7f33243098af9a862c152df1 (diff)
downloadzig-cfb29f18e476a3d814664a0944699927ce5bf190.tar.gz
zig-cfb29f18e476a3d814664a0944699927ce5bf190.zip
update embedded LLD to 7.0.0rc1
Diffstat (limited to 'deps/lld/Common/ErrorHandler.cpp')
-rw-r--r--deps/lld/Common/ErrorHandler.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/deps/lld/Common/ErrorHandler.cpp b/deps/lld/Common/ErrorHandler.cpp
index 18affce4d5..d1cb3dbbe0 100644
--- a/deps/lld/Common/ErrorHandler.cpp
+++ b/deps/lld/Common/ErrorHandler.cpp
@@ -12,7 +12,8 @@
#include "lld/Common/Threads.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/Support/Error.h"
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/raw_ostream.h"
#include <mutex>
@@ -59,6 +60,30 @@ void lld::exitLld(int Val) {
_exit(Val);
}
+void lld::diagnosticHandler(const DiagnosticInfo &DI) {
+ SmallString<128> S;
+ raw_svector_ostream OS(S);
+ DiagnosticPrinterRawOStream DP(OS);
+ DI.print(DP);
+ switch (DI.getSeverity()) {
+ case DS_Error:
+ error(S);
+ break;
+ case DS_Warning:
+ warn(S);
+ break;
+ case DS_Remark:
+ case DS_Note:
+ message(S);
+ break;
+ }
+}
+
+void lld::checkError(Error E) {
+ handleAllErrors(std::move(E),
+ [&](ErrorInfoBase &EIB) { error(EIB.message()); });
+}
+
void ErrorHandler::print(StringRef S, raw_ostream::Colors C) {
*ErrorOS << LogName << ": ";
if (ColorDiagnostics) {