Repository navigation
Clean up unused or redundant structure/union/interface code paths in tlbparser and codegenerator. - #976
Merged
junkmd merged 12 commits intoOct 24, 2026
Conversation
…in `Parser` class.
The parser only passes `Field` objects to records and unions, but `_Struct_Union_Base` allowed `Field`, `Method`, and `Constructor` members. Update its member annotation to reflect the objects actually produced by the parser.
The parser only passes `Field` objects to records and unions, but the structure generator still handled the unused `Method` and `Constructor` members. This suggests that this part of `typedesc` came from an older, more general C or C++ type model. Remove those branches so the model matches the COM type library rules, and generate structure packing and fields directly.
The parser only passes `Field` objects to records and unions, but the structure header generator still checked for unused `Method` members. This suggests that this part of `typedesc` came from an older, more general C or C++ type model. Remove that obsolete branch so the model matches the COM type library rules.
The parser only passes `Field` objects to records and unions, but the structure header generator still emitted helpers based on unused `Method` members. This suggests that this part of `typedesc` came from an older, more general C or C++ type model. Remove those obsolete branches so the model matches the COM type library rules.
Records and unions are data types in the COM type library model. The parser provides their fields, while the older structure header path also emitted base classes and an IID. Remove that legacy output so generated structure headers reflect the data-only model.
Records and unions are data types in the COM type library model. Their members are fields, and the parser does not provide structure base types. Remove the code-generator traversal of those obsolete bases so generation follows the data-only model.
Records and unions are data types in the COM type library model. The parser only provides their fields, so the obsolete `bases` parameter and stored base types are unnecessary. Remove them from the type descriptions, parser calls, packing support, and related packing tests.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #976 +/- ##
==========================================
+ Coverage 89.61% 89.90% +0.29%
==========================================
Files 143 143
Lines 14247 14192 -55
==========================================
- Hits 12768 12760 -8
+ Misses 1479 1432 -47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tlbparser and codegenerator.tlbparser and codegenerator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The main goal of this PR is to clean up our code.
I removed old code that was no longer used (dead code) from the parser and code generator. Now, the code returns early when it finds unnecessary steps. This makes the code shorter and simpler.
Specifically, I cleaned up warnings in
Parser, extra steps forIUnknown/IDispatch, and unused methods or inheritance code in structures.This cleanup is safe because
StructureandUnionare only for data types in COM Automation rules. In COMTYPEKIND:TKIND_RECORDmeans "a structure with no methods."TKIND_UNIONmeans a union where members share the same memory location.TKIND_INTERFACEorTKIND_DISPATCH.So, records and unions only need information about data, such as fields, sizes, and alignments.
They do not need methods, constructors, base classes, or IIDs. Microsoft's COM type descriptions document also says that structures and unions do not have functions.
Now,
Structure/Unionhandle data, andComInterface/DispInterfacehandle behaviors. This matches the COM rules.Impacts
ParserhandlesIUnknown,IDispatch, and warnings more simply, so it can stop early.ComInterfaceorDispInterface.