[lld-link] Change config and driver to unique_ptr
Similar to D116143. My x86-64 `lld` is ~5KiB smaller. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D116996
This commit is contained in:
parent
403772ff1c
commit
bfd00ae31e
|
@ -282,7 +282,7 @@ struct Configuration {
|
|||
bool stdcallFixup = false;
|
||||
};
|
||||
|
||||
extern Configuration *config;
|
||||
extern std::unique_ptr<Configuration> config;
|
||||
|
||||
} // namespace coff
|
||||
} // namespace lld
|
||||
|
|
|
@ -60,8 +60,8 @@ using namespace llvm::sys;
|
|||
namespace lld {
|
||||
namespace coff {
|
||||
|
||||
Configuration *config;
|
||||
LinkerDriver *driver;
|
||||
std::unique_ptr<Configuration> config;
|
||||
std::unique_ptr<LinkerDriver> driver;
|
||||
|
||||
bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stdoutOS,
|
||||
raw_ostream &stderrOS) {
|
||||
|
@ -80,8 +80,8 @@ bool link(ArrayRef<const char *> args, bool canExitEarly, raw_ostream &stdoutOS,
|
|||
stderrOS.enable_colors(stderrOS.has_colors());
|
||||
|
||||
COFFLinkerContext ctx;
|
||||
config = make<Configuration>();
|
||||
driver = make<LinkerDriver>(ctx);
|
||||
config = std::make_unique<Configuration>();
|
||||
driver = std::make_unique<LinkerDriver>(ctx);
|
||||
|
||||
driver->linkerMain(args);
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
namespace lld {
|
||||
namespace coff {
|
||||
|
||||
class LinkerDriver;
|
||||
extern LinkerDriver *driver;
|
||||
extern std::unique_ptr<class LinkerDriver> driver;
|
||||
|
||||
using llvm::COFF::MachineTypes;
|
||||
using llvm::COFF::WindowsSubsystem;
|
||||
|
|
Loading…
Reference in a new issue