mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
A few clangtidy updates
Enable: - bugprone-lambda-function-name: "Checks for attempts to get the name of a function from within a lambda expression. The name of a lambda is always something like operator(), which is almost never what was intended." - bugprone-unhandled-self-assignment: "Finds user-defined copy assignment operators which do not protect the code against self-assignment either by checking self-assignment explicitly or using the copy-and-swap or the copy-and-move method."" - hicpp-invalid-access-moved: "Warns if an object is used after it has been moved." - hicpp-use-noexcept: "This check replaces deprecated dynamic exception specifications with the appropriate noexcept specification (introduced in C++11)" - hicpp-use-override: "Adds override (introduced in C++11) to overridden virtual functions and removes virtual from those functions as it is not required." - performance-type-promotion-in-math-fn: "Finds calls to C math library functions (from math.h or, in C++, cmath) with implicit float to double promotions." Split up: - cppcoreguidelines-*. Some of them may be useful (haven't checked in detail), therefore allow to toggle them individually. Disable: - linuxkernel-*. Obvious.
This commit is contained in:
parent
23a61b1596
commit
0c55ac76d2
34
.clang-tidy
34
.clang-tidy
@ -9,10 +9,8 @@ Checks: '*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-exception-escape,
|
||||
-bugprone-implicit-widening-of-multiplication-result,
|
||||
-bugprone-lambda-function-name,
|
||||
-bugprone-narrowing-conversions,
|
||||
-bugprone-not-null-terminated-result,
|
||||
-bugprone-unhandled-self-assignment,
|
||||
|
||||
-cert-dcl16-c,
|
||||
-cert-err58-cpp,
|
||||
@ -27,7 +25,31 @@ Checks: '*,
|
||||
-clang-analyzer-security.insecureAPI.bzero,
|
||||
-clang-analyzer-security.insecureAPI.strcpy,
|
||||
|
||||
-cppcoreguidelines-*,
|
||||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-goto,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-explicit-virtual-functions,
|
||||
-cppcoreguidelines-init-variables,
|
||||
-cppcoreguidelines-interfaces-global-init,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
-cppcoreguidelines-no-malloc,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-prefer-member-initializer,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-cstyle-cast,
|
||||
-cppcoreguidelines-pro-type-member-init,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
-cppcoreguidelines-pro-type-union-access,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-cppcoreguidelines-slicing,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
|
||||
-concurrency-mt-unsafe,
|
||||
|
||||
@ -47,7 +69,6 @@ Checks: '*,
|
||||
-hicpp-braces-around-statements,
|
||||
-hicpp-explicit-conversions,
|
||||
-hicpp-function-size,
|
||||
-hicpp-invalid-access-moved,
|
||||
-hicpp-member-init,
|
||||
-hicpp-move-const-arg,
|
||||
-hicpp-multiway-paths-covered,
|
||||
@ -60,10 +81,10 @@ Checks: '*,
|
||||
-hicpp-uppercase-literal-suffix,
|
||||
-hicpp-use-auto,
|
||||
-hicpp-use-emplace,
|
||||
-hicpp-use-noexcept,
|
||||
-hicpp-use-override,
|
||||
-hicpp-vararg,
|
||||
|
||||
-linuxkernel-*,
|
||||
|
||||
-llvm-*,
|
||||
|
||||
-llvmlibc-*,
|
||||
@ -86,7 +107,6 @@ Checks: '*,
|
||||
|
||||
-performance-inefficient-string-concatenation,
|
||||
-performance-no-int-to-ptr,
|
||||
-performance-type-promotion-in-math-fn,
|
||||
-performance-unnecessary-value-param,
|
||||
|
||||
-portability-simd-intrinsics,
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define JSON_MAX_DEPTH 100
|
||||
|
||||
|
||||
POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOLINT(cert-err60-cpp, modernize-use-noexcept)
|
||||
POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOLINT(cert-err60-cpp, modernize-use-noexcept, hicpp-use-noexcept)
|
||||
|
||||
|
||||
/// Прочитать беззнаковое целое в простом формате из не-0-terminated строки.
|
||||
|
@ -366,7 +366,7 @@ namespace
|
||||
{
|
||||
if (info.zk_path.empty())
|
||||
{
|
||||
for (auto & [relative_path, backup_entry] : info.data)
|
||||
for (const auto & [relative_path, backup_entry] : info.data)
|
||||
res.emplace_back(info.data_path + relative_path, backup_entry);
|
||||
return;
|
||||
}
|
||||
@ -374,7 +374,7 @@ namespace
|
||||
Strings data_paths = backup_coordination->getReplicatedTableDataPaths(info.zk_path);
|
||||
Strings part_names = backup_coordination->getReplicatedTablePartNames(backup_settings.host_id, info.table_name, info.zk_path);
|
||||
std::unordered_set<std::string_view> part_names_set{part_names.begin(), part_names.end()};
|
||||
for (auto & [relative_path, backup_entry] : info.data)
|
||||
for (const auto & [relative_path, backup_entry] : info.data)
|
||||
{
|
||||
size_t slash_pos = relative_path.find('/');
|
||||
if (slash_pos != String::npos)
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
RestartAwareWriteBuffer(const DiskRestartProxy & disk, std::unique_ptr<WriteBuffer> impl_)
|
||||
: WriteBufferFromFileDecorator(std::move(impl_)), lock(disk.mutex) { }
|
||||
|
||||
virtual ~RestartAwareWriteBuffer() override
|
||||
~RestartAwareWriteBuffer() override
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ namespace DB
|
||||
}
|
||||
}
|
||||
|
||||
virtual DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
if (arguments.size() != 2)
|
||||
throw Exception(
|
||||
@ -166,7 +166,7 @@ namespace DB
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
}
|
||||
|
||||
virtual size_t getNumberOfArguments() const override { return 2; }
|
||||
size_t getNumberOfArguments() const override { return 2; }
|
||||
bool useDefaultImplementationForNulls() const override { return false; }
|
||||
|
||||
private:
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
return std::make_shared<DataTypeString>();
|
||||
}
|
||||
|
||||
virtual ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
|
||||
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
|
||||
{
|
||||
Block sample_block(arguments);
|
||||
size_t size = arguments.size();
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
AWSEC2MetadataClient& operator =(const AWSEC2MetadataClient && rhs) = delete;
|
||||
AWSEC2MetadataClient(const AWSEC2MetadataClient && rhs) = delete;
|
||||
|
||||
virtual ~AWSEC2MetadataClient() override = default;
|
||||
~AWSEC2MetadataClient() override = default;
|
||||
|
||||
using Aws::Internal::AWSHttpResourceClient::GetResource;
|
||||
|
||||
@ -264,10 +264,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AWSEC2InstanceProfileConfigLoader() override = default;
|
||||
~AWSEC2InstanceProfileConfigLoader() override = default;
|
||||
|
||||
protected:
|
||||
virtual bool LoadInternal() override
|
||||
bool LoadInternal() override
|
||||
{
|
||||
auto credentials_str = use_secure_pull ? client->getDefaultCredentialsSecurely() : client->getDefaultCredentials();
|
||||
|
||||
|
@ -80,7 +80,7 @@ class OutputStreamWriteBufferAdapter : public avro::OutputStream
|
||||
public:
|
||||
explicit OutputStreamWriteBufferAdapter(WriteBuffer & out_) : out(out_) {}
|
||||
|
||||
virtual bool next(uint8_t ** data, size_t * len) override
|
||||
bool next(uint8_t ** data, size_t * len) override
|
||||
{
|
||||
out.nextIfAtEnd();
|
||||
*data = reinterpret_cast<uint8_t *>(out.position());
|
||||
@ -90,10 +90,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void backup(size_t len) override { out.position() -= len; }
|
||||
void backup(size_t len) override { out.position() -= len; }
|
||||
|
||||
virtual uint64_t byteCount() const override { return out.count(); }
|
||||
virtual void flush() override { }
|
||||
uint64_t byteCount() const override { return out.count(); }
|
||||
void flush() override { }
|
||||
|
||||
private:
|
||||
WriteBuffer & out;
|
||||
|
@ -91,7 +91,7 @@ void ParallelParsingInputFormat::parserThreadFunction(ThreadGroupStatusPtr threa
|
||||
while (!parsing_finished && (chunk = parser.getChunk()) != Chunk())
|
||||
{
|
||||
/// Variable chunk is moved, but it is not really used in the next iteration.
|
||||
/// NOLINTNEXTLINE(bugprone-use-after-move)
|
||||
/// NOLINTNEXTLINE(bugprone-use-after-move, hicpp-invalid-access-moved)
|
||||
unit.chunk_ext.chunk.emplace_back(std::move(chunk));
|
||||
unit.chunk_ext.block_missing_values.emplace_back(parser.getMissingValues());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user