[COFF] Don't include llvm/LTO/LTO.h in a header
authorReid Kleckner <rnk@google.com>
Thu, 14 Nov 2019 21:46:00 +0000 (13:46 -0800)
committerReid Kleckner <rnk@google.com>
Thu, 14 Nov 2019 21:47:18 +0000 (13:47 -0800)
LLVM's LTO header includes all of llvm/IR, which most of the COFF linker
doesn't need.

lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/MinGW.h
lld/COFF/SymbolTable.cpp
lld/COFF/Writer.cpp

index faec3ba..16eb328 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/LTO/LTO.h"
 #include "llvm/Object/Binary.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/Casting.h"
@@ -877,6 +878,10 @@ void ImportFile::parse() {
 }
 
 BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
+                         uint64_t offsetInArchive)
+    : BitcodeFile(mb, archiveName, offsetInArchive, {}) {}
+
+BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
                          uint64_t offsetInArchive,
                          std::vector<Symbol *> &&symbols)
     : InputFile(BitcodeKind, mb), symbols(std::move(symbols)) {
@@ -898,6 +903,8 @@ BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
   obj = check(lto::InputFile::create(mbref));
 }
 
+BitcodeFile::~BitcodeFile() = default;
+
 void BitcodeFile::parse() {
   std::vector<std::pair<Symbol *, bool>> comdat(obj->getComdatTable().size());
   for (size_t i = 0; i != obj->getComdatTable().size(); ++i)
index 672461c..f369ad0 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/LTO/LTO.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/StringSaver.h"
@@ -30,6 +29,9 @@ struct DILineInfo;
 namespace pdb {
 class DbiModuleDescriptorBuilder;
 }
+namespace lto {
+class InputFile;
+}
 }
 
 namespace lld {
@@ -336,11 +338,11 @@ public:
 class BitcodeFile : public InputFile {
 public:
   BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
-              uint64_t offsetInArchive)
-      : BitcodeFile(mb, archiveName, offsetInArchive, {}) {}
+              uint64_t offsetInArchive);
   explicit BitcodeFile(MemoryBufferRef m, StringRef archiveName,
                        uint64_t offsetInArchive,
                        std::vector<Symbol *> &&symbols);
+  ~BitcodeFile();
   static bool classof(const InputFile *f) { return f->kind() == BitcodeKind; }
   ArrayRef<Symbol *> getSymbols() { return symbols; }
   MachineTypes getMachineType() override;
index 578a277..3d7a186 100644 (file)
@@ -12,6 +12,7 @@
 #include "Config.h"
 #include "Symbols.h"
 #include "lld/Common/LLVM.h"
+#include "llvm/ADT/StringSet.h"
 
 namespace lld {
 namespace coff {
index b582d22..302b05b 100644 (file)
@@ -17,6 +17,7 @@
 #include "lld/Common/Timer.h"
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/LTO/LTO.h"
 #include "llvm/Object/WindowsMachineFlag.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
index 9d912d3..965b366 100644 (file)
@@ -20,6 +20,7 @@
 #include "lld/Common/Timer.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/Debug.h"