diff --git a/cli/processexecutor.h b/cli/processexecutor.h index b8ed621a4..4c72c3ffc 100644 --- a/cli/processexecutor.h +++ b/cli/processexecutor.h @@ -39,7 +39,7 @@ class ProcessExecutor : public Executor { public: ProcessExecutor(const std::map &files, Settings &settings, ErrorLogger &errorLogger); ProcessExecutor(const ProcessExecutor &) = delete; - ~ProcessExecutor(); + ~ProcessExecutor() override; void operator=(const ProcessExecutor &) = delete; unsigned int check() override; diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index 1637854bf..5f4d8a8f1 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -41,7 +41,7 @@ class ThreadExecutor : public Executor { public: ThreadExecutor(const std::map &files, Settings &settings, ErrorLogger &errorLogger); ThreadExecutor(const ThreadExecutor &) = delete; - ~ThreadExecutor(); + ~ThreadExecutor() override; void operator=(const ThreadExecutor &) = delete; unsigned int check() override; diff --git a/gui/checkthread.h b/gui/checkthread.h index d2ac7c43d..5b60bacdf 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -95,6 +95,7 @@ signals: */ void done(); + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void fileChecked(const QString &file); protected: diff --git a/gui/codeeditstylecontrols.h b/gui/codeeditstylecontrols.h index 77e43bf2c..c35584e4f 100644 --- a/gui/codeeditstylecontrols.h +++ b/gui/codeeditstylecontrols.h @@ -40,6 +40,7 @@ public: const QColor& getColor(); signals: + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void colorChanged(const QColor& newColor); public slots: @@ -61,6 +62,7 @@ public: const QFont::Weight& getWeight(); signals: + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void weightChanged(const QFont::Weight& newWeight); public slots: diff --git a/gui/erroritem.h b/gui/erroritem.h index 7bebde0dc..93d2ab912 100644 --- a/gui/erroritem.h +++ b/gui/erroritem.h @@ -102,6 +102,7 @@ public: static bool sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2); }; +// NOLINTNEXTLINE(performance-no-int-to-ptr) Q_DECLARE_METATYPE(ErrorItem) /** diff --git a/gui/resultstree.h b/gui/resultstree.h index 6f0c6800e..5aec10135 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -188,6 +188,7 @@ signals: * * @param hidden true if there are some hidden results, or false if there are not */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void resultsHidden(bool hidden); /** @@ -195,6 +196,7 @@ signals: * * @param selectedItems list of selected files */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void checkSelected(QStringList selectedItems); /** @@ -202,9 +204,11 @@ signals: * * @param current Model index to specify new selected item. */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void treeSelectionChanged(const QModelIndex ¤t); /** Suppress Ids */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void suppressIds(QStringList ids); public slots: diff --git a/gui/resultsview.h b/gui/resultsview.h index 93ae0870d..cac574e1a 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -212,6 +212,7 @@ signals: * * @param hidden true if there are some hidden results, or false if there are not */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void resultsHidden(bool hidden); /** @@ -219,9 +220,11 @@ signals: * * @param selectedFilesList list of selected files */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void checkSelected(QStringList selectedFilesList); /** Suppress Ids */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void suppressIds(QStringList ids); /** @@ -231,6 +234,7 @@ signals: * @param type Type of error to show/hide * @param show Should specified errors be shown (true) or hidden (false) */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void showResults(ShowTypes::ShowType type, bool show); /** @@ -239,6 +243,7 @@ signals: * * @param show Should specified errors be shown (true) or hidden (false) */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void showCppcheckResults(bool show); /** @@ -247,6 +252,7 @@ signals: * * @param show Should specified errors be shown (true) or hidden (false) */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void showClangResults(bool show); /** diff --git a/gui/threadhandler.h b/gui/threadhandler.h index 7fe846360..5ba1edb8a 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -184,8 +184,10 @@ signals: */ void done(); + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void log(const QString &msg); + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void debugError(const ErrorItem &item); public slots: diff --git a/gui/threadresult.h b/gui/threadresult.h index 1895a2e0c..850b2b86b 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -93,6 +93,7 @@ signals: * @param value Current progress * @param description Description of the current stage */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void progress(int value, const QString& description); /** @@ -100,6 +101,7 @@ signals: * * @param item Error data */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void error(const ErrorItem &item); /** @@ -107,6 +109,7 @@ signals: * * @param logline Log line */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void log(const QString &logline); /** @@ -114,6 +117,7 @@ signals: * * @param item Error data */ + // NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code void debugError(const ErrorItem &item); protected: diff --git a/lib/check.h b/lib/check.h index 43c91f1d2..6278a2caf 100644 --- a/lib/check.h +++ b/lib/check.h @@ -26,6 +26,7 @@ #include #include +#include namespace tinyxml2 { class XMLElement; @@ -61,8 +62,8 @@ public: explicit Check(const std::string &aname); /** This constructor is used when running checks. */ - Check(const std::string &aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) - : mTokenizer(tokenizer), mSettings(settings), mErrorLogger(errorLogger), mName(aname) {} + Check(std::string aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + : mTokenizer(tokenizer), mSettings(settings), mErrorLogger(errorLogger), mName(std::move(aname)) {} virtual ~Check() { if (!mTokenizer) diff --git a/lib/ctu.h b/lib/ctu.h index 1ab2a2f17..737059c87 100644 --- a/lib/ctu.h +++ b/lib/ctu.h @@ -31,6 +31,7 @@ #include #include #include +#include #include class Function; @@ -57,7 +58,7 @@ namespace CTU { struct Location { Location() = default; Location(const Tokenizer *tokenizer, const Token *tok); - Location(const std::string &fileName, nonneg int lineNumber, nonneg int column) : fileName(fileName), lineNumber(lineNumber), column(column) {} + Location(std::string fileName, nonneg int lineNumber, nonneg int column) : fileName(std::move(fileName)), lineNumber(lineNumber), column(column) {} std::string fileName; nonneg int lineNumber{}; nonneg int column{}; @@ -65,7 +66,7 @@ namespace CTU { struct UnsafeUsage { UnsafeUsage() = default; - UnsafeUsage(const std::string &myId, nonneg int myArgNr, const std::string &myArgumentName, const Location &location, MathLib::bigint value) : myId(myId), myArgNr(myArgNr), myArgumentName(myArgumentName), location(location), value(value) {} + UnsafeUsage(std::string myId, nonneg int myArgNr, std::string myArgumentName, Location location, MathLib::bigint value) : myId(std::move(myId)), myArgNr(myArgNr), myArgumentName(std::move(myArgumentName)), location(std::move(location)), value(value) {} std::string myId; nonneg int myArgNr{}; std::string myArgumentName; @@ -77,8 +78,8 @@ namespace CTU { class CallBase { public: CallBase() = default; - CallBase(const std::string &callId, int callArgNr, const std::string &callFunctionName, const Location &loc) - : callId(callId), callArgNr(callArgNr), callFunctionName(callFunctionName), location(loc) + CallBase(std::string callId, int callArgNr, std::string callFunctionName, Location loc) + : callId(std::move(callId)), callArgNr(callArgNr), callFunctionName(std::move(callFunctionName)), location(std::move(loc)) {} CallBase(const Tokenizer *tokenizer, const Token *callToken); virtual ~CallBase() {} @@ -107,9 +108,9 @@ namespace CTU { public: NestedCall() = default; - NestedCall(const std::string &myId, nonneg int myArgNr, const std::string &callId, nonneg int callArgnr, const std::string &callFunctionName, const Location &location) + NestedCall(std::string myId, nonneg int myArgNr, const std::string &callId, nonneg int callArgnr, const std::string &callFunctionName, const Location &location) : CallBase(callId, callArgnr, callFunctionName, location), - myId(myId), + myId(std::move(myId)), myArgNr(myArgNr) {} NestedCall(const Tokenizer *tokenizer, const Function *myFunction, const Token *callToken); diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 9056642b2..0b7147cbb 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -30,6 +30,7 @@ #include #include #include +#include #include /** @@ -72,8 +73,8 @@ public: FileLocation(const std::string &file, int line, unsigned int column) : fileIndex(0), line(line), column(column), mOrigFileName(file), mFileName(file) {} - FileLocation(const std::string &file, const std::string &info, int line, unsigned int column) - : fileIndex(0), line(line), column(column), mOrigFileName(file), mFileName(file), mInfo(info) {} + FileLocation(const std::string &file, std::string info, int line, unsigned int column) + : fileIndex(0), line(line), column(column), mOrigFileName(file), mFileName(file), mInfo(std::move(info)) {} FileLocation(const Token* tok, const TokenList* tokenList); FileLocation(const Token* tok, std::string info, const TokenList* tokenList); diff --git a/lib/programmemory.h b/lib/programmemory.h index 0e2202e32..4cf37d8fc 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -28,6 +28,7 @@ #include #include #include +#include class Token; class Settings; @@ -66,7 +67,7 @@ struct ProgramMemory { ProgramMemory() = default; - explicit ProgramMemory(const Map& values) : mValues(values) {} + explicit ProgramMemory(Map values) : mValues(std::move(values)) {} void setValue(const Token* expr, const ValueFlow::Value& value); const ValueFlow::Value* getValue(nonneg int exprid, bool impossible = false) const; diff --git a/lib/suppressions.h b/lib/suppressions.h index 360f0f527..824d0bf50 100644 --- a/lib/suppressions.h +++ b/lib/suppressions.h @@ -27,6 +27,7 @@ #include #include #include +#include #include /// @addtogroup Core @@ -57,7 +58,7 @@ public: Suppression(const Suppression &other) { *this = other; } - Suppression(const std::string &id, const std::string &file, int line=NO_LINE) : errorId(id), fileName(file), lineNumber(line), hash(0), thisAndNextLine(false), matched(false), checked(false) {} + Suppression(std::string id, std::string file, int line=NO_LINE) : errorId(std::move(id)), fileName(std::move(file)), lineNumber(line), hash(0), thisAndNextLine(false), matched(false), checked(false) {} Suppression & operator=(const Suppression &other) { errorId = other.errorId; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 63a76b325..a94d1fc58 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1304,7 +1304,7 @@ public: containerTypeToken(nullptr), debugPath() {} - ValueType(enum Sign s, enum Type t, nonneg int p, nonneg int c, const std::string& otn) + ValueType(enum Sign s, enum Type t, nonneg int p, nonneg int c, std::string otn) : sign(s), type(t), bits(0), @@ -1316,7 +1316,7 @@ public: smartPointer(nullptr), container(nullptr), containerTypeToken(nullptr), - originalTypeName(otn), + originalTypeName(std::move(otn)), debugPath() {} diff --git a/lib/token.h b/lib/token.h index 992e65b20..974d10c9a 100644 --- a/lib/token.h +++ b/lib/token.h @@ -59,7 +59,7 @@ struct TokensFrontBack { }; struct ScopeInfo2 { - ScopeInfo2(const std::string &name_, const Token *bodyEnd_, const std::set &usingNamespaces_ = std::set()) : name(name_), bodyEnd(bodyEnd_), usingNamespaces(usingNamespaces_) {} + ScopeInfo2(std::string name_, const Token *bodyEnd_, std::set usingNamespaces_ = std::set()) : name(std::move(name_)), bodyEnd(bodyEnd_), usingNamespaces(std::move(usingNamespaces_)) {} std::string name; const Token * const bodyEnd; std::set usingNamespaces; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 51544b2cf..85478177b 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3348,7 +3348,7 @@ void Tokenizer::calculateScopes() tok->scopeInfo(nullptr); std::string nextScopeNameAddition; - std::shared_ptr primaryScope = std::make_shared(emptyString, nullptr); + std::shared_ptr primaryScope = std::make_shared("", nullptr); list.front()->scopeInfo(primaryScope); for (Token* tok = list.front(); tok; tok = tok->next()) { diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 16164ae78..3ea24c66a 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -116,6 +116,7 @@ public: const Token *front() const { return mTokensFrontBack.front; } + // NOLINTNEXTLINE(readability-make-member-function-const) - do not allow usage of mutable pointer from const object Token *front() { return mTokensFrontBack.front; } @@ -124,6 +125,7 @@ public: const Token *back() const { return mTokensFrontBack.back; } + // NOLINTNEXTLINE(readability-make-member-function-const) - do not allow usage of mutable pointer from const object Token *back() { return mTokensFrontBack.back; } diff --git a/test/testutils.h b/test/testutils.h index b7eb9b58b..5ece4a58f 100644 --- a/test/testutils.h +++ b/test/testutils.h @@ -30,6 +30,7 @@ #include #include // IWYU pragma: keep #include +#include class Token; @@ -72,7 +73,7 @@ private: class ScopedFile { public: - ScopedFile(const std::string &name, const std::string &content) : mName(name) { + ScopedFile(std::string name, const std::string &content) : mName(std::move(name)) { std::ofstream of(mName); of << content; }