diff options
| author | Peter LaFosse <peter@vector35.com> | 2024-10-21 10:55:45 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2024-10-23 20:37:38 -0400 |
| commit | 9aa54ef6723ad06b019c02c22b574516dca6289b (patch) | |
| tree | e0b420a8a609f4644607cad7f6170cf36ee26771 /highlevelil.cpp | |
| parent | c446e3acbcb0dc750a840551fa7cb54c184e7acb (diff) | |
Linear view function regions collapse
Update collapse code to support PseudoC
Diffstat (limited to 'highlevelil.cpp')
| -rw-r--r-- | highlevelil.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/highlevelil.cpp b/highlevelil.cpp index 89cf645f..10e2cd6a 100644 --- a/highlevelil.cpp +++ b/highlevelil.cpp @@ -648,6 +648,42 @@ HighLevelILTokenEmitter::HighLevelILTokenEmitter(BNHighLevelILTokenEmitter* emit m_object = emitter; } +void HighLevelILTokenEmitter::PrependCollapseIndicator() +{ + BNHighLevelILTokenPrependCollapseBlankIndicator(m_object); +} + + +void HighLevelILTokenEmitter::PrependCollapseIndicator(Ref<Function> function, const HighLevelILInstruction& instr, uint64_t designator) +{ + if (!HasCollapsableRegions()) + return; + + // Insert the collapse indicator at the beginning of the line if one isn't already there or the + // one that is there is empty + auto context = HighLevelILInstruction::CanCollapse(instr.operation) ? + (function && function->IsInstructionCollapsed(instr, designator) ? ContentCollapsedContext : ContentExpandedContext) : + ContentCollapsiblePadding; + + PrependCollapseIndicator(context, instr.GetInstructionHash(designator)); +} + +void HighLevelILTokenEmitter::PrependCollapseIndicator(BNInstructionTextTokenContext context, uint64_t hash) +{ + BNHighLevelILTokenPrependCollapseIndicator(m_object, context, hash); +} + +bool HighLevelILTokenEmitter::HasCollapsableRegions() +{ + return BNHighLevelILTokenEmitterHasCollapsableRegions(m_object); +} + + +void HighLevelILTokenEmitter::SetHasCollapsableRegions(bool state) +{ + BNHighLevelILTokenEmitterSetHasCollapsableRegions(m_object, state); +} + void HighLevelILTokenEmitter::NewLine() { @@ -908,4 +944,4 @@ void HighLevelILTokenEmitter::AddNamesForOuterStructureMembers( newNames.push_back(names[i]); BNFreeStringList(names, nameCount); nameList.insert(nameList.begin(), newNames.begin(), newNames.end()); -} +}
\ No newline at end of file |
