|
4 | 4 | #include "highlevelilinstruction.h"
|
5 | 5 | #include <optional>
|
6 | 6 | #include <string>
|
| 7 | +#include <string_view> |
7 | 8 | #include <vector>
|
8 | 9 |
|
9 | 10 | using namespace BinaryNinja;
|
@@ -350,6 +351,11 @@ void PseudoObjCFunction::GetExpr_CONST_PTR(const BinaryNinja::HighLevelILInstruc
|
350 | 351 | return;
|
351 | 352 | }
|
352 | 353 |
|
| 354 | + if (shortName.rfind("sel_", 0) == 0 |
| 355 | + && GetExpr_Selector( |
| 356 | + std::string_view(shortName).substr(4), constant, instr, tokens, settings, precedence, statement)) |
| 357 | + return; |
| 358 | + |
353 | 359 | DataVariable variable {};
|
354 | 360 | auto hasVariable = GetFunction()->GetView()->GetDataVariableAtAddress(constant, variable);
|
355 | 361 | if (!hasVariable)
|
@@ -393,6 +399,21 @@ bool PseudoObjCFunction::GetExpr_OBJC_CLASS(const Symbol& symbol, uint64_t const
|
393 | 399 | return true;
|
394 | 400 | }
|
395 | 401 |
|
| 402 | +bool PseudoObjCFunction::GetExpr_Selector(std::string_view selector, uint64_t constant, |
| 403 | + const BinaryNinja::HighLevelILInstruction& instr, BinaryNinja::HighLevelILTokenEmitter& tokens, |
| 404 | + BinaryNinja::DisassemblySettings* settings, BNOperatorPrecedence precedence, bool statement) |
| 405 | +{ |
| 406 | + if (selector.empty()) |
| 407 | + return false; |
| 408 | + |
| 409 | + tokens.Append(KeywordToken, "@selector"); |
| 410 | + tokens.AppendOpenParen(); |
| 411 | + tokens.Append(DataSymbolToken, ConstDataTokenContext, std::string(selector), instr.address, constant); |
| 412 | + tokens.AppendCloseParen(); |
| 413 | + |
| 414 | + return true; |
| 415 | +} |
| 416 | + |
396 | 417 | bool PseudoObjCFunction::GetExpr_NSConstantString(Ref<Type> type, uint64_t constant,
|
397 | 418 | const BinaryNinja::HighLevelILInstruction& instr, BinaryNinja::HighLevelILTokenEmitter& tokens,
|
398 | 419 | BinaryNinja::DisassemblySettings* settings, BNOperatorPrecedence precedence, bool statement)
|
|
0 commit comments