Forward declare the DWARFCache to avoid including LLVM DWARF details
authorReid Kleckner <rnk@google.com>
Thu, 14 Nov 2019 22:16:21 +0000 (14:16 -0800)
committerReid Kleckner <rnk@google.com>
Thu, 14 Nov 2019 22:17:49 +0000 (14:17 -0800)
LLD's DWARF.h header leaks a lot of LLVM DWARF includes that LLD doesn't
need. For Chunks.cpp, I see a compile time decrease of 3.1s to 2.7s.

lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h

index 16eb328..2d8292f 100644 (file)
@@ -13,6 +13,7 @@
 #include "Driver.h"
 #include "SymbolTable.h"
 #include "Symbols.h"
+#include "lld/Common/DWARF.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
 #include "llvm-c/lto.h"
index f369ad0..1df383e 100644 (file)
@@ -10,7 +10,6 @@
 #define LLD_COFF_INPUT_FILES_H
 
 #include "Config.h"
-#include "lld/Common/DWARF.h"
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
@@ -35,6 +34,8 @@ class InputFile;
 }
 
 namespace lld {
+class DWARFCache;
+
 namespace coff {
 
 std::vector<MemoryBufferRef> getArchiveMembers(llvm::object::Archive *file);
index 09b2046..11a4232 100644 (file)
@@ -13,6 +13,7 @@
 #include "SymbolTable.h"
 #include "Symbols.h"
 #include "SyntheticSections.h"
+#include "lld/Common/DWARF.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
 #include "llvm/ADT/STLExtras.h"
index cde6bc6..a310ba5 100644 (file)
@@ -10,7 +10,6 @@
 #define LLD_ELF_INPUT_FILES_H
 
 #include "Config.h"
-#include "lld/Common/DWARF.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/LLVM.h"
 #include "lld/Common/Reproduce.h"
@@ -25,6 +24,7 @@
 #include <map>
 
 namespace llvm {
+struct DILineInfo;
 class TarWriter;
 namespace lto {
 class InputFile;
@@ -32,6 +32,7 @@ class InputFile;
 } // namespace llvm
 
 namespace lld {
+class DWARFCache;
 
 // Returns "<internal>", "foo.a(bar.o)" or "baz.o".
 std::string toString(const elf::InputFile *f);