diff --git a/include/State.h b/include/State.h index a1fa33df9..7d8cf2cf4 100644 --- a/include/State.h +++ b/include/State.h @@ -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 ®) 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 ®) 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; diff --git a/plugins/Assembler/Assembler.h b/plugins/Assembler/Assembler.h index bb465e4e7..b0411beca 100644 --- a/plugins/Assembler/Assembler.h +++ b/plugins/Assembler/Assembler.h @@ -46,7 +46,7 @@ class Assembler : public QObject, public IPlugin { void showDialog(); private: - QPointer dialog_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/Backtrace/Backtrace.h b/plugins/Backtrace/Backtrace.h index 17269c889..0ef76f157 100644 --- a/plugins/Backtrace/Backtrace.h +++ b/plugins/Backtrace/Backtrace.h @@ -45,7 +45,7 @@ public Q_SLOTS: private: QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/FunctionFinder/FunctionFinder.h b/plugins/FunctionFinder/FunctionFinder.h index e7a0d6d6e..e1146e2e2 100644 --- a/plugins/FunctionFinder/FunctionFinder.h +++ b/plugins/FunctionFinder/FunctionFinder.h @@ -44,8 +44,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/HardwareBreakpoints/HardwareBreakpoints.h b/plugins/HardwareBreakpoints/HardwareBreakpoints.h index 7801ff48d..7efe6d63a 100644 --- a/plugins/HardwareBreakpoints/HardwareBreakpoints.h +++ b/plugins/HardwareBreakpoints/HardwareBreakpoints.h @@ -91,7 +91,7 @@ private Q_SLOTS: private: QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QPointer dialog_; QLineEdit *addresses_[4] = {}; QCheckBox *enabled_[4] = {}; diff --git a/plugins/HeapAnalyzer/HeapAnalyzer.h b/plugins/HeapAnalyzer/HeapAnalyzer.h index 6819e36fd..df53fe811 100644 --- a/plugins/HeapAnalyzer/HeapAnalyzer.h +++ b/plugins/HeapAnalyzer/HeapAnalyzer.h @@ -44,8 +44,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/OpcodeSearcher/OpcodeSearcher.h b/plugins/OpcodeSearcher/OpcodeSearcher.h index 647ca6b15..7de82fbfb 100644 --- a/plugins/OpcodeSearcher/OpcodeSearcher.h +++ b/plugins/OpcodeSearcher/OpcodeSearcher.h @@ -44,8 +44,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/ProcessProperties/ProcessProperties.h b/plugins/ProcessProperties/ProcessProperties.h index 694f1dd0a..89250899e 100644 --- a/plugins/ProcessProperties/ProcessProperties.h +++ b/plugins/ProcessProperties/ProcessProperties.h @@ -43,8 +43,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/ROPTool/ROPTool.h b/plugins/ROPTool/ROPTool.h index 12bd62b80..d6d24b176 100644 --- a/plugins/ROPTool/ROPTool.h +++ b/plugins/ROPTool/ROPTool.h @@ -43,8 +43,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/References/References.h b/plugins/References/References.h index e14142a3b..cc701b814 100644 --- a/plugins/References/References.h +++ b/plugins/References/References.h @@ -45,7 +45,7 @@ public Q_SLOTS: private: QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QPointer dialog_; }; } diff --git a/plugins/SymbolViewer/SymbolViewer.h b/plugins/SymbolViewer/SymbolViewer.h index 8382ad4a3..5f4c8ced1 100644 --- a/plugins/SymbolViewer/SymbolViewer.h +++ b/plugins/SymbolViewer/SymbolViewer.h @@ -44,8 +44,8 @@ public Q_SLOTS: void showMenu(); private: - QMenu *menu_ = nullptr; - QPointer dialog_ = nullptr; + QMenu *menu_ = nullptr; + QPointer dialog_; }; } diff --git a/src/Debugger.h b/src/Debugger.h index ca5b8d85c..c945e91ce 100644 --- a/src/Debugger.h +++ b/src/Debugger.h @@ -340,7 +340,7 @@ private Q_SLOTS: std::shared_ptr stackView_; std::shared_ptr lastEvent_; std::unique_ptr binaryInfo_; - QPointer breakpointDialog_ = nullptr; + QPointer breakpointDialog_; private: QAction *gotoAddressAction_; diff --git a/src/capstone-edb/include/Formatter.h b/src/capstone-edb/include/Formatter.h index b05fc321f..8cbe5fd23 100644 --- a/src/capstone-edb/include/Formatter.h +++ b/src/capstone-edb/include/Formatter.h @@ -31,11 +31,11 @@ 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_; } @@ -43,7 +43,7 @@ class EDB_EXPORT Formatter { 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}; diff --git a/src/widgets/TabWidget.h b/src/widgets/TabWidget.h index 2adcd1f35..5174d921f 100644 --- a/src/widgets/TabWidget.h +++ b/src/widgets/TabWidget.h @@ -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;