diff options
author | Max Graey <maxgraey@gmail.com> | 2021-11-23 07:03:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 21:03:25 -0800 |
commit | 7f24fce21a92f2aed4a11745d27d5181798ba6cd (patch) | |
tree | 80655dc933e3c2ae3ae53b7960cd71a6a022c3da /src/ir/struct-utils.h | |
parent | 37999167bb333dd0b12d744af8e633897e65cff8 (diff) | |
download | binaryen-7f24fce21a92f2aed4a11745d27d5181798ba6cd.tar.gz binaryen-7f24fce21a92f2aed4a11745d27d5181798ba6cd.tar.bz2 binaryen-7f24fce21a92f2aed4a11745d27d5181798ba6cd.zip |
Modernize code to C++17 (#3104)
Diffstat (limited to 'src/ir/struct-utils.h')
-rw-r--r-- | src/ir/struct-utils.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/ir/struct-utils.h b/src/ir/struct-utils.h index f1741fb27..f68692363 100644 --- a/src/ir/struct-utils.h +++ b/src/ir/struct-utils.h @@ -59,9 +59,7 @@ struct StructValuesMap : public std::unordered_map<HeapType, StructValues<T>> { } void combineInto(StructValuesMap<T>& combinedInfos) const { - for (auto& kv : *this) { - auto type = kv.first; - auto& info = kv.second; + for (auto& [type, info] : *this) { for (Index i = 0; i < info.size(); i++) { combinedInfos[type][i].combine(info[i]); } @@ -70,9 +68,7 @@ struct StructValuesMap : public std::unordered_map<HeapType, StructValues<T>> { void dump(std::ostream& o) { o << "dump " << this << '\n'; - for (auto& kv : (*this)) { - auto type = kv.first; - auto& vec = kv.second; + for (auto& [type, vec] : (*this)) { o << "dump " << type << " " << &vec << ' '; for (auto x : vec) { x.dump(o); @@ -235,8 +231,7 @@ public: private: void propagate(StructValuesMap<T>& combinedInfos, bool toSubTypes) { UniqueDeferredQueue<HeapType> work; - for (auto& kv : combinedInfos) { - auto type = kv.first; + for (auto& [type, _] : combinedInfos) { work.push(type); } while (!work.empty()) { |