enabled `readability-use-anyofallof` clang-tidy warning / added more checks to evaluate (#5339)

This commit is contained in:
Oliver Stöneberg 2023-08-31 09:04:51 +02:00 committed by GitHub
parent 7c992ced4c
commit e7dd9cd793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -66,8 +66,7 @@ Checks: >
-readability-magic-numbers,
-readability-redundant-access-specifiers,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix,
-readability-use-anyofallof
-readability-uppercase-literal-suffix
WarningsAsErrors: '*'
HeaderFilterRegex: '(cli|gui|lib|oss-fuzz|test|triage)\/[a-z]+\.h'
CheckOptions:

View File

@ -87,9 +87,6 @@ We intentionally use this.
Leads to lots of "false positives". This seem to enforce a coding guidelines of certain codebases.
`readability-use-anyofallof`<br/>
We currently don't even apply our own `useStlAlgorithm` findings.
`bugprone-easily-swappable-parameters`<br/>
@ -146,6 +143,15 @@ To be evaluated (need to remove exclusion).
`cppcoreguidelines-missing-std-forward`<br/>
`cppcoreguidelines-avoid-const-or-ref-data-members`<br/>
`cppcoreguidelines-macro-usage`<br/>
`cppcoreguidelines-pro-type-member-init`<br/>
`cppcoreguidelines-pro-type-static-cast-downcast`<br/>
`cppcoreguidelines-prefer-member-initializer`<br/>
`cppcoreguidelines-misleading-capture-default-by-value`<br/>
`bugprone-argument-comment.CommentBoolLiterals`<br/>
`cert-err33-c`<br/>
`google-readability-namespace-comments`<br/>
`cppcoreguidelines-special-member-functions`<br/>
To be evaluated (need to enable explicitly).

View File

@ -984,6 +984,7 @@ bool isAliasOf(const Token *tok, nonneg int varid, bool* inconclusive)
{
if (tok->varId() == varid)
return false;
// NOLINTNEXTLINE(readability-use-anyofallof) - TODO: fix this / also Cppcheck false negative
for (const ValueFlow::Value &val : tok->values()) {
if (!val.isLocalLifetimeValue())
continue;

View File

@ -3055,12 +3055,11 @@ struct SingleValueFlowAnalyzer : ValueFlowAnalyzer {
}
bool isGlobal() const override {
for (const auto&p:getVars()) {
const auto& vars = getVars();
return std::any_of(vars.cbegin(), vars.cend(), [] (const std::pair<nonneg int, const Variable*>& p) {
const Variable* var = p.second;
if (!var->isLocal() && !var->isArgument() && !var->isConst())
return true;
}
return false;
return !var->isLocal() && !var->isArgument() && !var->isConst();
});
}
bool lowerToPossible() override {
@ -5839,6 +5838,7 @@ static bool intersects(const C1& c1, const C2& c2)
{
if (c1.size() > c2.size())
return intersects(c2, c1);
// NOLINTNEXTLINE(readability-use-anyofallof) - TODO: fix if possible / also Cppcheck false negative
for (auto&& x : c1) {
if (c2.find(x) != c2.end())
return true;