Consistent use of header file for ICF and MarkLive
authorSam Clegg <sbc@chromium.org>
Tue, 20 Feb 2018 22:09:59 +0000 (22:09 +0000)
committerSam Clegg <sbc@chromium.org>
Tue, 20 Feb 2018 22:09:59 +0000 (22:09 +0000)
Previously wasm used a separate header to declare markLive
and ELF used to declare ICF.  This change makes each backend
consistently declare these in their own headers.

Differential Revision: https://reviews.llvm.org/D43529

llvm-svn: 325631

lld/COFF/Driver.cpp
lld/COFF/Driver.h
lld/COFF/ICF.cpp
lld/COFF/ICF.h [new file with mode: 0644]
lld/COFF/MarkLive.h [new file with mode: 0644]
lld/ELF/Driver.cpp
lld/ELF/ICF.h
lld/ELF/MarkLive.cpp
lld/ELF/MarkLive.h [new file with mode: 0644]
lld/ELF/Strings.cpp
lld/ELF/Writer.h

index 9a78987e80ce6e26c5a5e7ca0452f28618c1546d..3abe0249484646a67048184f5d023ca6a9b20d03 100644 (file)
@@ -9,7 +9,9 @@
 
 #include "Driver.h"
 #include "Config.h"
+#include "ICF.h"
 #include "InputFiles.h"
+#include "MarkLive.h"
 #include "MinGW.h"
 #include "SymbolTable.h"
 #include "Symbols.h"
@@ -37,8 +39,8 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
 #include <algorithm>
-#include <memory>
 #include <future>
+#include <memory>
 
 using namespace llvm;
 using namespace llvm::object;
index 02b24269049d73ef3de2c554de8dde7f17a39fad..9bd6c0fa2ab30c95381422b8df5c17e7c86a465f 100644 (file)
@@ -36,12 +36,6 @@ using llvm::COFF::MachineTypes;
 using llvm::COFF::WindowsSubsystem;
 using llvm::Optional;
 
-// Implemented in MarkLive.cpp.
-void markLive(ArrayRef<Chunk *> Chunks);
-
-// Implemented in ICF.cpp.
-void doICF(ArrayRef<Chunk *> Chunks);
-
 class COFFOptTable : public llvm::opt::OptTable {
 public:
   COFFOptTable();
index 2eb11f99192c946984cb578579edb23beec9af18..c063ab28edcfaed92f7ce192e918340bf408fd2b 100644 (file)
@@ -18,6 +18,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "ICF.h"
 #include "Chunks.h"
 #include "Symbols.h"
 #include "lld/Common/ErrorHandler.h"
diff --git a/lld/COFF/ICF.h b/lld/COFF/ICF.h
new file mode 100644 (file)
index 0000000..9c54e0c
--- /dev/null
@@ -0,0 +1,26 @@
+//===- ICF.h --------------------------------------------------------------===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COFF_ICF_H
+#define LLD_COFF_ICF_H
+
+#include "lld/Common/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lld {
+namespace coff {
+
+class Chunk;
+
+void doICF(ArrayRef<Chunk *> Chunks);
+
+} // namespace coff
+} // namespace lld
+
+#endif
diff --git a/lld/COFF/MarkLive.h b/lld/COFF/MarkLive.h
new file mode 100644 (file)
index 0000000..5b652dd
--- /dev/null
@@ -0,0 +1,24 @@
+//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COFF_MARKLIVE_H
+#define LLD_COFF_MARKLIVE_H
+
+#include "lld/Common/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lld {
+namespace coff {
+
+void markLive(ArrayRef<Chunk *> Chunks);
+
+} // namespace coff
+} // namespace lld
+
+#endif // LLD_COFF_MARKLIVE_H
index 1efd2466cdf15e8ac3e06b7638d3eefff17e1ba3..265b3e629186b7057c7cc1dea9ae4522e1e5679b 100644 (file)
@@ -30,6 +30,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "LinkerScript.h"
+#include "MarkLive.h"
 #include "OutputSections.h"
 #include "ScriptParser.h"
 #include "Strings.h"
index 24219855fc177ce95343b5dec3e800f1e772a111..a6c8636ead6d513d20d4b4a1cc640e8868d56bc2 100644 (file)
 
 namespace lld {
 namespace elf {
+
 template <class ELFT> void doIcf();
-}
+
+} // namespace elf
 } // namespace lld
 
 #endif
index 1aa20f797d979765a7f43b5818a2007c371d9e74..05ab2c89ab4a62090de4aed8639a0ffee2396ed7 100644 (file)
@@ -20,6 +20,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "MarkLive.h"
 #include "InputSection.h"
 #include "LinkerScript.h"
 #include "OutputSections.h"
@@ -27,7 +28,6 @@
 #include "SymbolTable.h"
 #include "Symbols.h"
 #include "Target.h"
-#include "Writer.h"
 #include "lld/Common/Memory.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Object/ELF.h"
diff --git a/lld/ELF/MarkLive.h b/lld/ELF/MarkLive.h
new file mode 100644 (file)
index 0000000..c9b99ad
--- /dev/null
@@ -0,0 +1,21 @@
+//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_ELF_MARKLIVE_H
+#define LLD_ELF_MARKLIVE_H
+
+namespace lld {
+namespace elf {
+
+template <class ELFT> void markLive();
+
+} // namespace elf
+} // namespace lld
+
+#endif // LLD_ELF_MARKLIVE_H
index 0ef33a14bc3d41d80a87f29cfe3aae82d9371159..ce642cfe7fab9586fc21b360a8dc3a8ddcd28ecf 100644 (file)
@@ -10,8 +10,6 @@
 #include "Strings.h"
 #include "Config.h"
 #include "lld/Common/ErrorHandler.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Demangle/Demangle.h"
 #include <algorithm>
index 9c7fbd4b1520e44578be59aa081f0212a75479c3..41f1e550eeb4baa894f93880b2357a32d2ed45cf 100644 (file)
@@ -23,7 +23,6 @@ class InputSectionBase;
 template <class ELFT> class ObjFile;
 class SymbolTable;
 template <class ELFT> void writeResult();
-template <class ELFT> void markLive();
 
 // This describes a program header entry.
 // Each contains type, access flags and range of output sections that will be