0
ObjCPropertyRefExpr 0x7fc2f9a80ac0 '<pseudo-object type>' lvalue objcproperty Kind=PropertyRef Property="text" Messaging=Getter
`-OpaqueValueExpr 0x7fc2f9a80aa0 'UITextField *'
  `-PseudoObjectExpr 0x7fc2f9a61d30 'UITextField *'
    |-ObjCPropertyRefExpr 0x7fc2f9a61cb8 '<pseudo-object type>' lvalue objcproperty Kind=PropertyRef Property="txtFirstname" Messaging=Getter
    | `-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
    |   `-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
    |     `-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'
    |-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
    | `-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
    |   `-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'
    `-ImplicitCastExpr 0x7fc2f9a61d18 'UITextField *' <ARCReclaimReturnedObject>
      `-ObjCMessageExpr 0x7fc2f9a61ce8 'UITextField *' selector=txtFirstname
        `-OpaqueValueExpr 0x7fc2f9a61c98 'EditInfoViewController *'
          `-ImplicitCastExpr 0x7fc2f9a61c50 'EditInfoViewController *' <LValueToRValue>
            `-DeclRefExpr 0x7fc2f9a61c28 'EditInfoViewController *const __strong' lvalue ImplicitParam 0x7fc2f9a61828 'self' 'EditInfoViewController *const __strong'

Given the AST above, is it possible to get the element 'UITextField' out from the ObjCPropertyRefExpr?

Right now I'm wildly trying all the getter methods but have no good luck getting that out so far.. any advice would be appreciated

Jeremy Kuah
  • 519
  • 1
  • 6
  • 18

1 Answers1

0

ObjectiveCPropertyRefExpr->getReceiverType(*ASTContext).getAsString() would work fine for this

Though this will return 'UITextField *', simple delimiting/substr would be required to retrieve 'UITextField'

Jeremy Kuah
  • 519
  • 1
  • 6
  • 18