clang-tools 22.0.0git
clang::reorder_fields::Designators Class Reference

List of designators. More...

#include <Designator.h>

Public Member Functions

 Designators (const Expr *Init, const InitListExpr *ILE, const ASTContext *Context)
 Initialize to the first member of the struct/array.
 Designators (const DesignatedInitExpr *DIE, const InitListExpr *ILE, const ASTContext *Context)
 Initialize to the designators of the given expression.
bool isValid () const
 Return whether this designator list is valid.
bool advanceToNextField (const Expr *Init)
 Moves the designators to the next initializer in the struct/array.
std::string toString () const
 Gets a string representation from a list of designators.
size_t size () const
SmallVector< Designator >::const_iterator begin () const
SmallVector< Designator >::const_iterator end () const

Detailed Description

List of designators.

Definition at line 120 of file Designator.h.

Constructor & Destructor Documentation

◆ Designators() [1/2]

clang::reorder_fields::Designators::Designators ( const Expr * Init,
const InitListExpr * ILE,
const ASTContext * Context )

Initialize to the first member of the struct/array.

Enters implicit initializer lists until a type that matches Init is found.

Definition at line 63 of file Designator.cpp.

Referenced by Designators().

◆ Designators() [2/2]

clang::reorder_fields::Designators::Designators ( const DesignatedInitExpr * DIE,
const InitListExpr * ILE,
const ASTContext * Context )

Initialize to the designators of the given expression.

Definition at line 91 of file Designator.cpp.

References Designators().

Member Function Documentation

◆ advanceToNextField()

bool clang::reorder_fields::Designators::advanceToNextField ( const Expr * Init)

Moves the designators to the next initializer in the struct/array.

If the type of next initializer doesn't match the expected type then there are omitted braces and we add new designators to reflect that.

Definition at line 138 of file Designator.cpp.

References advanceToNextField().

Referenced by advanceToNextField().

◆ begin()

SmallVector< Designator >::const_iterator clang::reorder_fields::Designators::begin ( ) const
inline

Definition at line 145 of file Designator.h.

Referenced by clang::reorder_fields::ReorderedStruct::operator()().

◆ end()

SmallVector< Designator >::const_iterator clang::reorder_fields::Designators::end ( ) const
inline

Definition at line 148 of file Designator.h.

Referenced by clang::reorder_fields::ReorderedStruct::operator()().

◆ isValid()

bool clang::reorder_fields::Designators::isValid ( ) const
inline

Return whether this designator list is valid.

Definition at line 132 of file Designator.h.

◆ size()

size_t clang::reorder_fields::Designators::size ( ) const
inline

Definition at line 143 of file Designator.h.

◆ toString()

std::string clang::reorder_fields::Designators::toString ( ) const

Gets a string representation from a list of designators.

This string will be inserted before an initializer expression to make it designated.

Definition at line 196 of file Designator.cpp.

References clang::reorder_fields::Designator::ARRAY, clang::reorder_fields::Designator::ARRAY_RANGE, clang::reorder_fields::Designator::STRUCT, and toString().

Referenced by toString().


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