Skip to content

Commit

Permalink
Set the clang-format standard c++17 (#3076)
Browse files Browse the repository at this point in the history
  • Loading branch information
yixinglu authored Oct 14, 2021
1 parent e6559e9 commit fb3be74
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
Expand Down
10 changes: 5 additions & 5 deletions src/common/base/EitherOr.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class EitherOr {
template <typename U,
typename V,
typename = std::enable_if_t<std::is_constructible<LEFT, U>::value &&
std::is_constructible<RIGHT, V>::value> >
std::is_constructible<RIGHT, V>::value>>
EitherOr(const EitherOr<U, V>& rhs) noexcept {
switch (rhs.state_) {
case State::VOID:
Expand All @@ -178,7 +178,7 @@ class EitherOr {
template <typename U,
typename V,
typename = std::enable_if_t<std::is_constructible<LEFT, U>::value &&
std::is_constructible<RIGHT, V>::value> >
std::is_constructible<RIGHT, V>::value>>
EitherOr(EitherOr<U, V>&& rhs) noexcept {
switch (rhs.state_) {
case State::VOID:
Expand Down Expand Up @@ -218,7 +218,7 @@ class EitherOr {
// LEFT or RIGHT, not both
template <class... Args,
typename = std::enable_if_t<std::is_constructible<LEFT, Args...>::value ||
std::is_constructible<RIGHT, Args...>::value> >
std::is_constructible<RIGHT, Args...>::value>>
EitherOr(Args&&... v) noexcept { // NOLINT
new (&val_) Variant(convert_to_t<Args...>, std::forward<Args>(v)...);
state_ = convert_to_s<Args...>;
Expand All @@ -228,7 +228,7 @@ class EitherOr {
// So we use a type tag to force selecting LEFT
template <typename U,
typename = std::enable_if_t<std::is_constructible<LEFT, U>::value &&
std::is_constructible<RIGHT, U>::value> >
std::is_constructible<RIGHT, U>::value>>
EitherOr(const LeftType*, U&& v) noexcept {
new (&val_) Variant(kConstructLeft, std::forward<U>(v));
state_ = State::LEFT_TYPE;
Expand All @@ -238,7 +238,7 @@ class EitherOr {
// So we use a type tag to force selecting RIGHT
template <typename U,
typename = std::enable_if_t<std::is_constructible<LEFT, U>::value &&
std::is_constructible<RIGHT, U>::value> >
std::is_constructible<RIGHT, U>::value>>
EitherOr(const RightType*, U&& v) noexcept {
new (&val_) Variant(kConstructRight, std::forward<U>(v));
state_ = State::RIGHT_TYPE;
Expand Down
2 changes: 1 addition & 1 deletion src/common/base/ErrorOr.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace nebula {
template <typename ErrorCode,
typename ResultType,
typename = std::enable_if_t<std::is_integral<ErrorCode>::value ||
std::is_enum<ErrorCode>::value> >
std::is_enum<ErrorCode>::value>>
using ErrorOr = EitherOr<ErrorCode, ResultType>;

/***********************************************
Expand Down
24 changes: 12 additions & 12 deletions src/common/datatypes/DataSetOps-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ uint32_t Cpp2Ops<nebula::DataSet>::write(Protocol* proto, nebula::DataSet const*

xfer += proto->writeFieldBegin("column_names", protocol::T_LIST, 1);
xfer += detail::pm::protocol_methods<type_class::list<type_class::binary>,
std::vector<std::string> >::write(*proto, obj->colNames);
std::vector<std::string>>::write(*proto, obj->colNames);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldBegin("rows", apache::thrift::protocol::T_LIST, 2);
xfer += detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Row> >::write(*proto, obj->rows);
std::vector<nebula::Row>>::write(*proto, obj->rows);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand All @@ -81,7 +81,7 @@ void Cpp2Ops<nebula::DataSet>::read(Protocol* proto, nebula::DataSet* obj) {
_readField_column_names : {
obj->colNames = std::vector<std::string>();
detail::pm::protocol_methods<type_class::list<type_class::binary>,
std::vector<std::string> >::read(*proto, obj->colNames);
std::vector<std::string>>::read(*proto, obj->colNames);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 1, 2, protocol::T_LIST))) {
Expand All @@ -91,7 +91,7 @@ _readField_column_names : {
_readField_rows : {
obj->rows = std::vector<nebula::Row>();
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Row> >::read(*proto, obj->rows);
std::vector<nebula::Row>>::read(*proto, obj->rows);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -147,13 +147,13 @@ uint32_t Cpp2Ops<nebula::DataSet>::serializedSize(Protocol const* proto,
xfer += proto->serializedFieldSize("column_names", protocol::T_LIST, 1);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::binary>,
std::vector<std::string> >::serializedSize<false>(*proto,
obj->colNames);
std::vector<std::string>>::serializedSize<false>(*proto,
obj->colNames);

xfer += proto->serializedFieldSize("rows", apache::thrift::protocol::T_LIST, 2);
xfer += detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Row> >::serializedSize<false>(*proto,
obj->rows);
std::vector<nebula::Row>>::serializedSize<false>(*proto,
obj->rows);

xfer += proto->serializedSizeStop();
return xfer;
Expand All @@ -168,13 +168,13 @@ uint32_t Cpp2Ops<nebula::DataSet>::serializedSizeZC(Protocol const* proto,
xfer += proto->serializedFieldSize("column_names", protocol::T_LIST, 1);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::binary>,
std::vector<std::string> >::serializedSize<false>(*proto,
obj->colNames);
std::vector<std::string>>::serializedSize<false>(*proto,
obj->colNames);

xfer += proto->serializedFieldSize("rows", protocol::T_LIST, 2);
xfer += detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Row> >::serializedSize<false>(*proto,
obj->rows);
std::vector<nebula::Row>>::serializedSize<false>(*proto,
obj->rows);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down
10 changes: 5 additions & 5 deletions src/common/datatypes/EdgeOps-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uint32_t Cpp2Ops<nebula::Edge>::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<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::write(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::write(*proto, obj->props);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand Down Expand Up @@ -145,8 +145,8 @@ _readField_ranking : {
_readField_props : {
obj->props = std::unordered_map<std::string, nebula::Value>();
detail::pm::protocol_methods<type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::read(*proto,
obj->props);
std::unordered_map<std::string, nebula::Value>>::read(*proto,
obj->props);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 6, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -248,7 +248,7 @@ uint32_t Cpp2Ops<nebula::Edge>::serializedSize(Protocol const* proto, nebula::Ed
xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 6);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->props);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down Expand Up @@ -281,7 +281,7 @@ uint32_t Cpp2Ops<nebula::Edge>::serializedSizeZC(Protocol const* proto, nebula::
xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 6);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->props);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down
12 changes: 6 additions & 6 deletions src/common/datatypes/ListOps-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint32_t Cpp2Ops<nebula::List>::write(Protocol* proto, nebula::List const* obj)

xfer += proto->writeFieldBegin("values", apache::thrift::protocol::T_LIST, 1);
xfer += detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Value> >::write(*proto, obj->values);
std::vector<nebula::Value>>::write(*proto, obj->values);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand All @@ -68,7 +68,7 @@ void Cpp2Ops<nebula::List>::read(Protocol* proto, nebula::List* obj) {
_readField_values : {
obj->values = std::vector<nebula::Value>();
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Value> >::read(*proto, obj->values);
std::vector<nebula::Value>>::read(*proto, obj->values);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 1, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -116,8 +116,8 @@ uint32_t Cpp2Ops<nebula::List>::serializedSize(Protocol const* proto, nebula::Li
xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_LIST, 1);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Value> >::serializedSize<false>(*proto,
obj->values);
std::vector<nebula::Value>>::serializedSize<false>(*proto,
obj->values);
xfer += proto->serializedSizeStop();
return xfer;
}
Expand All @@ -130,8 +130,8 @@ uint32_t Cpp2Ops<nebula::List>::serializedSizeZC(Protocol const* proto, nebula::
xfer += proto->serializedFieldSize("values", apache::thrift::protocol::T_LIST, 1);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Value> >::serializedSize<false>(*proto,
obj->values);
std::vector<nebula::Value>>::serializedSize<false>(*proto,
obj->values);
xfer += proto->serializedSizeStop();
return xfer;
}
Expand Down
15 changes: 8 additions & 7 deletions src/common/datatypes/MapOps-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ uint32_t Cpp2Ops<nebula::Map>::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<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::write(*proto, obj->kvs);
xfer +=
detail::pm::protocol_methods<type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value>>::write(*proto,
obj->kvs);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand All @@ -69,8 +70,8 @@ void Cpp2Ops<nebula::Map>::read(Protocol* proto, nebula::Map* obj) {
_readField_kvs : {
obj->kvs = std::unordered_map<std::string, nebula::Value>();
detail::pm::protocol_methods<type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::read(*proto,
obj->kvs);
std::unordered_map<std::string, nebula::Value>>::read(*proto,
obj->kvs);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 1, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -118,7 +119,7 @@ uint32_t Cpp2Ops<nebula::Map>::serializedSize(Protocol const* proto, nebula::Map
xfer += proto->serializedFieldSize("kvs", apache::thrift::protocol::T_MAP, 1);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->kvs);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->kvs);
xfer += proto->serializedSizeStop();
return xfer;
}
Expand All @@ -131,7 +132,7 @@ uint32_t Cpp2Ops<nebula::Map>::serializedSizeZC(Protocol const* proto, nebula::M
xfer += proto->serializedFieldSize("kvs", apache::thrift::protocol::T_MAP, 1);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->kvs);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->kvs);
xfer += proto->serializedSizeStop();
return xfer;
}
Expand Down
22 changes: 11 additions & 11 deletions src/common/datatypes/PathOps-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ uint32_t Cpp2Ops<nebula::Step>::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<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::write(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::write(*proto, obj->props);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand Down Expand Up @@ -138,8 +138,8 @@ _readField_ranking : {
_readField_props : {
obj->props = std::unordered_map<std::string, nebula::Value>();
detail::pm::protocol_methods<type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::read(*proto,
obj->props);
std::unordered_map<std::string, nebula::Value>>::read(*proto,
obj->props);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 5, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -231,7 +231,7 @@ uint32_t Cpp2Ops<nebula::Step>::serializedSize(Protocol const* proto, nebula::St
xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 5);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->props);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down Expand Up @@ -261,7 +261,7 @@ uint32_t Cpp2Ops<nebula::Step>::serializedSizeZC(Protocol const* proto, nebula::
xfer += proto->serializedFieldSize("props", apache::thrift::protocol::T_MAP, 5);
xfer += detail::pm::protocol_methods<
type_class::map<type_class::binary, type_class::structure>,
std::unordered_map<std::string, nebula::Value> >::serializedSize<false>(*proto, obj->props);
std::unordered_map<std::string, nebula::Value>>::serializedSize<false>(*proto, obj->props);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down Expand Up @@ -306,7 +306,7 @@ uint32_t Cpp2Ops<nebula::Path>::write(Protocol* proto, nebula::Path const* obj)

xfer += proto->writeFieldBegin("steps", apache::thrift::protocol::T_LIST, 2);
xfer += detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Step> >::write(*proto, obj->steps);
std::vector<nebula::Step>>::write(*proto, obj->steps);
xfer += proto->writeFieldEnd();

xfer += proto->writeFieldStop();
Expand Down Expand Up @@ -335,7 +335,7 @@ _readField_src : { Cpp2Ops<nebula::Vertex>::read(proto, &obj->src); }
_readField_steps : {
obj->steps = std::vector<nebula::Step>();
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Step> >::read(*proto, obj->steps);
std::vector<nebula::Step>>::read(*proto, obj->steps);
}

if (UNLIKELY(!readState.advanceToNextField(proto, 2, 0, protocol::T_STOP))) {
Expand Down Expand Up @@ -393,8 +393,8 @@ uint32_t Cpp2Ops<nebula::Path>::serializedSize(Protocol const* proto, nebula::Pa
xfer += proto->serializedFieldSize("steps", apache::thrift::protocol::T_LIST, 2);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Step> >::serializedSize<false>(*proto,
obj->steps);
std::vector<nebula::Step>>::serializedSize<false>(*proto,
obj->steps);

xfer += proto->serializedSizeStop();
return xfer;
Expand All @@ -411,8 +411,8 @@ uint32_t Cpp2Ops<nebula::Path>::serializedSizeZC(Protocol const* proto, nebula::
xfer += proto->serializedFieldSize("steps", apache::thrift::protocol::T_LIST, 2);
xfer +=
detail::pm::protocol_methods<type_class::list<type_class::structure>,
std::vector<nebula::Step> >::serializedSize<false>(*proto,
obj->steps);
std::vector<nebula::Step>>::serializedSize<false>(*proto,
obj->steps);

xfer += proto->serializedSizeStop();
return xfer;
Expand Down
Loading

0 comments on commit fb3be74

Please sign in to comment.