diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/execution-results.h | 2 | ||||
-rw-r--r-- | src/tools/fuzzing.h | 23 | ||||
-rw-r--r-- | src/tools/js-wrapper.h | 2 | ||||
-rw-r--r-- | src/tools/spec-wrapper.h | 2 | ||||
-rw-r--r-- | src/tools/wasm-shell.cpp | 2 | ||||
-rw-r--r-- | src/tools/wasm2c-wrapper.h | 11 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index e5d4dab00..dc62bba38 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -144,7 +144,7 @@ struct ExecutionResults { instance.callFunction(ex->value, arguments); } // call the method - for (Type param : func->sig.params.expand()) { + for (auto& param : func->sig.params) { // zeros in arguments TODO: more? arguments.push_back(Literal::makeSingleZero(param)); } diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 7fef9c208..c76b6e13a 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -308,7 +308,7 @@ private: Type getSubType(Type type) { if (type.isMulti()) { std::vector<Type> types; - for (auto t : type.expand()) { + for (auto& t : type) { types.push_back(getSubType(t)); } return Type(types); @@ -770,7 +770,7 @@ private: std::vector<Expression*> invocations; while (oneIn(2) && !finishedInput) { std::vector<Expression*> args; - for (auto type : func->sig.params.expand()) { + for (auto& type : func->sig.params) { args.push_back(makeConst(type)); } Expression* invoke = @@ -1166,7 +1166,7 @@ private: } // we found one! std::vector<Expression*> args; - for (auto argType : target->sig.params.expand()) { + for (auto& argType : target->sig.params) { args.push_back(make(argType)); } return builder.makeCall(target->name, args, type, isReturn); @@ -1210,7 +1210,7 @@ private: target = make(Type::i32); } std::vector<Expression*> args; - for (auto type : targetFn->sig.params.expand()) { + for (auto& type : targetFn->sig.params) { args.push_back(make(type)); } return builder.makeCallIndirect(target, args, targetFn->sig, isReturn); @@ -1267,7 +1267,7 @@ private: assert(wasm.features.hasMultivalue()); assert(type.isMulti()); std::vector<Expression*> elements; - for (auto t : type.expand()) { + for (auto& t : type) { elements.push_back(make(t)); } return builder.makeTupleMake(std::move(elements)); @@ -1277,20 +1277,21 @@ private: assert(wasm.features.hasMultivalue()); assert(type.isSingle() && type.isConcrete()); Type tupleType = getTupleType(); - auto& elements = tupleType.expand(); // Find indices from which we can extract `type` std::vector<size_t> extractIndices; - for (size_t i = 0; i < elements.size(); ++i) { - if (elements[i] == type) { + size_t i = 0; + for (auto& t : tupleType) { + if (t == type) { extractIndices.push_back(i); } + ++i; } // If there are none, inject one if (extractIndices.size() == 0) { - auto newElements = elements; - size_t injected = upTo(elements.size()); + std::vector<Type> newElements(tupleType.begin(), tupleType.end()); + size_t injected = upTo(newElements.size()); newElements[injected] = type; tupleType = Type(newElements); extractIndices.push_back(injected); @@ -1766,7 +1767,7 @@ private: } if (type.isMulti()) { std::vector<Expression*> operands; - for (auto t : type.expand()) { + for (auto& t : type) { operands.push_back(makeConst(t)); } return builder.makeTupleMake(std::move(operands)); diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h index 0a9b5925e..58e52b782 100644 --- a/src/tools/js-wrapper.h +++ b/src/tools/js-wrapper.h @@ -99,7 +99,7 @@ static std::string generateJSWrapper(Module& wasm) { } ret += std::string("instance.exports.") + exp->name.str + "("; bool first = true; - for (Type param : func->sig.params.expand()) { + for (auto& param : func->sig.params) { // zeros in arguments TODO more? if (first) { first = false; diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h index 3a674e495..513cc8bda 100644 --- a/src/tools/spec-wrapper.h +++ b/src/tools/spec-wrapper.h @@ -30,7 +30,7 @@ static std::string generateSpecWrapper(Module& wasm) { } ret += std::string("(invoke \"hangLimitInitializer\") (invoke \"") + exp->name.str + "\" "; - for (Type param : func->sig.params.expand()) { + for (auto& param : func->sig.params) { // zeros in arguments TODO more? TODO_SINGLE_COMPOUND(param); switch (param.getBasic()) { diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp index 1430c1891..1093ff85c 100644 --- a/src/tools/wasm-shell.cpp +++ b/src/tools/wasm-shell.cpp @@ -111,7 +111,7 @@ static void run_asserts(Name moduleName, std::cerr << "Unknown entry " << entry << std::endl; } else { LiteralList arguments; - for (Type param : function->sig.params.expand()) { + for (auto& param : function->sig.params) { arguments.push_back(Literal(param)); } try { diff --git a/src/tools/wasm2c-wrapper.h b/src/tools/wasm2c-wrapper.h index eae92ad60..0dd3c4381 100644 --- a/src/tools/wasm2c-wrapper.h +++ b/src/tools/wasm2c-wrapper.h @@ -144,7 +144,6 @@ int main(int argc, char** argv) { // Emit the callee's name with wasm2c name mangling. ret += std::string("(*Z_") + exp->name.str + "Z_"; - auto params = func->sig.params.expand(); auto wasm2cSignature = [](Type type) { TODO_SINGLE_COMPOUND(type); @@ -165,18 +164,18 @@ int main(int argc, char** argv) { }; ret += wasm2cSignature(result); - if (params.empty()) { - ret += wasm2cSignature(Type::none); - } else { - for (auto param : params) { + if (func->sig.params.isMulti()) { + for (auto& param : func->sig.params) { ret += wasm2cSignature(param); } + } else { + ret += wasm2cSignature(func->sig.params); } ret += ")("; // Emit the parameters (all 0s, like the other wrappers). bool first = true; - for (auto param : params) { + for (auto& param : func->sig.params) { WASM_UNUSED(param); if (!first) { ret += ", "; |