This repository was archived by the owner on Feb 15, 2026. It is now read-only.
Support type substitution of template types#103
Merged
Papierkorb merged 2 commits intoPapierkorb:masterfrom Nov 2, 2020
Merged
Support type substitution of template types#103Papierkorb merged 2 commits intoPapierkorb:masterfrom
Papierkorb merged 2 commits intoPapierkorb:masterfrom
Conversation
Papierkorb
reviewed
Nov 1, 2020
| type.pointer.should eq(1) | ||
| type.base_name.should eq("int") | ||
| type.full_name.should eq("int*") | ||
| type.full_name.should eq("int *") |
Owner
There was a problem hiding this comment.
Where's the extra space coming from?
Contributor
Author
There was a problem hiding this comment.
Pointers/references coming from the Clang parser have the extra space, so Parser::Type.parse now canonicalizes the typename given to it with Cpp::Typename, instead of using the typename verbatim. (This probably fixed a bug somewhere that considered T* and T * to be unequal types.)
Owner
|
Thanks 👍 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 Bindgen's type parser to handle C++ templates, and adds methods that replace names in a given type with other types. This PR lays the groundwork for at least 2 scenarios:
const QVector<QRgb> &toconst QVector<unsigned int> &, providedQRgbis an alias forunsigned int. This can be used for the first issue mentioned in Generic pseudo-instantiation macro for container wrapper types #102; before this PR, the most Bindgen could do was resolving one level of aliases in each template argument.QVector<const T *>toQVector<const QVector<int> *>, providedTis instantiated withconst QVector<int> &(notice the combination of const-ness and references and pointers). This allows for example the possibility of defining container interfaces in the config files.The parser and the substitution both fully handle arbitrarily nested templates; the returned
Parser::Types respect the template structure at all levels, and should match what would be produced by the Clang parser.