summaryrefslogtreecommitdiff
path: root/lang/c/pseudoc.cpp
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2025-04-15 14:20:58 -0400
committerBrandon Miller <brandon@vector35.com>2025-04-15 15:10:16 -0400
commit5e1a86395a959f9902d63c9504cdfc6cd07847a3 (patch)
treea9566b6122e9c5a81d66e9be3b6a5443e0c4bfae /lang/c/pseudoc.cpp
parenta6f64bf19f966f5ecbaab0a9eff85ecbaa573317 (diff)
Cast on indexed array assignments in pseudo C/Rust
Diffstat (limited to 'lang/c/pseudoc.cpp')
-rw-r--r--lang/c/pseudoc.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lang/c/pseudoc.cpp b/lang/c/pseudoc.cpp
index 8ab07a75..b91b8e71 100644
--- a/lang/c/pseudoc.cpp
+++ b/lang/c/pseudoc.cpp
@@ -1604,6 +1604,21 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
}
else
{
+ if ((!settings || settings->IsOptionSet(ShowTypeCasts)) && srcExpr.operation == HLIL_ARRAY_INDEX)
+ {
+ auto arrayIndexExpr = srcExpr.GetSourceExpr<HLIL_ARRAY_INDEX>();
+ if (arrayIndexExpr.operation == HLIL_VAR &&
+ arrayIndexExpr.GetType()->GetChildType()->GetWidth() < instr.size)
+ {
+ tokens.Append(TextToken, "*");
+ tokens.AppendOpenParen();
+ AppendSizeToken(instr.size, false, tokens);
+ tokens.Append(TextToken, "*");
+ tokens.AppendCloseParen();
+ tokens.Append(OperationToken, "&");
+ }
+ }
+
GetExprTextInternal(srcExpr, tokens, settings, MemberAndFunctionOperatorPrecedence);
}