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

C++: Add getTemplateClass to DeductionGuide #17118

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,305 changes: 2,305 additions & 0 deletions cpp/downgrades/e197626a6ebccd052d5c891975fccf8aebcc9803/old.dbscheme

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Add relation between deduction guides and class templates
compatibility: full
deduction_guide_for_class.rel: delete
4 changes: 4 additions & 0 deletions cpp/ql/lib/change-notes/2024-08-01-deduction-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: feature
---
* A `getTemplateClass` predicate was added to the `DeductionGuide` class to get the class template for which the deduction guide is a guide.
7 changes: 7 additions & 0 deletions cpp/ql/lib/semmle/code/cpp/Function.qll
Original file line number Diff line number Diff line change
Expand Up @@ -898,4 +898,11 @@ class UserDefinedLiteral extends Function {
*/
class DeductionGuide extends Function {
DeductionGuide() { functions(underlyingElement(this), _, 8) }

/**
* Gets the class template for which this is a deduction guide.
*/
TemplateClass getTemplateClass() {
deduction_guide_for_class(underlyingElement(this), unresolveElement(result))
}
}
5 changes: 5 additions & 0 deletions cpp/ql/lib/semmlecode.cpp.dbscheme
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ function_defaulted(unique int id: @function ref);

function_prototyped(unique int id: @function ref)

deduction_guide_for_class(
int id: @function ref,
int class_template: @usertype ref
)

member_function_this_type(
unique int id: @function ref,
int this_type: @type ref
Expand Down
Loading
Loading