Fix clang-tidy-s

This commit is contained in:
Robert Schulze 2024-03-10 14:29:18 +00:00
parent ecb11005e3
commit e5e84419af
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
36 changed files with 69 additions and 69 deletions

View File

@ -17,6 +17,8 @@
#ifndef METROHASH_METROHASH_128_H
#define METROHASH_METROHASH_128_H
// NOLINTBEGIN(readability-avoid-const-params-in-decls)
#include <stdint.h>
class MetroHash128
@ -68,5 +70,6 @@ private:
void metrohash128_1(const uint8_t * key, uint64_t len, uint32_t seed, uint8_t * out);
void metrohash128_2(const uint8_t * key, uint64_t len, uint32_t seed, uint8_t * out);
// NOLINTEND(readability-avoid-const-params-in-decls)
#endif // #ifndef METROHASH_METROHASH_128_H

View File

@ -133,20 +133,20 @@ public:
/// This function also enables custom prefixes to be used.
void setCustomSettingsPrefixes(const Strings & prefixes);
void setCustomSettingsPrefixes(const String & comma_separated_prefixes);
bool isSettingNameAllowed(const std::string_view name) const;
void checkSettingNameIsAllowed(const std::string_view name) const;
bool isSettingNameAllowed(std::string_view name) const;
void checkSettingNameIsAllowed(std::string_view name) const;
/// Allows implicit user creation without password (by default it's allowed).
/// In other words, allow 'CREATE USER' queries without 'IDENTIFIED WITH' clause.
void setImplicitNoPasswordAllowed(const bool allow_implicit_no_password_);
void setImplicitNoPasswordAllowed(bool allow_implicit_no_password_);
bool isImplicitNoPasswordAllowed() const;
/// Allows users without password (by default it's allowed).
void setNoPasswordAllowed(const bool allow_no_password_);
void setNoPasswordAllowed(bool allow_no_password_);
bool isNoPasswordAllowed() const;
/// Allows users with plaintext password (by default it's allowed).
void setPlaintextPasswordAllowed(const bool allow_plaintext_password_);
void setPlaintextPasswordAllowed(bool allow_plaintext_password_);
bool isPlaintextPasswordAllowed() const;
/// Default password type when the user does not specify it.

View File

@ -616,7 +616,7 @@ UUID IAccessStorage::generateRandomID()
}
void IAccessStorage::clearConflictsInEntitiesList(std::vector<std::pair<UUID, AccessEntityPtr>> & entities, const LoggerPtr log_)
void IAccessStorage::clearConflictsInEntitiesList(std::vector<std::pair<UUID, AccessEntityPtr>> & entities, LoggerPtr log_)
{
std::unordered_map<UUID, size_t> positions_by_id;
std::unordered_map<std::string_view, size_t> positions_by_type_and_name[static_cast<size_t>(AccessEntityType::MAX)];

View File

@ -228,7 +228,7 @@ protected:
static UUID generateRandomID();
LoggerPtr getLogger() const;
static String formatEntityTypeWithName(AccessEntityType type, const String & name) { return AccessEntityTypeInfo::get(type).formatEntityNameWithType(name); }
static void clearConflictsInEntitiesList(std::vector<std::pair<UUID, AccessEntityPtr>> & entities, const LoggerPtr log_);
static void clearConflictsInEntitiesList(std::vector<std::pair<UUID, AccessEntityPtr>> & entities, LoggerPtr log_);
[[noreturn]] void throwNotFound(const UUID & id) const;
[[noreturn]] void throwNotFound(AccessEntityType type, const String & name) const;
[[noreturn]] static void throwBadCast(const UUID & id, AccessEntityType type, const String & name, AccessEntityType required_type);

View File

@ -47,9 +47,7 @@ private:
std::unique_ptr<MemoryChunk> prev;
MemoryChunk()
{
}
MemoryChunk() = default;
void swap(MemoryChunk & other)
{

View File

@ -297,7 +297,7 @@ void DNSResolver::setDisableCacheFlag(bool is_disabled)
impl->disable_cache = is_disabled;
}
void DNSResolver::setCacheMaxEntries(const UInt64 cache_max_entries)
void DNSResolver::setCacheMaxEntries(UInt64 cache_max_entries)
{
impl->cache_address.setMaxSizeInBytes(cache_max_entries);
impl->cache_host.setMaxSizeInBytes(cache_max_entries);

View File

@ -56,7 +56,7 @@ public:
void setDisableCacheFlag(bool is_disabled = true);
/// Set a limit of entries in cache
void setCacheMaxEntries(const UInt64 cache_max_entries);
void setCacheMaxEntries(UInt64 cache_max_entries);
/// Drops all caches
void dropCache();

View File

@ -255,7 +255,7 @@ private:
static LUTIndex toLUTIndex(ExtendedDayNum d)
{
return normalizeLUTIndex(static_cast<Int64>(d + daynum_offset_epoch));
return normalizeLUTIndex(static_cast<Int64>(d) + daynum_offset_epoch);
}
LUTIndex toLUTIndex(Time t) const

View File

@ -41,9 +41,9 @@ public:
}
/// There is no copy constructor because only one MultiVersion should own the same object.
MultiVersion(MultiVersion && src) { *this = std::move(src); }
MultiVersion(MultiVersion && src) { *this = std::move(src); } /// NOLINT
MultiVersion & operator=(MultiVersion && src)
MultiVersion & operator=(MultiVersion && src) /// NOLINT
{
if (this != &src)
{

View File

@ -25,7 +25,7 @@
*/
template <typename T, typename U>
constexpr bool memcpy_can_be_used_for_assignment = std::is_same_v<T, U>
|| (std::is_integral_v<T> && std::is_integral_v<U> && sizeof(T) == sizeof(U));
|| (std::is_integral_v<T> && std::is_integral_v<U> && sizeof(T) == sizeof(U)); /// NOLINT(misc-redundant-expression)
namespace DB
{
@ -558,7 +558,7 @@ public:
}
template <typename... TAllocatorParams>
void swap(PODArray & rhs, TAllocatorParams &&... allocator_params)
void swap(PODArray & rhs, TAllocatorParams &&... allocator_params) /// NOLINT(performance-noexcept-swap)
{
#ifndef NDEBUG
this->unprotect();
@ -756,7 +756,7 @@ public:
};
template <typename T, size_t initial_bytes, typename TAllocator, size_t pad_right_, size_t pad_left_>
void swap(PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & lhs, PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & rhs)
void swap(PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & lhs, PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & rhs) /// NOLINT
{
lhs.swap(rhs);
}

View File

@ -149,7 +149,7 @@ public:
/// Pad the remainder, which is missing up to an 8-byte word.
current_word = 0;
switch (end - data)
switch (end - data) /// NOLINT(bugprone-switch-missing-default-case)
{
case 7: current_bytes[CURRENT_BYTES_IDX(6)] = data[6]; [[fallthrough]];
case 6: current_bytes[CURRENT_BYTES_IDX(5)] = data[5]; [[fallthrough]];

View File

@ -16,7 +16,7 @@ class MergeTreeTransaction;
/// or transaction object is not needed and not passed intentionally.
#ifndef NO_TRANSACTION_PTR
#define NO_TRANSACTION_PTR std::shared_ptr<MergeTreeTransaction>(nullptr)
#define NO_TRANSACTION_RAW static_cast<MergeTreeTransaction *>(nullptr)
#define NO_TRANSACTION_RAW static_cast<MergeTreeTransaction *>(nullptr) /// NOLINT(bugprone-macro-parentheses)
#endif
/// Commit Sequence Number

View File

@ -23,7 +23,7 @@ namespace ProfileEvents
namespace Coordination
{
void Exception::incrementErrorMetrics(const Error code_)
void Exception::incrementErrorMetrics(Error code_)
{
if (Coordination::isUserError(code_))
ProfileEvents::increment(ProfileEvents::ZooKeeperUserExceptions);
@ -33,14 +33,14 @@ void Exception::incrementErrorMetrics(const Error code_)
ProfileEvents::increment(ProfileEvents::ZooKeeperOtherExceptions);
}
Exception::Exception(const std::string & msg, const Error code_, int)
Exception::Exception(const std::string & msg, Error code_, int)
: DB::Exception(msg, DB::ErrorCodes::KEEPER_EXCEPTION)
, code(code_)
{
incrementErrorMetrics(code);
}
Exception::Exception(PreformattedMessage && msg, const Error code_)
Exception::Exception(PreformattedMessage && msg, Error code_)
: DB::Exception(std::move(msg), DB::ErrorCodes::KEEPER_EXCEPTION)
, code(code_)
{
@ -48,7 +48,7 @@ Exception::Exception(PreformattedMessage && msg, const Error code_)
incrementErrorMetrics(code);
}
Exception::Exception(const Error code_)
Exception::Exception(Error code_)
: Exception(code_, "Coordination error: {}", errorMessage(code_))
{
}

View File

@ -466,13 +466,13 @@ class Exception : public DB::Exception
{
private:
/// Delegate constructor, used to minimize repetition; last parameter used for overload resolution.
Exception(const std::string & msg, const Error code_, int); /// NOLINT
Exception(PreformattedMessage && msg, const Error code_);
Exception(const std::string & msg, Error code_, int); /// NOLINT
Exception(PreformattedMessage && msg, Error code_);
/// Message must be a compile-time constant
template <typename T>
requires std::is_convertible_v<T, String>
Exception(T && message, const Error code_) : DB::Exception(std::forward<T>(message), DB::ErrorCodes::KEEPER_EXCEPTION, /* remote_= */ false), code(code_)
Exception(T && message, Error code_) : DB::Exception(std::forward<T>(message), DB::ErrorCodes::KEEPER_EXCEPTION, /* remote_= */ false), code(code_)
{
incrementErrorMetrics(code);
}
@ -480,23 +480,23 @@ private:
static void incrementErrorMetrics(Error code_);
public:
explicit Exception(const Error code_); /// NOLINT
explicit Exception(Error code_); /// NOLINT
Exception(const Exception & exc);
template <typename... Args>
Exception(const Error code_, FormatStringHelper<Args...> fmt, Args &&... args)
Exception(Error code_, FormatStringHelper<Args...> fmt, Args &&... args)
: DB::Exception(DB::ErrorCodes::KEEPER_EXCEPTION, std::move(fmt), std::forward<Args>(args)...)
, code(code_)
{
incrementErrorMetrics(code);
}
inline static Exception createDeprecated(const std::string & msg, const Error code_)
inline static Exception createDeprecated(const std::string & msg, Error code_)
{
return Exception(msg, code_, 0);
}
inline static Exception fromPath(const Error code_, const std::string & path)
inline static Exception fromPath(Error code_, const std::string & path)
{
return Exception(code_, "Coordination error: {}, path {}", errorMessage(code_), path);
}
@ -504,7 +504,7 @@ public:
/// Message must be a compile-time constant
template <typename T>
requires std::is_convertible_v<T, String>
inline static Exception fromMessage(const Error code_, T && message)
inline static Exception fromMessage(Error code_, T && message)
{
return Exception(std::forward<T>(message), code_);
}

View File

@ -19,14 +19,14 @@ namespace Poco { class Logger; }
using LogSeriesLimiterPtr = std::shared_ptr<LogSeriesLimiter>;
namespace
namespace impl
{
[[maybe_unused]] LoggerPtr getLoggerHelper(const LoggerPtr & logger) { return logger; }
[[maybe_unused]] LoggerPtr getLoggerHelper(const AtomicLogger & logger) { return logger.load(); }
[[maybe_unused]] const ::Poco::Logger * getLoggerHelper(const ::Poco::Logger * logger) { return logger; }
[[maybe_unused]] std::unique_ptr<LogToStrImpl> getLoggerHelper(std::unique_ptr<LogToStrImpl> && logger) { return logger; }
[[maybe_unused]] std::unique_ptr<LogFrequencyLimiterIml> getLoggerHelper(std::unique_ptr<LogFrequencyLimiterIml> && logger) { return logger; }
[[maybe_unused]] LogSeriesLimiterPtr getLoggerHelper(LogSeriesLimiterPtr & logger) { return logger; }
[[maybe_unused]] inline LoggerPtr getLoggerHelper(const LoggerPtr & logger) { return logger; }
[[maybe_unused]] inline LoggerPtr getLoggerHelper(const AtomicLogger & logger) { return logger.load(); }
[[maybe_unused]] inline const ::Poco::Logger * getLoggerHelper(const ::Poco::Logger * logger) { return logger; }
[[maybe_unused]] inline std::unique_ptr<LogToStrImpl> getLoggerHelper(std::unique_ptr<LogToStrImpl> && logger) { return logger; }
[[maybe_unused]] inline std::unique_ptr<LogFrequencyLimiterIml> getLoggerHelper(std::unique_ptr<LogFrequencyLimiterIml> && logger) { return logger; }
[[maybe_unused]] inline LogSeriesLimiterPtr getLoggerHelper(LogSeriesLimiterPtr & logger) { return logger; }
}
#define LOG_IMPL_FIRST_ARG(X, ...) X
@ -65,7 +65,7 @@ namespace
#define LOG_IMPL(logger, priority, PRIORITY, ...) do \
{ \
auto _logger = ::getLoggerHelper(logger); \
auto _logger = ::impl::getLoggerHelper(logger); \
const bool _is_clients_log = (DB::CurrentThread::getGroup() != nullptr) && \
(DB::CurrentThread::get().getClientLogsLevel() >= (priority)); \
if (!_is_clients_log && !_logger->is((PRIORITY))) \

View File

@ -36,7 +36,7 @@ void insertDefaultPostgreSQLValue(IColumn & column, const IColumn & sample_colum
void insertPostgreSQLValue(
IColumn & column, std::string_view value,
const ExternalResultDescription::ValueType type, const DataTypePtr data_type,
ExternalResultDescription::ValueType type, DataTypePtr data_type,
const std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t idx)
{
switch (type)
@ -170,7 +170,7 @@ void insertPostgreSQLValue(
void preparePostgreSQLArrayInfo(
std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t column_idx, const DataTypePtr data_type)
std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t column_idx, DataTypePtr data_type)
{
const auto * array_type = typeid_cast<const DataTypeArray *>(data_type.get());
auto nested = array_type->getNestedType();

View File

@ -22,11 +22,11 @@ struct PostgreSQLArrayInfo
void insertPostgreSQLValue(
IColumn & column, std::string_view value,
const ExternalResultDescription::ValueType type, const DataTypePtr data_type,
ExternalResultDescription::ValueType type, DataTypePtr data_type,
const std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t idx);
void preparePostgreSQLArrayInfo(
std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t column_idx, const DataTypePtr data_type);
std::unordered_map<size_t, PostgreSQLArrayInfo> & array_info, size_t column_idx, DataTypePtr data_type);
void insertDefaultPostgreSQLValue(IColumn & column, const IColumn & sample_column);

View File

@ -1192,6 +1192,7 @@ class IColumn;
FORMAT_FACTORY_SETTINGS(M, ALIAS) \
OBSOLETE_FORMAT_SETTINGS(M, ALIAS) \
/// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
DECLARE_SETTINGS_TRAITS_ALLOW_CUSTOM_SETTINGS(SettingsTraits, LIST_OF_SETTINGS)
@ -1236,6 +1237,7 @@ private:
/*
* User-specified file format settings for File and URL engines.
*/
/// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
DECLARE_SETTINGS_TRAITS(FormatFactorySettingsTraits, LIST_OF_ALL_FORMAT_SETTINGS)
struct FormatFactorySettings : public BaseSettings<FormatFactorySettingsTraits>

View File

@ -423,7 +423,7 @@ MutableColumns CacheDictionary<dictionary_key_type>::aggregateColumnsInOrderOfKe
const DictionaryStorageFetchRequest & request,
const MutableColumns & fetched_columns,
const PaddedPODArray<KeyState> & key_index_to_state,
IColumn::Filter * const default_mask) const
IColumn::Filter * default_mask) const
{
MutableColumns aggregated_columns = request.makeAttributesResultColumns();
@ -473,7 +473,7 @@ MutableColumns CacheDictionary<dictionary_key_type>::aggregateColumns(
const PaddedPODArray<KeyState> & key_index_to_fetched_columns_from_storage_result,
const MutableColumns & fetched_columns_during_update,
const HashMap<KeyType, size_t> & found_keys_to_fetched_columns_during_update_index,
IColumn::Filter * const default_mask) const
IColumn::Filter * default_mask) const
{
/**
* Aggregation of columns fetched from storage and from source during update.

View File

@ -162,7 +162,7 @@ private:
const DictionaryStorageFetchRequest & request,
const MutableColumns & fetched_columns,
const PaddedPODArray<KeyState> & key_index_to_state,
IColumn::Filter * const default_mask = nullptr) const;
IColumn::Filter * default_mask = nullptr) const;
MutableColumns aggregateColumns(
const PaddedPODArray<KeyType> & keys,

View File

@ -14,7 +14,7 @@ class IRegionsHierarchyReader
public:
virtual bool readNext(RegionEntry & entry) = 0;
virtual ~IRegionsHierarchyReader() {}
virtual ~IRegionsHierarchyReader() = default;
};
using IRegionsHierarchyReaderPtr = std::unique_ptr<IRegionsHierarchyReader>;

View File

@ -568,7 +568,7 @@ bool RegExpTreeDictionary::setAttributesShortCircuit(
const String & data,
std::unordered_set<UInt64> & visited_nodes,
const std::unordered_map<String, const DictionaryAttribute &> & attributes,
std::unordered_set<String> * const defaults) const
std::unordered_set<String> * defaults) const
{
if (visited_nodes.contains(id))
return attributes_to_set.attributesFull() == attributes.size();

View File

@ -210,7 +210,7 @@ private:
const String & data,
std::unordered_set<UInt64> & visited_nodes,
const std::unordered_map<String, const DictionaryAttribute &> & attributes,
std::unordered_set<String> * const defaults) const;
std::unordered_set<String> * defaults) const;
struct RegexTreeNode;
using RegexTreeNodePtr = std::shared_ptr<RegexTreeNode>;

View File

@ -13,10 +13,6 @@
#include <memory>
#if USE_EMBEDDED_COMPILER
# include <Core/ValuesWithType.h>
#endif
/// This file contains user interface for functions.
namespace llvm

View File

@ -63,6 +63,7 @@ enum class RemoteFSReadMethod
class MMappedFileCache;
class PageCache;
/// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
struct ReadSettings
{
/// Method to use reading from local filesystem.

View File

@ -905,7 +905,7 @@ Chunk AsynchronousInsertQueue::processEntriesWithParsing(
const InsertDataPtr & data,
const Block & header,
const ContextPtr & insert_context,
const LoggerPtr logger,
LoggerPtr logger,
LogFunc && add_to_async_insert_log)
{
size_t total_rows = 0;

View File

@ -265,7 +265,7 @@ private:
const InsertDataPtr & data,
const Block & header,
const ContextPtr & insert_context,
const LoggerPtr logger,
LoggerPtr logger,
LogFunc && add_to_async_insert_log);
template <typename LogFunc>

View File

@ -330,7 +330,7 @@ protected:
return *this;
}
void swap(QueryAccessInfo & rhs)
void swap(QueryAccessInfo & rhs) noexcept
{
std::swap(databases, rhs.databases);
std::swap(tables, rhs.tables);
@ -680,7 +680,7 @@ public:
void addSpecialScalar(const String & name, const Block & block);
const QueryAccessInfo & getQueryAccessInfo() const { return *getQueryAccessInfoPtr(); }
const QueryAccessInfoPtr getQueryAccessInfoPtr() const { return query_access_info; }
QueryAccessInfoPtr getQueryAccessInfoPtr() const { return query_access_info; }
void setQueryAccessInfo(QueryAccessInfoPtr other) { query_access_info = other; }
void addQueryAccessInfo(

View File

@ -23,7 +23,7 @@ struct ExternalLoadableLifetime
UInt64 max_sec = 0;
ExternalLoadableLifetime(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix);
ExternalLoadableLifetime() {}
ExternalLoadableLifetime() = default;
};
/// Get delay before trying to load again after error.

View File

@ -318,7 +318,7 @@ public:
~ProcessListEntry();
QueryStatusPtr getQueryStatus() { return *it; }
const QueryStatusPtr getQueryStatus() const { return *it; }
QueryStatusPtr getQueryStatus() const { return *it; }
};

View File

@ -59,7 +59,7 @@ public:
Chunk clone() const;
void swap(Chunk & other)
void swap(Chunk & other) noexcept
{
columns.swap(other.columns);
chunk_info.swap(other.chunk_info);

View File

@ -126,7 +126,7 @@ static void postprocessChunk(Chunk & chunk, const AggregatingSortedAlgorithm::Co
AggregatingSortedAlgorithm::SimpleAggregateDescription::SimpleAggregateDescription(
AggregateFunctionPtr function_, const size_t column_number_,
AggregateFunctionPtr function_, size_t column_number_,
DataTypePtr nested_type_, DataTypePtr real_type_)
: function(std::move(function_)), column_number(column_number_)
, nested_type(std::move(nested_type_)), real_type(std::move(real_type_))

View File

@ -110,7 +110,7 @@ protected:
return result;
}
uintptr_t ALWAYS_INLINE swap(std::atomic<Data *> & value, std::uintptr_t flags, std::uintptr_t mask)
uintptr_t ALWAYS_INLINE swap(std::atomic<Data *> & value, std::uintptr_t flags, std::uintptr_t mask) /// NOLINT
{
Data * expected = nullptr;
Data * desired = getPtr(flags | getUInt(data));

View File

@ -6,8 +6,8 @@ namespace DB
TTLUpdateInfoAlgorithm::TTLUpdateInfoAlgorithm(
const TTLExpressions & ttl_expressions_,
const TTLDescription & description_,
const TTLUpdateField ttl_update_field_,
const String ttl_update_key_,
TTLUpdateField ttl_update_field_,
String ttl_update_key_,
const TTLInfo & old_ttl_info_,
time_t current_time_,
bool force_)

View File

@ -22,8 +22,8 @@ public:
TTLUpdateInfoAlgorithm(
const TTLExpressions & ttl_expressions_,
const TTLDescription & description_,
const TTLUpdateField ttl_update_field_,
const String ttl_update_key_,
TTLUpdateField ttl_update_field_,
String ttl_update_key_,
const TTLInfo & old_ttl_info_,
time_t current_time_, bool force_
);

View File

@ -72,8 +72,8 @@ struct StorageInMemoryMetadata
StorageInMemoryMetadata(const StorageInMemoryMetadata & other);
StorageInMemoryMetadata & operator=(const StorageInMemoryMetadata & other);
StorageInMemoryMetadata(StorageInMemoryMetadata && other) = default;
StorageInMemoryMetadata & operator=(StorageInMemoryMetadata && other) = default;
StorageInMemoryMetadata(StorageInMemoryMetadata && other) = default; /// NOLINT
StorageInMemoryMetadata & operator=(StorageInMemoryMetadata && other) = default; /// NOLINT
/// NOTE: Thread unsafe part. You should not modify same StorageInMemoryMetadata
/// structure from different threads. It should be used as MultiVersion