CodeQL library for C/C++
codeql/cpp-all 0.12.10 (changelog, source)
Search

Member predicate ArrayOrVectorAggregateLiteral::getElementExpr

Gets the expression within the aggregate literal that is used to initialize element elementIndex, if present. The expression is the position’th entry in the aggregate literal.

For example, if a represents the initialization literal {[0] = 123, [1] = 456, [0] = 789 } in

int x[2] = {[0] = 123, [1] = 456, [0] = 789 };

then:

  • a.getElementExpr(0, 0) gives 123.
  • a.getElementExpr(1, 1) gives 456.
  • a.getElementExpr(0, 2) gives 789.
Expr getElementExpr(int elementIndex, int position)