Merge pull request #47722 from ClickHouse/rs/llvm-16-preparation

Preparation for libcxx(abi), llvm, clang-tidy 16
This commit is contained in:
Alexander Gololobov 2023-03-20 00:03:32 +01:00 committed by GitHub
commit 6fa0b0b459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 44 additions and 30 deletions

View File

@ -41,6 +41,8 @@ Checks: '*,
-clang-analyzer-security.insecureAPI.strcpy,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
@ -128,6 +130,7 @@ Checks: '*,
-portability-simd-intrinsics,
-readability-braces-around-statements,
-readability-convert-member-functions-to-static,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,

View File

@ -1,5 +1,6 @@
#pragma once
#include <bit>
#include <cstring>
#include "types.h"

View File

@ -27,7 +27,7 @@
#include "Poco/Exception.h"
#include "Poco/NumberParser.h"
#include "Poco/NumberFormatter.h"
#include <set>
#include <unordered_map>
namespace Poco {

View File

@ -5,14 +5,14 @@ if (ENABLE_CLANG_TIDY)
find_program (CLANG_TIDY_CACHE_PATH NAMES "clang-tidy-cache")
if (CLANG_TIDY_CACHE_PATH)
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-15" "clang-tidy-14" "clang-tidy-13" "clang-tidy-12" "clang-tidy")
find_program (_CLANG_TIDY_PATH NAMES "clang-tidy-16" "clang-tidy-15" "clang-tidy-14" "clang-tidy")
# Why do we use ';' here?
# It's a cmake black magic: https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html#prop_tgt:%3CLANG%3E_CLANG_TIDY
# The CLANG_TIDY_PATH is passed to CMAKE_CXX_CLANG_TIDY, which follows CXX_CLANG_TIDY syntax.
set (CLANG_TIDY_PATH "${CLANG_TIDY_CACHE_PATH};${_CLANG_TIDY_PATH}" CACHE STRING "A combined command to run clang-tidy with caching wrapper")
else ()
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-15" "clang-tidy-14" "clang-tidy-13" "clang-tidy-12" "clang-tidy")
find_program (CLANG_TIDY_PATH NAMES "clang-tidy-16" "clang-tidy-15" "clang-tidy-14" "clang-tidy")
endif ()
if (CLANG_TIDY_PATH)

View File

@ -400,7 +400,7 @@ struct fmt::formatter<DB::Identifier>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -408,7 +408,7 @@ struct fmt::formatter<DB::Identifier>
template <typename FormatContext>
auto format(const DB::Identifier & identifier, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", identifier.getFullName());
return fmt::format_to(ctx.out(), "{}", identifier.getFullName());
}
};
@ -422,7 +422,7 @@ struct fmt::formatter<DB::IdentifierView>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -430,6 +430,6 @@ struct fmt::formatter<DB::IdentifierView>
template <typename FormatContext>
auto format(const DB::IdentifierView & identifier_view, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", identifier_view.getFullName());
return fmt::format_to(ctx.out(), "{}", identifier_view.getFullName());
}
};

View File

@ -106,7 +106,7 @@ struct fmt::formatter<DB::TestHint::ErrorVector>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("Invalid format");
throw fmt::format_error("Invalid format");
return it;
}
@ -115,10 +115,10 @@ struct fmt::formatter<DB::TestHint::ErrorVector>
auto format(const DB::TestHint::ErrorVector & ErrorVector, FormatContext & ctx)
{
if (ErrorVector.empty())
return format_to(ctx.out(), "{}", 0);
return fmt::format_to(ctx.out(), "{}", 0);
else if (ErrorVector.size() == 1)
return format_to(ctx.out(), "{}", ErrorVector[0]);
return fmt::format_to(ctx.out(), "{}", ErrorVector[0]);
else
return format_to(ctx.out(), "[{}]", fmt::join(ErrorVector, ", "));
return fmt::format_to(ctx.out(), "[{}]", fmt::join(ErrorVector, ", "));
}
};

View File

@ -3,6 +3,7 @@
#include <sys/epoll.h>
#include <vector>
#include <functional>
#include <boost/noncopyable.hpp>
#include <Poco/Logger.h>

View File

@ -1,5 +1,6 @@
#pragma once
#include <algorithm>
#include <string>
#include <cstring>
#include <cstddef>

View File

@ -563,7 +563,7 @@ std::string ZooKeeperMultiRequest::toStringImpl() const
for (const auto & request : requests)
{
const auto & zk_request = dynamic_cast<const ZooKeeperRequest &>(*request);
format_to(std::back_inserter(out), "SubRequest\n{}\n", zk_request.toString());
fmt::format_to(std::back_inserter(out), "SubRequest\n{}\n", zk_request.toString());
}
return {out.data(), out.size()};
}

View File

@ -43,7 +43,7 @@ struct fmt::formatter<ReadableSize>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -51,6 +51,6 @@ struct fmt::formatter<ReadableSize>
template <typename FormatContext>
auto format(const ReadableSize & size, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", formatReadableSizeWithBinarySuffix(size.value));
return fmt::format_to(ctx.out(), "{}", formatReadableSizeWithBinarySuffix(size.value));
}
};

View File

@ -1019,7 +1019,7 @@ struct fmt::formatter<DB::Field>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("Invalid format");
throw fmt::format_error("Invalid format");
return it;
}
@ -1027,6 +1027,6 @@ struct fmt::formatter<DB::Field>
template <typename FormatContext>
auto format(const DB::Field & x, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", toString(x));
return fmt::format_to(ctx.out(), "{}", toString(x));
}
};

View File

@ -626,7 +626,7 @@ struct fmt::formatter<DB::DataTypePtr>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -634,6 +634,6 @@ struct fmt::formatter<DB::DataTypePtr>
template <typename FormatContext>
auto format(const DB::DataTypePtr & type, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", type->getName());
return fmt::format_to(ctx.out(), "{}", type->getName());
}
};

View File

@ -1,6 +1,7 @@
#pragma once
#include <Disks/IDiskTransaction.h>
#include <IO/WriteBufferFromFileBase.h>
namespace DB
{

View File

@ -1,5 +1,6 @@
#pragma once
#include <functional>
#include <string>
#include <Disks/ObjectStorages/IObjectStorage_fwd.h>

View File

@ -2,6 +2,7 @@
#include <boost/noncopyable.hpp>
#include <base/types.h>
#include <functional>
#include <memory>

View File

@ -1,6 +1,7 @@
#pragma once
#include <base/types.h>
#include <functional>
#include <memory>

View File

@ -138,7 +138,7 @@ namespace fmt
template <typename FormatContext>
auto format(const DB::StorageID & storage_id, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", storage_id.getNameForLogs());
return fmt::format_to(ctx.out(), "{}", storage_id.getNameForLogs());
}
};
}

View File

@ -45,6 +45,15 @@ void TemporaryDataOnDiskScope::deltaAllocAndCheck(ssize_t compressed_delta, ssiz
stat.uncompressed_size += uncompressed_delta;
}
TemporaryDataOnDisk::TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_)
: TemporaryDataOnDiskScope(std::move(parent_), /* limit_ = */ 0)
{}
TemporaryDataOnDisk::TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_, CurrentMetrics::Value metric_scope)
: TemporaryDataOnDiskScope(std::move(parent_), /* limit_ = */ 0)
, current_metric_scope(metric_scope)
{}
TemporaryFileStream & TemporaryDataOnDisk::createStream(const Block & header, size_t max_file_size)
{
if (file_cache)

View File

@ -83,14 +83,9 @@ class TemporaryDataOnDisk : private TemporaryDataOnDiskScope
public:
using TemporaryDataOnDiskScope::StatAtomic;
explicit TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_)
: TemporaryDataOnDiskScope(std::move(parent_), /* limit_ = */ 0)
{}
explicit TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_);
explicit TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_, CurrentMetrics::Value metric_scope)
: TemporaryDataOnDiskScope(std::move(parent_), /* limit_ = */ 0)
, current_metric_scope(metric_scope)
{}
explicit TemporaryDataOnDisk(TemporaryDataOnDiskScopePtr parent_, CurrentMetrics::Value metric_scope);
/// If max_file_size > 0, then check that there's enough space on the disk and throw an exception in case of lack of free space
TemporaryFileStream & createStream(const Block & header, size_t max_file_size = 0);

View File

@ -373,7 +373,7 @@ struct fmt::formatter<DB::RowNumber>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -381,6 +381,6 @@ struct fmt::formatter<DB::RowNumber>
template <typename FormatContext>
auto format(const DB::RowNumber & x, FormatContext & ctx)
{
return format_to(ctx.out(), "{}:{}", x.block, x.row);
return fmt::format_to(ctx.out(), "{}:{}", x.block, x.row);
}
};

View File

@ -63,7 +63,7 @@ struct fmt::formatter<DB::MarkRange>
/// Only support {}.
if (it != end && *it != '}')
throw format_error("invalid format");
throw fmt::format_error("invalid format");
return it;
}
@ -71,6 +71,6 @@ struct fmt::formatter<DB::MarkRange>
template <typename FormatContext>
auto format(const DB::MarkRange & range, FormatContext & ctx)
{
return format_to(ctx.out(), "{}", fmt::format("({}, {})", range.begin, range.end));
return fmt::format_to(ctx.out(), "{}", fmt::format("({}, {})", range.begin, range.end));
}
};