From 6887637749041e6d234f1afd6ebff2f225188ae8 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 13 Nov 2023 15:28:29 -0800 Subject: [PATCH 1/5] Make `fml/status_or.h` compatible with `.clang_tidy`. --- fml/status_or.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fml/status_or.h b/fml/status_or.h index 080b836c05723..b3dfa5a13aa57 100644 --- a/fml/status_or.h +++ b/fml/status_or.h @@ -31,8 +31,8 @@ namespace fml { template class StatusOr { public: - StatusOr(const T& value) : status_(), value_(value) {} - StatusOr(const Status& status) : status_(status), value_() {} + explicit StatusOr(const T& value) : status_(), value_(value) {} + explicit StatusOr(const Status& status) : status_(status), value_() {} StatusOr(const StatusOr&) = default; StatusOr(StatusOr&&) = default; @@ -63,13 +63,17 @@ class StatusOr { bool ok() const { return status_.ok(); } const T& value() const { - FML_CHECK(status_.ok()); - return value_.value(); + if (status_.ok()) { + return value_.value(); + } + FML_LOG(FATAL) << "StatusOr::value() called on error Status"; } T& value() { - FML_CHECK(status_.ok()); - return value_.value(); + if (status_.ok()) { + return value_.value(); + } + FML_LOG(FATAL) << "StatusOr::value() called on error Status"; } private: From eb7c6ed99ede3eaa617e81f8ac820e55427a282f Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 15 Nov 2023 12:56:12 -0800 Subject: [PATCH 2/5] ++ --- fml/status_or.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fml/status_or.h b/fml/status_or.h index b3dfa5a13aa57..be4cb56b4b27b 100644 --- a/fml/status_or.h +++ b/fml/status_or.h @@ -31,8 +31,13 @@ namespace fml { template class StatusOr { public: - explicit StatusOr(const T& value) : status_(), value_(value) {} - explicit StatusOr(const Status& status) : status_(status), value_() {} + // These constructors are intended be compatible with absl::status_or. + // NOLINTBEGIN(google-explicit-constructor) + + StatusOr(const T& value) : status_(), value_(value) {} + StatusOr(const Status& status) : status_(status), value_() {} + + // NOLINTEND(google-explicit-constructor) StatusOr(const StatusOr&) = default; StatusOr(StatusOr&&) = default; From cd4ba21110e0eac92d56974fdd409b32758b8bd8 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 15 Nov 2023 13:04:53 -0800 Subject: [PATCH 3/5] ++ --- fml/status_or.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fml/status_or.h b/fml/status_or.h index be4cb56b4b27b..8b892d3563452 100644 --- a/fml/status_or.h +++ b/fml/status_or.h @@ -32,12 +32,12 @@ template class StatusOr { public: // These constructors are intended be compatible with absl::status_or. - // NOLINTBEGIN(google-explicit-constructor) - + // NOLINTNEXTLINE(google-explicit-constructor) StatusOr(const T& value) : status_(), value_(value) {} - StatusOr(const Status& status) : status_(status), value_() {} - // NOLINTEND(google-explicit-constructor) + // These constructors are intended be compatible with absl::status_or. + // NOLINTNEXTLINE(google-explicit-constructor) + StatusOr(const Status& status) : status_(status), value_() {} StatusOr(const StatusOr&) = default; StatusOr(StatusOr&&) = default; From 4435f9cc335723af15d5631f9dc6a06d2beba5cf Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 15 Nov 2023 13:49:43 -0800 Subject: [PATCH 4/5] ++ --- fml/status_or.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fml/status_or.h b/fml/status_or.h index 8b892d3563452..6e53280118c8c 100644 --- a/fml/status_or.h +++ b/fml/status_or.h @@ -9,6 +9,7 @@ #include "flutter/fml/logging.h" #include "flutter/fml/status.h" +#include "platform/assert.h" namespace fml { @@ -72,6 +73,7 @@ class StatusOr { return value_.value(); } FML_LOG(FATAL) << "StatusOr::value() called on error Status"; + FML_UNREACHABLE(); } T& value() { @@ -79,6 +81,7 @@ class StatusOr { return value_.value(); } FML_LOG(FATAL) << "StatusOr::value() called on error Status"; + FML_UNREACHABLE(); } private: From c1233da834e22322665bf44efe3d0c7dee7f0243 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 15 Nov 2023 15:08:53 -0800 Subject: [PATCH 5/5] ++ --- fml/status_or.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fml/status_or.h b/fml/status_or.h index 6e53280118c8c..537878fff6f3b 100644 --- a/fml/status_or.h +++ b/fml/status_or.h @@ -9,7 +9,6 @@ #include "flutter/fml/logging.h" #include "flutter/fml/status.h" -#include "platform/assert.h" namespace fml {