Fix vulnerable code related to std::move and noexcept

This commit fixes the vulnerable code related to std::move and noexcept identified by clangtidy tool.
This commit is contained in:
mreddy017 2022-02-17 07:56:42 -08:00 committed by Maksim Kita
parent d4cdf04683
commit f893002b69
7 changed files with 11 additions and 9 deletions

View File

@ -33,6 +33,8 @@ Checks: '-*,
performance-no-automatic-move,
performance-trivially-destructible,
performance-unnecessary-copy-initialization,
performance-noexcept-move-constructor,
performance-move-const-arg,
readability-avoid-const-params-in-decls,
readability-const-return-type,

View File

@ -761,9 +761,9 @@ private:
FileDescriptor() = default;
FileDescriptor(FileDescriptor && rhs) : fd(rhs.fd) { rhs.fd = -1; }
FileDescriptor(FileDescriptor && rhs) noexcept : fd(rhs.fd) { rhs.fd = -1; }
FileDescriptor & operator=(FileDescriptor && rhs)
FileDescriptor & operator=(FileDescriptor && rhs) noexcept
{
if (this == &rhs)
return *this;

View File

@ -1062,7 +1062,7 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create)
QualifiedTableName qualified_name{database_name, create.getTable()};
TableNamesSet loading_dependencies = getDependenciesSetFromCreateQuery(getContext()->getGlobalContext(), qualified_name, query_ptr);
if (!loading_dependencies.empty())
DatabaseCatalog::instance().addLoadingDependencies(std::move(qualified_name), std::move(loading_dependencies));
DatabaseCatalog::instance().addLoadingDependencies(qualified_name, std::move(loading_dependencies));
return fillTableIfNeeded(create);
}

View File

@ -23,7 +23,7 @@ void BlockIO::reset()
/// TODO Do we need also reset callbacks? In which order?
}
BlockIO & BlockIO::operator= (BlockIO && rhs)
BlockIO & BlockIO::operator= (BlockIO && rhs) noexcept
{
if (this == &rhs)
return *this;

View File

@ -14,7 +14,7 @@ struct BlockIO
BlockIO() = default;
BlockIO(BlockIO &&) = default;
BlockIO & operator= (BlockIO && rhs);
BlockIO & operator= (BlockIO && rhs) noexcept;
~BlockIO();
BlockIO(const BlockIO &) = delete;

View File

@ -105,8 +105,8 @@ MergedBlockOutputStream::Finalizer::~Finalizer()
}
}
MergedBlockOutputStream::Finalizer::Finalizer(Finalizer &&) = default;
MergedBlockOutputStream::Finalizer & MergedBlockOutputStream::Finalizer::operator=(Finalizer &&) = default;
MergedBlockOutputStream::Finalizer::Finalizer(Finalizer &&) noexcept = default;
MergedBlockOutputStream::Finalizer & MergedBlockOutputStream::Finalizer::operator=(Finalizer &&) noexcept = default;
MergedBlockOutputStream::Finalizer::Finalizer(std::unique_ptr<Impl> impl_) : impl(std::move(impl_)) {}
void MergedBlockOutputStream::finalizePart(

View File

@ -42,8 +42,8 @@ public:
explicit Finalizer(std::unique_ptr<Impl> impl_);
~Finalizer();
Finalizer(Finalizer &&);
Finalizer & operator=(Finalizer &&);
Finalizer(Finalizer &&) noexcept;
Finalizer & operator=(Finalizer &&) noexcept;
void finish();
};