[flang] Remove needless braces

Original-commit: flang-compiler/f18@edd18355be
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-05-07 12:24:59 -07:00
parent 19a5dfeacf
commit 7269dc8a82
1 changed files with 16 additions and 15 deletions

View File

@ -76,7 +76,7 @@ public:
using resultType = A; using resultType = A;
constexpr PureParser(const PureParser &) = default; constexpr PureParser(const PureParser &) = default;
constexpr explicit PureParser(A &&x) : value_(std::move(x)) {} constexpr explicit PureParser(A &&x) : value_(std::move(x)) {}
std::optional<A> Parse(ParseState &) const { return {value_}; } std::optional<A> Parse(ParseState &) const { return value_; }
private: private:
const A value_; const A value_;
@ -126,8 +126,9 @@ public:
forked.set_deferMessages(true); forked.set_deferMessages(true);
if (parser_.Parse(forked)) { if (parser_.Parse(forked)) {
return std::nullopt; return std::nullopt;
} else {
return Success{};
} }
return {Success{}};
} }
private: private:
@ -149,7 +150,7 @@ public:
ParseState forked{state}; ParseState forked{state};
forked.set_deferMessages(true); forked.set_deferMessages(true);
if (parser_.Parse(forked).has_value()) { if (parser_.Parse(forked).has_value()) {
return {Success{}}; return Success{};
} }
return std::nullopt; return std::nullopt;
} }
@ -415,7 +416,7 @@ public:
} }
at = state.GetLocation(); at = state.GetLocation();
} }
return {std::move(result)}; return result;
} }
private: private:
@ -445,7 +446,7 @@ public:
if (state.GetLocation() > start) { if (state.GetLocation() > start) {
result.splice(result.end(), many(parser_).Parse(state).value()); result.splice(result.end(), many(parser_).Parse(state).value());
} }
return {std::move(result)}; return result;
} }
return std::nullopt; return std::nullopt;
} }
@ -469,7 +470,7 @@ public:
parser_.Parse(state) && state.GetLocation() > at; parser_.Parse(state) && state.GetLocation() > at;
at = state.GetLocation()) { at = state.GetLocation()) {
} }
return {Success{}}; return Success{};
} }
private: private:
@ -491,7 +492,7 @@ public:
std::optional<Success> Parse(ParseState &state) const { std::optional<Success> Parse(ParseState &state) const {
while (parser_.Parse(state)) { while (parser_.Parse(state)) {
} }
return {Success{}}; return Success{};
} }
private: private:
@ -513,9 +514,9 @@ public:
constexpr MaybeParser(PA parser) : parser_{parser} {} constexpr MaybeParser(PA parser) : parser_{parser} {}
std::optional<resultType> Parse(ParseState &state) const { std::optional<resultType> Parse(ParseState &state) const {
if (resultType result{parser_.Parse(state)}) { if (resultType result{parser_.Parse(state)}) {
return {std::move(result)}; return result;
} }
return {resultType{}}; return resultType{};
} }
private: private:
@ -539,7 +540,7 @@ public:
if (ax.value().has_value()) { // maybe() always succeeds if (ax.value().has_value()) { // maybe() always succeeds
return std::move(*ax); return std::move(*ax);
} }
return {resultType{}}; return resultType{};
} }
private: private:
@ -610,8 +611,8 @@ public:
ApplyArgs<PARSER...> results; ApplyArgs<PARSER...> results;
using Sequence = std::index_sequence_for<PARSER...>; using Sequence = std::index_sequence_for<PARSER...>;
if (ApplyHelperArgs(parsers_, results, state, Sequence{})) { if (ApplyHelperArgs(parsers_, results, state, Sequence{})) {
return {ApplyHelperFunction<FUNCTION, RESULT, PARSER...>( return ApplyHelperFunction<FUNCTION, RESULT, PARSER...>(
function_, std::move(results), Sequence{})}; function_, std::move(results), Sequence{});
} else { } else {
return std::nullopt; return std::nullopt;
} }
@ -669,8 +670,8 @@ public:
using Sequence1 = std::index_sequence_for<OBJPARSER, PARSER...>; using Sequence1 = std::index_sequence_for<OBJPARSER, PARSER...>;
using Sequence2 = std::index_sequence_for<PARSER...>; using Sequence2 = std::index_sequence_for<PARSER...>;
if (ApplyHelperArgs(parsers_, results, state, Sequence1{})) { if (ApplyHelperArgs(parsers_, results, state, Sequence1{})) {
return {ApplyHelperMember<OBJPARSER, PARSER...>( return ApplyHelperMember<OBJPARSER, PARSER...>(
function_, std::move(results), Sequence2{})}; function_, std::move(results), Sequence2{});
} else { } else {
return std::nullopt; return std::nullopt;
} }
@ -795,7 +796,7 @@ template<bool pass> struct FixedParser {
constexpr FixedParser() {} constexpr FixedParser() {}
static constexpr std::optional<Success> Parse(ParseState &) { static constexpr std::optional<Success> Parse(ParseState &) {
if (pass) { if (pass) {
return {Success{}}; return Success{};
} }
return std::nullopt; return std::nullopt;
} }