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/ir/branch-utils.h | |
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/ir/branch-utils.h')
-rw-r--r-- | src/ir/branch-utils.h | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h index f62941e15..ce7d7b0f6 100644 --- a/src/ir/branch-utils.h +++ b/src/ir/branch-utils.h @@ -155,47 +155,57 @@ struct BranchSeeker : public PostWalker<BranchSeeker> { void noteFound(Expression* value) { found++; - if (found == 1) + if (found == 1) { valueType = unreachable; - if (!value) + } + if (!value) { valueType = none; - else if (value->type != unreachable) + } else if (value->type != unreachable) { valueType = value->type; + } } void visitBreak(Break* curr) { if (!named) { // ignore an unreachable break - if (curr->condition && curr->condition->type == unreachable) + if (curr->condition && curr->condition->type == unreachable) { return; - if (curr->value && curr->value->type == unreachable) + } + if (curr->value && curr->value->type == unreachable) { return; + } } // check the break - if (curr->name == target) + if (curr->name == target) { noteFound(curr->value); + } } void visitSwitch(Switch* curr) { if (!named) { // ignore an unreachable switch - if (curr->condition->type == unreachable) + if (curr->condition->type == unreachable) { return; - if (curr->value && curr->value->type == unreachable) + } + if (curr->value && curr->value->type == unreachable) { return; + } } // check the switch for (auto name : curr->targets) { - if (name == target) + if (name == target) { noteFound(curr->value); + } } - if (curr->default_ == target) + if (curr->default_ == target) { noteFound(curr->value); + } } static bool hasReachable(Expression* tree, Name target) { - if (!target.is()) + if (!target.is()) { return false; + } BranchSeeker seeker(target); seeker.named = false; seeker.walk(tree); @@ -203,8 +213,9 @@ struct BranchSeeker : public PostWalker<BranchSeeker> { } static Index countReachable(Expression* tree, Name target) { - if (!target.is()) + if (!target.is()) { return 0; + } BranchSeeker seeker(target); seeker.named = false; seeker.walk(tree); @@ -212,16 +223,18 @@ struct BranchSeeker : public PostWalker<BranchSeeker> { } static bool hasNamed(Expression* tree, Name target) { - if (!target.is()) + if (!target.is()) { return false; + } BranchSeeker seeker(target); seeker.walk(tree); return seeker.found > 0; } static Index countNamed(Expression* tree, Name target) { - if (!target.is()) + if (!target.is()) { return 0; + } BranchSeeker seeker(target); seeker.walk(tree); return seeker.found; |