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/trapping.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/trapping.h')
-rw-r--r-- | src/ir/trapping.h | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/ir/trapping.h b/src/ir/trapping.h index 48f485faa..e6eca9e53 100644 --- a/src/ir/trapping.h +++ b/src/ir/trapping.h @@ -23,11 +23,7 @@ namespace wasm { -enum class TrapMode { - Allow, - Clamp, - JS -}; +enum class TrapMode { Allow, Clamp, JS }; inline void addTrapModePass(PassRunner& runner, TrapMode trapMode) { if (trapMode == TrapMode::Clamp) { @@ -39,17 +35,13 @@ inline void addTrapModePass(PassRunner& runner, TrapMode trapMode) { class TrappingFunctionContainer { public: - TrappingFunctionContainer(TrapMode mode, Module &wasm, bool immediate = false) - : mode(mode), - wasm(wasm), - immediate(immediate) { } + TrappingFunctionContainer(TrapMode mode, Module& wasm, bool immediate = false) + : mode(mode), wasm(wasm), immediate(immediate) {} bool hasFunction(Name name) { return functions.find(name) != functions.end(); } - bool hasImport(Name name) { - return imports.find(name) != imports.end(); - } + bool hasImport(Name name) { return imports.find(name) != imports.end(); } void addFunction(Function* function) { functions[function->name] = function; @@ -66,10 +58,10 @@ public: void addToModule() { if (!immediate) { - for (auto &pair : functions) { + for (auto& pair : functions) { wasm.addFunction(pair.second); } - for (auto &pair : imports) { + for (auto& pair : imports) { wasm.addFunction(pair.second); } } @@ -77,17 +69,11 @@ public: imports.clear(); } - TrapMode getMode() { - return mode; - } + TrapMode getMode() { return mode; } - Module& getModule() { - return wasm; - } + Module& getModule() { return wasm; } - std::map<Name, Function*>& getFunctions() { - return functions; - } + std::map<Name, Function*>& getFunctions() { return functions; } private: std::map<Name, Function*> functions; @@ -98,8 +84,10 @@ private: bool immediate; }; -Expression* makeTrappingBinary(Binary* curr, TrappingFunctionContainer &trappingFunctions); -Expression* makeTrappingUnary(Unary* curr, TrappingFunctionContainer &trappingFunctions); +Expression* makeTrappingBinary(Binary* curr, + TrappingFunctionContainer& trappingFunctions); +Expression* makeTrappingUnary(Unary* curr, + TrappingFunctionContainer& trappingFunctions); inline TrapMode trapModeFromString(std::string const& str) { if (str == "allow") { @@ -110,11 +98,12 @@ inline TrapMode trapModeFromString(std::string const& str) { return TrapMode::JS; } else { throw std::invalid_argument( - "Unsupported trap mode \"" + str + "\". " + "Unsupported trap mode \"" + str + + "\". " "Valid modes are \"allow\", \"js\", and \"clamp\""); } } -} // wasm +} // namespace wasm #endif // wasm_ir_trapping_h |