facebookexperimental / object-introspection

Object Introspection (OI) enables on-demand, hierarchical profiling of objects in arbitrary C/C++ programs with no recompilation.
Apache License 2.0
164 stars 14 forks source link

Fix CodeGen V2 for zero-length array #453

Closed ttreyer closed 10 months ago

ttreyer commented 10 months ago

Summary

Fix issue #295

  1. Replace the recursive validate_size template with a non-recursive one, making CodeGen compile
  2. Process zero-length array as containers, so no object size is left unread in the data buffer
  3. Enable the zero-length array test

Is it ok to process zero-length array as container? I had to modify the test's results to all 0 sizes. Is this the behavior expected? Or should it report an exclusive size of 1 for the Foo struct?

Test plan

The example provided in #295 now passes successfully and has been enabled in the integration tests.

$ build/test/integration/integration_test_runner --gtest_filter='OidIntegration.arrays_member_int0' --verbose --preserve --enable-feature type-graph
codecov-commenter commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (cbeafba) 62.38% compared to head (cff773b) 62.41%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #453 +/- ## ========================================== + Coverage 62.38% 62.41% +0.02% ========================================== Files 123 123 Lines 12007 12006 -1 Branches 1956 1955 -1 ========================================== + Hits 7491 7493 +2 + Misses 3571 3570 -1 + Partials 945 943 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.