[llvm] r320906 - [WebAssembly] Return ArrayRef's rather than const std::vector&
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 18:10:16 PST 2017
Author: sbc
Date: Fri Dec 15 18:10:16 2017
New Revision: 320906
URL: http://llvm.org/viewvc/llvm-project?rev=320906&view=rev
Log:
[WebAssembly] Return ArrayRef's rather than const std::vector&
>From working on lld I've learned this is generally the
preferred way for several reasons (e.g. more concise, improves
encapsulation).
Differential Revision: https://reviews.llvm.org/D41265
Modified:
llvm/trunk/include/llvm/Object/Wasm.h
Modified: llvm/trunk/include/llvm/Object/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Wasm.h?rev=320906&r1=320905&r2=320906&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/Wasm.h (original)
+++ llvm/trunk/include/llvm/Object/Wasm.h Fri Dec 15 18:10:16 2017
@@ -128,28 +128,18 @@ public:
static bool classof(const Binary *v) { return v->isWasm(); }
- const std::vector<wasm::WasmSignature>& types() const { return Signatures; }
- const std::vector<uint32_t>& functionTypes() const { return FunctionTypes; }
- const std::vector<wasm::WasmImport>& imports() const { return Imports; }
- const std::vector<wasm::WasmTable>& tables() const { return Tables; }
- const std::vector<wasm::WasmLimits>& memories() const { return Memories; }
- const std::vector<wasm::WasmGlobal>& globals() const { return Globals; }
- const std::vector<wasm::WasmExport>& exports() const { return Exports; }
+ ArrayRef<wasm::WasmSignature> types() const { return Signatures; }
+ ArrayRef<uint32_t> functionTypes() const { return FunctionTypes; }
+ ArrayRef<wasm::WasmImport> imports() const { return Imports; }
+ ArrayRef<wasm::WasmTable> tables() const { return Tables; }
+ ArrayRef<wasm::WasmLimits> memories() const { return Memories; }
+ ArrayRef<wasm::WasmGlobal> globals() const { return Globals; }
+ ArrayRef<wasm::WasmExport> exports() const { return Exports; }
const wasm::WasmLinkingData& linkingData() const { return LinkingData; }
-
- uint32_t getNumberOfSymbols() const {
- return Symbols.size();
- }
-
- const std::vector<wasm::WasmElemSegment>& elements() const {
- return ElemSegments;
- }
-
- const std::vector<WasmSegment>& dataSegments() const {
- return DataSegments;
- }
-
- const std::vector<wasm::WasmFunction>& functions() const { return Functions; }
+ uint32_t getNumberOfSymbols() const { return Symbols.size(); }
+ ArrayRef<wasm::WasmElemSegment> elements() const { return ElemSegments; }
+ ArrayRef<WasmSegment> dataSegments() const { return DataSegments; }
+ ArrayRef<wasm::WasmFunction> functions() const { return Functions; }
const ArrayRef<uint8_t>& code() const { return CodeSection; }
uint32_t startFunction() const { return StartFunction; }
More information about the llvm-commits
mailing list