[PATCH] D116996: [lld-link] Change config and driver to unique_ptr

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 18:31:37 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbfd00ae31ea2: [lld-link] Change config and driver to unique_ptr (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116996/new/

https://reviews.llvm.org/D116996

Files:
  lld/COFF/Config.h
  lld/COFF/Driver.cpp
  lld/COFF/Driver.h


Index: lld/COFF/Driver.h
===================================================================
--- lld/COFF/Driver.h
+++ lld/COFF/Driver.h
@@ -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;
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -60,8 +60,8 @@
 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 @@
   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);
 
Index: lld/COFF/Config.h
===================================================================
--- lld/COFF/Config.h
+++ lld/COFF/Config.h
@@ -282,7 +282,7 @@
   bool stdcallFixup = false;
 };
 
-extern Configuration *config;
+extern std::unique_ptr<Configuration> config;
 
 } // namespace coff
 } // namespace lld


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116996.399162.patch
Type: text/x-patch
Size: 1422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220112/8eb0246e/attachment.bin>


More information about the llvm-commits mailing list