From fb3be742dca8b798dea602a7475be39a1128dc9b Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Thu, 14 Oct 2021 23:26:42 +0800 Subject: [PATCH] Set the clang-format standard c++17 (#3076) --- .clang-format | 2 +- src/common/base/EitherOr.h | 10 +++++----- src/common/base/ErrorOr.h | 2 +- src/common/datatypes/DataSetOps-inl.h | 24 ++++++++++++------------ src/common/datatypes/EdgeOps-inl.h | 10 +++++----- src/common/datatypes/ListOps-inl.h | 12 ++++++------ src/common/datatypes/MapOps-inl.h | 15 ++++++++------- src/common/datatypes/PathOps-inl.h | 22 +++++++++++----------- src/common/datatypes/SetOps-inl.h | 8 ++++---- src/common/datatypes/VertexOps-inl.h | 22 +++++++++++----------- src/common/thrift/ThriftClientManager.h | 2 +- 11 files changed, 65 insertions(+), 64 deletions(-) diff --git a/.clang-format b/.clang-format index 04bec9bceec..bcf5df71785 100644 --- a/.clang-format +++ b/.clang-format @@ -166,7 +166,7 @@ SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false SpaceBeforeSquareBrackets: false -Standard: Auto +Standard: c++17 StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION diff --git a/src/common/base/EitherOr.h b/src/common/base/EitherOr.h index 595f35b24f8..620ed93035c 100644 --- a/src/common/base/EitherOr.h +++ b/src/common/base/EitherOr.h @@ -159,7 +159,7 @@ class EitherOr { template ::value && - std::is_constructible::value> > + std::is_constructible::value>> EitherOr(const EitherOr& rhs) noexcept { switch (rhs.state_) { case State::VOID: @@ -178,7 +178,7 @@ class EitherOr { template ::value && - std::is_constructible::value> > + std::is_constructible::value>> EitherOr(EitherOr&& rhs) noexcept { switch (rhs.state_) { case State::VOID: @@ -218,7 +218,7 @@ class EitherOr { // LEFT or RIGHT, not both template ::value || - std::is_constructible::value> > + std::is_constructible::value>> EitherOr(Args&&... v) noexcept { // NOLINT new (&val_) Variant(convert_to_t, std::forward(v)...); state_ = convert_to_s; @@ -228,7 +228,7 @@ class EitherOr { // So we use a type tag to force selecting LEFT template ::value && - std::is_constructible::value> > + std::is_constructible::value>> EitherOr(const LeftType*, U&& v) noexcept { new (&val_) Variant(kConstructLeft, std::forward(v)); state_ = State::LEFT_TYPE; @@ -238,7 +238,7 @@ class EitherOr { // So we use a type tag to force selecting RIGHT template ::value && - std::is_constructible::value> > + std::is_constructible::value>> EitherOr(const RightType*, U&& v) noexcept { new (&val_) Variant(kConstructRight, std::forward(v)); state_ = State::RIGHT_TYPE; diff --git a/src/common/base/ErrorOr.h b/src/common/base/ErrorOr.h index 40fe16d76bf..c8c2030404c 100644 --- a/src/common/base/ErrorOr.h +++ b/src/common/base/ErrorOr.h @@ -30,7 +30,7 @@ namespace nebula { template ::value || - std::is_enum::value> > + std::is_enum::value>> using ErrorOr = EitherOr; /*********************************************** diff --git a/src/common/datatypes/DataSetOps-inl.h b/src/common/datatypes/DataSetOps-inl.h index e1871426c17..a0757d0b6c1 100644 --- a/src/common/datatypes/DataSetOps-inl.h +++ b/src/common/datatypes/DataSetOps-inl.h @@ -53,12 +53,12 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::DataSet const* xfer += proto->writeFieldBegin("column_names", protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::write(*proto, obj->colNames); + std::vector>::write(*proto, obj->colNames); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldBegin("rows", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::write(*proto, obj->rows); + std::vector>::write(*proto, obj->rows); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -81,7 +81,7 @@ void Cpp2Ops::read(Protocol* proto, nebula::DataSet* obj) { _readField_column_names : { obj->colNames = std::vector(); detail::pm::protocol_methods, - std::vector >::read(*proto, obj->colNames); + std::vector>::read(*proto, obj->colNames); } if (UNLIKELY(!readState.advanceToNextField(proto, 1, 2, protocol::T_LIST))) { @@ -91,7 +91,7 @@ _readField_column_names : { _readField_rows : { obj->rows = std::vector(); detail::pm::protocol_methods, - std::vector >::read(*proto, obj->rows); + std::vector>::read(*proto, obj->rows); } if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) { @@ -147,13 +147,13 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, xfer += proto->serializedFieldSize("column_names", protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->colNames); + std::vector>::serializedSize(*proto, + obj->colNames); xfer += proto->serializedFieldSize("rows", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->rows); + std::vector>::serializedSize(*proto, + obj->rows); xfer += proto->serializedSizeStop(); return xfer; @@ -168,13 +168,13 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, xfer += proto->serializedFieldSize("column_names", protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->colNames); + std::vector>::serializedSize(*proto, + obj->colNames); xfer += proto->serializedFieldSize("rows", protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->rows); + std::vector>::serializedSize(*proto, + obj->rows); xfer += proto->serializedSizeStop(); return xfer; diff --git a/src/common/datatypes/EdgeOps-inl.h b/src/common/datatypes/EdgeOps-inl.h index b236d5a62b8..93b74cd1e28 100644 --- a/src/common/datatypes/EdgeOps-inl.h +++ b/src/common/datatypes/EdgeOps-inl.h @@ -88,7 +88,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Edge const* obj) xfer += proto->writeFieldBegin("props", apache::thrift::protocol::T_MAP, 6); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::write(*proto, obj->props); + std::unordered_map>::write(*proto, obj->props); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -145,8 +145,8 @@ _readField_ranking : { _readField_props : { obj->props = std::unordered_map(); detail::pm::protocol_methods, - std::unordered_map >::read(*proto, - obj->props); + std::unordered_map>::read(*proto, + obj->props); } if (UNLIKELY(!readState.advanceToNextField(proto, 6, 0, protocol::T_STOP))) { @@ -248,7 +248,7 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Ed xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 6); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; @@ -281,7 +281,7 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula:: xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 6); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; diff --git a/src/common/datatypes/ListOps-inl.h b/src/common/datatypes/ListOps-inl.h index ec05620c710..c1b80589718 100644 --- a/src/common/datatypes/ListOps-inl.h +++ b/src/common/datatypes/ListOps-inl.h @@ -45,7 +45,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::List const* obj) xfer += proto->writeFieldBegin("values", apache::thrift::protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::write(*proto, obj->values); + std::vector>::write(*proto, obj->values); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -68,7 +68,7 @@ void Cpp2Ops::read(Protocol* proto, nebula::List* obj) { _readField_values : { obj->values = std::vector(); detail::pm::protocol_methods, - std::vector >::read(*proto, obj->values); + std::vector>::read(*proto, obj->values); } if (UNLIKELY(!readState.advanceToNextField(proto, 1, 0, protocol::T_STOP))) { @@ -116,8 +116,8 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Li xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->values); + std::vector>::serializedSize(*proto, + obj->values); xfer += proto->serializedSizeStop(); return xfer; } @@ -130,8 +130,8 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula:: xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_LIST, 1); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->values); + std::vector>::serializedSize(*proto, + obj->values); xfer += proto->serializedSizeStop(); return xfer; } diff --git a/src/common/datatypes/MapOps-inl.h b/src/common/datatypes/MapOps-inl.h index aa79503063c..332127e1a81 100644 --- a/src/common/datatypes/MapOps-inl.h +++ b/src/common/datatypes/MapOps-inl.h @@ -44,9 +44,10 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Map const* obj) { xfer += proto->writeStructBegin("NMap"); xfer += proto->writeFieldBegin("kvs", apache::thrift::protocol::T_MAP, 1); - xfer += detail::pm::protocol_methods< - type_class::map, - std::unordered_map >::write(*proto, obj->kvs); + xfer += + detail::pm::protocol_methods, + std::unordered_map>::write(*proto, + obj->kvs); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -69,8 +70,8 @@ void Cpp2Ops::read(Protocol* proto, nebula::Map* obj) { _readField_kvs : { obj->kvs = std::unordered_map(); detail::pm::protocol_methods, - std::unordered_map >::read(*proto, - obj->kvs); + std::unordered_map>::read(*proto, + obj->kvs); } if (UNLIKELY(!readState.advanceToNextField(proto, 1, 0, protocol::T_STOP))) { @@ -118,7 +119,7 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Map xfer += proto->serializedFieldSize("kvs", apache::thrift::protocol::T_MAP, 1); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->kvs); + std::unordered_map>::serializedSize(*proto, obj->kvs); xfer += proto->serializedSizeStop(); return xfer; } @@ -131,7 +132,7 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula::M xfer += proto->serializedFieldSize("kvs", apache::thrift::protocol::T_MAP, 1); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->kvs); + std::unordered_map>::serializedSize(*proto, obj->kvs); xfer += proto->serializedSizeStop(); return xfer; } diff --git a/src/common/datatypes/PathOps-inl.h b/src/common/datatypes/PathOps-inl.h index 8e9f7bed7e0..677d32b822d 100644 --- a/src/common/datatypes/PathOps-inl.h +++ b/src/common/datatypes/PathOps-inl.h @@ -86,7 +86,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Step const* obj) xfer += proto->writeFieldBegin("props", apache::thrift::protocol::T_MAP, 5); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::write(*proto, obj->props); + std::unordered_map>::write(*proto, obj->props); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -138,8 +138,8 @@ _readField_ranking : { _readField_props : { obj->props = std::unordered_map(); detail::pm::protocol_methods, - std::unordered_map >::read(*proto, - obj->props); + std::unordered_map>::read(*proto, + obj->props); } if (UNLIKELY(!readState.advanceToNextField(proto, 5, 0, protocol::T_STOP))) { @@ -231,7 +231,7 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::St xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 5); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; @@ -261,7 +261,7 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula:: xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 5); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; @@ -306,7 +306,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Path const* obj) xfer += proto->writeFieldBegin("steps", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::write(*proto, obj->steps); + std::vector>::write(*proto, obj->steps); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -335,7 +335,7 @@ _readField_src : { Cpp2Ops::read(proto, &obj->src); } _readField_steps : { obj->steps = std::vector(); detail::pm::protocol_methods, - std::vector >::read(*proto, obj->steps); + std::vector>::read(*proto, obj->steps); } if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) { @@ -393,8 +393,8 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Pa xfer += proto->serializedFieldSize("steps", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->steps); + std::vector>::serializedSize(*proto, + obj->steps); xfer += proto->serializedSizeStop(); return xfer; @@ -411,8 +411,8 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula:: xfer += proto->serializedFieldSize("steps", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->steps); + std::vector>::serializedSize(*proto, + obj->steps); xfer += proto->serializedSizeStop(); return xfer; diff --git a/src/common/datatypes/SetOps-inl.h b/src/common/datatypes/SetOps-inl.h index 5fd138c5830..69fdc694bfe 100644 --- a/src/common/datatypes/SetOps-inl.h +++ b/src/common/datatypes/SetOps-inl.h @@ -46,7 +46,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Set const* obj) { xfer += proto->writeFieldBegin("values", apache::thrift::protocol::T_SET, 1); xfer += detail::pm::protocol_methods, - std::unordered_set >::write(*proto, obj->values); + std::unordered_set>::write(*proto, obj->values); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -69,7 +69,7 @@ void Cpp2Ops::read(Protocol* proto, nebula::Set* obj) { _readField_values : { obj->values = std::unordered_set(); detail::pm::protocol_methods, - std::unordered_set >::read(*proto, obj->values); + std::unordered_set>::read(*proto, obj->values); } if (UNLIKELY(!readState.advanceToNextField(proto, 1, 0, protocol::T_STOP))) { @@ -116,7 +116,7 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Set xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_SET, 1); xfer += detail::pm::protocol_methods< type_class::set, - std::unordered_set >::serializedSize(*proto, obj->values); + std::unordered_set>::serializedSize(*proto, obj->values); xfer += proto->serializedSizeStop(); return xfer; } @@ -128,7 +128,7 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula::S xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_SET, 1); xfer += detail::pm::protocol_methods< type_class::set, - std::unordered_set >::serializedSize(*proto, obj->values); + std::unordered_set>::serializedSize(*proto, obj->values); xfer += proto->serializedSizeStop(); return xfer; } diff --git a/src/common/datatypes/VertexOps-inl.h b/src/common/datatypes/VertexOps-inl.h index e2a6eed3fd0..79599f50c2d 100644 --- a/src/common/datatypes/VertexOps-inl.h +++ b/src/common/datatypes/VertexOps-inl.h @@ -58,7 +58,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Tag const* obj) { xfer += proto->writeFieldBegin("props", apache::thrift::protocol::T_MAP, 2); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::write(*proto, obj->props); + std::unordered_map>::write(*proto, obj->props); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); @@ -87,8 +87,8 @@ _readField_name : { proto->readBinary(obj->name); } _readField_props : { obj->props = std::unordered_map(); detail::pm::protocol_methods, - std::unordered_map >::read(*proto, - obj->props); + std::unordered_map>::read(*proto, + obj->props); } if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) { @@ -146,7 +146,7 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula::Tag xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 2); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; @@ -163,7 +163,7 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, nebula::T xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 2); xfer += detail::pm::protocol_methods< type_class::map, - std::unordered_map >::serializedSize(*proto, obj->props); + std::unordered_map>::serializedSize(*proto, obj->props); xfer += proto->serializedSizeStop(); return xfer; @@ -206,7 +206,7 @@ uint32_t Cpp2Ops::write(Protocol* proto, nebula::Vertex const* o xfer += proto->writeFieldEnd(); xfer += proto->writeFieldBegin("tags", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::write(*proto, obj->tags); + std::vector>::write(*proto, obj->tags); xfer += proto->writeFieldEnd(); xfer += proto->writeFieldStop(); xfer += proto->writeStructEnd(); @@ -234,7 +234,7 @@ _readField_vid : { ::apache::thrift::Cpp2Ops::read(proto, &obj->v _readField_tags : { obj->tags = std::vector(); detail::pm::protocol_methods, - std::vector >::read(*proto, obj->tags); + std::vector>::read(*proto, obj->tags); } if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) { @@ -289,8 +289,8 @@ uint32_t Cpp2Ops::serializedSize(Protocol const* proto, nebula:: xfer += ::apache::thrift::Cpp2Ops::serializedSize(proto, &obj->vid); xfer += proto->serializedFieldSize("tags", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->tags); + std::vector>::serializedSize(*proto, + obj->tags); xfer += proto->serializedSizeStop(); return xfer; } @@ -304,8 +304,8 @@ uint32_t Cpp2Ops::serializedSizeZC(Protocol const* proto, xfer += ::apache::thrift::Cpp2Ops::serializedSizeZC(proto, &obj->vid); xfer += proto->serializedFieldSize("tags", apache::thrift::protocol::T_LIST, 2); xfer += detail::pm::protocol_methods, - std::vector >::serializedSize(*proto, - obj->tags); + std::vector>::serializedSize(*proto, + obj->tags); xfer += proto->serializedSizeStop(); return xfer; } diff --git a/src/common/thrift/ThriftClientManager.h b/src/common/thrift/ThriftClientManager.h index 8c70b0352ce..04800dab4bd 100644 --- a/src/common/thrift/ThriftClientManager.h +++ b/src/common/thrift/ThriftClientManager.h @@ -32,7 +32,7 @@ class ThriftClientManager final { private: using ClientMap = - std::unordered_map, std::shared_ptr >; + std::unordered_map, std::shared_ptr>; folly::ThreadLocal clientMap_; // whether enable ssl