Skip to content

Commit

Permalink
initializing QPointer isn't necessary (and throws off clang-tidy for …
Browse files Browse the repository at this point in the history
…some reason)

adding [[nodiscard]] in a bunch of places based on clang-tidy recomendations
  • Loading branch information
eteran committed Mar 18, 2024
1 parent 7405b37 commit 51d10fe
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 35 deletions.
24 changes: 12 additions & 12 deletions include/State.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ class EDB_EXPORT State {
void swap(State &other);

public:
QString flagsToString() const;
QString flagsToString(edb::reg_t flags) const;
Register value(const QString &reg) const;
Register instructionPointerRegister() const;
Register flagsRegister() const;
edb::address_t framePointer() const;
edb::address_t instructionPointer() const;
edb::address_t stackPointer() const;
edb::reg_t debugRegister(size_t n) const;
edb::reg_t flags() const;
Register gpRegister(size_t n) const;
Register archRegister(uint64_t type, size_t n) const;
[[nodiscard]] QString flagsToString() const;
[[nodiscard]] QString flagsToString(edb::reg_t flags) const;
[[nodiscard]] Register value(const QString &reg) const;
[[nodiscard]] Register instructionPointerRegister() const;
[[nodiscard]] Register flagsRegister() const;
[[nodiscard]] edb::address_t framePointer() const;
[[nodiscard]] edb::address_t instructionPointer() const;
[[nodiscard]] edb::address_t stackPointer() const;
[[nodiscard]] edb::reg_t debugRegister(size_t n) const;
[[nodiscard]] edb::reg_t flags() const;
[[nodiscard]] Register gpRegister(size_t n) const;
[[nodiscard]] Register archRegister(uint64_t type, size_t n) const;
void adjustStack(int bytes);
void clear();
bool empty() const;
Expand Down
2 changes: 1 addition & 1 deletion plugins/Assembler/Assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Assembler : public QObject, public IPlugin {
void showDialog();

private:
QPointer<QDialog> dialog_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
2 changes: 1 addition & 1 deletion plugins/Backtrace/Backtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Q_SLOTS:

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/FunctionFinder/FunctionFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
2 changes: 1 addition & 1 deletion plugins/HardwareBreakpoints/HardwareBreakpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private Q_SLOTS:

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QPointer<QDialog> dialog_;

QLineEdit *addresses_[4] = {};
QCheckBox *enabled_[4] = {};
Expand Down
4 changes: 2 additions & 2 deletions plugins/HeapAnalyzer/HeapAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/OpcodeSearcher/OpcodeSearcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/ProcessProperties/ProcessProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/ROPTool/ROPTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
2 changes: 1 addition & 1 deletion plugins/References/References.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Q_SLOTS:

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/SymbolViewer/SymbolViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public Q_SLOTS:
void showMenu();

private:
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_ = nullptr;
QMenu *menu_ = nullptr;
QPointer<QDialog> dialog_;
};

}
Expand Down
2 changes: 1 addition & 1 deletion src/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private Q_SLOTS:
std::shared_ptr<QHexView> stackView_;
std::shared_ptr<const IDebugEvent> lastEvent_;
std::unique_ptr<IBinary> binaryInfo_;
QPointer<QDialog> breakpointDialog_ = nullptr;
QPointer<QDialog> breakpointDialog_;

private:
QAction *gotoAddressAction_;
Expand Down
10 changes: 5 additions & 5 deletions src/capstone-edb/include/Formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ class EDB_EXPORT Formatter {
};

public:
std::string toString(const Instruction &insn) const;
std::string toString(const Operand &operand) const;
std::string registerName(unsigned int reg) const;
[[nodiscard]] std::string toString(const Instruction &insn) const;
[[nodiscard]] std::string toString(const Operand &operand) const;
[[nodiscard]] std::string registerName(unsigned int reg) const;

FormatOptions options() const {
[[nodiscard]] FormatOptions options() const {
return options_;
}

void setOptions(const FormatOptions &options);

private:
void checkCapitalize(std::string &str, bool canContainHex = true) const;
QString adjustInstructionText(const Instruction &insn) const;
[[nodiscard]] QString adjustInstructionText(const Instruction &insn) const;

private:
FormatOptions options_ = {SyntaxIntel, LowerCase, false, true};
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/TabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TabWidget : public QTabWidget {

public:
void setData(int index, const QVariant &data);
QVariant data(int index) const;
[[nodiscard]] QVariant data(int index) const;

protected:
void mousePressEvent(QMouseEvent *event) override;
Expand Down

0 comments on commit 51d10fe

Please sign in to comment.