mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Merge pull request #19792 from jketema/sve
C++: Add Arm scalable vector type QL classes
This commit is contained in:
@@ -352,7 +352,23 @@ class UnknownType extends BuiltInType {
|
||||
private predicate isArithmeticType(@builtintype type, int kind) {
|
||||
builtintypes(type, _, kind, _, _, _) and
|
||||
kind >= 4 and
|
||||
kind != 34 // Exclude decltype(nullptr)
|
||||
kind != 34 and // Exclude decltype(nullptr)
|
||||
kind != 63 // Exclude __SVCount_t
|
||||
}
|
||||
|
||||
/**
|
||||
* The Arm scalable vector count type.
|
||||
*
|
||||
* In the following example, `a` is declared using the scalable vector
|
||||
* count type:
|
||||
* ```
|
||||
* svcount_t a;
|
||||
* ```
|
||||
*/
|
||||
class ScalableVectorCount extends BuiltInType {
|
||||
ScalableVectorCount() { builtintypes(underlyingElement(this), _, 63, _, _, _) }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ScalableVectorCount" }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1084,7 +1100,7 @@ class NullPointerType extends BuiltInType {
|
||||
/**
|
||||
* A C/C++ derived type.
|
||||
*
|
||||
* These are pointer and reference types, array and GNU vector types, and `const` and `volatile` types.
|
||||
* These are pointer and reference types, array and vector types, and `const` and `volatile` types.
|
||||
* In all cases, the type is formed from a single base type. For example:
|
||||
* ```
|
||||
* int *pi;
|
||||
@@ -1648,6 +1664,30 @@ class GNUVectorType extends DerivedType {
|
||||
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An Arm Scalable vector type.
|
||||
*
|
||||
* In the following example, `a` has a scalable vector type consisting
|
||||
* of 8-bit signed integer elements:
|
||||
* ```
|
||||
* svint8_t a;
|
||||
* ```
|
||||
*/
|
||||
class ScalableVectorType extends DerivedType {
|
||||
ScalableVectorType() { derivedtypes(underlyingElement(this), _, 11, _) }
|
||||
|
||||
/**
|
||||
* Get the number of tuple elements of this scalable vector type.
|
||||
*/
|
||||
int getNumTupleElements() { tupleelements(underlyingElement(this), result) }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ScalableVectorType" }
|
||||
|
||||
override string explain() { result = "scalable vector of {" + this.getBaseType().explain() + "}" }
|
||||
|
||||
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C/C++ pointer to a function. See 7.7.
|
||||
* ```
|
||||
|
||||
@@ -134,6 +134,8 @@ private predicate isOpaqueType(Type type) {
|
||||
)
|
||||
or
|
||||
type instanceof PointerToMemberType // PTMs are missing size info
|
||||
or
|
||||
type instanceof ScalableVectorCount
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user