mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: add isVLA() to ArrayType to identify variable-length arrays
This commit is contained in:
@@ -1369,6 +1369,11 @@ class ArrayType extends DerivedType {
|
||||
override predicate isDeeplyConst() { this.getBaseType().isDeeplyConst() } // No such thing as a const array type
|
||||
|
||||
override predicate isDeeplyConstBelow() { this.getBaseType().isDeeplyConst() }
|
||||
|
||||
/**
|
||||
* Holds if this array is a variable-length array (VLA).
|
||||
*/
|
||||
predicate isVla() { type_is_vla(underlyingElement(this)) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2178,6 +2178,8 @@ variable_vla(
|
||||
int decl: @stmt_vla_decl ref
|
||||
);
|
||||
|
||||
type_is_vla(unique int type_id: @derivedtype ref)
|
||||
|
||||
if_initialization(
|
||||
unique int if_stmt: @stmt_if ref,
|
||||
int init_id: @stmt ref
|
||||
|
||||
Reference in New Issue
Block a user