From 7fed58cd9f45b34fa6b694fbd205eeaecd1773a2 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 8 Dec 2016 19:10:28 +0000 Subject: [PATCH] Start using make() in COFF (with a smaller change.) llvm-svn: 289089 --- lld/COFF/Driver.cpp | 7 +++---- lld/COFF/Error.cpp | 10 ++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index fbdb2d0..8719c0f 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -15,6 +15,7 @@ #include "Symbols.h" #include "Writer.h" #include "lld/Driver/Driver.h" +#include "lld/Support/Memory.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/LibDriver/LibDriver.h" @@ -43,10 +44,8 @@ Configuration *Config; LinkerDriver *Driver; bool link(llvm::ArrayRef Args) { - Configuration C; - LinkerDriver D; - Config = &C; - Driver = &D; + Config = make(); + Driver = make(); Driver->link(Args); return true; } diff --git a/lld/COFF/Error.cpp b/lld/COFF/Error.cpp index 80ca842..b2bd557 100644 --- a/lld/COFF/Error.cpp +++ b/lld/COFF/Error.cpp @@ -14,6 +14,10 @@ #include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" +#if !defined(_MSC_VER) && !defined(__MINGW32__) +#include +#endif + using namespace llvm; namespace lld { @@ -27,9 +31,11 @@ void fatal(const Twine &Msg) { } else { errs() << "error: "; } - errs() << Msg << "\n"; - exit(1); + + outs().flush(); + errs().flush(); + _exit(1); } void fatal(std::error_code EC, const Twine &Msg) { -- 2.7.4