fixes for Clang and clang-tidy 10 (#2588)
* clang_tidy.cmake: added clang-tidy-10 to program list * fixed -Wrange-loop-construct Clang warnings * fixed readability-qualified-auto clang-tidy warnings * .clang-tidy: actually disable clang-analyzer-* warnings * .clang-tidy: disabled some new warnings introduced with clang-tidy-10
This commit is contained in:
parent
ac45bf7af2
commit
1dd8d4afaf
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
Checks: '*,-abseil-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-llvm-*,-linuxkernel-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-modernize-use-using,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-readability-static-accessed-through-instance,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-performance-for-range-copy,-misc-throw-by-value-catch-by-reference,-modernize-use-bool-literals,-readability-avoid-const-params-in-decls,-readability-redundant-control-flow,-bugprone-argument-comment,-readability-redundant-string-cstr,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-performance-unnecessary-copy-initialization,-readability-redundant-string-init,-bugprone-suspicious-string-compare,-bugprone-use-after-move,-readability-misleading-indentation,-misc-unused-parameters-,clang-analyzer-*'
|
||||
Checks: '*,-abseil-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-llvm-*,-linuxkernel-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-modernize-use-using,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-use-override,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-misc-unused-using-decls,-modernize-use-emplace,-readability-const-return-type,-performance-unnecessary-value-param,-readability-static-accessed-through-instance,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-performance-for-range-copy,-misc-throw-by-value-catch-by-reference,-modernize-use-bool-literals,-readability-avoid-const-params-in-decls,-readability-redundant-control-flow,-bugprone-argument-comment,-readability-redundant-string-cstr,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-performance-unnecessary-copy-initialization,-readability-redundant-string-init,-bugprone-suspicious-string-compare,-bugprone-use-after-move,-readability-misleading-indentation,-misc-unused-parameters-,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const'
|
||||
CheckOptions:
|
||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: '1'
|
|
@ -1,4 +1,4 @@
|
|||
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-9 clang-tidy-8)
|
||||
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-10 clang-tidy-9 clang-tidy-8)
|
||||
message(STATUS "CLANG_TIDY=${CLANG_TIDY}")
|
||||
if (CLANG_TIDY)
|
||||
set(CLANG_TIDY_SRCS ${CMAKE_SOURCE_DIR}/cli/*.cpp ${CMAKE_SOURCE_DIR}/lib/*.cpp)
|
||||
|
|
|
@ -462,7 +462,7 @@ ExprEngine::ConditionalValue::Vector ExprEngine::ArrayValue::read(ExprEngine::Va
|
|||
ExprEngine::ConditionalValue::Vector ret;
|
||||
if (!index)
|
||||
return ret;
|
||||
for (const auto indexAndValue : data) {
|
||||
for (const auto &indexAndValue : data) {
|
||||
if (::isEqual(index, indexAndValue.index))
|
||||
ret.clear();
|
||||
if (isNonOverlapping(index, indexAndValue.index))
|
||||
|
@ -542,7 +542,7 @@ std::string ExprEngine::ArrayValue::getSymbolicExpression() const
|
|||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << "size=" << (size ? size->name : std::string("(null)"));
|
||||
for (const auto indexAndValue : data) {
|
||||
for (const auto &indexAndValue : data) {
|
||||
ostr << ",["
|
||||
<< (!indexAndValue.index ? std::string(":") : indexAndValue.index->name)
|
||||
<< "]="
|
||||
|
|
|
@ -250,11 +250,11 @@ void Token::swapWithNext()
|
|||
std::swap(mTokType, mNext->mTokType);
|
||||
std::swap(mFlags, mNext->mFlags);
|
||||
std::swap(mImpl, mNext->mImpl);
|
||||
for (auto templateSimplifierPointer : mImpl->mTemplateSimplifierPointers) {
|
||||
for (auto *templateSimplifierPointer : mImpl->mTemplateSimplifierPointers) {
|
||||
templateSimplifierPointer->token(this);
|
||||
}
|
||||
|
||||
for (auto templateSimplifierPointer : mNext->mImpl->mTemplateSimplifierPointers) {
|
||||
for (auto *templateSimplifierPointer : mNext->mImpl->mTemplateSimplifierPointers) {
|
||||
templateSimplifierPointer->token(mNext);
|
||||
}
|
||||
if (mNext->mLink)
|
||||
|
@ -273,7 +273,7 @@ void Token::takeData(Token *fromToken)
|
|||
delete mImpl;
|
||||
mImpl = fromToken->mImpl;
|
||||
fromToken->mImpl = nullptr;
|
||||
for (auto templateSimplifierPointer : mImpl->mTemplateSimplifierPointers) {
|
||||
for (auto *templateSimplifierPointer : mImpl->mTemplateSimplifierPointers) {
|
||||
templateSimplifierPointer->token(this);
|
||||
}
|
||||
mLink = fromToken->mLink;
|
||||
|
@ -2105,7 +2105,7 @@ TokenImpl::~TokenImpl()
|
|||
delete mValueType;
|
||||
delete mValues;
|
||||
|
||||
for (auto templateSimplifierPointer : mTemplateSimplifierPointers) {
|
||||
for (auto *templateSimplifierPointer : mTemplateSimplifierPointers) {
|
||||
templateSimplifierPointer->token(nullptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -2876,7 +2876,7 @@ void Tokenizer::simplifyCaseRange()
|
|||
|
||||
void Tokenizer::calculateScopes()
|
||||
{
|
||||
for (auto tok = list.front(); tok; tok = tok->next())
|
||||
for (auto *tok = list.front(); tok; tok = tok->next())
|
||||
tok->scopeInfo(nullptr);
|
||||
|
||||
std::string nextScopeNameAddition;
|
||||
|
|
|
@ -100,7 +100,7 @@ private:
|
|||
std::function<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> f = [&](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) {
|
||||
if (tok->str() != binop)
|
||||
return;
|
||||
auto b = dynamic_cast<const ExprEngine::BinOpResult *>(&value);
|
||||
const auto *b = dynamic_cast<const ExprEngine::BinOpResult *>(&value);
|
||||
if (!b)
|
||||
return;
|
||||
if (!ret.empty())
|
||||
|
|
Loading…
Reference in New Issue