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 9a78987..3abe024 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 02b2426..9bd6c0f 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 2eb11f9..c063ab2 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 1efd246..265b3e6 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 2421985..a6c8636 100644 (file)
 
 namespace lld {
 namespace elf {
+
 template <class ELFT> void doIcf();
-}
+
+} // namespace elf
 } // namespace lld
 
 #endif
index 1aa20f7..05ab2c8 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 0ef33a1..ce642cf 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 9c7fbd4..41f1e55 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