[lld] r325631 - Consistent use of header file for ICF and MarkLive

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 14:09:59 PST 2018


Author: sbc
Date: Tue Feb 20 14:09:59 2018
New Revision: 325631

URL: http://llvm.org/viewvc/llvm-project?rev=325631&view=rev
Log:
Consistent use of header file for ICF and MarkLive

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

Added:
    lld/trunk/COFF/ICF.h
      - copied, changed from r325629, lld/trunk/ELF/ICF.h
    lld/trunk/COFF/MarkLive.h   (with props)
    lld/trunk/ELF/MarkLive.h
      - copied, changed from r325629, lld/trunk/ELF/ICF.h
Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/Driver.h
    lld/trunk/COFF/ICF.cpp
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/ICF.h
    lld/trunk/ELF/MarkLive.cpp
    lld/trunk/ELF/Strings.cpp
    lld/trunk/ELF/Writer.h

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Tue Feb 20 14:09:59 2018
@@ -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;

Modified: lld/trunk/COFF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.h?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.h (original)
+++ lld/trunk/COFF/Driver.h Tue Feb 20 14:09:59 2018
@@ -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();

Modified: lld/trunk/COFF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.cpp?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/COFF/ICF.cpp (original)
+++ lld/trunk/COFF/ICF.cpp Tue Feb 20 14:09:59 2018
@@ -18,6 +18,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "ICF.h"
 #include "Chunks.h"
 #include "Symbols.h"
 #include "lld/Common/ErrorHandler.h"

Copied: lld/trunk/COFF/ICF.h (from r325629, lld/trunk/ELF/ICF.h)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.h?p2=lld/trunk/COFF/ICF.h&p1=lld/trunk/ELF/ICF.h&r1=325629&r2=325631&rev=325631&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.h (original)
+++ lld/trunk/COFF/ICF.h Tue Feb 20 14:09:59 2018
@@ -7,13 +7,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLD_ELF_ICF_H
-#define LLD_ELF_ICF_H
+#ifndef LLD_COFF_ICF_H
+#define LLD_COFF_ICF_H
+
+#include "lld/Common/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
 
 namespace lld {
-namespace elf {
-template <class ELFT> void doIcf();
-}
+namespace coff {
+
+class Chunk;
+
+void doICF(ArrayRef<Chunk *> Chunks);
+
+} // namespace coff
 } // namespace lld
 
 #endif

Added: lld/trunk/COFF/MarkLive.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/MarkLive.h?rev=325631&view=auto
==============================================================================
--- lld/trunk/COFF/MarkLive.h (added)
+++ lld/trunk/COFF/MarkLive.h Tue Feb 20 14:09:59 2018
@@ -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

Propchange: lld/trunk/COFF/MarkLive.h
------------------------------------------------------------------------------
    svn:eol-style = LF

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Feb 20 14:09:59 2018
@@ -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"

Modified: lld/trunk/ELF/ICF.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.h?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.h (original)
+++ lld/trunk/ELF/ICF.h Tue Feb 20 14:09:59 2018
@@ -12,8 +12,10 @@
 
 namespace lld {
 namespace elf {
+
 template <class ELFT> void doIcf();
-}
+
+} // namespace elf
 } // namespace lld
 
 #endif

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Tue Feb 20 14:09:59 2018
@@ -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"

Copied: lld/trunk/ELF/MarkLive.h (from r325629, lld/trunk/ELF/ICF.h)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.h?p2=lld/trunk/ELF/MarkLive.h&p1=lld/trunk/ELF/ICF.h&r1=325629&r2=325631&rev=325631&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.h (original)
+++ lld/trunk/ELF/MarkLive.h Tue Feb 20 14:09:59 2018
@@ -1,4 +1,4 @@
-//===- ICF.h --------------------------------------------------------------===//
+//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
 //
 //                             The LLVM Linker
 //
@@ -7,13 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLD_ELF_ICF_H
-#define LLD_ELF_ICF_H
+#ifndef LLD_ELF_MARKLIVE_H
+#define LLD_ELF_MARKLIVE_H
 
 namespace lld {
 namespace elf {
-template <class ELFT> void doIcf();
-}
+
+template <class ELFT> void markLive();
+
+} // namespace elf
 } // namespace lld
 
-#endif
+#endif // LLD_ELF_MARKLIVE_H

Modified: lld/trunk/ELF/Strings.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Strings.cpp?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/ELF/Strings.cpp (original)
+++ lld/trunk/ELF/Strings.cpp Tue Feb 20 14:09:59 2018
@@ -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>

Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=325631&r1=325630&r2=325631&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Tue Feb 20 14:09:59 2018
@@ -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




More information about the llvm-commits mailing list