object-introspection icon indicating copy to clipboard operation
object-introspection copied to clipboard

OID produces incorrect results when top level argument is a pointer

Open JakeHillion opened this issue 3 years ago • 1 comments

The top level pointer attribute is omitted when traced with OID. That is, the argument is treated as an argument of the underlying data type. For example:

Actual output:

[
  {
    "name": "a0",
    "typePath": "a0",
    "typeName": "int",
    "isTypedef": false,
    "staticSize": 4,
    "dynamicSize": 0
  }
]

Expected output:

[
  {
    "typeName": "int *",
    "staticSize": 8,
    "dynamicSize": 4,
    "pointer": XXX,
    "members": [
      {
        "typeName": "int",
        "staticSize": 4,
        "dynamicSize": 0
      }
    ]
  }
]

### Affected tests:

  • OidIntegration.pointers_int
  • OidIntegration.pointers_no_follow
  • OidIntegration.pointers_int_null
  • OidIntegration.pointers_void
  • OidIntegration.pointers_void_no_follow
  • OidIntegration.pointers_void_null
  • OidIntegration.pointers_vector
  • OidIntegration.pointers_vector_no_follow
  • OidIntegration.pointers_vector_null

JakeHillion avatar Jan 03 '23 13:01 JakeHillion

  • OidIntegration.pointers_void
  • OidIntegration.pointers_void_no_follow
  • OidIntegration.pointers_void_null

Are special cases of this. As oid codegen sees them as the underlying type (void when it should be void*) it hits: https://github.com/facebookexperimental/object-introspection/blob/1c3ee5bf6b79676bce4155284f3723de42b2227e/src/OICodeGen.cpp#L1025-L1028

JakeHillion avatar Jan 04 '23 12:01 JakeHillion