Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp =================================================================== --- llvm/trunk/lib/MC/WasmObjectWriter.cpp +++ llvm/trunk/lib/MC/WasmObjectWriter.cpp @@ -262,19 +262,19 @@ encodeSLEB128(int32_t(Ty), getStream()); } - void writeTypeSection(const SmallVector &FunctionTypes); - void writeImportSection(const SmallVector &Imports); - void writeFunctionSection(const SmallVector &Functions); + void writeTypeSection(ArrayRef FunctionTypes); + void writeImportSection(ArrayRef Imports); + void writeFunctionSection(ArrayRef Functions); void writeTableSection(uint32_t NumElements); void writeMemorySection(uint32_t DataSize); void writeGlobalSection(); - void writeExportSection(const SmallVector &Exports); - void writeElemSection(const SmallVector &TableElems); + void writeExportSection(ArrayRef Exports); + void writeElemSection(ArrayRef TableElems); void writeCodeSection(const MCAssembler &Asm, const MCAsmLayout &Layout, - const SmallVector &Functions); - void writeDataSection(const SmallVector &Segments); - void writeNameSection(const SmallVector &Functions, - const SmallVector &Imports, + ArrayRef Functions); + void writeDataSection(ArrayRef Segments); + void writeNameSection(ArrayRef Functions, + ArrayRef Imports, uint32_t NumFuncImports); void writeCodeRelocSection(); void writeDataRelocSection(); @@ -602,7 +602,7 @@ } void WasmObjectWriter::writeTypeSection( - const SmallVector &FunctionTypes) { + ArrayRef FunctionTypes) { if (FunctionTypes.empty()) return; @@ -624,9 +624,7 @@ endSection(Section); } - -void WasmObjectWriter::writeImportSection( - const SmallVector &Imports) { +void WasmObjectWriter::writeImportSection(ArrayRef Imports) { if (Imports.empty()) return; @@ -656,8 +654,7 @@ endSection(Section); } -void WasmObjectWriter::writeFunctionSection( - const SmallVector &Functions) { +void WasmObjectWriter::writeFunctionSection(ArrayRef Functions) { if (Functions.empty()) return; @@ -731,8 +728,7 @@ endSection(Section); } -void WasmObjectWriter::writeExportSection( - const SmallVector &Exports) { +void WasmObjectWriter::writeExportSection(ArrayRef Exports) { if (Exports.empty()) return; @@ -749,8 +745,7 @@ endSection(Section); } -void WasmObjectWriter::writeElemSection( - const SmallVector &TableElems) { +void WasmObjectWriter::writeElemSection(ArrayRef TableElems) { if (TableElems.empty()) return; @@ -772,9 +767,9 @@ endSection(Section); } -void WasmObjectWriter::writeCodeSection( - const MCAssembler &Asm, const MCAsmLayout &Layout, - const SmallVector &Functions) { +void WasmObjectWriter::writeCodeSection(const MCAssembler &Asm, + const MCAsmLayout &Layout, + ArrayRef Functions) { if (Functions.empty()) return; @@ -803,8 +798,7 @@ endSection(Section); } -void WasmObjectWriter::writeDataSection( - const SmallVector &Segments) { +void WasmObjectWriter::writeDataSection(ArrayRef Segments) { if (Segments.empty()) return; @@ -830,8 +824,8 @@ } void WasmObjectWriter::writeNameSection( - const SmallVector &Functions, - const SmallVector &Imports, + ArrayRef Functions, + ArrayRef Imports, unsigned NumFuncImports) { uint32_t TotalFunctions = NumFuncImports + Functions.size(); if (TotalFunctions == 0)