diff options
author | Alon Zakai <azakai@google.com> | 2019-05-01 14:48:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 14:48:41 -0700 |
commit | 2bd3758a22131cfd6925b3fd995657b211095c90 (patch) | |
tree | 2a38a48ab68c00ed1b55e885f86014bbdda92ff2 /src/wasm/wasm.cpp | |
parent | 73709b4da08d285c2237c8c23a54ba53274c0c7f (diff) | |
download | binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.gz binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.bz2 binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.zip |
clang-tidy braces changes (#2075)
Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 22cce6e80..bf12c22d4 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -185,11 +185,13 @@ struct TypeSeeker : public PostWalker<TypeSeeker> { void visitSwitch(Switch* curr) { for (auto name : curr->targets) { - if (name == targetName) + if (name == targetName) { types.push_back(curr->value ? curr->value->type : none); + } } - if (curr->default_ == targetName) + if (curr->default_ == targetName) { types.push_back(curr->value ? curr->value->type : none); + } } void visitBlock(Block* curr) { @@ -243,15 +245,18 @@ static Type mergeTypes(std::vector<Type>& types) { static void handleUnreachable(Block* block, bool breakabilityKnown = false, bool hasBreak = false) { - if (block->type == unreachable) + if (block->type == unreachable) { return; // nothing to do - if (block->list.size() == 0) + } + if (block->list.size() == 0) { return; // nothing to do + } // if we are concrete, stop - even an unreachable child // won't change that (since we have a break with a value, // or the final child flows out a value) - if (isConcreteType(block->type)) + if (isConcreteType(block->type)) { return; + } // look for an unreachable child for (auto* child : block->list) { if (child->type == unreachable) { @@ -280,11 +285,13 @@ void Block::finalize() { // (return) // (i32.const 10) // ) - if (isConcreteType(type)) + if (isConcreteType(type)) { return; + } // if we are unreachable, we are done - if (type == unreachable) + if (type == unreachable) { return; + } // we may still be unreachable if we have an unreachable // child for (auto* child : list) { @@ -398,20 +405,24 @@ void CallIndirect::finalize() { } bool FunctionType::structuralComparison(FunctionType& b) { - if (result != b.result) + if (result != b.result) { return false; - if (params.size() != b.params.size()) + } + if (params.size() != b.params.size()) { return false; + } for (size_t i = 0; i < params.size(); i++) { - if (params[i] != b.params[i]) + if (params[i] != b.params[i]) { return false; + } } return true; } bool FunctionType::operator==(FunctionType& b) { - if (name != b.name) + if (name != b.name) { return false; + } return structuralComparison(b); } bool FunctionType::operator!=(FunctionType& b) { return !(*this == b); } @@ -419,10 +430,11 @@ bool FunctionType::operator!=(FunctionType& b) { return !(*this == b); } bool SetLocal::isTee() { return type != none; } void SetLocal::setTee(bool is) { - if (is) + if (is) { type = value->type; - else + } else { type = none; + } finalize(); // type may need to be unreachable } |