[lld] f24c335 - [COFF] Don't include llvm/LTO/LTO.h in a header
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 13:48:52 PST 2019
Author: Reid Kleckner
Date: 2019-11-14T13:47:18-08:00
New Revision: f24c3352c97b864ae6c9851949497b8f880133f6
URL: https://github.com/llvm/llvm-project/commit/f24c3352c97b864ae6c9851949497b8f880133f6
DIFF: https://github.com/llvm/llvm-project/commit/f24c3352c97b864ae6c9851949497b8f880133f6.diff
LOG: [COFF] Don't include llvm/LTO/LTO.h in a header
LLVM's LTO header includes all of llvm/IR, which most of the COFF linker
doesn't need.
Added:
Modified:
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/MinGW.h
lld/COFF/SymbolTable.cpp
lld/COFF/Writer.cpp
Removed:
################################################################################
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index faec3ba160a5..16eb32864a9d 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -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"
@@ -876,6 +877,10 @@ void ImportFile::parse() {
name, cast_or_null<DefinedImportData>(impSym), hdr->Machine);
}
+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)
@@ -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)
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index 672461cd84ba..f369ad009af7 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -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 @@ class ImportFile : public InputFile {
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;
diff --git a/lld/COFF/MinGW.h b/lld/COFF/MinGW.h
index 578a277561ad..3d7a186aa199 100644
--- a/lld/COFF/MinGW.h
+++ b/lld/COFF/MinGW.h
@@ -12,6 +12,7 @@
#include "Config.h"
#include "Symbols.h"
#include "lld/Common/LLVM.h"
+#include "llvm/ADT/StringSet.h"
namespace lld {
namespace coff {
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index b582d225df79..302b05b31abd 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -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"
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 9d912d339bcc..965b3667df55 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -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"
More information about the llvm-commits
mailing list