From db9124f1de0478dcac525009b6f1589b44a7edd8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 26 Apr 2019 16:59:41 -0700 Subject: 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 --- src/ir/hashed.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/ir/hashed.h') 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 -class HashedExpressionMap : public std::unordered_map { +class HashedExpressionMap + : public std:: + unordered_map { }; // A pass that hashes all functions @@ -63,21 +65,19 @@ struct FunctionHasher : public WalkerPass> { 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> { ret = rehash(ret, (HashType)type); } ret = rehash(ret, (HashType)func->result); - ret = rehash(ret, HashType(func->type.is() ? std::hash{}(func->type) : HashType(0))); + ret = rehash(ret, + HashType(func->type.is() ? std::hash{}(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 - -- cgit v1.2.3