From 9c8d4eac3dadf6273b34ba193c219de9283285b3 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 3 Jun 2025 13:42:04 -0600 Subject: Add UI action and API to control early returns in HLIL --- ui/commands.h | 1 + ui/flowgraphwidget.h | 3 +++ ui/linearview.h | 3 +++ 3 files changed, 7 insertions(+) (limited to 'ui') diff --git a/ui/commands.h b/ui/commands.h index aed0fbf6..754d99a7 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -98,6 +98,7 @@ TypeRef GetFunctionType(BinaryViewRef data, TypeRef type); std::optional getFoldableExprAddress( BinaryNinja::HighLevelILFunction* hlil, const HighlightTokenState& highlight); std::optional getInvertableConditionAddress(BinaryNinja::HighLevelILFunction* hlil, size_t instrIndex); +std::optional getEarlyReturnAddress(BinaryNinja::HighLevelILFunction* hlil, size_t instrIndex); /*! @} diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index b69ec38b..d988da12 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -170,6 +170,8 @@ class BINARYNINJAUIAPI FlowGraphWidget : BNExprFolding getCurrentExprFolding(); std::optional getCurrentInvertableConditionAddress(); bool getCurrentConditionInverted(); + std::optional getCurrentEarlyReturnAddress(); + BNEarlyReturn getCurrentEarlyReturn(); std::optional> getMergeVariablesAtCurrentLocation(); protected: @@ -401,6 +403,7 @@ class BINARYNINJAUIAPI FlowGraphWidget : void setCurrentVariableDeadStoreElimination(BNDeadStoreElimination elimination); void setCurrentExprFolding(BNExprFolding folding); void toggleConditionInverted(); + void setCurrentEarlyReturn(BNEarlyReturn earlyReturn); void splitToNewTabAndNavigateFromCursorPosition(); void splitToNewWindowAndNavigateFromCursorPosition(); void splitToNewPaneAndNavigateFromCursorPosition(); diff --git a/ui/linearview.h b/ui/linearview.h index 2ea8e37f..eea40d7f 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -320,6 +320,8 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub BNExprFolding getCurrentExprFolding(); std::optional getCurrentInvertableConditionAddress(); bool getCurrentConditionInverted(); + std::optional getCurrentEarlyReturnAddress(); + BNEarlyReturn getCurrentEarlyReturn(); void setDataButtonVisible(bool visible); std::optional> getMergeVariablesAtCurrentLocation(); @@ -412,6 +414,7 @@ private Q_SLOTS: void setCurrentVariableDeadStoreElimination(BNDeadStoreElimination elimination); void setCurrentExprFolding(BNExprFolding folding); void toggleConditionInverted(); + void setCurrentEarlyReturn(BNEarlyReturn earlyReturn); Q_SIGNALS: void notifyResizeEvent(int width, int height); -- cgit v1.3.1