C++: add isVLA() to ArrayType to identify variable-length arrays

This commit is contained in:
idrissrio
2025-04-14 09:14:36 +02:00
parent 86313715a4
commit 033bade0ab
2 changed files with 7 additions and 0 deletions

View File

@@ -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)) }
}
/**

View File

@@ -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