Skip to content

Commit

Permalink
continuing to clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
eteran committed Mar 18, 2024
1 parent 1767a31 commit 257d01c
Show file tree
Hide file tree
Showing 38 changed files with 92 additions and 94 deletions.
2 changes: 1 addition & 1 deletion include/RegisterRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RegisterRef {
RegisterRef &operator=(const RegisterRef &) = default;

public:
const void *data() const { return ptr_; }
[[nodiscard]] const void *data() const { return ptr_; }

public:
[[nodiscard]] bool operator==(const RegisterRef &rhs) const { return size_ == rhs.size_ && std::memcmp(ptr_, rhs.ptr_, size_) == 0; }
Expand Down
6 changes: 3 additions & 3 deletions include/RegisterViewModelBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ class Category : public RegisterViewItem {
class SIMDCategory final : public Category {
public:
SIMDCategory(const QString &name, int row, const std::vector<NumberDisplayMode> &validFormats);
~SIMDCategory();
~SIMDCategory() override;

public:
[[nodiscard]] virtual Model::ElementSize chosenSize() const;
Expand All @@ -504,7 +504,7 @@ class SIMDCategory final : public Category {
virtual void setChosenFormat(NumberDisplayMode newFormat);

public:
const std::vector<NumberDisplayMode> &validFormats() const;
[[nodiscard]] const std::vector<NumberDisplayMode> &validFormats() const;

private:
bool sizeChanged_ = false;
Expand All @@ -520,7 +520,7 @@ class FPUCategory final : public Category {
~FPUCategory() override;

public:
NumberDisplayMode chosenFormat() const;
[[nodiscard]] NumberDisplayMode chosenFormat() const;
void setChosenFormat(NumberDisplayMode newFormat);

private:
Expand Down
2 changes: 1 addition & 1 deletion plugins/Bookmarks/Bookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Bookmarks : public QObject, public IPlugin {
[[nodiscard]] QList<QAction *> cpuContextMenu() override;

public:
QVariantMap saveState() const override;
[[nodiscard]] QVariantMap saveState() const override;
void restoreState(const QVariantMap &) override;

private:
Expand Down
4 changes: 2 additions & 2 deletions plugins/Bookmarks/BookmarksModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent

if (row >= 0) {
return createIndex(row, column, const_cast<Bookmark *>(&bookmarks_[row]));
} else {
return createIndex(row, column);
}

return createIndex(row, column);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions plugins/DebuggerCore/DebuggerCoreBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ class DebuggerCoreBase : public QObject, public IDebugger {
Launch
};

virtual MeansOfCapture lastMeansOfCapture() const = 0;
[[nodiscard]] virtual MeansOfCapture lastMeansOfCapture() const = 0;

public:
BreakpointList backupBreakpoints() const override;
[[nodiscard]] BreakpointList backupBreakpoints() const override;
std::shared_ptr<IBreakpoint> addBreakpoint(edb::address_t address) override;
std::shared_ptr<IBreakpoint> findBreakpoint(edb::address_t address) override;
std::shared_ptr<IBreakpoint> findTriggeredBreakpoint(edb::address_t address) override;
void clearBreakpoints() override;
void removeBreakpoint(edb::address_t address) override;
void endDebugSession() override;

std::vector<IBreakpoint::BreakpointType> supportedBreakpointTypes() const override;
[[nodiscard]] std::vector<IBreakpoint::BreakpointType> supportedBreakpointTypes() const override;

protected:
[[nodiscard]] bool attached() const;
Expand Down
22 changes: 11 additions & 11 deletions plugins/DebuggerCore/arch/arm-generic/Breakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ class Breakpoint final : public IBreakpoint {
~Breakpoint() override;

public:
edb::address_t address() const override { return address_; }
uint64_t hitCount() const override { return hitCount_; }
bool enabled() const override { return enabled_; }
bool oneTime() const override { return oneTime_; }
bool internal() const override { return internal_; }
size_t size() const override { return originalBytes_.size(); }
const uint8_t *originalBytes() const override { return &originalBytes_[0]; }
IBreakpoint::TypeId type() const override { return type_; }

static std::vector<BreakpointType> supportedTypes();
static std::vector<size_t> possibleRewindSizes();
[[nodiscard]] edb::address_t address() const override { return address_; }
[[nodiscard]] uint64_t hitCount() const override { return hitCount_; }
[[nodiscard]] bool enabled() const override { return enabled_; }
[[nodiscard]] bool oneTime() const override { return oneTime_; }
[[nodiscard]] bool internal() const override { return internal_; }
[[nodiscard]] size_t size() const override { return originalBytes_.size(); }
[[nodiscard]] const uint8_t *originalBytes() const override { return &originalBytes_[0]; }
[[nodiscard]] IBreakpoint::TypeId type() const override { return type_; }

[[nodiscard]] static std::vector<BreakpointType> supportedTypes();
[[nodiscard]] static std::vector<size_t> possibleRewindSizes();

public:
bool enable() override;
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/arch/x86-generic/Breakpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void Breakpoint::setType(IBreakpoint::TypeId type) {
* @brief Breakpoint::~Breakpoint
*/
Breakpoint::~Breakpoint() {
this->disable();
disable();
}

/**
Expand Down
22 changes: 11 additions & 11 deletions plugins/DebuggerCore/arch/x86-generic/Breakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ class Breakpoint final : public IBreakpoint {
~Breakpoint() override;

public:
edb::address_t address() const override { return address_; }
uint64_t hitCount() const override { return hitCount_; }
bool enabled() const override { return enabled_; }
bool oneTime() const override { return oneTime_; }
bool internal() const override { return internal_; }
size_t size() const override { return originalBytes_.size(); }
const uint8_t *originalBytes() const override { return &originalBytes_[0]; }
IBreakpoint::TypeId type() const override { return type_; }

static std::vector<BreakpointType> supportedTypes();
static std::vector<size_t> possibleRewindSizes();
[[nodiscard]] edb::address_t address() const override { return address_; }
[[nodiscard]] uint64_t hitCount() const override { return hitCount_; }
[[nodiscard]] bool enabled() const override { return enabled_; }
[[nodiscard]] bool oneTime() const override { return oneTime_; }
[[nodiscard]] bool internal() const override { return internal_; }
[[nodiscard]] size_t size() const override { return originalBytes_.size(); }
[[nodiscard]] const uint8_t *originalBytes() const override { return &originalBytes_[0]; }
[[nodiscard]] IBreakpoint::TypeId type() const override { return type_; }

[[nodiscard]] static std::vector<BreakpointType> supportedTypes();
[[nodiscard]] static std::vector<size_t> possibleRewindSizes();

public:
bool enable() override;
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/Posix.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#include "Posix.h"
#include <cerrno>
#include <csignal>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/Unix.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include "Unix.h"
#include <cstring>
#include <signal.h>
#include <csignal>
#include <unistd.h>

namespace DebuggerCorePlugin {
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/freebsd/DebuggerCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kvm.h>
#include <machine/reg.h>
#include <paths.h>
#include <signal.h>
#include <csignal>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/ptrace.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/freebsd/PlatformEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstring>
#include <fcntl.h>
#include <kvm.h>
#include <signal.h> // for the SIG* definitions
#include <csignal> // for the SIG* definitions
#include <sys/exec.h>
#include <sys/mman.h>
#include <sys/param.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/freebsd/PlatformProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kvm.h>
#include <machine/reg.h>
#include <paths.h>
#include <signal.h>
#include <csignal>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/ptrace.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/linux/PlatformEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "IDebugEvent.h"

#include <QCoreApplication>
#include <signal.h> // for the SIG* definitions
#include <csignal> // for the SIG* definitions

namespace DebuggerCorePlugin {

Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/openbsd/DebuggerCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kvm.h>
#include <machine/reg.h>
#include <paths.h>
#include <signal.h>
#include <csignal>
#include <sys/exec.h>
#include <sys/lock.h>
#include <sys/mman.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/openbsd/PlatformEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstring>
#include <fcntl.h>
#include <kvm.h>
#include <signal.h> // for the SIG* definitions
#include <csignal> // for the SIG* definitions
#include <sys/exec.h>
#include <sys/mman.h>
#include <sys/param.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/osx/DebuggerCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <mach/vm_region.h>
#include <mach/vm_statistics.h>
#include <paths.h>
#include <signal.h>
#include <csignal>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/proc.h>
Expand Down
2 changes: 1 addition & 1 deletion plugins/DebuggerCore/unix/osx/PlatformEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "edb.h"
#include <cstdio>
#include <cstring>
#include <signal.h> // for the SIG* definitions
#include <csignal> // for the SIG* definitions
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
Expand Down
4 changes: 2 additions & 2 deletions plugins/FunctionFinder/ResultsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ QModelIndex ResultsModel::index(int row, int column, const QModelIndex &parent)

if (row >= 0) {
return createIndex(row, column, const_cast<Result *>(&results_[row]));
} else {
return createIndex(row, column);
}

return createIndex(row, column);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions plugins/HeapAnalyzer/DialogHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ struct malloc_chunk {
MallocChunkPtr fd; /* double links -- used only if free. */
MallocChunkPtr bk;

edb::address_t chunkSize() const { return edb::address_t::fromZeroExtended(size & ~(SizeBits)); }
bool prevInUse() const { return size & PreviousInUse; }
[[nodiscard]] edb::address_t chunkSize() const { return edb::address_t::fromZeroExtended(size & ~(SizeBits)); }
[[nodiscard]] bool prevInUse() const { return size & PreviousInUse; }
};

template <class Addr>
Expand Down Expand Up @@ -211,7 +211,7 @@ DialogHeap::DialogHeap(QWidget *parent, Qt::WindowFlags f)
while (!result_stack.isEmpty()) {
const ResultViewModel::Result *const result = result_stack.pop();

GraphNode *node = new GraphNode(graph, edb::v1::format_pointer(result->address), result->type == ResultViewModel::Result::Busy ? Qt::lightGray : Qt::red);
auto node = new GraphNode(graph, edb::v1::format_pointer(result->address), result->type == ResultViewModel::Result::Busy ? Qt::lightGray : Qt::red);

nodes.insert(result->address, node);

Expand Down Expand Up @@ -422,9 +422,9 @@ void DialogHeap::collectBlocks(edb::address_t start_address, edb::address_t end_

if (memcmp(bytes, "\x89\x50\x4e\x47", 4) == 0) {
data_type = ResultViewModel::Result::Png;
} else if (memcmp(bytes, "\x2f\x2a\x20\x58\x50\x4d\x20\x2a\x2f", 9) == 0) {
} else if (memcmp(bytes, R"(/* XPM */)", 9) == 0) {
data_type = ResultViewModel::Result::Xpm;
} else if (memcmp(bytes, "\x42\x5a", 2) == 0) {
} else if (memcmp(bytes, R"(BZ)", 2) == 0) {
data_type = ResultViewModel::Result::Bzip;
} else if (memcmp(bytes, "\x1f\x9d", 2) == 0) {
data_type = ResultViewModel::Result::Compress;
Expand Down
4 changes: 2 additions & 2 deletions plugins/HeapAnalyzer/DialogHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public Q_SLOTS:
private:
void detectPointers();
void processPotentialPointers(const QHash<edb::address_t, edb::address_t> &targets, const QModelIndex &index);
edb::address_t findHeapStartHeuristic(edb::address_t end_address, size_t offset) const;
QMap<edb::address_t, const ResultViewModel::Result *> createResultMap() const;
[[nodiscard]] edb::address_t findHeapStartHeuristic(edb::address_t end_address, size_t offset) const;
[[nodiscard]] QMap<edb::address_t, const ResultViewModel::Result *> createResultMap() const;

private:
template <class Addr>
Expand Down
4 changes: 2 additions & 2 deletions plugins/HeapAnalyzer/ResultViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ QModelIndex ResultViewModel::index(int row, int column, const QModelIndex &paren

if (row >= 0) {
return createIndex(row, column, const_cast<Result *>(&results_[row]));
} else {
return createIndex(row, column);
}

return createIndex(row, column);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions plugins/InstructionInspector/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ std::string printReg(csh csh, int reg, bool canBeZero = false) {

if (const auto regName = cs_reg_name(csh, reg)) {
return uppercase(regName);
} else {
return toHex(reg);
}

return toHex(reg);
}

#if 0
Expand Down
4 changes: 2 additions & 2 deletions plugins/ODbgRegisterView/GprEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class GprEdit final : public QLineEdit {
void setGPRValue(std::uint64_t gprValue);
void updateGPRValue(std::uint64_t &gpr) const;

QSize minimumSizeHint() const override {
[[nodiscard]] QSize minimumSizeHint() const override {
return sizeHint();
}

QSize sizeHint() const override;
[[nodiscard]] QSize sizeHint() const override;

private:
void setupFormat(Format newFormat);
Expand Down
4 changes: 2 additions & 2 deletions plugins/ODbgRegisterView/NumberEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class NumberEdit final : public QLineEdit {
void setNaturalWidthInChars(int nChars);

public:
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
[[nodiscard]] QSize minimumSizeHint() const override;
[[nodiscard]] QSize sizeHint() const override;

private:
int naturalWidthInChars_ = 17; // default roughly as in QLineEdit
Expand Down
2 changes: 1 addition & 1 deletion plugins/ODbgRegisterView/arch/x86-generic/Float80Edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Float80Edit : public QLineEdit {
void setValue(edb::value80 input);

public:
QSize sizeHint() const override;
[[nodiscard]] QSize sizeHint() const override;

protected:
void focusOutEvent(QFocusEvent *e) override;
Expand Down
4 changes: 2 additions & 2 deletions plugins/OpcodeSearcher/ResultsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ QModelIndex ResultsModel::index(int row, int column, const QModelIndex &parent)

if (row >= 0) {
return createIndex(row, column, const_cast<Result *>(&results_[row]));
} else {
return createIndex(row, column);
}

return createIndex(row, column);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions plugins/ROPTool/ResultsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ QModelIndex ResultsModel::index(int row, int column, const QModelIndex &parent)

if (row >= 0) {
return createIndex(row, column, const_cast<Result *>(&results_[row]));
} else {
return createIndex(row, column);
}

return createIndex(row, column);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <random>

#if defined(Q_OS_UNIX)
#include <signal.h>
#include <csignal>
#endif

#include <sys/stat.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ExpressionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ExpressionDialog::ExpressionDialog(const QString &title, const QString &prompt,

allLabels.append(edb::v1::symbol_manager().labels().values());

QCompleter *completer = new QCompleter(allLabels, this);
auto completer = new QCompleter(allLabels, this);
expression_->setCompleter(completer);
allLabels.clear();
}
Expand Down
Loading

0 comments on commit 257d01c

Please sign in to comment.