diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h index 3917975e165d..5597389b4226 100644 --- a/lld/COFF/Config.h +++ b/lld/COFF/Config.h @@ -282,7 +282,7 @@ struct Configuration { bool stdcallFixup = false; }; -extern Configuration *config; +extern std::unique_ptr config; } // namespace coff } // namespace lld diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 6178d328e3f5..f8da63c5edbf 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -60,8 +60,8 @@ using namespace llvm::sys; namespace lld { namespace coff { -Configuration *config; -LinkerDriver *driver; +std::unique_ptr config; +std::unique_ptr driver; bool link(ArrayRef args, bool canExitEarly, raw_ostream &stdoutOS, raw_ostream &stderrOS) { @@ -80,8 +80,8 @@ bool link(ArrayRef args, bool canExitEarly, raw_ostream &stdoutOS, stderrOS.enable_colors(stderrOS.has_colors()); COFFLinkerContext ctx; - config = make(); - driver = make(ctx); + config = std::make_unique(); + driver = std::make_unique(ctx); driver->linkerMain(args); diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h index 77e67b282665..518ec1470677 100644 --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -30,8 +30,7 @@ namespace lld { namespace coff { -class LinkerDriver; -extern LinkerDriver *driver; +extern std::unique_ptr driver; using llvm::COFF::MachineTypes; using llvm::COFF::WindowsSubsystem;