Skip to content

Commit f187c4d

Browse files
committedFeb 20, 2018
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 llvm-svn: 325631
1 parent fd06306 commit f187c4d

File tree

11 files changed

+80
-12
lines changed

11 files changed

+80
-12
lines changed
 

‎lld/COFF/Driver.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
#include "Driver.h"
1111
#include "Config.h"
12+
#include "ICF.h"
1213
#include "InputFiles.h"
14+
#include "MarkLive.h"
1315
#include "MinGW.h"
1416
#include "SymbolTable.h"
1517
#include "Symbols.h"
@@ -37,8 +39,8 @@
3739
#include "llvm/Support/raw_ostream.h"
3840
#include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
3941
#include <algorithm>
40-
#include <memory>
4142
#include <future>
43+
#include <memory>
4244

4345
using namespace llvm;
4446
using namespace llvm::object;

‎lld/COFF/Driver.h

-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ using llvm::COFF::MachineTypes;
3636
using llvm::COFF::WindowsSubsystem;
3737
using llvm::Optional;
3838

39-
// Implemented in MarkLive.cpp.
40-
void markLive(ArrayRef<Chunk *> Chunks);
41-
42-
// Implemented in ICF.cpp.
43-
void doICF(ArrayRef<Chunk *> Chunks);
44-
4539
class COFFOptTable : public llvm::opt::OptTable {
4640
public:
4741
COFFOptTable();

‎lld/COFF/ICF.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//
1919
//===----------------------------------------------------------------------===//
2020

21+
#include "ICF.h"
2122
#include "Chunks.h"
2223
#include "Symbols.h"
2324
#include "lld/Common/ErrorHandler.h"

‎lld/COFF/ICF.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===- ICF.h --------------------------------------------------------------===//
2+
//
3+
// The LLVM Linker
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef LLD_COFF_ICF_H
11+
#define LLD_COFF_ICF_H
12+
13+
#include "lld/Common/LLVM.h"
14+
#include "llvm/ADT/ArrayRef.h"
15+
16+
namespace lld {
17+
namespace coff {
18+
19+
class Chunk;
20+
21+
void doICF(ArrayRef<Chunk *> Chunks);
22+
23+
} // namespace coff
24+
} // namespace lld
25+
26+
#endif

‎lld/COFF/MarkLive.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
2+
//
3+
// The LLVM Linker
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef LLD_COFF_MARKLIVE_H
11+
#define LLD_COFF_MARKLIVE_H
12+
13+
#include "lld/Common/LLVM.h"
14+
#include "llvm/ADT/ArrayRef.h"
15+
16+
namespace lld {
17+
namespace coff {
18+
19+
void markLive(ArrayRef<Chunk *> Chunks);
20+
21+
} // namespace coff
22+
} // namespace lld
23+
24+
#endif // LLD_COFF_MARKLIVE_H

‎lld/ELF/Driver.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "InputFiles.h"
3131
#include "InputSection.h"
3232
#include "LinkerScript.h"
33+
#include "MarkLive.h"
3334
#include "OutputSections.h"
3435
#include "ScriptParser.h"
3536
#include "Strings.h"

‎lld/ELF/ICF.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
namespace lld {
1414
namespace elf {
15+
1516
template <class ELFT> void doIcf();
16-
}
17+
18+
} // namespace elf
1719
} // namespace lld
1820

1921
#endif

‎lld/ELF/MarkLive.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
//
2121
//===----------------------------------------------------------------------===//
2222

23+
#include "MarkLive.h"
2324
#include "InputSection.h"
2425
#include "LinkerScript.h"
2526
#include "OutputSections.h"
2627
#include "Strings.h"
2728
#include "SymbolTable.h"
2829
#include "Symbols.h"
2930
#include "Target.h"
30-
#include "Writer.h"
3131
#include "lld/Common/Memory.h"
3232
#include "llvm/ADT/STLExtras.h"
3333
#include "llvm/Object/ELF.h"

‎lld/ELF/MarkLive.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
2+
//
3+
// The LLVM Linker
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef LLD_ELF_MARKLIVE_H
11+
#define LLD_ELF_MARKLIVE_H
12+
13+
namespace lld {
14+
namespace elf {
15+
16+
template <class ELFT> void markLive();
17+
18+
} // namespace elf
19+
} // namespace lld
20+
21+
#endif // LLD_ELF_MARKLIVE_H

‎lld/ELF/Strings.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "Strings.h"
1111
#include "Config.h"
1212
#include "lld/Common/ErrorHandler.h"
13-
#include "llvm/ADT/ArrayRef.h"
14-
#include "llvm/ADT/StringRef.h"
1513
#include "llvm/ADT/Twine.h"
1614
#include "llvm/Demangle/Demangle.h"
1715
#include <algorithm>

‎lld/ELF/Writer.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class InputSectionBase;
2323
template <class ELFT> class ObjFile;
2424
class SymbolTable;
2525
template <class ELFT> void writeResult();
26-
template <class ELFT> void markLive();
2726

2827
// This describes a program header entry.
2928
// Each contains type, access flags and range of output sections that will be

0 commit comments

Comments
 (0)
Please sign in to comment.