fixed some clang-tidy warnings (#3080)
This commit is contained in:
parent
eb9c4b4aed
commit
c71033548f
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-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,-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,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-readability-misleading-indentation,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
||||
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-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,-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,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-modernize-use-equals-delete,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument'
|
||||
WarningsAsErrors: '*'
|
||||
CheckOptions:
|
||||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
|
|
|
@ -32,6 +32,7 @@ tools/extracttests
|
|||
*.suo
|
||||
*.user
|
||||
.vs/
|
||||
UpgradeLog*.htm
|
||||
|
||||
# VS build folders
|
||||
bin/
|
||||
|
|
|
@ -34,7 +34,7 @@ static std::string unhandledElement(const QXmlStreamReader &xmlReader)
|
|||
throw std::runtime_error(QObject::tr("line %1: Unhandled element %2").arg(xmlReader.lineNumber()).arg(xmlReader.name().toString()).toStdString());
|
||||
}
|
||||
|
||||
static std::string mandatoryAttibuteMissing(const QXmlStreamReader &xmlReader, QString attributeName)
|
||||
static std::string mandatoryAttibuteMissing(const QXmlStreamReader &xmlReader, const QString& attributeName)
|
||||
{
|
||||
throw std::runtime_error(QObject::tr("line %1: Mandatory attribute '%2' missing in '%3'")
|
||||
.arg(xmlReader.lineNumber())
|
||||
|
|
|
@ -72,7 +72,7 @@ std::string Path::fromNativeSeparators(std::string path)
|
|||
|
||||
std::string Path::simplifyPath(std::string originalPath)
|
||||
{
|
||||
return simplecpp::simplifyPath(originalPath);
|
||||
return simplecpp::simplifyPath(std::move(originalPath));
|
||||
}
|
||||
|
||||
std::string Path::getPathFromFilename(const std::string &filename)
|
||||
|
|
|
@ -1310,20 +1310,20 @@ void SymbolDatabase::createSymbolDatabaseSetVariablePointers()
|
|||
void SymbolDatabase::createSymbolDatabaseEnums()
|
||||
{
|
||||
// fill in enumerators in enum
|
||||
for (std::list<Scope>::iterator it = scopeList.begin(); it != scopeList.end(); ++it) {
|
||||
if (it->type != Scope::eEnum)
|
||||
for (Scope &scope : scopeList) {
|
||||
if (scope.type != Scope::eEnum)
|
||||
continue;
|
||||
|
||||
// add enumerators to enumerator tokens
|
||||
for (Enumerator & i : it->enumeratorList)
|
||||
for (Enumerator & i : scope.enumeratorList)
|
||||
const_cast<Token *>(i.name)->enumerator(&i);
|
||||
}
|
||||
|
||||
for (std::list<Scope>::iterator it = scopeList.begin(); it != scopeList.end(); ++it) {
|
||||
if (it->type != Scope::eEnum)
|
||||
for (Scope &scope : scopeList) {
|
||||
if (scope.type != Scope::eEnum)
|
||||
continue;
|
||||
|
||||
for (Enumerator & enumerator : it->enumeratorList) {
|
||||
for (Enumerator & enumerator : scope.enumeratorList) {
|
||||
// look for initialization tokens that can be converted to enumerators and convert them
|
||||
if (enumerator.start) {
|
||||
if (!enumerator.end)
|
||||
|
|
|
@ -211,7 +211,7 @@ void TokenList::deleteTokens(Token *tok)
|
|||
// add a token.
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TokenList::addtoken(std::string str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split)
|
||||
void TokenList::addtoken(const std::string& str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split)
|
||||
{
|
||||
if (str.empty())
|
||||
return;
|
||||
|
@ -244,7 +244,7 @@ void TokenList::addtoken(std::string str, const nonneg int lineno, const nonneg
|
|||
mTokensFrontBack.back->fileIndex(fileno);
|
||||
}
|
||||
|
||||
void TokenList::addtoken(std::string str, const Token *locationTok)
|
||||
void TokenList::addtoken(const std::string& str, const Token *locationTok)
|
||||
{
|
||||
if (str.empty())
|
||||
return;
|
||||
|
|
|
@ -70,8 +70,8 @@ public:
|
|||
*/
|
||||
static void deleteTokens(Token *tok);
|
||||
|
||||
void addtoken(std::string str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split = false);
|
||||
void addtoken(std::string str, const Token *locationTok);
|
||||
void addtoken(const std::string& str, const nonneg int lineno, const nonneg int column, const nonneg int fileno, bool split = false);
|
||||
void addtoken(const std::string& str, const Token *locationTok);
|
||||
|
||||
void addtoken(const Token *tok, const nonneg int lineno, const nonneg int column, const nonneg int fileno);
|
||||
void addtoken(const Token *tok, const Token *locationTok);
|
||||
|
|
|
@ -1807,7 +1807,7 @@ static void valueFlowGlobalStaticVar(TokenList *tokenList, const Settings *setti
|
|||
static Analyzer::Result valueFlowForward(Token* startToken,
|
||||
const Token* endToken,
|
||||
const Token* exprTok,
|
||||
std::list<ValueFlow::Value> values,
|
||||
const std::list<ValueFlow::Value>& values,
|
||||
TokenList* const tokenlist,
|
||||
const Settings* settings);
|
||||
|
||||
|
@ -1815,7 +1815,7 @@ static void valueFlowReverse(TokenList* tokenlist,
|
|||
Token* tok,
|
||||
const Token* const varToken,
|
||||
ValueFlow::Value val,
|
||||
ValueFlow::Value val2,
|
||||
const ValueFlow::Value& val2,
|
||||
ErrorLogger* errorLogger,
|
||||
const Settings* settings);
|
||||
|
||||
|
@ -3026,7 +3026,7 @@ ValuePtr<Analyzer> makeAnalyzer(const Token* exprTok, ValueFlow::Value value, co
|
|||
static Analyzer::Result valueFlowForward(Token* startToken,
|
||||
const Token* endToken,
|
||||
const Token* exprTok,
|
||||
std::list<ValueFlow::Value> values,
|
||||
const std::list<ValueFlow::Value>& values,
|
||||
TokenList* const tokenlist,
|
||||
const Settings* settings)
|
||||
{
|
||||
|
@ -3067,7 +3067,7 @@ static void valueFlowReverse(TokenList* tokenlist,
|
|||
Token* tok,
|
||||
const Token* const varToken,
|
||||
ValueFlow::Value val,
|
||||
ValueFlow::Value val2,
|
||||
const ValueFlow::Value& val2,
|
||||
ErrorLogger* /*errorLogger*/,
|
||||
const Settings* settings)
|
||||
{
|
||||
|
|
|
@ -147,7 +147,7 @@ void MainWindow::refreshResults()
|
|||
filter(ui->version->currentText());
|
||||
}
|
||||
|
||||
void MainWindow::filter(QString filter)
|
||||
void MainWindow::filter(const QString& filter)
|
||||
{
|
||||
QStringList allErrors;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
public slots:
|
||||
void loadFile();
|
||||
void loadFromClipboard();
|
||||
void filter(QString filter);
|
||||
void filter(const QString& filter);
|
||||
void showResult(QListWidgetItem *item);
|
||||
void refreshResults();
|
||||
void fileTreeFilter(const QString &str);
|
||||
|
|
Loading…
Reference in New Issue