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

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 20:15:51 PST 2016


Adding ifdefs like this is not very maintainable. can we put this in a
helper?

On Dec 8, 2016 11:20 AM, "Rui Ueyama via llvm-commits" <
llvm-commits at lists.llvm.org> wrote:

> 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) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161208/139a2b9c/attachment.html>


More information about the llvm-commits mailing list