diff options
author | Alon Zakai <azakai@google.com> | 2019-04-26 16:59:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 16:59:41 -0700 |
commit | db9124f1de0478dcac525009b6f1589b44a7edd8 (patch) | |
tree | fa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/ir/hashed.h | |
parent | 87636dccd404a340d75acb1d96301581343f29ca (diff) | |
download | binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2 binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip |
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/ir/hashed.h')
-rw-r--r-- | src/ir/hashed.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/ir/hashed.h b/src/ir/hashed.h index 61bf19478..676b82cb4 100644 --- a/src/ir/hashed.h +++ b/src/ir/hashed.h @@ -17,9 +17,9 @@ #ifndef _wasm_ir_hashed_h #define _wasm_ir_hashed_h +#include "ir/utils.h" #include "support/hash.h" #include "wasm.h" -#include "ir/utils.h" namespace wasm { @@ -34,24 +34,26 @@ struct HashedExpression { } } - HashedExpression(const HashedExpression& other) : expr(other.expr), hash(other.hash) {} + HashedExpression(const HashedExpression& other) + : expr(other.expr), hash(other.hash) {} }; struct ExpressionHasher { - HashType operator()(const HashedExpression value) const { - return value.hash; - } + HashType operator()(const HashedExpression value) const { return value.hash; } }; struct ExpressionComparer { bool operator()(const HashedExpression a, const HashedExpression b) const { - if (a.hash != b.hash) return false; + if (a.hash != b.hash) + return false; return ExpressionAnalyzer::equal(a.expr, b.expr); } }; template<typename T> -class HashedExpressionMap : public std::unordered_map<HashedExpression, T, ExpressionHasher, ExpressionComparer> { +class HashedExpressionMap + : public std:: + unordered_map<HashedExpression, T, ExpressionHasher, ExpressionComparer> { }; // A pass that hashes all functions @@ -63,21 +65,19 @@ struct FunctionHasher : public WalkerPass<PostWalker<FunctionHasher>> { FunctionHasher(Map* output) : output(output) {} - FunctionHasher* create() override { - return new FunctionHasher(output); - } + FunctionHasher* create() override { return new FunctionHasher(output); } static Map createMap(Module* module) { Map hashes; for (auto& func : module->functions) { - hashes[func.get()] = 0; // ensure an entry for each function - we must not modify the map shape in parallel, just the values + // ensure an entry for each function - we must not modify the map shape in + // parallel, just the values + hashes[func.get()] = 0; } return hashes; } - void doWalkFunction(Function* func) { - output->at(func) = hashFunction(func); - } + void doWalkFunction(Function* func) { output->at(func) = hashFunction(func); } static HashType hashFunction(Function* func) { HashType ret = 0; @@ -90,7 +90,9 @@ struct FunctionHasher : public WalkerPass<PostWalker<FunctionHasher>> { ret = rehash(ret, (HashType)type); } ret = rehash(ret, (HashType)func->result); - ret = rehash(ret, HashType(func->type.is() ? std::hash<wasm::Name>{}(func->type) : HashType(0))); + ret = rehash(ret, + HashType(func->type.is() ? std::hash<wasm::Name>{}(func->type) + : HashType(0))); ret = rehash(ret, (HashType)ExpressionAnalyzer::hash(func->body)); return ret; } @@ -102,4 +104,3 @@ private: } // namespace wasm #endif // _wasm_ir_hashed_h - |