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/support/command-line.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/support/command-line.cpp')
-rw-r--r-- | src/support/command-line.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp index f3b9ffe25..f1b4fca4d 100644 --- a/src/support/command-line.cpp +++ b/src/support/command-line.cpp @@ -37,8 +37,9 @@ void printWrap(std::ostream& os, int leftPad, const std::string& content) { } os << nextWord; space -= nextWord.size() + 1; - if (space > 0) + if (space > 0) { os << ' '; + } nextWord.clear(); if (content[i] == '\n') { os << '\n'; @@ -56,8 +57,9 @@ Options::Options(const std::string& command, const std::string& description) Arguments::Zero, [this, command, description](Options* o, const std::string&) { std::cout << command; - if (positional != Arguments::Zero) + if (positional != Arguments::Zero) { std::cout << ' ' << positionalName; + } std::cout << "\n\n"; printWrap(std::cout, 0, description); std::cout << "\n\nOptions:\n"; @@ -109,8 +111,9 @@ void Options::parse(int argc, const char* argv[]) { size_t positionalsSeen = 0; auto dashes = [](const std::string& s) { for (size_t i = 0;; ++i) { - if (s[i] != '-') + if (s[i] != '-') { return i; + } } }; for (size_t i = 1, e = argc; i != e; ++i) { @@ -147,9 +150,11 @@ void Options::parse(int argc, const char* argv[]) { currentOption = currentOption.substr(0, equal); } Option* option = nullptr; - for (auto& o : options) - if (o.longName == currentOption || o.shortName == currentOption) + for (auto& o : options) { + if (o.longName == currentOption || o.shortName == currentOption) { option = &o; + } + } if (!option) { std::cerr << "Unknown option '" << currentOption << "'\n"; exit(EXIT_FAILURE); @@ -181,8 +186,9 @@ void Options::parse(int argc, const char* argv[]) { break; case Arguments::Optional: if (!argument.size()) { - if (i + 1 != e) + if (i + 1 != e) { argument = argv[++i]; + } } break; } |