clang  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::InitializationKind Class Reference

Describes the kind of initialization being performed, along with location information for tokens related to the initialization (equal sign, parentheses). More...

#include "clang/Sema/Initialization.h"

Public Types

enum  InitKind {
  IK_Direct, IK_DirectList, IK_Copy, IK_Default,
  IK_Value
}
 The kind of initialization being performed. More...
 

Public Member Functions

InitKind getKind () const
 Determine the initialization kind. More...
 
bool isExplicitCast () const
 Determine whether this initialization is an explicit cast. More...
 
bool isStaticCast () const
 Determine whether this initialization is a static cast. More...
 
bool isCStyleOrFunctionalCast () const
 Determine whether this initialization is a C-style cast. More...
 
bool isCStyleCast () const
 Determine whether this is a C-style cast. More...
 
bool isFunctionalCast () const
 Determine whether this is a functional-style cast. More...
 
bool isImplicitValueInit () const
 Determine whether this initialization is an implicit value-initialization, e.g., as occurs during aggregate initialization. More...
 
SourceLocation getLocation () const
 Retrieve the location at which initialization is occurring. More...
 
SourceRange getRange () const
 Retrieve the source range that covers the initialization. More...
 
SourceLocation getEqualLoc () const
 Retrieve the location of the equal sign for copy initialization (if present). More...
 
bool isCopyInit () const
 
bool AllowExplicit () const
 Retrieve whether this initialization allows the use of explicit constructors. More...
 
bool allowExplicitConversionFunctionsInRefBinding () const
 Retrieve whether this initialization allows the use of explicit conversion functions when binding a reference. More...
 
bool hasParenOrBraceRange () const
 Determine whether this initialization has a source range containing the locations of open and closing parentheses or braces. More...
 
SourceRange getParenOrBraceRange () const
 Retrieve the source range containing the locations of the open and closing parentheses or braces for value, direct, and direct list initializations. More...
 

Static Public Member Functions

static InitializationKind CreateDirect (SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
 Create a direct initialization. More...
 
static InitializationKind CreateDirectList (SourceLocation InitLoc)
 
static InitializationKind CreateDirectList (SourceLocation InitLoc, SourceLocation LBraceLoc, SourceLocation RBraceLoc)
 
static InitializationKind CreateCast (SourceRange TypeRange)
 Create a direct initialization due to a cast that isn't a C-style or functional cast. More...
 
static InitializationKind CreateCStyleCast (SourceLocation StartLoc, SourceRange TypeRange, bool InitList)
 Create a direct initialization for a C-style cast. More...
 
static InitializationKind CreateFunctionalCast (SourceRange TypeRange, bool InitList)
 Create a direct initialization for a functional cast. More...
 
static InitializationKind CreateCopy (SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
 Create a copy initialization. More...
 
static InitializationKind CreateDefault (SourceLocation InitLoc)
 Create a default initialization. More...
 
static InitializationKind CreateValue (SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool isImplicit=false)
 Create a value initialization. More...
 
static InitializationKind CreateForInit (SourceLocation Loc, bool DirectInit, Expr *Init)
 Create an initialization from an initializer (which, for direct initialization from a parenthesized list, will be a ParenListExpr). More...
 

Detailed Description

Describes the kind of initialization being performed, along with location information for tokens related to the initialization (equal sign, parentheses).

Definition at line 567 of file Initialization.h.

Member Enumeration Documentation

◆ InitKind

The kind of initialization being performed.

Enumerator
IK_Direct 

Direct initialization.

IK_DirectList 

Direct list-initialization.

IK_Copy 

Copy initialization.

IK_Default 

Default initialization.

IK_Value 

Value initialization.

Definition at line 570 of file Initialization.h.

Member Function Documentation

◆ AllowExplicit()

bool clang::InitializationKind::AllowExplicit ( ) const
inline

Retrieve whether this initialization allows the use of explicit constructors.

Definition at line 760 of file Initialization.h.

References isCopyInit().

◆ allowExplicitConversionFunctionsInRefBinding()

bool clang::InitializationKind::allowExplicitConversionFunctionsInRefBinding ( ) const
inline

Retrieve whether this initialization allows the use of explicit conversion functions when binding a reference.

If the reference is the first parameter in a copy or move constructor, such conversions are permitted even though we are performing copy-initialization.

Definition at line 766 of file Initialization.h.

References isCopyInit().

◆ CreateCast()

static InitializationKind clang::InitializationKind::CreateCast ( SourceRange  TypeRange)
inlinestatic

Create a direct initialization due to a cast that isn't a C-style or functional cast.

Definition at line 649 of file Initialization.h.

References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), and IK_Direct.

Referenced by TryStaticImplicitCast().

◆ CreateCopy()

static InitializationKind clang::InitializationKind::CreateCopy ( SourceLocation  InitLoc,
SourceLocation  EqualLoc,
bool  AllowExplicitConvs = false 
)
inlinestatic

◆ CreateCStyleCast()

static InitializationKind clang::InitializationKind::CreateCStyleCast ( SourceLocation  StartLoc,
SourceRange  TypeRange,
bool  InitList 
)
inlinestatic

Create a direct initialization for a C-style cast.

Definition at line 655 of file Initialization.h.

References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), IK_Direct, and IK_DirectList.

Referenced by clang::Sema::BuildCompoundLiteralExpr(), and TryStaticImplicitCast().

◆ CreateDefault()

static InitializationKind clang::InitializationKind::CreateDefault ( SourceLocation  InitLoc)
inlinestatic

◆ CreateDirect()

static InitializationKind clang::InitializationKind::CreateDirect ( SourceLocation  InitLoc,
SourceLocation  LParenLoc,
SourceLocation  RParenLoc 
)
inlinestatic

◆ CreateDirectList() [1/2]

static InitializationKind clang::InitializationKind::CreateDirectList ( SourceLocation  InitLoc)
inlinestatic

◆ CreateDirectList() [2/2]

static InitializationKind clang::InitializationKind::CreateDirectList ( SourceLocation  InitLoc,
SourceLocation  LBraceLoc,
SourceLocation  RBraceLoc 
)
inlinestatic

Definition at line 640 of file Initialization.h.

References IK_DirectList.

◆ CreateForInit()

static InitializationKind clang::InitializationKind::CreateForInit ( SourceLocation  Loc,
bool  DirectInit,
Expr Init 
)
inlinestatic

Create an initialization from an initializer (which, for direct initialization from a parenthesized list, will be a ParenListExpr).

Definition at line 698 of file Initialization.h.

References CreateCopy(), CreateDefault(), CreateDirect(), CreateDirectList(), and clang::DirectInit.

Referenced by clang::Sema::AddInitializerToDecl(), clang::Sema::buildCoroutinePromise(), and clang::Sema::CheckTemplateArgument().

◆ CreateFunctionalCast()

static InitializationKind clang::InitializationKind::CreateFunctionalCast ( SourceRange  TypeRange,
bool  InitList 
)
inlinestatic

Create a direct initialization for a functional cast.

Definition at line 666 of file Initialization.h.

References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), IK_Direct, and IK_DirectList.

Referenced by TryStaticImplicitCast().

◆ CreateValue()

static InitializationKind clang::InitializationKind::CreateValue ( SourceLocation  InitLoc,
SourceLocation  LParenLoc,
SourceLocation  RParenLoc,
bool  isImplicit = false 
)
inlinestatic

Create a value initialization.

Definition at line 688 of file Initialization.h.

References IK_Value.

Referenced by clang::Sema::BuildCXXTypeConstructExpr().

◆ getEqualLoc()

SourceLocation clang::InitializationKind::getEqualLoc ( ) const
inline

Retrieve the location of the equal sign for copy initialization (if present).

Definition at line 751 of file Initialization.h.

References IK_Copy.

◆ getKind()

InitKind clang::InitializationKind::getKind ( ) const
inline

Determine the initialization kind.

Definition at line 709 of file Initialization.h.

◆ getLocation()

SourceLocation clang::InitializationKind::getLocation ( ) const
inline

Retrieve the location at which initialization is occurring.

Definition at line 742 of file Initialization.h.

◆ getParenOrBraceRange()

SourceRange clang::InitializationKind::getParenOrBraceRange ( ) const
inline

Retrieve the source range containing the locations of the open and closing parentheses or braces for value, direct, and direct list initializations.

Definition at line 779 of file Initialization.h.

References hasParenOrBraceRange().

◆ getRange()

SourceRange clang::InitializationKind::getRange ( ) const
inline

Retrieve the source range that covers the initialization.

Definition at line 745 of file Initialization.h.

◆ hasParenOrBraceRange()

bool clang::InitializationKind::hasParenOrBraceRange ( ) const
inline

Determine whether this initialization has a source range containing the locations of open and closing parentheses or braces.

Definition at line 772 of file Initialization.h.

References IK_Direct, IK_DirectList, and IK_Value.

Referenced by getParenOrBraceRange().

◆ isCopyInit()

bool clang::InitializationKind::isCopyInit ( ) const
inline

Definition at line 756 of file Initialization.h.

References IK_Copy.

Referenced by AllowExplicit(), and allowExplicitConversionFunctionsInRefBinding().

◆ isCStyleCast()

bool clang::InitializationKind::isCStyleCast ( ) const
inline

Determine whether this is a C-style cast.

Definition at line 727 of file Initialization.h.

◆ isCStyleOrFunctionalCast()

bool clang::InitializationKind::isCStyleOrFunctionalCast ( ) const
inline

Determine whether this initialization is a C-style cast.

Definition at line 722 of file Initialization.h.

◆ isExplicitCast()

bool clang::InitializationKind::isExplicitCast ( ) const
inline

Determine whether this initialization is an explicit cast.

Definition at line 714 of file Initialization.h.

◆ isFunctionalCast()

bool clang::InitializationKind::isFunctionalCast ( ) const
inline

Determine whether this is a functional-style cast.

Definition at line 732 of file Initialization.h.

◆ isImplicitValueInit()

bool clang::InitializationKind::isImplicitValueInit ( ) const
inline

Determine whether this initialization is an implicit value-initialization, e.g., as occurs during aggregate initialization.

Definition at line 739 of file Initialization.h.

◆ isStaticCast()

bool clang::InitializationKind::isStaticCast ( ) const
inline

Determine whether this initialization is a static cast.

Definition at line 719 of file Initialization.h.


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