clang-tools 22.0.0git
Classes | Public Types | Public Member Functions | List of all members
clang::reorder_fields::Designator Class Reference

Represents a part of a designation in a C99/C++20 designated initializer. More...

#include <Designator.h>

Public Types

enum  Kind { STRUCT , ARRAY , ARRAY_RANGE }
 

Public Member Functions

 Designator (const QualType Type, RecordDecl::field_iterator Field, const RecordDecl *RD)
 
 Designator (const QualType Type, uint64_t Idx, uint64_t Size)
 
 Designator (const QualType Type, uint64_t Start, uint64_t End, uint64_t Size)
 
void advanceToNextField ()
 Moves the iterator to the next element.
 
bool isFinished ()
 Checks if the iterator has iterated through all elements.
 
Kind getTag () const
 
QualType getType () const
 
const RecordDecl::field_iterator getStructIter () const
 
const RecordDecl * getStructDecl () const
 
uint64_t getArrayIndex () const
 
uint64_t getArrayRangeStart () const
 
uint64_t getArrayRangeEnd () const
 
uint64_t getArraySize () const
 

Detailed Description

Represents a part of a designation in a C99/C++20 designated initializer.

It is a tagged union of different kinds of designators: struct, array and array range. Holds enough information to be able to advance to the next field and to know when all fields have been iterated through.

Definition at line 29 of file Designator.h.

Member Enumeration Documentation

◆ Kind

Enumerator
STRUCT 
ARRAY 
ARRAY_RANGE 

Definition at line 31 of file Designator.h.

Constructor & Destructor Documentation

◆ Designator() [1/3]

clang::reorder_fields::Designator::Designator ( const QualType  Type,
RecordDecl::field_iterator  Field,
const RecordDecl *  RD 
)
inline

Definition at line 33 of file Designator.h.

References Field, and Type.

◆ Designator() [2/3]

clang::reorder_fields::Designator::Designator ( const QualType  Type,
uint64_t  Idx,
uint64_t  Size 
)
inline

Definition at line 37 of file Designator.h.

References Type.

◆ Designator() [3/3]

clang::reorder_fields::Designator::Designator ( const QualType  Type,
uint64_t  Start,
uint64_t  End,
uint64_t  Size 
)
inline

Definition at line 40 of file Designator.h.

References Type.

Member Function Documentation

◆ advanceToNextField()

void clang::reorder_fields::Designator::advanceToNextField ( )

Moves the iterator to the next element.

Definition at line 23 of file Designator.cpp.

References ARRAY, ARRAY_RANGE, ArrayIt, ArrayRangeIt, isFinished(), STRUCT, and StructIt.

◆ getArrayIndex()

uint64_t clang::reorder_fields::Designator::getArrayIndex ( ) const
inline

Definition at line 62 of file Designator.h.

References ARRAY, and ArrayIt.

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

◆ getArrayRangeEnd()

uint64_t clang::reorder_fields::Designator::getArrayRangeEnd ( ) const
inline

Definition at line 72 of file Designator.h.

References ARRAY_RANGE, and ArrayRangeIt.

◆ getArrayRangeStart()

uint64_t clang::reorder_fields::Designator::getArrayRangeStart ( ) const
inline

Definition at line 67 of file Designator.h.

References ARRAY_RANGE, and ArrayRangeIt.

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

◆ getArraySize()

uint64_t clang::reorder_fields::Designator::getArraySize ( ) const
inline

Definition at line 77 of file Designator.h.

References ARRAY, ARRAY_RANGE, ArrayIt, and ArrayRangeIt.

◆ getStructDecl()

const RecordDecl * clang::reorder_fields::Designator::getStructDecl ( ) const
inline

Definition at line 57 of file Designator.h.

References STRUCT, and StructIt.

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

◆ getStructIter()

const RecordDecl::field_iterator clang::reorder_fields::Designator::getStructIter ( ) const
inline

Definition at line 52 of file Designator.h.

References STRUCT, and StructIt.

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

◆ getTag()

Kind clang::reorder_fields::Designator::getTag ( ) const
inline

Definition at line 49 of file Designator.h.

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

◆ getType()

QualType clang::reorder_fields::Designator::getType ( ) const
inline

Definition at line 50 of file Designator.h.

◆ isFinished()

bool clang::reorder_fields::Designator::isFinished ( )

Checks if the iterator has iterated through all elements.

Definition at line 51 of file Designator.cpp.

References ARRAY, ARRAY_RANGE, ArrayIt, ArrayRangeIt, STRUCT, and StructIt.

Referenced by advanceToNextField().

Member Data Documentation

◆ ArrayIt

ArrayIter clang::reorder_fields::Designator::ArrayIt

Definition at line 114 of file Designator.h.

Referenced by advanceToNextField(), getArrayIndex(), getArraySize(), and isFinished().

◆ ArrayRangeIt

ArrayRangeIter clang::reorder_fields::Designator::ArrayRangeIt

◆ StructIt

StructIter clang::reorder_fields::Designator::StructIt

Definition at line 113 of file Designator.h.

Referenced by advanceToNextField(), getStructDecl(), getStructIter(), and isFinished().


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