summaryrefslogtreecommitdiff
path: root/examples/workflows/tailcall/tailcall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/workflows/tailcall/tailcall.cpp')
-rw-r--r--examples/workflows/tailcall/tailcall.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/workflows/tailcall/tailcall.cpp b/examples/workflows/tailcall/tailcall.cpp
index 3d8613c4..01190987 100644
--- a/examples/workflows/tailcall/tailcall.cpp
+++ b/examples/workflows/tailcall/tailcall.cpp
@@ -17,7 +17,7 @@ using namespace BinaryNinja;
using namespace std;
#if defined(_MSC_VER)
-#define snprintf _snprintf
+ #define snprintf _snprintf
#endif
@@ -52,7 +52,8 @@ extern "C"
RegisterValue target = destExpr.GetValue();
if (target.IsConstant())
platformAddr = target.value;
- else if (target.state == ImportedAddressValue) // Call to imported function, look up type from import symbol
+ else if (target.state
+ == ImportedAddressValue) // Call to imported function, look up type from import symbol
platformAddr = target.value;
else if (target.state == ExternalPointerValue && target.offset == 0)
platformAddr = target.value;
@@ -62,7 +63,9 @@ extern "C"
size_t opLen = data->Read(opcode, instr.address, arch->GetMaxInstructionLength());
if (!opLen || !arch->GetInstructionInfo(opcode, instr.address, opLen, iInfo))
continue;
- Ref<Platform> platform = iInfo.archTransitionByTargetAddr ? function->GetPlatform()->GetAssociatedPlatformByAddress(platformAddr) : function->GetPlatform();
+ Ref<Platform> platform = iInfo.archTransitionByTargetAddr ?
+ function->GetPlatform()->GetAssociatedPlatformByAddress(platformAddr) :
+ function->GetPlatform();
if (platform)
{
bool canReturn = true;
@@ -72,7 +75,8 @@ extern "C"
DataVariable var;
if (data->GetDataVariableAtAddress(target.value, var))
{
- if (var.type && (var.type->GetClass() == PointerTypeClass) && (var.type->GetChildType()->GetClass() == FunctionTypeClass))
+ if (var.type && (var.type->GetClass() == PointerTypeClass)
+ && (var.type->GetChildType()->GetClass() == FunctionTypeClass))
canReturn = var.type->GetChildType()->CanReturn().GetValue();
}
}
@@ -119,7 +123,7 @@ extern "C"
customTailCallWorkflow->Replace("core.function.translateTailCalls", "extension.translateTailCalls");
customTailCallWorkflow->Remove("core.function.translateTailCalls");
Workflow::RegisterWorkflow(customTailCallWorkflow,
- R"#({
+ R"#({
"title" : "Tail Call Translation (Example)",
"description" : "This analysis stands in as an example to demonstrate Binary Ninja's extensible analysis APIs. ***Note** this feature is under active development and subject to change without notice.",
"capabilities" : []