clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions
clang::DesignatedInitExpr Class Reference

Represents a C99 designated initializer expression. More...

#include <Expr.h>

Inheritance diagram for clang::DesignatedInitExpr:
Inheritance graph
[legend]
Collaboration diagram for clang::DesignatedInitExpr:
Collaboration graph
[legend]

List of all members.

Classes

struct  ArrayOrRangeDesignator
 An array or GNU array-range designator, e.g., "[9]" or "[10..15]". More...
class  Designator
 Represents a single C99 designator. More...
struct  FieldDesignator
 A field designator, e.g., ".x". More...

Public Types

typedef Designatordesignators_iterator
typedef const Designatorconst_designators_iterator
typedef llvm::iterator_range
< designators_iterator
designators_range
typedef llvm::iterator_range
< const_designators_iterator
designators_const_range
typedef std::reverse_iterator
< designators_iterator
reverse_designators_iterator
typedef std::reverse_iterator
< const_designators_iterator
const_reverse_designators_iterator

Public Member Functions

unsigned size () const
 Returns the number of designators in this initializer.
designators_iterator designators_begin ()
designators_iterator designators_end ()
const_designators_iterator designators_begin () const
const_designators_iterator designators_end () const
designators_range designators ()
designators_const_range designators () const
reverse_designators_iterator designators_rbegin ()
reverse_designators_iterator designators_rend ()
const_reverse_designators_iterator designators_rbegin () const
const_reverse_designators_iterator designators_rend () const
DesignatorgetDesignator (unsigned Idx)
void setDesignators (const ASTContext &C, const Designator *Desigs, unsigned NumDesigs)
ExprgetArrayIndex (const Designator &D) const
ExprgetArrayRangeStart (const Designator &D) const
ExprgetArrayRangeEnd (const Designator &D) const
SourceLocation getEqualOrColonLoc () const
 Retrieve the location of the '=' that precedes the initializer value itself, if present.
void setEqualOrColonLoc (SourceLocation L)
bool usesGNUSyntax () const
 Determines whether this designated initializer used the deprecated GNU syntax for designated initializers.
void setGNUSyntax (bool GNU)
ExprgetInit () const
 Retrieve the initializer value.
void setInit (Expr *init)
unsigned getNumSubExprs () const
 Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
ExprgetSubExpr (unsigned Idx) const
void setSubExpr (unsigned Idx, Expr *E)
void ExpandDesignator (const ASTContext &C, unsigned Idx, const Designator *First, const Designator *Last)
 Replaces the designator at index Idx with the series of designators in [First, Last).
SourceRange getDesignatorsSourceRange () const
SourceLocation getLocStart () const LLVM_READONLY
SourceLocation getLocEnd () const LLVM_READONLY
child_range children ()

Static Public Member Functions

static DesignatedInitExprCreate (const ASTContext &C, Designator *Designators, unsigned NumDesignators, ArrayRef< Expr * > IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
static DesignatedInitExprCreateEmpty (const ASTContext &C, unsigned NumIndexExprs)
static bool classof (const Stmt *T)

Detailed Description

Represents a C99 designated initializer expression.

A designated initializer expression (C99 6.7.8) contains one or more designators (which can be field designators, array designators, or GNU array-range designators) followed by an expression that initializes the field or element(s) that the designators refer to. For example, given:

 struct point {
   double x;
   double y;
 };
 struct point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };

The InitListExpr contains three DesignatedInitExprs, the first of which covers [2].y=1.0. This DesignatedInitExpr will have two designators, one array designator for [2] followed by one field designator for .y. The initialization expression will be 1.0.

Definition at line 3960 of file Expr.h.


Member Typedef Documentation

Definition at line 4169 of file Expr.h.

Definition at line 4196 of file Expr.h.

Definition at line 4181 of file Expr.h.

Definition at line 4163 of file Expr.h.

Definition at line 4175 of file Expr.h.

Definition at line 4187 of file Expr.h.


Member Function Documentation

Reimplemented from clang::Stmt.

Definition at line 4263 of file Expr.h.

static bool clang::DesignatedInitExpr::classof ( const Stmt T) [inline, static]

Reimplemented from clang::Expr.

Definition at line 4258 of file Expr.h.

DesignatedInitExpr * DesignatedInitExpr::Create ( const ASTContext C,
Designator Designators,
unsigned  NumDesignators,
ArrayRef< Expr * >  IndexExprs,
SourceLocation  EqualOrColonLoc,
bool  GNUSyntax,
Expr Init 
) [static]
DesignatedInitExpr * DesignatedInitExpr::CreateEmpty ( const ASTContext C,
unsigned  NumIndexExprs 
) [static]

Definition at line 3855 of file Expr.cpp.

References clang::ASTContext::Allocate().

Definition at line 4176 of file Expr.h.

References designators_begin(), and designators_end().

Definition at line 4182 of file Expr.h.

References designators_begin(), and designators_end().

Definition at line 4170 of file Expr.h.

Definition at line 4165 of file Expr.h.

Referenced by designators(), and designators_rbegin().

Definition at line 4171 of file Expr.h.

Definition at line 4188 of file Expr.h.

References designators_end().

Definition at line 4197 of file Expr.h.

References designators_end().

Definition at line 4191 of file Expr.h.

References designators_begin().

Definition at line 4200 of file Expr.h.

References designators_begin().

void DesignatedInitExpr::ExpandDesignator ( const ASTContext C,
unsigned  Idx,
const Designator First,
const Designator Last 
)

Replaces the designator at index Idx with the series of designators in [First, Last).

Definition at line 3920 of file Expr.cpp.

References AttributeLangSupport::C.

Referenced by ExpandAnonymousFieldDesignator().

Definition at line 4204 of file Expr.h.

References designators_begin().

Referenced by ExpandAnonymousFieldDesignator(), and getDesignatorsSourceRange().

Retrieve the location of the '=' that precedes the initializer value itself, if present.

Definition at line 4215 of file Expr.h.

Referenced by CloneDesignatedInitExpr().

Retrieve the initializer value.

Definition at line 4224 of file Expr.h.

References clang::Stmt::child_begin().

Referenced by CloneDesignatedInitExpr(), getLocEnd(), and clang::EvaluatedExprVisitor< ImplClass >::VisitDesignatedInitExpr().

Reimplemented from clang::Stmt.

Definition at line 3894 of file Expr.cpp.

References getInit(), and clang::Stmt::getLocEnd().

Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.

Definition at line 4236 of file Expr.h.

Referenced by CloneDesignatedInitExpr().

Definition at line 4238 of file Expr.h.

Referenced by CloneDesignatedInitExpr().

void DesignatedInitExpr::setDesignators ( const ASTContext C,
const Designator Desigs,
unsigned  NumDesigs 
)

Definition at line 3862 of file Expr.cpp.

References AttributeLangSupport::C.

Definition at line 4216 of file Expr.h.

Definition at line 4221 of file Expr.h.

References clang::GNU.

void clang::DesignatedInitExpr::setInit ( Expr init) [inline]

Definition at line 4228 of file Expr.h.

References clang::Stmt::child_begin().

void clang::DesignatedInitExpr::setSubExpr ( unsigned  Idx,
Expr E 
) [inline]

Definition at line 4243 of file Expr.h.

Returns the number of designators in this initializer.

Definition at line 4160 of file Expr.h.

Referenced by CloneDesignatedInitExpr(), and getDesignatorsSourceRange().

Determines whether this designated initializer used the deprecated GNU syntax for designated initializers.

Definition at line 4220 of file Expr.h.

Referenced by CloneDesignatedInitExpr().


The documentation for this class was generated from the following files: