[lld] r289089 - Start using make() in COFF (with a smaller change.)

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:10:28 PST 2016


Author: ruiu
Date: Thu Dec  8 13:10:28 2016
New Revision: 289089

URL: http://llvm.org/viewvc/llvm-project?rev=289089&view=rev
Log:
Start using make() in COFF (with a smaller change.)

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/Error.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=289089&r1=289088&r2=289089&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Dec  8 13:10:28 2016
@@ -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<const char *> Args) {
-  Configuration C;
-  LinkerDriver D;
-  Config = &C;
-  Driver = &D;
+  Config = make<Configuration>();
+  Driver = make<LinkerDriver>();
   Driver->link(Args);
   return true;
 }

Modified: lld/trunk/COFF/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Error.cpp?rev=289089&r1=289088&r2=289089&view=diff
==============================================================================
--- lld/trunk/COFF/Error.cpp (original)
+++ lld/trunk/COFF/Error.cpp Thu Dec  8 13:10:28 2016
@@ -14,6 +14,10 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include <unistd.h>
+#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) {




More information about the llvm-commits mailing list