summaryrefslogtreecommitdiff
path: root/plugins/warp/ui/shared/function.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-08-26 23:59:38 -0400
committerMason Reed <mason@vector35.com>2025-10-01 21:38:39 -0400
commitede39aee7e00c40a43b67ca18dd8ab80ee863d85 (patch)
tree67c5eda347ece2282e3c888f38066b496e06dec8 /plugins/warp/ui/shared/function.cpp
parenta1c46813e7f279aa4cfdb9dbb91c45b559ebeacd (diff)
[WARP] Enhanced network support
Diffstat (limited to 'plugins/warp/ui/shared/function.cpp')
-rw-r--r--plugins/warp/ui/shared/function.cpp26
1 files changed, 3 insertions, 23 deletions
diff --git a/plugins/warp/ui/shared/function.cpp b/plugins/warp/ui/shared/function.cpp
index 88d27cd1..e1609e0b 100644
--- a/plugins/warp/ui/shared/function.cpp
+++ b/plugins/warp/ui/shared/function.cpp
@@ -14,35 +14,15 @@ WarpFunctionItem::WarpFunctionItem(Warp::Ref<Warp::Function> function,
{
m_function = function;
- // TODO: This needs to be better. Symbol can be nullptr.
BinaryNinja::Ref<BinaryNinja::Symbol> symbol = m_function->GetSymbol(*analysisFunction);
std::string symbolName = symbol->GetShortName();
setText(QString::fromStdString(symbolName));
- BinaryNinja::InstructionTextToken nameToken = {255, TextToken, symbolName};
// Serialize the tokens to make it accessible via QModelIndex.
// We will take these tokens and then user them in our custom item delegate.
- TokenData tokenData = {};
-
- // TODO: Make this not look like garbage
- BinaryNinja::Ref<BinaryNinja::Type> type = m_function->GetType(*analysisFunction);
- if (type)
- {
- BinaryNinja::Ref<BinaryNinja::Platform> platform = analysisFunction->GetPlatform();
- std::vector<BinaryNinja::InstructionTextToken> beforeTokens = type->GetTokensBeforeName(platform);
- std::vector<BinaryNinja::InstructionTextToken> afterTokens = type->GetTokensAfterName(platform);
-
- for (const auto &token: beforeTokens)
- tokenData.tokens.emplace_back(token);
- tokenData.tokens.emplace_back(255, TextToken, " ");
- tokenData.tokens.emplace_back(nameToken);
- for (const auto &token: afterTokens)
- tokenData.tokens.emplace_back(token);
- } else
- {
- tokenData.tokens.emplace_back(nameToken);
- }
-
+ TokenData tokenData = TokenData(symbolName);
+ if (BinaryNinja::Ref<BinaryNinja::Type> type = m_function->GetType(*analysisFunction))
+ tokenData = TokenData(*type, symbolName);
setData(QVariant::fromValue(tokenData), Qt::UserRole);
}