]> granicus.if.org Git - llvm/commitdiff
llvm-lto2: Print diagnostics before exiting (NFC)
authorMehdi Amini <mehdi.amini@apple.com>
Fri, 23 Dec 2016 23:54:17 +0000 (23:54 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Fri, 23 Dec 2016 23:54:17 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290463 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-lto2/llvm-lto2.cpp

index e8bf7a397f2f1231078f532427711de96e56a381..1fa22a01bea27f7d5ef8028f5ccef7a907bb39dd 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "llvm/LTO/Caching.h"
 #include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/LTO/LTO.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/TargetSelect.h"
@@ -157,7 +158,10 @@ int main(int argc, char **argv) {
   std::vector<std::unique_ptr<MemoryBuffer>> MBs;
 
   Config Conf;
-  Conf.DiagHandler = [](const DiagnosticInfo &) {
+  Conf.DiagHandler = [](const DiagnosticInfo &DI) {
+    DiagnosticPrinterRawOStream DP(errs());
+    DI.print(DP);
+    errs() << '\n';
     exit(1);
   };