Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/processexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ProcessExecutor : public Executor {
public:
ProcessExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
ProcessExecutor(const ProcessExecutor &) = delete;
~ProcessExecutor();
~ProcessExecutor() override;
void operator=(const ProcessExecutor &) = delete;

unsigned int check() override;
Expand Down
2 changes: 1 addition & 1 deletion cli/threadexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ThreadExecutor : public Executor {
public:
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
ThreadExecutor(const ThreadExecutor &) = delete;
~ThreadExecutor();
~ThreadExecutor() override;
void operator=(const ThreadExecutor &) = delete;

unsigned int check() override;
Expand Down
1 change: 1 addition & 0 deletions gui/checkthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CheckThread : public QThread {
*/
void done();

// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void fileChecked(const QString &file);
protected:

Expand Down
2 changes: 2 additions & 0 deletions gui/codeeditstylecontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SelectColorButton : public QPushButton {
const QColor& getColor();

signals:
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void colorChanged(const QColor& newColor);

public slots:
Expand All @@ -61,6 +62,7 @@ class SelectFontWeightCombo : public QComboBox {
const QFont::Weight& getWeight();

signals:
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void weightChanged(const QFont::Weight& newWeight);

public slots:
Expand Down
1 change: 1 addition & 0 deletions gui/erroritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class ErrorItem {
static bool sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2);
};

// NOLINTNEXTLINE(performance-no-int-to-ptr)
Q_DECLARE_METATYPE(ErrorItem)

/**
Expand Down
4 changes: 4 additions & 0 deletions gui/resultstree.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,27 @@ class ResultsTree : public QTreeView {
*
* @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);

/**
* @brief Signal to perform selected files recheck
*
* @param selectedItems list of selected files
*/
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void checkSelected(QStringList selectedItems);

/**
* @brief Signal for selection change in result tree.
*
* @param current Model index to specify new selected item.
*/
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void treeSelectionChanged(const QModelIndex &current);

/** Suppress Ids */
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void suppressIds(QStringList ids);

public slots:
Expand Down
6 changes: 6 additions & 0 deletions gui/resultsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,19 @@ class ResultsView : public QWidget {
*
* @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);

/**
* @brief Signal to perform recheck of selected files
*
* @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);

/**
Expand All @@ -231,6 +234,7 @@ class ResultsView : public QWidget {
* @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);

/**
Expand All @@ -239,6 +243,7 @@ class ResultsView : public QWidget {
*
* @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);

/**
Expand All @@ -247,6 +252,7 @@ class ResultsView : public QWidget {
*
* @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);

/**
Expand Down
2 changes: 2 additions & 0 deletions gui/threadhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ class ThreadHandler : public QObject {
*/
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:
Expand Down
4 changes: 4 additions & 0 deletions gui/threadresult.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,31 @@ public slots:
* @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);

/**
* @brief Signal of a new error
*
* @param item Error data
*/
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void error(const ErrorItem &item);

/**
* @brief Signal of a new log message
*
* @param logline Log line
*/
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void log(const QString &logline);

/**
* @brief Signal of a debug error
*
* @param item Error data
*/
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
void debugError(const ErrorItem &item);

protected:
Expand Down
5 changes: 3 additions & 2 deletions lib/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <list>
#include <string>
#include <utility>

namespace tinyxml2 {
class XMLElement;
Expand Down Expand Up @@ -61,8 +62,8 @@ class CPPCHECKLIB Check {
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)
Expand Down
13 changes: 7 additions & 6 deletions lib/ctu.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <list>
#include <map>
#include <string>
#include <utility>
#include <vector>

class Function;
Expand All @@ -57,15 +58,15 @@ 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{};
};

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;
Expand All @@ -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() {}
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions lib/errorlogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <fstream>
#include <list>
#include <string>
#include <utility>
#include <vector>

/**
Expand Down Expand Up @@ -72,8 +73,8 @@ class CPPCHECKLIB ErrorMessage {
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);
Expand Down
3 changes: 2 additions & 1 deletion lib/programmemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <map>
#include <string>
#include <unordered_map>
#include <utility>

class Token;
class Settings;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion lib/suppressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <istream>
#include <list>
#include <string>
#include <utility>
#include <vector>

/// @addtogroup Core
Expand Down Expand Up @@ -57,7 +58,7 @@ class CPPCHECKLIB Suppressions {
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;
Expand Down
4 changes: 2 additions & 2 deletions lib/symboldatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class CPPCHECKLIB ValueType {
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),
Expand All @@ -1316,7 +1316,7 @@ class CPPCHECKLIB ValueType {
smartPointer(nullptr),
container(nullptr),
containerTypeToken(nullptr),
originalTypeName(otn),
originalTypeName(std::move(otn)),
debugPath()
{}

Expand Down
2 changes: 1 addition & 1 deletion lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct TokensFrontBack {
};

struct ScopeInfo2 {
ScopeInfo2(const std::string &name_, const Token *bodyEnd_, const std::set<std::string> &usingNamespaces_ = std::set<std::string>()) : name(name_), bodyEnd(bodyEnd_), usingNamespaces(usingNamespaces_) {}
ScopeInfo2(std::string name_, const Token *bodyEnd_, std::set<std::string> usingNamespaces_ = std::set<std::string>()) : name(std::move(name_)), bodyEnd(bodyEnd_), usingNamespaces(std::move(usingNamespaces_)) {}
std::string name;
const Token * const bodyEnd;
std::set<std::string> usingNamespaces;
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3348,7 +3348,7 @@ void Tokenizer::calculateScopes()
tok->scopeInfo(nullptr);

std::string nextScopeNameAddition;
std::shared_ptr<ScopeInfo2> primaryScope = std::make_shared<ScopeInfo2>(emptyString, nullptr);
std::shared_ptr<ScopeInfo2> primaryScope = std::make_shared<ScopeInfo2>("", nullptr);
list.front()->scopeInfo(primaryScope);

for (Token* tok = list.front(); tok; tok = tok->next()) {
Expand Down
2 changes: 2 additions & 0 deletions lib/tokenlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class CPPCHECKLIB TokenList {
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;
}
Expand All @@ -124,6 +125,7 @@ class CPPCHECKLIB TokenList {
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;
}
Expand Down
3 changes: 2 additions & 1 deletion test/testutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <list>
#include <sstream> // IWYU pragma: keep
#include <string>
#include <utility>

class Token;

Expand Down Expand Up @@ -72,7 +73,7 @@ class SimpleSuppressor : public ErrorLogger {

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;
}
Expand Down