mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: Fix incorrect dbscheme assumptions on proxy classes
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user