Fix/suppress system/security google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters
Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I4ed5aea36fcdcd8dbda9a4be9607c5af606f2a08
diff --git a/keystore/keystore_attestation_id.h b/keystore/keystore_attestation_id.h
index f45d5be..63015ee 100644
--- a/keystore/keystore_attestation_id.h
+++ b/keystore/keystore_attestation_id.h
@@ -33,12 +33,18 @@
template <typename T> class StatusOr {
public:
+ // NOLINTNEXTLINE(google-explicit-constructor)
StatusOr(const status_t error) : _status(error), _value() {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
StatusOr(const T& value) : _status(NO_ERROR), _value(value) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
StatusOr(T&& value) : _status(NO_ERROR), _value(value) {}
+ // NOLINTNEXTLINE(google-explicit-constructor)
operator const T&() const { return _value; }
+ // NOLINTNEXTLINE(google-explicit-constructor)
operator T&() { return _value; }
+ // NOLINTNEXTLINE(google-explicit-constructor)
operator T &&() && { return std::move(_value); }
bool isOk() const { return NO_ERROR == _status; }