diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/execution-results.h | 3 | ||||
-rw-r--r-- | src/tools/wasm-metadce.cpp | 14 | ||||
-rw-r--r-- | src/tools/wasm-split/wasm-split.cpp | 4 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 8fc4c2eed..b689ffc66 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -185,8 +185,7 @@ struct ExecutionResults { std::cout << "ignoring comparison of ExecutionResults!\n"; return true; } - for (auto& iter : other.results) { - auto name = iter.first; + for (auto& [name, _] : other.results) { if (results.find(name) == results.end()) { std::cout << "[fuzz-exec] missing " << name << '\n'; return false; diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp index 00fa87ce2..3a468e071 100644 --- a/src/tools/wasm-metadce.cpp +++ b/src/tools/wasm-metadce.cpp @@ -334,8 +334,7 @@ public: queue.pop_back(); auto& node = nodes[name]; for (auto target : node.reaches) { - if (reached.find(target) == reached.end()) { - reached.insert(target); + if (reached.emplace(target).second) { queue.push_back(target); } } @@ -368,8 +367,7 @@ public: // removed, including on the outside void printAllUnused() { std::set<std::string> unused; - for (auto& pair : nodes) { - auto name = pair.first; + for (auto& [name, _] : nodes) { if (reached.find(name) == reached.end()) { unused.insert(name.str); } @@ -386,14 +384,10 @@ public: std::cout << "root: " << root << '\n'; } std::map<Name, ImportId> importMap; - for (auto& pair : importIdToDCENode) { - auto& id = pair.first; - auto dceName = pair.second; + for (auto& [id, dceName] : importIdToDCENode) { importMap[dceName] = id; } - for (auto& pair : nodes) { - auto name = pair.first; - auto& node = pair.second; + for (auto& [name, node] : nodes) { std::cout << "node: " << name << '\n'; if (importMap.find(name) != importMap.end()) { std::cout << " is import " << importMap[name] << '\n'; diff --git a/src/tools/wasm-split/wasm-split.cpp b/src/tools/wasm-split/wasm-split.cpp index 2be368994..2732502ad 100644 --- a/src/tools/wasm-split/wasm-split.cpp +++ b/src/tools/wasm-split/wasm-split.cpp @@ -161,8 +161,8 @@ void writePlaceholderMap(const std::map<size_t, Name> placeholderMap, std::string filename) { Output output(filename, Flags::Text); auto& o = output.getStream(); - for (auto pair : placeholderMap) { - o << pair.first << ':' << pair.second << '\n'; + for (auto& [index, func] : placeholderMap) { + o << index << ':' << func << '\n'; } } |