summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/Driver.h6
-rw-r--r--lld/COFF/DriverUtils.cpp2
-rw-r--r--lld/COFF/ICF.cpp6
-rw-r--r--lld/COFF/InputFiles.h8
-rw-r--r--lld/COFF/MarkLive.cpp2
-rw-r--r--lld/COFF/PDB.cpp2
-rw-r--r--lld/COFF/SymbolTable.cpp2
-rw-r--r--lld/COFF/Writer.h2
-rw-r--r--lld/include/lld/Core/LinkingContext.h4
-rw-r--r--lld/wasm/InputFiles.h2
-rw-r--r--lld/wasm/OutputSections.cpp6
-rw-r--r--lld/wasm/OutputSections.h8
12 files changed, 25 insertions, 25 deletions
diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h
index 0cef3519b42..63d41cf6909 100644
--- a/lld/COFF/Driver.h
+++ b/lld/COFF/Driver.h
@@ -36,10 +36,10 @@ using llvm::COFF::WindowsSubsystem;
using llvm::Optional;
// Implemented in MarkLive.cpp.
-void markLive(const std::vector<Chunk *> &Chunks);
+void markLive(ArrayRef<Chunk *> Chunks);
// Implemented in ICF.cpp.
-void doICF(const std::vector<Chunk *> &Chunks);
+void doICF(ArrayRef<Chunk *> Chunks);
class COFFOptTable : public llvm::opt::OptTable {
public:
@@ -171,7 +171,7 @@ void assignExportOrdinals();
void checkFailIfMismatch(StringRef Arg);
// Convert Windows resource files (.res files) to a .obj file.
-MemoryBufferRef convertResToCOFF(const std::vector<MemoryBufferRef> &MBs);
+MemoryBufferRef convertResToCOFF(ArrayRef<MemoryBufferRef> MBs);
void runMSVCLinker(std::string Rsp, ArrayRef<StringRef> Objects);
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 27a52d1ba99..e2ac2882f60 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -642,7 +642,7 @@ void checkFailIfMismatch(StringRef Arg) {
}
// Convert Windows resource files (.res files) to a .obj file.
-MemoryBufferRef convertResToCOFF(const std::vector<MemoryBufferRef> &MBs) {
+MemoryBufferRef convertResToCOFF(ArrayRef<MemoryBufferRef> MBs) {
object::WindowsResourceParser Parser;
for (MemoryBufferRef MB : MBs) {
diff --git a/lld/COFF/ICF.cpp b/lld/COFF/ICF.cpp
index 3626743f989..48895c34886 100644
--- a/lld/COFF/ICF.cpp
+++ b/lld/COFF/ICF.cpp
@@ -36,7 +36,7 @@ namespace coff {
class ICF {
public:
- void run(const std::vector<Chunk *> &V);
+ void run(ArrayRef<Chunk *> V);
private:
void segregate(size_t Begin, size_t End, bool Constant);
@@ -206,7 +206,7 @@ void ICF::forEachClass(std::function<void(size_t, size_t)> Fn) {
// Merge identical COMDAT sections.
// Two sections are considered the same if their section headers,
// contents and relocations are all the same.
-void ICF::run(const std::vector<Chunk *> &Vec) {
+void ICF::run(ArrayRef<Chunk *> Vec) {
// Collect only mergeable sections and group by hash value.
uint32_t NextId = 1;
for (Chunk *C : Vec) {
@@ -257,7 +257,7 @@ void ICF::run(const std::vector<Chunk *> &Vec) {
}
// Entry point to ICF.
-void doICF(const std::vector<Chunk *> &Chunks) { ICF().run(Chunks); }
+void doICF(ArrayRef<Chunk *> Chunks) { ICF().run(Chunks); }
} // namespace coff
} // namespace lld
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index 645fa38badc..adedbc2ad7a 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -108,9 +108,9 @@ public:
static bool classof(const InputFile *F) { return F->kind() == ObjectKind; }
void parse() override;
MachineTypes getMachineType() override;
- std::vector<Chunk *> &getChunks() { return Chunks; }
- std::vector<SectionChunk *> &getDebugChunks() { return DebugChunks; }
- std::vector<Symbol *> &getSymbols() { return Symbols; }
+ ArrayRef<Chunk *> getChunks() { return Chunks; }
+ ArrayRef<SectionChunk *> getDebugChunks() { return DebugChunks; }
+ ArrayRef<Symbol *> getSymbols() { return Symbols; }
// Returns a Symbol object for the SymbolIndex'th symbol in the
// underlying object file.
@@ -217,7 +217,7 @@ class BitcodeFile : public InputFile {
public:
explicit BitcodeFile(MemoryBufferRef M) : InputFile(BitcodeKind, M) {}
static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; }
- std::vector<Symbol *> &getSymbols() { return SymbolBodies; }
+ ArrayRef<Symbol *> getSymbols() { return SymbolBodies; }
MachineTypes getMachineType() override;
static std::vector<BitcodeFile *> Instances;
std::unique_ptr<llvm::lto::InputFile> Obj;
diff --git a/lld/COFF/MarkLive.cpp b/lld/COFF/MarkLive.cpp
index b1e27bafb1e..01be60d12d8 100644
--- a/lld/COFF/MarkLive.cpp
+++ b/lld/COFF/MarkLive.cpp
@@ -18,7 +18,7 @@ namespace coff {
// Set live bit on for each reachable chunk. Unmarked (unreachable)
// COMDAT chunks will be ignored by Writer, so they will be excluded
// from the final output.
-void markLive(const std::vector<Chunk *> &Chunks) {
+void markLive(ArrayRef<Chunk *> Chunks) {
// We build up a worklist of sections which have been marked as live. We only
// push into the worklist when we discover an unmarked section, and we mark
// as we push, so sections never appear twice in the list.
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 0c187f4ac0c..d6891f97bf3 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -136,7 +136,7 @@ private:
};
}
-static SectionChunk *findByName(std::vector<SectionChunk *> &Sections,
+static SectionChunk *findByName(ArrayRef<SectionChunk *> Sections,
StringRef Name) {
for (SectionChunk *C : Sections)
if (C->getSectionName() == Name)
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index 02c82b00d19..c1cf704a2b7 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -291,7 +291,7 @@ DefinedImportThunk *SymbolTable::addImportThunk(StringRef Name,
std::vector<Chunk *> SymbolTable::getChunks() {
std::vector<Chunk *> Res;
for (ObjFile *File : ObjFile::Instances) {
- std::vector<Chunk *> &V = File->getChunks();
+ ArrayRef<Chunk *> V = File->getChunks();
Res.insert(Res.end(), V.begin(), V.end());
}
return Res;
diff --git a/lld/COFF/Writer.h b/lld/COFF/Writer.h
index e423a8e8097..21be1be6e92 100644
--- a/lld/COFF/Writer.h
+++ b/lld/COFF/Writer.h
@@ -34,7 +34,7 @@ public:
void setFileOffset(uint64_t);
void addChunk(Chunk *C);
llvm::StringRef getName() { return Name; }
- std::vector<Chunk *> &getChunks() { return Chunks; }
+ ArrayRef<Chunk *> getChunks() { return Chunks; }
void addPermissions(uint32_t C);
void setPermissions(uint32_t C);
uint32_t getPermissions() { return Header.Characteristics & PermMask; }
diff --git a/lld/include/lld/Core/LinkingContext.h b/lld/include/lld/Core/LinkingContext.h
index b3a999b00fb..eb9510cbd21 100644
--- a/lld/include/lld/Core/LinkingContext.h
+++ b/lld/include/lld/Core/LinkingContext.h
@@ -62,7 +62,7 @@ public:
/// of DefinedAtoms that should be marked live (along with all Atoms they
/// reference). Only Atoms with scope scopeLinkageUnit or scopeGlobal can
/// be kept live using this method.
- const std::vector<StringRef> &deadStripRoots() const {
+ ArrayRef<StringRef> deadStripRoots() const {
return _deadStripRoots;
}
@@ -106,7 +106,7 @@ public:
/// options which are used to configure LLVM's command line settings.
/// For instance the -debug-only XXX option can be used to dynamically
/// trace different parts of LLVM and lld.
- const std::vector<const char *> &llvmOptions() const { return _llvmOptions; }
+ ArrayRef<const char *> llvmOptions() const { return _llvmOptions; }
/// \name Methods used by Drivers to configure TargetInfo
/// @{
diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h
index 52014258fee..ed2cb75097f 100644
--- a/lld/wasm/InputFiles.h
+++ b/lld/wasm/InputFiles.h
@@ -112,7 +112,7 @@ public:
std::vector<uint32_t> TypeMap;
std::vector<InputSegment *> Segments;
- const std::vector<Symbol *> &getSymbols() { return Symbols; }
+ ArrayRef<Symbol *> getSymbols() { return Symbols; }
private:
Symbol *createDefined(const WasmSymbol &Sym,
diff --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp
index 579a60e7ea8..e5253640b9d 100644
--- a/lld/wasm/OutputSections.cpp
+++ b/lld/wasm/OutputSections.cpp
@@ -109,7 +109,7 @@ static void applyRelocation(uint8_t *Buf, const OutputRelocation &Reloc) {
}
static void applyRelocations(uint8_t *Buf,
- const std::vector<OutputRelocation> &Relocs) {
+ ArrayRef<OutputRelocation> Relocs) {
log("applyRelocations: count=" + Twine(Relocs.size()));
for (const OutputRelocation &Reloc : Relocs) {
applyRelocation(Buf, Reloc);
@@ -188,7 +188,7 @@ void OutputSection::createHeader(size_t BodySize) {
" total=" + Twine(getSize()));
}
-CodeSection::CodeSection(uint32_t NumFunctions, std::vector<ObjFile *> &Objs)
+CodeSection::CodeSection(uint32_t NumFunctions, ArrayRef<ObjFile *> Objs)
: OutputSection(WASM_SEC_CODE), InputObjects(Objs) {
raw_string_ostream OS(CodeSectionHeader);
writeUleb128(OS, NumFunctions, "function count");
@@ -263,7 +263,7 @@ void CodeSection::writeRelocations(raw_ostream &OS) const {
writeReloc(OS, Reloc);
}
-DataSection::DataSection(std::vector<OutputSegment *> &Segments)
+DataSection::DataSection(ArrayRef<OutputSegment *> Segments)
: OutputSection(WASM_SEC_DATA), Segments(Segments) {
raw_string_ostream OS(DataSectionHeader);
diff --git a/lld/wasm/OutputSections.h b/lld/wasm/OutputSections.h
index c6289182e79..926101710cd 100644
--- a/lld/wasm/OutputSections.h
+++ b/lld/wasm/OutputSections.h
@@ -105,21 +105,21 @@ public:
class CodeSection : public OutputSection {
public:
- explicit CodeSection(uint32_t NumFunctions, std::vector<ObjFile *> &Objs);
+ explicit CodeSection(uint32_t NumFunctions, ArrayRef<ObjFile *> Objs);
size_t getSize() const override { return Header.size() + BodySize; }
void writeTo(uint8_t *Buf) override;
uint32_t numRelocations() const override;
void writeRelocations(raw_ostream &OS) const override;
protected:
- std::vector<ObjFile *> &InputObjects;
+ ArrayRef<ObjFile *> InputObjects;
std::string CodeSectionHeader;
size_t BodySize = 0;
};
class DataSection : public OutputSection {
public:
- explicit DataSection(std::vector<OutputSegment *> &Segments);
+ explicit DataSection(ArrayRef<OutputSegment *> Segments);
size_t getSize() const override { return Header.size() + BodySize; }
void writeTo(uint8_t *Buf) override;
uint32_t numRelocations() const override { return Relocations.size(); }
@@ -127,7 +127,7 @@ public:
protected:
std::vector<OutputRelocation> Relocations;
- std::vector<OutputSegment *> &Segments;
+ ArrayRef<OutputSegment *> Segments;
std::string DataSectionHeader;
size_t BodySize = 0;
};
OpenPOWER on IntegriCloud