title: How can I deduce from NSMethodSignature that a struct argument is passed by pointer?
body: <p>How can I deduce from <code>NSMethodSignature</code> that a struct argument is passed by pointer to the stack?</p>
  <p>Specifically on ARM.</p>
  <p>For example if I have:</p>
  <pre><code>@protocol TestProtocol &lt;NSObject&gt;
  - (void)time:(CMTime)time;
  - (void)rect:(CGRect)point;
  @end
  </code></pre>
  <p>And then I do:</p>
  <pre><code>  struct objc_method_description methodDescription1 =
      protocol_getMethodDescription(@protocol(TestProtocol), @selector(time:), YES, YES);
    struct objc_method_description methodDescription2 =
      protocol_getMethodDescription(@protocol(TestProtocol), @selector(rect:), YES, YES);
  
    NSMethodSignature *sig1 = [NSMethodSignature signatureWithObjCTypes:methodDescription1.types];
    NSMethodSignature *sig2 = [NSMethodSignature signatureWithObjCTypes:methodDescription2.types];
  
    const char *arg1 = [sig1 getArgumentTypeAtIndex:2];
    const char *arg2 = [sig2 getArgumentTypeAtIndex:2];
  
    NSLog(@&quot;%s %s&quot;, methodDescription1.types, arg1);
    NSLog(@&quot;%s %s&quot;, methodDescription2.types, arg2);
  </code></pre>
  <p>The output is:</p>
  <pre><code>v40@0:8{?=qiIq}16 {?=qiIq}
  v48@0:8{CGRect={CGPoint=dd}{CGSize=dd}}16 {CGRect={CGPoint=dd}{CGSize=dd}}
  </code></pre>
  <p>Both look similar, no indication that CMTime will be actually passed as a pointer.</p>
  <p>But when I print the debug description:</p>
  <pre><code>  NSLog(@&quot;%@&quot;, [sig1 debugDescription]);
    NSLog(@&quot;%@&quot;, [sig2 debugDescription]);
  </code></pre>
  <p>The first prints:</p>
  <pre><code>  ...
    argument 2: -------- -------- -------- --------
          type encoding (^) '^{?=qiIq}'
          flags {isPointer}
    ...
  </code></pre>
  <p>While the second prints:</p>
  <pre><code>  ...
    argument 2: -------- -------- -------- --------
          type encoding ({) '{CGRect={CGPoint=dd}{CGSize=dd}}'
          flags {isStruct}
    ...
  </code></pre>
  <p>So this information is indeed stored in the method signature, but how do I retrieve it without parsing the debug description? Are there rules I can use to deduce this myself? I tried different structs but it is hard to spot a pattern.</p>