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

Member predicate ClassAggregateLiteral::hasDesignator

Holds if the position-th initialization of field in this aggregate initializer uses a designated (e.g., .x = ...) rather than a positional initializer.

For example, in:

struct S { int x, y; };
struct S s = { .x = 1, 2 };
  • .x = 1 is a designated initializer, therefore hasDesignator(x, 0) holds.
  • 2 is a positional initializer for s.y, therefore hasDesignator(y, 1) does not hold.
predicate hasDesignator(Field field, int position)