summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2026-03-19 16:53:42 -0700
committerMark Rowe <mark@vector35.com>2026-03-19 17:37:14 -0700
commit9ca4a08fbeabc22bed721ab522cf0a7dc4484a9f (patch)
treed7ee783a932aa6a7f23465fd7302dd0151e1567a /binaryninjaapi.h
parent351f1baa3ec50c7fea9176751e29f2debdeef388 (diff)
Add nodiscard attribute to Structure{,Builder}::{GetMemberByName,GetMemberByOffset}
Failing to check the return value is almost always a bug.
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 2b6f8adb..2feff8d8 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -11424,7 +11424,7 @@ namespace BinaryNinja {
\param result Reference to a StructureMember to copy the result to
\return Whether a member was found
*/
- bool GetMemberByName(const std::string& name, StructureMember& result) const;
+ [[nodiscard]] bool GetMemberByName(const std::string& name, StructureMember& result) const;
/*! Get a structure member at a certain offset
@@ -11432,7 +11432,7 @@ namespace BinaryNinja {
\param result Reference to a StructureMember to copy the result to
\return Whether a member was found
*/
- bool GetMemberAtOffset(int64_t offset, StructureMember& result) const;
+ [[nodiscard]] bool GetMemberAtOffset(int64_t offset, StructureMember& result) const;
/*! Get a structure member and its index at a certain offset
@@ -11441,7 +11441,7 @@ namespace BinaryNinja {
\param idx Reference to a size_t to copy the index to
\return Whether a member was found
*/
- bool GetMemberAtOffset(int64_t offset, StructureMember& result, size_t& idx) const;
+ [[nodiscard]] bool GetMemberAtOffset(int64_t offset, StructureMember& result, size_t& idx) const;
/*! Get the structure width in bytes
@@ -11554,10 +11554,10 @@ namespace BinaryNinja {
\param result Reference to a StructureMember object the field will be passed to
\return Whether a StructureMember was successfully retrieved
*/
- bool GetMemberByName(const std::string& name, StructureMember& result) const;
+ [[nodiscard]] bool GetMemberByName(const std::string& name, StructureMember& result) const;
// TODO: GetMember at offset also needs to pass a bit position.
- bool GetMemberAtOffset(int64_t offset, StructureMember& result) const;
- bool GetMemberAtOffset(int64_t offset, StructureMember& result, size_t& idx) const;
+ [[nodiscard]] bool GetMemberAtOffset(int64_t offset, StructureMember& result) const;
+ [[nodiscard]] bool GetMemberAtOffset(int64_t offset, StructureMember& result, size_t& idx) const;
uint64_t GetWidth() const;
StructureBuilder& SetWidth(size_t width);
int64_t GetPointerOffset() const;