Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tbv2: account for duplicate types when emitting name providers #438

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

JakeHillion
Copy link
Contributor

@JakeHillion JakeHillion commented Dec 20, 2023

tbv2: account for duplicate types when emitting name providers

ClangTypeParser has emitted a duplicate type for std::allocatr<int8_t>.
Rather than fixing this, add the same check the compiler will do for the
duplicate templates that addNames emits. That is, template<> NameProvider<Foo> will collide if Foo is used twice. We can do this by
adding a set of these strings for now. If this shows up regularly it will
likely make sense to deduplicate the type graph with a deduplication pass.

Test plan:

  • Fixes the issue in prod. This change is quite logical.

Stack created with Sapling. Best reviewed with ReviewStack.

folly::IOBuf does not have TreeBuilder v2 container support. Add it.

The implementation is a direct clone of v1. It still lacks tests.

Test Plan:
- It codegens on a prod type.
- No runtime testing... Bad form, I know.
- Issue created to add integration tests: facebookexperimental#436
ClangTypeParser has emitted a duplicate type for `std::allocatr<int8_t>`.
Rather than fixing this, add the same check the compiler will do for the
duplicate templates that `addNames` emits. That is, `template<>
NameProvider<Foo>` will collide if `Foo` is used twice. We can do this by
adding a set of these strings for now. If this shows up regularly it will
likely make sense to deduplicate the type graph with a deduplication pass.

Test plan:
- Fixes the issue in prod. This change is quite logical.
@codecov-commenter
Copy link

Codecov Report

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

Comparison is base (55989a9) 44.63% compared to head (851901d) 44.63%.

Files Patch % Lines
oi/CodeGen.cpp 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #438      +/-   ##
==========================================
- Coverage   44.63%   44.63%   -0.01%     
==========================================
  Files         121      121              
  Lines       11902    11905       +3     
  Branches     1946     1947       +1     
==========================================
+ Hits         5313     5314       +1     
- Misses       5737     5738       +1     
- Partials      852      853       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JakeHillion JakeHillion merged commit 6d898be into facebookexperimental:main Dec 20, 2023
13 checks passed
@JakeHillion JakeHillion deleted the pr438 branch December 20, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants