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/passes/RemoveUnusedNames.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src/passes/RemoveUnusedNames.cpp') diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp index e5aaf5509..86db53b0c 100644 --- a/src/passes/RemoveUnusedNames.cpp +++ b/src/passes/RemoveUnusedNames.cpp @@ -19,8 +19,8 @@ // merge names when possible (by merging their blocks) // -#include #include +#include namespace wasm { @@ -33,11 +33,9 @@ struct RemoveUnusedNames : public WalkerPass> { // a parent block, we know if it was branched to std::map> branchesSeen; - void visitBreak(Break *curr) { - branchesSeen[curr->name].insert(curr); - } + void visitBreak(Break* curr) { branchesSeen[curr->name].insert(curr); } - void visitSwitch(Switch *curr) { + void visitSwitch(Switch* curr) { for (auto name : curr->targets) { branchesSeen[name].insert(curr); } @@ -54,20 +52,24 @@ struct RemoveUnusedNames : public WalkerPass> { } } - void visitBlock(Block *curr) { + void visitBlock(Block* curr) { if (curr->name.is() && curr->list.size() == 1) { auto* child = curr->list[0]->dynCast(); if (child && child->name.is() && child->type == curr->type) { - // we have just one child, this block, so breaking out of it goes to the same place as breaking out of us, we just need one name (and block) + // we have just one child, this block, so breaking out of it goes to the + // same place as breaking out of us, we just need one name (and block) auto& branches = branchesSeen[curr->name]; for (auto* branch : branches) { if (Break* br = branch->dynCast()) { - if (br->name == curr->name) br->name = child->name; + if (br->name == curr->name) + br->name = child->name; } else if (Switch* sw = branch->dynCast()) { for (auto& target : sw->targets) { - if (target == curr->name) target = child->name; + if (target == curr->name) + target = child->name; } - if (sw->default_ == curr->name) sw->default_ = child->name; + if (sw->default_ == curr->name) + sw->default_ = child->name; } else { WASM_UNREACHABLE(); } @@ -79,20 +81,16 @@ struct RemoveUnusedNames : public WalkerPass> { handleBreakTarget(curr->name); } - void visitLoop(Loop *curr) { + void visitLoop(Loop* curr) { handleBreakTarget(curr->name); if (!curr->name.is()) { replaceCurrent(curr->body); } } - void visitFunction(Function *curr) { - assert(branchesSeen.empty()); - } + void visitFunction(Function* curr) { assert(branchesSeen.empty()); } }; -Pass *createRemoveUnusedNamesPass() { - return new RemoveUnusedNames(); -} +Pass* createRemoveUnusedNamesPass() { return new RemoveUnusedNames(); } } // namespace wasm -- cgit v1.2.3