[lld] adfad4d - Forward declare the DWARFCache to avoid including LLVM DWARF details

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 14:17:55 PST 2019


Author: Reid Kleckner
Date: 2019-11-14T14:17:49-08:00
New Revision: adfad4d7c84657026bc4f96d310c33b9550c4334

URL: https://github.com/llvm/llvm-project/commit/adfad4d7c84657026bc4f96d310c33b9550c4334
DIFF: https://github.com/llvm/llvm-project/commit/adfad4d7c84657026bc4f96d310c33b9550c4334.diff

LOG: Forward declare the DWARFCache to avoid including LLVM DWARF details

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 16eb32864a9d..2d8292fc141e 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -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"

diff  --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index f369ad009af7..1df383ec7c16 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -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);

diff  --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 09b20463af2f..11a4232df5ab 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -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"

diff  --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index cde6bc617764..a310ba551bd4 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -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);


        


More information about the llvm-commits mailing list