C++: Introduce 'getAnElementExpr' and 'getAnExpr'.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-04-04 10:12:25 +01:00
parent ea180c07e4
commit 6dd6488437

View File

@@ -187,8 +187,22 @@ class ClassAggregateLiteral extends AggregateLiteral {
override string getAPrimaryQlClass() { result = "ClassAggregateLiteral" }
/**
* Gets an expression within the aggregate literal that is used to initialize
* field `field`, if present.
*
* This predicate may have multiple results since a field can be initialized
* multiple times in the same initializer.
*/
Expr getAFieldExpr(Field field) { result = this.getFieldExpr(field, _) }
/**
* DEPRECATED: Use `getAFieldExpr` instead.
*
* Gets the expression within the aggregate literal that is used to initialize
* field `field`, if present.
*
* This predicate may have multiple results since a field can be initialized
* multiple times in the same initializer.
*/
Expr getFieldExpr(Field field) { result = this.getFieldExpr(field, _) }
@@ -274,8 +288,22 @@ class ArrayOrVectorAggregateLiteral extends AggregateLiteral {
Type getElementType() { none() }
/**
* Gets an expression within the aggregate literal that is used to initialize
* element `elementIndex`, if present.
*
* This predicate may have multiple results since an element can be initialized
* multiple times in the same initializer.
*/
Expr getAnElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) }
/**
* DEPRECATED: Use `getAnElementExpr` instead.
*
* Gets the expression within the aggregate literal that is used to initialize
* element `elementIndex`, if present.
*
* This predicate may have multiple results since an element can be initialized
* multiple times in the same initializer.
*/
Expr getElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) }