C++: Fix incorrect dbscheme assumptions on proxy classes

This commit is contained in:
Jeroen Ketema
2025-01-13 14:52:38 +01:00
parent 13e8853277
commit 8e39eb9020
2 changed files with 16 additions and 5 deletions

View File

@@ -1076,13 +1076,19 @@ class VirtualBaseClass extends Class {
}
/**
* The proxy class (where needed) associated with a template parameter, as
* in the following code:
* ```
* The proxy class (where needed) associated with a template parameter or a
* decltype, as in the following code:
* ```cpp
* template <typename T>
* struct S : T { // the type of this T is a proxy class
* ...
* };
*
* template <typename T>
* concept C =
* decltype(std::span{std::declval<T&>()})::extent
* != std::dynamic_extent;
* // the type of decltype(std::span{std::declval<T&>()}) is a proxy class
* ```
*/
class ProxyClass extends UserType {
@@ -1093,10 +1099,13 @@ class ProxyClass extends UserType {
/** Gets the location of the proxy class. */
override Location getLocation() { result = this.getTemplateParameter().getDefinitionLocation() }
/** Gets the template parameter for which this is the proxy class. */
/** Gets the template parameter for which this is the proxy class, if any. */
TypeTemplateParameter getTemplateParameter() {
is_proxy_class_for(underlyingElement(this), unresolveElement(result))
}
/** Gets the decltype for which this is the proxy class, if any. */
Decltype getDecltype() { is_proxy_class_for(underlyingElement(this), unresolveElement(result)) }
}
// Unpacks "array of ... of array of t" into t.

View File

@@ -847,9 +847,11 @@ class_template_argument_value(
int arg_value: @expr ref
);
@user_or_decltype = @usertype | @decltype;
is_proxy_class_for(
unique int id: @usertype ref,
unique int templ_param_id: @usertype ref
int templ_param_id: @user_or_decltype ref
);
type_mentions(