[PATCH] D119913: [lld-macho] Don't include CommandFlags.h in CommonLinkerContext.h

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 17:05:31 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69297cf63904: [lld-macho] Don't include CommandFlags.h in CommonLinkerContext.h (authored by int3).

Changed prior to commit:
  https://reviews.llvm.org/D119913?vs=409239&id=409455#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119913

Files:
  lld/Common/CommonLinkerContext.cpp
  lld/ELF/Writer.cpp
  lld/MachO/ICF.cpp
  lld/include/lld/Common/CommonLinkerContext.h


Index: lld/include/lld/Common/CommonLinkerContext.h
===================================================================
--- lld/include/lld/Common/CommonLinkerContext.h
+++ lld/include/lld/Common/CommonLinkerContext.h
@@ -21,7 +21,6 @@
 
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
-#include "llvm/CodeGen/CommandFlags.h"
 #include "llvm/Support/StringSaver.h"
 
 namespace llvm {
@@ -42,9 +41,6 @@
   llvm::DenseMap<void *, SpecificAllocBase *> instances;
 
   ErrorHandler e;
-
-private:
-  llvm::codegen::RegisterCodeGenFlags cgf;
 };
 
 // Retrieve the global state. Currently only one state can exist per process,
Index: lld/MachO/ICF.cpp
===================================================================
--- lld/MachO/ICF.cpp
+++ lld/MachO/ICF.cpp
@@ -12,6 +12,7 @@
 #include "Symbols.h"
 #include "UnwindInfoSection.h"
 
+#include "lld/Common/CommonLinkerContext.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/TimeProfiler.h"
 
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -24,6 +24,7 @@
 #include "lld/Common/Filesystem.h"
 #include "lld/Common/Strings.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/Support/MD5.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/SHA1.h"
Index: lld/Common/CommonLinkerContext.cpp
===================================================================
--- lld/Common/CommonLinkerContext.cpp
+++ lld/Common/CommonLinkerContext.cpp
@@ -10,6 +10,8 @@
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
 
+#include "llvm/CodeGen/CommandFlags.h"
+
 using namespace llvm;
 using namespace lld;
 
@@ -20,7 +22,11 @@
 // state.
 static CommonLinkerContext *lctx;
 
-CommonLinkerContext::CommonLinkerContext() { lctx = this; }
+CommonLinkerContext::CommonLinkerContext() {
+  lctx = this;
+  // Fire off the static initializations in CGF's constructor.
+  codegen::RegisterCodeGenFlags CGF;
+}
 
 CommonLinkerContext::~CommonLinkerContext() {
   assert(lctx);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119913.409455.patch
Type: text/x-patch
Size: 2115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220217/ee415aa7/attachment-0001.bin>


More information about the llvm-commits mailing list