This is an automated email from the ASF dual-hosted git repository.
panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 82da071b45 [Chore](format) update clang-format version to 15 (#13036)
82da071b45 is described below
commit 82da071b457a0a8481fe0dea17431c355b70d9d5
Author: Pxl <[email protected]>
AuthorDate: Tue Nov 29 14:46:10 2022 +0800
[Chore](format) update clang-format version to 15 (#13036)
update clang-format version to 15
---
.github/workflows/clang-format.yml | 2 +-
be/src/http/http_request.h | 4 +--
be/src/olap/page_cache.cpp | 2 +-
be/src/olap/utils.h | 2 +-
be/src/util/binary_cast.hpp | 2 +-
be/src/vec/core/accurate_comparison.h | 29 +++++++++++-----------
.../community/developer-guide/cpp-format-code.md | 12 ++++-----
.../community/developer-guide/cpp-format-code.md | 14 +++++------
8 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/.github/workflows/clang-format.yml
b/.github/workflows/clang-format.yml
index 9884cf0789..df4a75af2e 100644
--- a/.github/workflows/clang-format.yml
+++ b/.github/workflows/clang-format.yml
@@ -48,7 +48,7 @@ jobs:
id: be_clang_format
with:
source: 'be/src be/test'
- clangFormatVersion: 13
+ clangFormatVersion: 15
inplace: False
- name: Ignore it!
diff --git a/be/src/http/http_request.h b/be/src/http/http_request.h
index 81085f7cce..1503e4303a 100644
--- a/be/src/http/http_request.h
+++ b/be/src/http/http_request.h
@@ -72,9 +72,7 @@ public:
void set_handler(HttpHandler* handler) { _handler = handler; }
HttpHandler* handler() const { return _handler; }
- struct evhttp_request* get_evhttp_request() const {
- return _ev_req;
- }
+ struct evhttp_request* get_evhttp_request() const { return _ev_req; }
void* handler_ctx() const { return _handler_ctx; }
void set_handler_ctx(void* ctx) {
diff --git a/be/src/olap/page_cache.cpp b/be/src/olap/page_cache.cpp
index d4d1fce972..fa9f9010be 100644
--- a/be/src/olap/page_cache.cpp
+++ b/be/src/olap/page_cache.cpp
@@ -64,7 +64,7 @@ bool StoragePageCache::lookup(const CacheKey& key,
PageCacheHandle* handle,
void StoragePageCache::insert(const CacheKey& key, const Slice& data,
PageCacheHandle* handle,
segment_v2::PageTypePB page_type, bool
in_memory) {
- auto deleter = [](const doris::CacheKey& key, void* value) {
delete[](uint8_t*) value; };
+ auto deleter = [](const doris::CacheKey& key, void* value) { delete[]
(uint8_t*)value; };
CachePriority priority = CachePriority::NORMAL;
if (in_memory) {
diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h
index 36a3677616..e6f9c7a5db 100644
--- a/be/src/olap/utils.h
+++ b/be/src/olap/utils.h
@@ -110,7 +110,7 @@ void _destruct_object(const void* obj, void*) {
template <typename T>
void _destruct_array(const void* array, void*) {
- delete[]((const T*)array);
+ delete[] ((const T*)array);
}
// 根据压缩类型的不同,执行压缩。dest_buf_len是dest_buf的最大长度,
diff --git a/be/src/util/binary_cast.hpp b/be/src/util/binary_cast.hpp
index 5da841a45e..17754a15e9 100644
--- a/be/src/util/binary_cast.hpp
+++ b/be/src/util/binary_cast.hpp
@@ -37,7 +37,7 @@ union TypeConverter {
};
template <typename C0, typename C1, typename T0, typename T1>
-inline constexpr bool match_v = std::is_same_v<C0, C1>&& std::is_same_v<T0,
T1>;
+inline constexpr bool match_v = std::is_same_v<C0, C1> && std::is_same_v<T0,
T1>;
union DecimalInt128Union {
DecimalV2Value decimal;
diff --git a/be/src/vec/core/accurate_comparison.h
b/be/src/vec/core/accurate_comparison.h
index 3f13772041..e52cc4ef65 100644
--- a/be/src/vec/core/accurate_comparison.h
+++ b/be/src/vec/core/accurate_comparison.h
@@ -54,15 +54,14 @@ namespace accurate {
// Case 1. Is pair of floats or pair of ints or pair of uints
template <typename A, typename B>
-constexpr bool is_safe_conversion = (std::is_floating_point_v<A> &&
std::is_floating_point_v<B>) ||
- (std::is_integral_v<A> &&
std::is_integral_v<B> &&
- !(std::is_signed_v<A> ^
std::is_signed_v<B>)) ||
- (std::is_same_v<A,
doris::vectorized::Int128> &&
- std::is_same_v<B,
doris::vectorized::Int128>) ||
- (std::is_integral_v<A> &&
- std::is_same_v<B,
doris::vectorized::Int128>) ||
- (std::is_same_v<A,
doris::vectorized::Int128> &&
- std::is_integral_v<B>);
+constexpr bool is_safe_conversion =
+ (std::is_floating_point_v<A> && std::is_floating_point_v<B>) ||
+ (std::is_integral_v<A> && std::is_integral_v<B> &&
+ !(std::is_signed_v<A> ^ std::is_signed_v<B>)) ||
+ (std::is_same_v<A, doris::vectorized::Int128> &&
+ std::is_same_v<B, doris::vectorized::Int128>) ||
+ (std::is_integral_v<A> && std::is_same_v<B,
doris::vectorized::Int128>) ||
+ (std::is_same_v<A, doris::vectorized::Int128> &&
std::is_integral_v<B>);
template <typename A, typename B>
using bool_if_safe_conversion = std::enable_if_t<is_safe_conversion<A, B>,
bool>;
template <typename A, typename B>
@@ -70,13 +69,13 @@ using bool_if_not_safe_conversion =
std::enable_if_t<!is_safe_conversion<A, B>,
/// Case 2. Are params IntXX and UIntYY ?
template <typename TInt, typename TUInt>
-constexpr bool is_any_int_vs_uint = std::is_integral_v<TInt>&&
std::is_integral_v<TUInt>&&
- std::is_signed_v<TInt>&& std::is_unsigned_v<TUInt>;
+constexpr bool is_any_int_vs_uint = std::is_integral_v<TInt> &&
std::is_integral_v<TUInt> &&
+ std::is_signed_v<TInt> &&
std::is_unsigned_v<TUInt>;
// Case 2a. Are params IntXX and UIntYY and sizeof(IntXX) >= sizeof(UIntYY)
(in such case will use accurate compare)
template <typename TInt, typename TUInt>
-constexpr bool is_le_int_vs_uint = is_any_int_vs_uint<TInt, TUInt> &&
- (sizeof(TInt) <= sizeof(TUInt));
+constexpr bool is_le_int_vs_uint =
+ is_any_int_vs_uint<TInt, TUInt> && (sizeof(TInt) <= sizeof(TUInt));
template <typename TInt, typename TUInt>
using bool_if_le_int_vs_uint_t = std::enable_if_t<is_le_int_vs_uint<TInt,
TUInt>, bool>;
@@ -107,8 +106,8 @@ inline bool_if_le_int_vs_uint_t<TInt, TUInt>
equalsOpTmpl(TUInt a, TInt b) {
// Case 2b. Are params IntXX and UIntYY and sizeof(IntXX) > sizeof(UIntYY) (in
such case will cast UIntYY to IntXX and compare)
template <typename TInt, typename TUInt>
-constexpr bool is_gt_int_vs_uint = is_any_int_vs_uint<TInt, TUInt> &&
- (sizeof(TInt) > sizeof(TUInt));
+constexpr bool is_gt_int_vs_uint =
+ is_any_int_vs_uint<TInt, TUInt> && (sizeof(TInt) > sizeof(TUInt));
template <typename TInt, typename TUInt>
using bool_if_gt_int_vs_uint = std::enable_if_t<is_gt_int_vs_uint<TInt,
TUInt>, bool>;
diff --git a/docs/en/community/developer-guide/cpp-format-code.md
b/docs/en/community/developer-guide/cpp-format-code.md
index 937ba7b464..a5e45352c5 100644
--- a/docs/en/community/developer-guide/cpp-format-code.md
+++ b/docs/en/community/developer-guide/cpp-format-code.md
@@ -40,7 +40,7 @@ Doris uses clang-format for code formatting, and provides a
package script in th
The code style of Doris is slightly modified on the basis of Google Style and
is customized as a `.clang-format` file located in the root directory of Doris.
-Currently, the `.clang-format` configuration file is adapted to versions above
clang-format-13.0.1.
+Currently, the `.clang-format` configuration file is adapted to versions above
clang-format-15.0.1.
The code that you do not want to be formatted is recorded in the
`.clang-format-ignore` file. These codes usually come from third-party code
bases, and it is recommended to keep the original code style.
@@ -50,24 +50,24 @@ You need to download and install clang-format, or you can
use the clang-format p
### Download and install clang-format
-It is recommended to use NPM to install clang-format 14 (different versions of
clang-format may produce different code formats, it is recommended to use
version 14):
+It is recommended to use NPM to install clang-format 15 (different versions of
clang-format may produce different code formats, it is recommended to use
version 15):
-`npm install [email protected]`
+`npm install [email protected]`
Ubuntu: `apt-get install clang-format`
-The current version is 10.0, you can also specify the old version, for
example: `apt-get install clang-format-9`. It is recommended to compile version
14.0 from source code.
+The current version is 10.0, you can also specify the old version, for
example: `apt-get install clang-format-9`. It is recommended to compile version
15.0 from source code.
Mac: `brew install clang-format`
Centos 7:
-The version of clang-format installed by centos yum is too old and supports
too few StyleOptions. It is recommended to compile version 14.0 from source
code.
+The version of clang-format installed by centos yum is too old and supports
too few StyleOptions. It is recommended to compile version 15.0 from source
code.
LDB toolchain:
If you are using [LDB
toolchain](/docs/install/source-install/compilation-with-ldb-toolchain),
-the latest version (>= v0.11) of [LDB
toolchain](https://github.com/amosbird/ldb_toolchain_gen/releases) has already
included clang-format with 13.0.1 version.
+the latest version (>= v0.13) of [LDB
toolchain](https://github.com/amosbird/ldb_toolchain_gen/releases) has already
included clang-format with 15.0.1 version.
### clang-format plugin
diff --git a/docs/zh-CN/community/developer-guide/cpp-format-code.md
b/docs/zh-CN/community/developer-guide/cpp-format-code.md
index 5a9a51d893..c240f1903b 100644
--- a/docs/zh-CN/community/developer-guide/cpp-format-code.md
+++ b/docs/zh-CN/community/developer-guide/cpp-format-code.md
@@ -40,7 +40,7 @@ Doris使用clang-format进行代码格式化,并在build-support目录下提
Doris的代码风格在Google Style的基础上稍有改动,定制为 `.clang-format` 文件,位于Doris根目录。
-目前,`.clang-format` 配置文件适配clang-format-13.0.1以上的版本。
+目前,`.clang-format` 配置文件适配clang-format-15.0.1以上的版本。
`.clang-format-ignore` 文件中记录了不希望被格式化的代码。这些代码通常来自第三方代码库,建议保持原有代码风格。
@@ -50,25 +50,25 @@ Doris的代码风格在Google Style的基础上稍有改动,定制为 `.clang-
### 下载安装clang-format
-推荐使用 NPM 安装 clang-format 14(不同版本的 clang-format 可能产生不同的代码格式,建议使用 14 版本):
+推荐使用 NPM 安装 clang-format 15(不同版本的 clang-format 可能产生不同的代码格式,建议使用 15 版本):
-`npm install [email protected]`
+`npm install [email protected]`
Ubuntu: `apt-get install clang-format`
-当前版本为10.0,也可指定旧版本,例如: `apt-get install clang-format-9`,建议源码编译14.0版本。
+当前版本为10.0,也可指定旧版本,例如: `apt-get install clang-format-9`,建议源码编译15.0版本。
Mac: `brew install clang-format`
Centos 7:
-centos yum安装的clang-format版本过老,支持的StyleOption太少,建议源码编译14.0版本。
+centos yum安装的clang-format版本过老,支持的StyleOption太少,建议源码编译15.0版本。
LDB toolchain:
如果使用 [LDB
toolchain](/docs/install/source-install/compilation-with-ldb-toolchain),
-最新版本的 [LDB
toolchain](https://github.com/amosbird/ldb_toolchain_gen/releases)(>=
v0.11)已经包含了预编译的clang-format
-13.0.1的二进制文件。
+最新版本的 [LDB
toolchain](https://github.com/amosbird/ldb_toolchain_gen/releases)(>=
v0.13)已经包含了预编译的clang-format
+15.0.1的二进制文件。
### clang-format插件
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]