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
163 stars 14 forks source link

Make KeyCapture work with nested typedefs #473

Closed tyroguru closed 9 months ago

tyroguru commented 9 months ago

Summary

If a map in an object is typedef'd then we fail to identify the map as a container and ignore it as the target for key capture.

e.g.

using Foo = std::map<int, int>;

class Bar {
  Foo myMap;
};  

Currently the following config with the above definition would fail to capture keys in maMap:

      [[codegen.capture_keys]]
      type = "Bar"
      members = ["myMap"]

Test plan

I've added a new integration test 'capture_keys_typedef' and a unit test.

There are more changes here than first thought needed but the reviewers ar well aware :-) .

codecov-commenter commented 9 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (b5b94ed) 62.51% compared to head (56be62e) 62.52%. Report is 4 commits behind head on main.

Files Patch % Lines
oi/type_graph/Types.h 70.00% 3 Missing :warning:
oi/CodeGen.cpp 71.42% 1 Missing and 1 partial :warning:
oi/type_graph/Visitor.h 50.00% 1 Missing :warning:
test/test_key_capture.cpp 83.33% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #473 +/- ## ======================================= Coverage 62.51% 62.52% ======================================= Files 123 123 Lines 12072 12083 +11 Branches 1966 1969 +3 ======================================= + Hits 7547 7555 +8 - Misses 3570 3571 +1 - Partials 955 957 +2 ```

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