diff options
| author | Galen Williamson <galen@vector35.com> | 2022-05-02 15:36:52 -0400 |
|---|---|---|
| committer | Galen Williamson <galen@vector35.com> | 2022-05-02 15:36:52 -0400 |
| commit | bbbe4d177c378077b43b09c74a3a20a09bfee443 (patch) | |
| tree | 0e40cedd86fce589c4e6a67742194a026d9e7752 | |
| parent | 8ed00c24795872a33eeb2fd3b00911ef0b45b269 (diff) | |
added API for GetLanguageRepresentationIfAvailable
| -rw-r--r-- | binaryninjaapi.h | 1 | ||||
| -rw-r--r-- | binaryninjacore.h | 1 | ||||
| -rw-r--r-- | function.cpp | 14 |
3 files changed, 15 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 763eb02c..755d465c 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -3778,6 +3778,7 @@ namespace BinaryNinja { Ref<HighLevelILFunction> GetHighLevelIL() const; Ref<HighLevelILFunction> GetHighLevelILIfAvailable() const; Ref<LanguageRepresentationFunction> GetLanguageRepresentation() const; + Ref<LanguageRepresentationFunction> GetLanguageRepresentationIfAvailable() const; Ref<Type> GetType() const; Confidence<Ref<Type>> GetReturnType() const; diff --git a/binaryninjacore.h b/binaryninjacore.h index fd004a27..cd079fdc 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -3583,6 +3583,7 @@ extern "C" BINARYNINJACOREAPI BNHighLevelILFunction* BNGetFunctionHighLevelIL(BNFunction* func); BINARYNINJACOREAPI BNHighLevelILFunction* BNGetFunctionHighLevelILIfAvailable(BNFunction* func); BINARYNINJACOREAPI BNLanguageRepresentationFunction* BNGetFunctionLanguageRepresentation(BNFunction* func); + BINARYNINJACOREAPI BNLanguageRepresentationFunction* BNGetFunctionLanguageRepresentationIfAvailable(BNFunction* func); BINARYNINJACOREAPI BNRegisterValue BNGetRegisterValueAtInstruction( BNFunction* func, BNArchitecture* arch, uint64_t addr, uint32_t reg); BINARYNINJACOREAPI BNRegisterValue BNGetRegisterValueAfterInstruction( diff --git a/function.cpp b/function.cpp index bacfbab0..c93a8329 100644 --- a/function.cpp +++ b/function.cpp @@ -769,7 +769,19 @@ Ref<HighLevelILFunction> Function::GetHighLevelILIfAvailable() const Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentation() const { - return new LanguageRepresentationFunction(BNGetFunctionLanguageRepresentation(m_object)); + BNLanguageRepresentationFunction* function = BNGetFunctionLanguageRepresentation(m_object); + if (!function) + return nullptr; + return new LanguageRepresentationFunction(function); +} + + +Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentationIfAvailable() const +{ + BNLanguageRepresentationFunction* function = BNGetFunctionLanguageRepresentationIfAvailable(m_object); + if (!function) + return nullptr; + return new LanguageRepresentationFunction(function); } |
