Extend cpp-rule-preprocessor supported C++ rules#187
Open
joaotgouveia wants to merge 2 commits into
Open
Conversation
Contributor
|
This needs to add a few rules that make use of this functionality. |
93e8653 to
81d131d
Compare
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.
Extends the set of rules that
cpp-rule-preprocessorcan handle.The biggest additions are
createMirrorTypeand support for adding type hints to IR rules in the form of default template arguments.One limitation on the kinds of rules that could be processed was that the synthesized PODs did not necessarily exhibit all of the characteristics required to instantiate a given C++ construct.
This patch adds support for specifying default template arguments in rules, which are used as a reference for the characteristics that the synthesized structs must exhibit.
This information is then used by
createMirrorType.When the provided type is a non-template class, the synthesized struct simply inherits from it.
When the provided type is a class template, the synthesized struct becomes an instantiation of a synthesized class template that inherits from it.
Roughly:
Using a synthesized class template rather than inheriting directly allows the synthesized struct to match the hinted type structurally.
This is useful when instantiating constructs that perform structural checks, such as:
These changes enable
cpp-rule-preprocessorto parse 479 automatically generated rule sources forstd::vectorand its specializations.