From: peter klausler Date: Tue, 7 May 2019 19:24:59 +0000 (-0700) Subject: [flang] Remove needless braces X-Git-Tag: llvmorg-12-init~9537^2~1134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7269dc8a82dfb54d5de057a60f630b80c45316ca;p=platform%2Fupstream%2Fllvm.git [flang] Remove needless braces Original-commit: flang-compiler/f18@edd18355be574122aaa9abf58c15d8c50fb085a1 Reviewed-on: https://github.com/flang-compiler/f18/pull/490 Tree-same-pre-rewrite: false --- diff --git a/flang/lib/parser/basic-parsers.h b/flang/lib/parser/basic-parsers.h index 74f7d611..ce44388 100644 --- a/flang/lib/parser/basic-parsers.h +++ b/flang/lib/parser/basic-parsers.h @@ -76,7 +76,7 @@ public: using resultType = A; constexpr PureParser(const PureParser &) = default; constexpr explicit PureParser(A &&x) : value_(std::move(x)) {} - std::optional Parse(ParseState &) const { return {value_}; } + std::optional Parse(ParseState &) const { return value_; } private: const A value_; @@ -126,8 +126,9 @@ public: forked.set_deferMessages(true); if (parser_.Parse(forked)) { return std::nullopt; + } else { + return Success{}; } - return {Success{}}; } private: @@ -149,7 +150,7 @@ public: ParseState forked{state}; forked.set_deferMessages(true); if (parser_.Parse(forked).has_value()) { - return {Success{}}; + return Success{}; } return std::nullopt; } @@ -415,7 +416,7 @@ public: } at = state.GetLocation(); } - return {std::move(result)}; + return result; } private: @@ -445,7 +446,7 @@ public: if (state.GetLocation() > start) { result.splice(result.end(), many(parser_).Parse(state).value()); } - return {std::move(result)}; + return result; } return std::nullopt; } @@ -469,7 +470,7 @@ public: parser_.Parse(state) && state.GetLocation() > at; at = state.GetLocation()) { } - return {Success{}}; + return Success{}; } private: @@ -491,7 +492,7 @@ public: std::optional Parse(ParseState &state) const { while (parser_.Parse(state)) { } - return {Success{}}; + return Success{}; } private: @@ -513,9 +514,9 @@ public: constexpr MaybeParser(PA parser) : parser_{parser} {} std::optional Parse(ParseState &state) const { if (resultType result{parser_.Parse(state)}) { - return {std::move(result)}; + return result; } - return {resultType{}}; + return resultType{}; } private: @@ -539,7 +540,7 @@ public: if (ax.value().has_value()) { // maybe() always succeeds return std::move(*ax); } - return {resultType{}}; + return resultType{}; } private: @@ -610,8 +611,8 @@ public: ApplyArgs results; using Sequence = std::index_sequence_for; if (ApplyHelperArgs(parsers_, results, state, Sequence{})) { - return {ApplyHelperFunction( - function_, std::move(results), Sequence{})}; + return ApplyHelperFunction( + function_, std::move(results), Sequence{}); } else { return std::nullopt; } @@ -669,8 +670,8 @@ public: using Sequence1 = std::index_sequence_for; using Sequence2 = std::index_sequence_for; if (ApplyHelperArgs(parsers_, results, state, Sequence1{})) { - return {ApplyHelperMember( - function_, std::move(results), Sequence2{})}; + return ApplyHelperMember( + function_, std::move(results), Sequence2{}); } else { return std::nullopt; } @@ -795,7 +796,7 @@ template struct FixedParser { constexpr FixedParser() {} static constexpr std::optional Parse(ParseState &) { if (pass) { - return {Success{}}; + return Success{}; } return std::nullopt; }