diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2024-02-18 20:03:52 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2024-02-23 15:24:12 +0000 |
commit | c59665eebda0e18995432e55b43d7a3beadcb913 (patch) | |
tree | 50917a9bb7f725a3e75ad9e30b50673b4dd2f0d7 | |
parent | 60a18f09fa547af064fb851e72b816ee25bf71a3 (diff) |
clang-tidy: fix 'readability-simplify-boolean-expr'
Change-Id: I65a98c0f6b80773b1e8a30e6db7df3a63b521570
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/parser/qmljslexer.cpp | 6 | ||||
-rw-r--r-- | src/lib/corelib/tools/clangclinfo.cpp | 2 | ||||
-rw-r--r-- | src/lib/corelib/tools/settingsmodel.cpp | 8 | ||||
-rw-r--r-- | src/lib/pkgconfig/pcparser.cpp | 6 | ||||
-rw-r--r-- | src/plugins/scanner/cpp/Lexer.cpp | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/src/lib/corelib/parser/qmljslexer.cpp b/src/lib/corelib/parser/qmljslexer.cpp index 684be9317..e148652ad 100644 --- a/src/lib/corelib/parser/qmljslexer.cpp +++ b/src/lib/corelib/parser/qmljslexer.cpp @@ -1071,7 +1071,7 @@ bool Lexer::scanDirectives(Directives *directives) const int lineNumber = tokenStartLine(); - if (! (_tokenKind == T_IDENTIFIER || _tokenKind == T_RESERVED_WORD)) + if (_tokenKind != T_IDENTIFIER && _tokenKind != T_RESERVED_WORD) return false; // expected a valid QML/JS directive const QString directiveName = tokenText(); @@ -1083,7 +1083,7 @@ bool Lexer::scanDirectives(Directives *directives) // it must be a pragma or an import directive. if (directiveName == QLatin1String("pragma")) { // .pragma library - if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) + if (lex() != T_IDENTIFIER || tokenText() != QLatin1String("library")) return false; // expected `library // we found a .pragma library directive @@ -1126,7 +1126,7 @@ bool Lexer::scanDirectives(Directives *directives) // // recognize the mandatory `as' followed by the module name // - if (! (lex() == T_RESERVED_WORD && tokenText() == QLatin1String("as"))) + if (lex() != T_RESERVED_WORD || tokenText() != QLatin1String("as")) return false; // expected `as' if (lex() != T_IDENTIFIER) diff --git a/src/lib/corelib/tools/clangclinfo.cpp b/src/lib/corelib/tools/clangclinfo.cpp index d89c5cb9b..fd907ebf1 100644 --- a/src/lib/corelib/tools/clangclinfo.cpp +++ b/src/lib/corelib/tools/clangclinfo.cpp @@ -47,7 +47,7 @@ static std::vector<MSVCInstallInfo> compatibleMsvcs(Logger &logger) return true; bool ok = false; const int major = versions.at(0).toInt(&ok); - return !(ok && major >= 15); // support MSVC2017 and above + return !ok || major < 15; // support MSVC2017 and above }; Internal::removeIf(msvcs, filter); for (const auto &msvc: msvcs) { diff --git a/src/lib/corelib/tools/settingsmodel.cpp b/src/lib/corelib/tools/settingsmodel.cpp index e3c995db3..4fa0e14da 100644 --- a/src/lib/corelib/tools/settingsmodel.cpp +++ b/src/lib/corelib/tools/settingsmodel.cpp @@ -281,10 +281,10 @@ bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int const QString valueString = value.toString(); QString *toChange = nullptr; if (index.column() == keyColumn() && !valueString.isEmpty() - && !node->parent->hasDirectChildWithName(valueString) - && !(node->parent->parent == &d->rootNode - && node->parent->name == Internal::StringConstants::profilesSettingsKey() - && valueString == Profile::fallbackName())) { + && !node->parent->hasDirectChildWithName(valueString) + && (node->parent->parent != &d->rootNode + || node->parent->name != Internal::StringConstants::profilesSettingsKey() + || valueString != Profile::fallbackName())) { toChange = &node->name; } else if (index.column() == valueColumn() && valueString != node->value) { toChange = &node->value; diff --git a/src/lib/pkgconfig/pcparser.cpp b/src/lib/pkgconfig/pcparser.cpp index 4469ca193..e44f293e5 100644 --- a/src/lib/pkgconfig/pcparser.cpp +++ b/src/lib/pkgconfig/pcparser.cpp @@ -722,10 +722,8 @@ void PcParser::parseLine(PcPackage &pkg, std::string_view str) size_t pos = 0; for (; pos < s.size(); ++pos) { auto p = s.data() + pos; - if (!((*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - (*p >= '0' && *p <= '9') || - *p == '_' || *p == '.')) { + if ((*p < 'A' || *p > 'Z') && (*p < 'a' || *p > 'z') && (*p < '0' || *p > '9') + && *p != '_' && *p != '.') { break; } } diff --git a/src/plugins/scanner/cpp/Lexer.cpp b/src/plugins/scanner/cpp/Lexer.cpp index ebf843aca..6793080e9 100644 --- a/src/plugins/scanner/cpp/Lexer.cpp +++ b/src/plugins/scanner/cpp/Lexer.cpp @@ -564,7 +564,7 @@ void Lexer::scan_helper(Token *tok) do { yyinp(); - if (! (isalnum(_yychar) || _yychar == '_' || _yychar == '$')) + if (!isalnum(_yychar) && _yychar != '_' && _yychar != '$') break; } while (_yychar); |