clang 10.0.0git

Enumerations | Functions
SemaInit.cpp File Reference
`#include "clang/AST/ASTContext.h"`
`#include "clang/AST/DeclObjC.h"`
`#include "clang/AST/ExprCXX.h"`
`#include "clang/AST/ExprObjC.h"`
`#include "clang/AST/ExprOpenMP.h"`
`#include "clang/AST/TypeLoc.h"`
`#include "clang/Basic/CharInfo.h"`
`#include "clang/Basic/TargetInfo.h"`
`#include "clang/Sema/Designator.h"`
`#include "clang/Sema/Initialization.h"`
`#include "clang/Sema/Lookup.h"`
`#include "clang/Sema/SemaInternal.h"`
`#include "llvm/ADT/APInt.h"`
`#include "llvm/ADT/SmallString.h"`
`#include "llvm/Support/ErrorHandling.h"`
`#include "llvm/Support/raw_ostream.h"`
Include dependency graph for SemaInit.cpp:

Go to the source code of this file.

## Enumerations
enum | StringInitFailureKind { SIF_None, SIF_NarrowStringIntoWideChar, SIF_WideStringIntoChar, SIF_IncompatWideStringIntoWideChar, SIF_UTF8StringIntoPlainChar, SIF_PlainStringIntoUTF8Char, SIF_Other }
enum | InvalidICRKind { IIK_okay, IIK_nonlocal, IIK_nonscalar }
| The non-zero enum values here are indexes into diagnostic alternatives. More...
enum | LifetimeKind
enum | ReferenceKind

## Functions
static bool | IsWideCharCompatible (QualType T, ASTContext &Context)
| Check whether T is compatible with a wide character type (wchar_t, char16_t or char32_t). More...
static StringInitFailureKind | IsStringInit (Expr *Init, const ArrayType *AT, ASTContext &Context)
| Check whether the array of type AT can be initialized by the Init expression by means of string initialization. More...
static StringInitFailureKind | IsStringInit (Expr *init, QualType declType, ASTContext &Context)
static void | updateStringLiteralType (Expr *E, QualType Ty)
| Update the type of a string literal, including any surrounding parentheses, to match the type of the object which it is initializing. More...
static void | updateGNUCompoundLiteralRValue (Expr *E)
| Fix a compound literal initializing an array so it's correctly marked as an rvalue. More...
static void | CheckStringInit (Expr *Str, QualType &DeclT, const ArrayType *AT, Sema &S)
static bool | hasAnyDesignatedInits (const InitListExpr *IL)
static bool | isIdiomaticBraceElisionEntity (const InitializedEntity &Entity)
| Determine whether Entity is an entity for which it is idiomatic to elide the braces in aggregate initialization. More...
static void | warnBracedScalarInit (Sema &S, const InitializedEntity &Entity, SourceRange Braces)
| Warn that `Entity` was of scalar type and was initialized by a single-element braced initializer list. More...
static bool | checkDestructorReference (QualType ElementType, SourceLocation Loc, Sema &SemaRef)
| Check if the type of a class element has an accessible destructor, and marks it referenced. More...
static void | ExpandAnonymousFieldDesignator (Sema &SemaRef, DesignatedInitExpr *DIE, unsigned DesigIdx, IndirectFieldDecl *IndirectField)
| Expand a field designator that refers to a member of an anonymous struct or union into a series of field designators that refers to the field within the appropriate subobject. More...
static DesignatedInitExpr * | CloneDesignatedInitExpr (Sema &SemaRef, DesignatedInitExpr *DIE)
static ExprResult | CheckArrayDesignatorExpr (Sema &S, Expr *Index, llvm::APSInt &Value)
| Check that the given Index expression is a valid array designator value. More...
static bool | maybeRecoverWithZeroInitialization (Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity)
| Tries to add a zero initializer. Returns true if that worked. More...
static void | MaybeProduceObjCObject (Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity)
static void | TryListInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitListExpr *InitList, InitializationSequence &Sequence, bool TreatUnavailableAsInvalid)
| Attempt list initialization (C++0x [dcl.init.list]) More...
static bool | TryInitializerListConstruction (Sema &S, InitListExpr *List, QualType DestType, InitializationSequence &Sequence, bool TreatUnavailableAsInvalid)
| When initializing from init list via constructor, handle initialization of an object of type std::initializer_list<T>. More...
static bool | hasCopyOrMoveCtorParam (ASTContext &Ctx, const ConstructorInfo &Info)
| Determine if the constructor has the signature of a copy or move constructor for the type T of the class in which it was found. More...
static OverloadingResult | ResolveConstructorOverload (Sema &S, SourceLocation DeclLoc, MultiExprArg Args, OverloadCandidateSet &CandidateSet, QualType DestType, DeclContext::lookup_result Ctors, OverloadCandidateSet::iterator &Best, bool CopyInitializing, bool AllowExplicit, bool OnlyListConstructors, bool IsListInit, bool SecondStepOfCopyInit=false)
static void | TryConstructorInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType DestType, QualType DestArrayType, InitializationSequence &Sequence, bool IsListInit=false, bool IsInitListCopy=false)
| Attempt initialization by constructor (C++ [dcl.init]), which enumerates the constructors of the initialized entity and performs overload resolution to select the best. More...
static bool | ResolveOverloadedFunctionForReferenceBinding (Sema &S, Expr *Initializer, QualType &SourceType, QualType &UnqualifiedSourceType, QualType UnqualifiedTargetType, InitializationSequence &Sequence)
static void | TryReferenceInitializationCore (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, QualType cv1T1, QualType T1, Qualifiers T1Quals, QualType cv2T2, QualType T2, Qualifiers T2Quals, InitializationSequence &Sequence)
| Reference initialization without resolving overloaded functions. More...
static void | TryValueInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitializationSequence &Sequence, InitListExpr *InitList)
| Attempt value initialization (C++ [dcl.init]p7). More...
static void | TryReferenceListInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitListExpr *InitList, InitializationSequence &Sequence, bool TreatUnavailableAsInvalid)
| Attempt list initialization of a reference. More...
static OverloadingResult | TryRefInitWithConversionFunction (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, bool AllowRValues, bool IsLValueRef, InitializationSequence &Sequence)
| Try a reference initialization that involves calling a conversion function. More...
static void | CheckCXX98CompatAccessibleCopy (Sema &S, const InitializedEntity &Entity, Expr *CurInitExpr)
| Check whether elidable copy construction for binding a reference to a temporary would have succeeded if we were building in C++98 mode, for -Wc++98-compat. More...
static void | TryReferenceInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, InitializationSequence &Sequence)
| Attempt reference initialization (C++0x [dcl.init.ref]) More...
static bool | isNonReferenceableGLValue (Expr *E)
| Determine whether an expression is a non-referenceable glvalue (one to which a reference can never bind). More...
static void | TryStringLiteralInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, InitializationSequence &Sequence)
| Attempt character array initialization from a string literal (C++ [dcl.init.string], C99 6.7.8). More...
static void | TryDefaultInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitializationSequence &Sequence)
| Attempt default initialization (C++ [dcl.init]p6). More...
static void | TryUserDefinedConversion (Sema &S, QualType DestType, const InitializationKind &Kind, Expr *Initializer, InitializationSequence &Sequence, bool TopLevelOfInitList)
| Attempt a user-defined conversion between two types (C++ [dcl.init]), which enumerates all conversion functions and performs overload resolution to select the best. More...
static bool | isLibstdcxxPointerReturnFalseHack (Sema &S, const InitializedEntity &Entity, const Expr *Init)
| An egregious hack for compatibility with libstdc++-4.2: in <tr1/hashtable>, a function with a pointer return type contains a 'return false;' statement. More...
static InvalidICRKind | isInvalidICRSource (ASTContext &C, Expr *e, bool isAddressOf, bool &isWeakAccess)
| Determines whether this expression is an acceptable ICR source. More...
static void | checkIndirectCopyRestoreSource (Sema &S, Expr *src)
| Check whether the given expression is a valid operand for an indirect copy/restore. More...
static bool | hasCompatibleArrayTypes (ASTContext &Context, const ArrayType *Dest, const ArrayType *Source)
| Determine whether we have compatible array types for the purposes of GNU by-copy array initialization. More...
static bool | tryObjCWritebackConversion (Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity, Expr *Initializer)
static bool | TryOCLSamplerInitialization (Sema &S, InitializationSequence &Sequence, QualType DestType, Expr *Initializer)
static bool | IsZeroInitializer (Expr *Initializer, Sema &S)
static bool | TryOCLZeroOpaqueTypeInitialization (Sema &S, InitializationSequence &Sequence, QualType DestType, Expr *Initializer)
static bool | isExprAnUnaddressableFunction (Sema &S, const Expr *E)
| Tries to get a FunctionDecl out of `E`. More...
static bool | canPerformArrayCopy (const InitializedEntity &Entity)
| Determine whether we can perform an elementwise array copy for this kind of entity. More...
static Sema::AssignmentAction | getAssignmentAction (const InitializedEntity &Entity, bool Diagnose=false)
static bool | shouldBindAsTemporary (const InitializedEntity &Entity)
| Whether we should bind a created object as a temporary when initializing the given entity. More...
static bool | shouldDestroyEntity (const InitializedEntity &Entity)
| Whether the given entity, when initialized with an object created for that initialization, requires destruction. More...
static SourceLocation | getInitializationLoc (const InitializedEntity &Entity, Expr *Initializer)
| Get the location at which initialization diagnostics should appear. More...
static ExprResult | CopyObject (Sema &S, QualType T, const InitializedEntity &Entity, ExprResult CurInit, bool IsExtraneousCopy)
| Make a (potentially elidable) temporary copy of the object provided by the given initializer by calling the appropriate copy constructor. More...
static bool | isExplicitTemporary (const InitializedEntity &Entity, const InitializationKind &Kind, unsigned NumArgs)
| Returns true if the parameters describe a constructor initialization of an explicit temporary object, e.g. More...
static ExprResult | PerformConstructorInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, const InitializationSequence::Step &Step, bool &ConstructorInitRequiresZeroInit, bool IsListInitialization, bool IsStdInitListInitialization, SourceLocation LBraceLoc, SourceLocation RBraceLoc)
static LifetimeResult | getEntityLifetime (const InitializedEntity *Entity, const InitializedEntity *InitField=nullptr)
| Determine the declaration which an initialized entity ultimately refers to, for the purpose of lifetime-extending a temporary bound to a reference in the initialization of `Entity`. More...
static bool | isVarOnPath (IndirectLocalPath &Path, VarDecl *VD)
static bool | pathContainsInit (IndirectLocalPath &Path)
static void | visitLocalsRetainedByInitializer (IndirectLocalPath &Path, Expr *Init, LocalVisitor Visit, bool RevisitSubinits, bool EnableLifetimeWarnings)
| Visit the locals that would be reachable through an object initialized by the prvalue expression `Init`. More...
static void | visitLocalsRetainedByReferenceBinding (IndirectLocalPath &Path, Expr *Init, ReferenceKind RK, LocalVisitor Visit, bool EnableLifetimeWarnings)
| Visit the locals that would be reachable through a reference bound to the glvalue expression `Init`. More...
template<typename T >
static bool | isRecordWithAttr (QualType Type)
static bool | isInStlNamespace (const Decl *D)
static bool | shouldTrackImplicitObjectArg (const CXXMethodDecl *Callee)
static bool | shouldTrackFirstArgument (const FunctionDecl *FD)
static void | handleGslAnnotatedTypes (IndirectLocalPath &Path, Expr *Call, LocalVisitor Visit)
static bool | implicitObjectParamIsLifetimeBound (const FunctionDecl *FD)
static void | visitLifetimeBoundArguments (IndirectLocalPath &Path, Expr *Call, LocalVisitor Visit)
static bool | shouldLifetimeExtendThroughPath (const IndirectLocalPath &Path)
| Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along (but don't). More...
static SourceRange | nextPathEntryRange (const IndirectLocalPath &Path, unsigned I, Expr *E)
| Find the range for the first interesting entry in the path at or after I. More...
static bool | pathOnlyInitializesGslPointer (IndirectLocalPath &Path)
static void | DiagnoseNarrowingInInitList (Sema &S, const ImplicitConversionSequence &ICS, QualType PreNarrowingType, QualType EntityType, const Expr *PostInit)
static void | CheckMoveOnConstruction (Sema &S, const Expr *InitExpr, bool IsReturnStmt)
| Provide warnings when std::move is used on construction. More...
static void | CheckForNullPointerDereference (Sema &S, const Expr *E)
static bool | DiagnoseUninitializedReference (Sema &S, SourceLocation Loc, QualType T)
| Somewhere within T there is an uninitialized reference subobject. More...
static void | emitBadConversionNotes (Sema &S, const InitializedEntity &entity, Expr *op)
| Emit notes associated with an initialization that failed due to a "simple" conversion failure. More...
static void | diagnoseListInit (Sema &S, const InitializedEntity &Entity, InitListExpr *InitList)
static bool | NarrowingErrs (const LangOptions &L)
static bool | isOrIsDerivedFromSpecializationOf (CXXRecordDecl *RD, ClassTemplateDecl *CTD)
| Determine whether RD is, or is derived from, a specialization of CTD. More...

## Enumeration Type Documentation

## ◆ InvalidICRKind

enum InvalidICRKind

The non-zero enum values here are indexes into diagnostic alternatives.

Enumerator
IIK_okay |
IIK_nonlocal |
IIK_nonscalar |

Definition at line 5306 of file SemaInit.cpp.

## ◆ LifetimeKind

enum LifetimeKind

Definition at line 6489 of file SemaInit.cpp.

## ◆ ReferenceKind

enum ReferenceKind

Definition at line 6619 of file SemaInit.cpp.

## ◆ StringInitFailureKind

enum StringInitFailureKind

Enumerator
SIF_None |
SIF_NarrowStringIntoWideChar |
SIF_WideStringIntoChar |
SIF_IncompatWideStringIntoWideChar |
SIF_UTF8StringIntoPlainChar |
SIF_PlainStringIntoUTF8Char |
SIF_Other |

Definition at line 48 of file SemaInit.cpp.

## Function Documentation

## ◆ canPerformArrayCopy()

static bool canPerformArrayCopy | ( | const InitializedEntity & | Entity | ) |
| static

Determine whether we can perform an elementwise array copy for this kind of entity.

Definition at line 5541 of file SemaInit.cpp.

References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::getDecl(), clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), and clang::InitializedEntity::isImplicitMemberInitializer().

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ CheckArrayDesignatorExpr()

static ExprResult CheckArrayDesignatorExpr | ( | Sema & | S,
|  | Expr * | Index,
|  | llvm::APSInt & | Value
| ) |  |
| static

Check that the given Index expression is a valid array designator value.

This is essentially just a wrapper around VerifyIntegerConstantExpression that also checks for negative values and produces a reasonable diagnostic if there is a failure. Returns the index expression, possibly with an implicit cast added, on success. If everything went okay, Value will receive the value of the constant expression.

Definition at line 3110 of file SemaInit.cpp.

## ◆ CheckCXX98CompatAccessibleCopy()

static void CheckCXX98CompatAccessibleCopy | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | Expr * | CurInitExpr
| ) |  |
| static

Check whether elidable copy construction for binding a reference to a temporary would have succeeded if we were building in C++98 mode, for -Wc++98-compat.

Definition at line 6242 of file SemaInit.cpp.

References clang::Sema::CheckConstructorAccess(), clang::OverloadCandidateSet::CSK_Normal, Diag(), clang::Sema::Diag(), clang::Sema::Diags, clang::InitializedEntity::EK_RelatedResult, clang::Type::getAs(), clang::InitializedEntity::getDecl(), clang::NamedDecl::getDeclName(), getInitializationLoc(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::InitializedEntity::getMethodDecl(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::DiagnosticsEngine::isIgnored(), clang::SourceLocation::isInvalid(), clang::InitializedEntity::isParameterKind(), clang::Sema::LookupConstructors(), clang::OverloadCandidateSet::NoteCandidates(), clang::Sema::NoteDeletedFunction(), clang::OCD_AllCandidates, clang::OCD_AmbiguousCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::PDiag(), and ResolveConstructorOverload().

Referenced by TryReferenceInitializationCore(), and TryRefInitWithConversionFunction().

## ◆ checkDestructorReference()

static bool checkDestructorReference | ( | QualType | ElementType,
|  | SourceLocation | Loc,
|  | Sema & | SemaRef
| ) |  |
| static

Check if the type of a class element has an accessible destructor, and marks it referenced.

Returns true if we shouldn't form a reference to the destructor.

Aggregate initialization requires a class element's destructor be accessible per 11.6.1 [dcl.init.aggr]:

The destructor for each element of class type is potentially invoked (15.4 [class.dtor]) from the context where the aggregate initialization occurs.

Definition at line 1799 of file SemaInit.cpp.

References clang::Sema::CheckDestructorAccess(), clang::Sema::DiagnoseUseOfDecl(), clang::Type::getAsCXXRecordDecl(), clang::Sema::LookupDestructor(), clang::Sema::MarkFunctionReferenced(), and clang::Sema::PDiag().

Referenced by PerformConstructorInitialization().

## ◆ CheckForNullPointerDereference()

static void CheckForNullPointerDereference | ( | Sema & | S,
|  | const Expr * | E
| ) |  |
| static

Definition at line 7683 of file SemaInit.cpp.

References clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), clang::Expr::IgnoreParenCasts(), clang::Expr::NPC_ValueDependentIsNotNull, and clang::Sema::PDiag().

Referenced by clang::InitializationSequence::Perform().

## ◆ checkIndirectCopyRestoreSource()

static void checkIndirectCopyRestoreSource | ( | Sema & | S,
|  | Expr * | src
| ) |  |
| static

Check whether the given expression is a valid operand for an indirect copy/restore.

Definition at line 5376 of file SemaInit.cpp.

References clang::Sema::Cleanup, clang::Sema::Context, clang::Sema::Diag(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), IIK_okay, isInvalidICRSource(), clang::Expr::isRValue(), and clang::CleanupInfo::setExprNeedsCleanups().

## ◆ CheckMoveOnConstruction()

static void CheckMoveOnConstruction | ( | Sema & | S,
|  | const Expr * | InitExpr,
|  | bool | IsReturnStmt
| ) |  |
| static

Provide warnings when std::move is used on construction.

Definition at line 7586 of file SemaInit.cpp.

References clang::Sema::Context, clang::FixItHint::CreateRemoval(), clang::Sema::Diag(), clang::CXXConstructExpr::getArg(), clang::CallExpr::getArg(), clang::CharSourceRange::getBegin(), clang::Stmt::getBeginLoc(), clang::CallExpr::getBeginLoc(), clang::CallExpr::getCallee(), clang::CXXConstructExpr::getConstructor(), clang::DeclRefExpr::getDecl(), clang::SourceManager::getImmediateExpansionRange(), clang::SourceLocation::getLocWithOffset(), clang::CXXConstructExpr::getNumArgs(), clang::CallExpr::getRParenLoc(), clang::Sema::getSourceManager(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::VarDecl::hasLocalStorage(), clang::ASTContext::hasSameUnqualifiedType(), clang::Expr::IgnoreImpCasts(), clang::Expr::IgnoreImplicit(), clang::Expr::IgnoreParenImpCasts(), clang::Expr::IgnoreParens(), clang::Sema::inTemplateInstantiation(), clang::SourceManager::isAtStartOfImmediateMacroExpansion(), clang::CallExpr::isCallToStdMove(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::SourceLocation::isMacroID(), clang::Type::isRecordType(), clang::Expr::isRValue(), and clang::DeclRefExpr::refersToEnclosingVariableOrCapture().

## ◆ CheckStringInit()

static void CheckStringInit | ( | Expr * | Str,
|  | QualType & | DeclT,
|  | const ArrayType * | AT,
|  | Sema & | S
| ) |  |
| static

Definition at line 188 of file SemaInit.cpp.

Referenced by clang::InitializationSequence::Perform().

## ◆ CloneDesignatedInitExpr()

static DesignatedInitExpr* CloneDesignatedInitExpr | ( | Sema & | SemaRef,
|  | DesignatedInitExpr * | DIE
| ) |  |
| static

Definition at line 2283 of file SemaInit.cpp.

References clang::Sema::Context, clang::DesignatedInitExpr::Create(), clang::DesignatedInitExpr::designators(), clang::DeclContext::Equals(), clang::TypoCorrection::getCorrectionDeclAs(), clang::Decl::getDeclContext(), clang::DesignatedInitExpr::getEqualOrColonLoc(), clang::DesignatedInitExpr::getInit(), clang::DesignatedInitExpr::getNumSubExprs(), clang::DeclContext::getRedeclContext(), clang::DesignatedInitExpr::getSubExpr(), and clang::DesignatedInitExpr::usesGNUSyntax().

## ◆ CopyObject()

static ExprResult CopyObject | ( | Sema & | S,
|  | QualType | T,
|  | const InitializedEntity & | Entity,
|  | ExprResult | CurInit,
|  | bool | IsExtraneousCopy
| ) |  |
| static

Make a (potentially elidable) temporary copy of the object provided by the given initializer by calling the appropriate copy constructor.

Parameters

  S | The Sema object used for type-checking.
  T | The type of the temporary object, which must either be the type of the initializer expression or a superclass thereof.
  Entity | The entity being initialized.
  CurInit | The initializer expression.
  IsExtraneousCopy | Whether this is an "extraneous" copy that is permitted in C++03 (but not C++0x) when binding a reference to an rvalue.

Returns
  An expression that copies the initializer expression into a temporary object, or an error expression if a copy could not be created.

Definition at line 6090 of file SemaInit.cpp.

References clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::CheckConstructorAccess(), clang::CXXConstructExpr::CK_Complete, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_Normal, clang::Sema::Diag(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ActionResult< PtrTy, CompressInvalid >::getAs(), clang::Type::getAs(), getInitializationLoc(), clang::InitializedEntity::getKind(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Expr::isTemporaryObject(), clang::Sema::LookupConstructors(), clang::Sema::MaybeBindToTemporary(), clang::OverloadCandidateSet::NoteCandidates(), clang::Sema::NoteDeletedFunction(), clang::OCD_AllCandidates, clang::OCD_AmbiguousCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::PDiag(), clang::Sema::RequireCompleteType(), ResolveConstructorOverload(), shouldBindAsTemporary(), and clang::OverloadCandidateSet::size().

Referenced by clang::InitializationSequence::Perform().

## ◆ diagnoseListInit()

static void diagnoseListInit | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | InitListExpr * | InitList
| ) |  |
| static

Definition at line 8657 of file SemaInit.cpp.

References clang::Type::castAs(), clang::Sema::Context, clang::Sema::Diag(), clang::InitListExpr::getBeginLoc(), clang::ASTContext::getConstantArrayType(), clang::InitializedEntity::getDecl(), clang::Sema::getLangOpts(), clang::InitListExpr::getNumInits(), clang::ASTContext::getSizeType(), clang::InitializedEntity::getType(), clang::ASTContext::getTypeSize(), clang::InitializedEntity::InitializeTemporary(), clang::Type::isReferenceType(), clang::Sema::isStdInitializerList(), clang::ArrayType::Normal, and clang::QualType::withConst().

## ◆ DiagnoseNarrowingInInitList()

static void DiagnoseNarrowingInInitList | ( | Sema & | S,
|  | const ImplicitConversionSequence & | ICS,
|  | QualType | PreNarrowingType,
|  | QualType | EntityType,
|  | const Expr * | PostInit
| ) |  |
| static

Definition at line 9500 of file SemaInit.cpp.

References clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::AmbiguousConversion, clang::ImplicitConversionSequence::BadConversion, clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::Sema::Diag(), clang::ImplicitConversionSequence::EllipsisConversion, clang::Type::getAs(), clang::APValue::getAsString(), clang::Sema::getASTContext(), clang::Stmt::getBeginLoc(), clang::Stmt::getEndLoc(), clang::ImplicitConversionSequence::getKind(), clang::Sema::getLangOpts(), clang::QualType::getLocalUnqualifiedType(), clang::Sema::getLocForEndOfToken(), clang::StandardConversionSequence::getNarrowingKind(), clang::Stmt::getSourceRange(), NarrowingErrs(), clang::NK_Constant_Narrowing, clang::NK_Dependent_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, clang::ImplicitConversionSequence::Standard, clang::ImplicitConversionSequence::StandardConversion, clang::ImplicitConversionSequence::UserDefined, and clang::ImplicitConversionSequence::UserDefinedConversion.

Referenced by clang::Sema::checkInitializerLifetime(), and clang::InitializationSequence::Perform().

## ◆ DiagnoseUninitializedReference()

static bool DiagnoseUninitializedReference | ( | Sema & | S,
|  | SourceLocation | Loc,
|  | QualType | T
| ) |  |
| static

Somewhere within T there is an uninitialized reference subobject.

Dig it out and diagnose it.

Definition at line 8601 of file SemaInit.cpp.

References clang::CXXRecordDecl::bases(), clang::Sema::Diag(), clang::RecordDecl::fields(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::QualType::getNonReferenceType(), clang::CXXRecordDecl::hasUninitializedReferenceMember(), and clang::Type::isReferenceType().

## ◆ emitBadConversionNotes()

static void emitBadConversionNotes | ( | Sema & | S,
|  | const InitializedEntity & | entity,
|  | Expr * | op
| ) |  |
| static

Emit notes associated with an initialization that failed due to a "simple" conversion failure.

Definition at line 8640 of file SemaInit.cpp.

References clang::InitializedEntity::EK_Result, clang::Sema::EmitRelatedResultTypeNote(), clang::Sema::EmitRelatedResultTypeNoteForReturn(), clang::InitializedEntity::getKind(), clang::QualType::getNonReferenceType(), clang::Expr::getType(), clang::InitializedEntity::getType(), and clang::Type::isObjCObjectPointerType().

## ◆ ExpandAnonymousFieldDesignator()

static void ExpandAnonymousFieldDesignator | ( | Sema & | SemaRef,
|  | DesignatedInitExpr * | DIE,
|  | unsigned | DesigIdx,
|  | IndirectFieldDecl * | IndirectField
| ) |  |
| static

Expand a field designator that refers to a member of an anonymous struct or union into a series of field designators that refers to the field within the appropriate subobject.

Definition at line 2255 of file SemaInit.cpp.

References clang::IndirectFieldDecl::chain_begin(), clang::IndirectFieldDecl::chain_end(), clang::Sema::Context, clang::DesignatedInitExpr::ExpandDesignator(), clang::DesignatedInitExpr::getDesignator(), clang::DesignatedInitExpr::Designator::getDotLoc(), and clang::DesignatedInitExpr::Designator::getFieldLoc().

## ◆ getAssignmentAction()

static Sema::AssignmentAction getAssignmentAction | ( | const InitializedEntity & | Entity,
|  | bool | Diagnose = `false`
| ) |  |
| static

Definition at line 5922 of file SemaInit.cpp.

References clang::Sema::AA_Casting, clang::Sema::AA_Initializing, clang::Sema::AA_Passing, clang::Sema::AA_Passing_CFAudited, clang::Sema::AA_Returning, clang::Sema::AA_Sending, clang::InitializationSequence::Diagnose(), clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getDecl(), clang::Decl::getDeclContext(), and clang::InitializedEntity::getKind().

Referenced by clang::InitializationSequence::Perform().

## ◆ getEntityLifetime()

static LifetimeResult getEntityLifetime | ( | const InitializedEntity * | Entity,
|  | const InitializedEntity * | InitField = `nullptr`
| ) |  |
| static

Determine the declaration which an initialized entity ultimately refers to, for the purpose of lifetime-extending a temporary bound to a reference in the initialization of `Entity`.

Definition at line 6521 of file SemaInit.cpp.

References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), clang::interp::InitField(), and clang::InitializedEntity::isDefaultMemberInitializer().

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

## ◆ getInitializationLoc()

static SourceLocation getInitializationLoc | ( | const InitializedEntity & | Entity,
|  | Expr * | Initializer
| ) |  |
| static

Get the location at which initialization diagnostics should appear.

Definition at line 6034 of file SemaInit.cpp.

References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::Stmt::getBeginLoc(), clang::InitializedEntity::getCaptureLoc(), clang::InitializedEntity::getDecl(), clang::InitializedEntity::getKind(), clang::Decl::getLocation(), clang::InitializedEntity::getReturnLoc(), and clang::InitializedEntity::getThrowLoc().

Referenced by CheckCXX98CompatAccessibleCopy(), and CopyObject().

## ◆ handleGslAnnotatedTypes()

static void handleGslAnnotatedTypes | ( | IndirectLocalPath & | Path,
|  | Expr * | Call,
|  | LocalVisitor | Visit
| ) |  |
| static

Definition at line 6773 of file SemaInit.cpp.

References End, clang::DeclContext::getParent(), clang::FunctionDecl::getReturnType(), clang::Decl::hasAttr(), clang::NamedDecl::isCXXInstanceMember(), clang::Type::isReferenceType(), shouldTrackFirstArgument(), shouldTrackImplicitObjectArg(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

Referenced by visitLocalsRetainedByReferenceBinding().

## ◆ hasAnyDesignatedInits()

static bool hasAnyDesignatedInits | ( | const InitListExpr * | IL | ) |
| static

Definition at line 929 of file SemaInit.cpp.

## ◆ hasCompatibleArrayTypes()

static bool hasCompatibleArrayTypes | ( | ASTContext & | Context,
|  | const ArrayType * | Dest,
|  | const ArrayType * | Source
| ) |  |
| static

Determine whether we have compatible array types for the purposes of GNU by-copy array initialization.

Definition at line 5394 of file SemaInit.cpp.

References clang::ArrayType::getElementType(), clang::ASTContext::hasSameType(), clang::Type::isConstantArrayType(), and clang::Type::isIncompleteArrayType().

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ hasCopyOrMoveCtorParam()

static bool hasCopyOrMoveCtorParam | ( | ASTContext & | Ctx,
|  | const ConstructorInfo & | Info
| ) |  |
| static

Determine if the constructor has the signature of a copy or move constructor for the type T of the class in which it was found.

That is, determine if its first parameter is of type T or reference to (possibly cv-qualified) T.

Definition at line 3849 of file SemaInit.cpp.

References clang::ConstructorInfo::Constructor, clang::ConstructorInfo::FoundDecl, clang::Decl::getDeclContext(), clang::QualType::getNonReferenceType(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::ASTContext::getRecordType(), clang::ValueDecl::getType(), and clang::ASTContext::hasSameUnqualifiedType().

Referenced by PerformConstructorInitialization(), and ResolveConstructorOverload().

## ◆ implicitObjectParamIsLifetimeBound()

static bool implicitObjectParamIsLifetimeBound | ( | const FunctionDecl * | FD | ) |
| static

Definition at line 6832 of file SemaInit.cpp.

References clang::TypeLoc::getAsAdjusted(), clang::AttributedTypeLoc::getAttrAs(), clang::AttributedTypeLoc::getModifiedLoc(), clang::TypeSourceInfo::getTypeLoc(), and clang::DeclaratorDecl::getTypeSourceInfo().

Referenced by visitLifetimeBoundArguments().

## ◆ isExplicitTemporary()

static bool isExplicitTemporary | ( | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | unsigned | NumArgs
| ) |  |
| static

Returns true if the parameters describe a constructor initialization of an explicit temporary object, e.g.

"Point(x, y)".

Definition at line 6317 of file SemaInit.cpp.

References clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::getKind(), clang::InitializationKind::getKind(), clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_DirectList, and clang::InitializationKind::IK_Value.

Referenced by PerformConstructorInitialization().

## ◆ isExprAnUnaddressableFunction()

static bool isExprAnUnaddressableFunction | ( | Sema & | S,
|  | const Expr * | E
| ) |  |
| static

Tries to get a FunctionDecl out of `E`.

If it succeeds and we can take the address of that function, this returns true. Otherwise, it returns false.

Definition at line 5530 of file SemaInit.cpp.

References clang::Sema::checkAddressOfFunctionIsAvailable().

## ◆ isIdiomaticBraceElisionEntity()

static bool isIdiomaticBraceElisionEntity | ( | const InitializedEntity & | Entity | ) |
| static

Determine whether Entity is an entity for which it is idiomatic to elide the braces in aggregate initialization.

Definition at line 992 of file SemaInit.cpp.

References clang::Type::castAs(), clang::InitializedEntity::EK_Member, clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), and clang::InitializedEntity::getType().

## ◆ isInStlNamespace()

static bool isInStlNamespace | ( | const Decl * | D | ) |
| static

Definition at line 6701 of file SemaInit.cpp.

References clang::Decl::getDeclContext().

Referenced by shouldTrackImplicitObjectArg().

## ◆ isInvalidICRSource()

static InvalidICRKind isInvalidICRSource | ( | ASTContext & | C,
|  | Expr * | e,
|  | bool | isAddressOf,
|  | bool & | isWeakAccess
| ) |  |
| static

Determines whether this expression is an acceptable ICR source.

Definition at line 5309 of file SemaInit.cpp.

References clang::QualType::getObjCLifetime(), clang::Expr::getType(), clang::VarDecl::hasLocalStorage(), clang::Expr::IgnoreParens(), IIK_nonlocal, IIK_nonscalar, IIK_okay, clang::Expr::isNullPointerConstant(), clang::Expr::NPC_ValueDependentIsNull, and clang::Qualifiers::OCL_Weak.

Referenced by checkIndirectCopyRestoreSource().

## ◆ isLibstdcxxPointerReturnFalseHack()

static bool isLibstdcxxPointerReturnFalseHack | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const Expr * | Init
| ) |  |
| static

An egregious hack for compatibility with libstdc++-4.2: in <tr1/hashtable>, a function with a pointer return type contains a 'return false;' statement.

In C++11, 'false' is not a null pointer, so this breaks the build of any code using that header.

Work around this by treating 'return false;' as zero-initializing the result if it's used in a pointer-returning function in a system header.

Definition at line 5294 of file SemaInit.cpp.

References clang::InitializedEntity::EK_Result, clang::Expr::getExprLoc(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Sema::getSourceManager(), clang::InitializedEntity::getType(), clang::SourceManager::isInSystemHeader(), and clang::Type::isPointerType().

## ◆ isNonReferenceableGLValue()

static bool isNonReferenceableGLValue | ( | Expr * | E | ) |
| static

Determine whether an expression is a non-referenceable glvalue (one to which a reference can never bind).

Attempting to bind a reference to such a glvalue will always create a temporary.

Definition at line 4668 of file SemaInit.cpp.

References clang::Expr::refersToBitField(), and clang::Expr::refersToVectorElement().

Referenced by TryReferenceInitializationCore().

## ◆ isOrIsDerivedFromSpecializationOf()

static bool isOrIsDerivedFromSpecializationOf | ( | CXXRecordDecl * | RD,
|  | ClassTemplateDecl * | CTD
| ) |  |
| static

Determine whether RD is, or is derived from, a specialization of CTD.

Definition at line 9670 of file SemaInit.cpp.

References clang::declaresSameEntity(), and clang::CXXRecordDecl::forallBases().

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

## ◆ isRecordWithAttr()

template<typename T >

static bool isRecordWithAttr | ( | QualType | Type | ) |
| static

Definition at line 6692 of file SemaInit.cpp.

References clang::Type::getAsCXXRecordDecl().

## ◆ IsStringInit() [1/2]

static StringInitFailureKind IsStringInit | ( | Expr * | Init,
|  | const ArrayType * | AT,
|  | ASTContext & | Context
| ) |  |
| static

Check whether the array of type AT can be initialized by the Init expression by means of string initialization.

Returns SIF_None if so, otherwise returns a StringInitFailureKind that describes why the initialization would not work.

Definition at line 62 of file SemaInit.cpp.

Referenced by clang::InitializationSequence::InitializeFrom(), and TryListInitialization().

## ◆ IsStringInit() [2/2]

static StringInitFailureKind IsStringInit | ( | Expr * | init,
|  | QualType | declType,
|  | ASTContext & | Context
| ) |  |
| static

Definition at line 135 of file SemaInit.cpp.

## ◆ isVarOnPath()

static bool isVarOnPath | ( | IndirectLocalPath & | Path,
|  | VarDecl * | VD
| ) |  |
| static

Definition at line 6668 of file SemaInit.cpp.

Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

## ◆ IsWideCharCompatible()

static bool IsWideCharCompatible | ( | QualType | T,
|  | ASTContext & | Context
| ) |  |
| static

Check whether T is compatible with a wide character type (wchar_t, char16_t or char32_t).

Definition at line 38 of file SemaInit.cpp.

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ IsZeroInitializer()

static bool IsZeroInitializer | ( | Expr * | Initializer,
|  | Sema & | S
| ) |  |
| static

Definition at line 5470 of file SemaInit.cpp.

References clang::Expr::EvaluateKnownConstInt(), clang::Sema::getASTContext(), and clang::Expr::isIntegerConstantExpr().

Referenced by TryOCLZeroOpaqueTypeInitialization().

## ◆ MaybeProduceObjCObject()

static void MaybeProduceObjCObject | ( | Sema & | S,
|  | InitializationSequence & | Sequence,
|  | const InitializedEntity & | Entity
| ) |  |
| static

When initializing a parameter, produce the value if it's marked attribute((ns_consumed)).

When initializing a return value, if the return type is a retainable type, then returns need to immediately retain the object. If an autorelease is required, it will be done at the last instant.

Definition at line 3774 of file SemaInit.cpp.

References clang::InitializationSequence::AddProduceObjCObjectStep(), clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::InitializedEntity::getType(), clang::Type::isObjCRetainableType(), clang::InitializedEntity::isParameterConsumed(), clang::InitializedEntity::isParameterKind(), and TryListInitialization().

## ◆ maybeRecoverWithZeroInitialization()

static bool maybeRecoverWithZeroInitialization | ( | Sema & | S,
|  | InitializationSequence & | Sequence,
|  | const InitializedEntity & | Entity
| ) |  |
| static

Tries to add a zero initializer. Returns true if that worked.

Definition at line 3754 of file SemaInit.cpp.

References clang::InitializationSequence::AddZeroInitializationStep(), clang::InitializedEntity::EK_Variable, clang::QualType::getCanonicalType(), clang::InitializedEntity::getDecl(), clang::Decl::getEndLoc(), clang::Sema::getFixItZeroInitializerForType(), clang::VarDecl::getInit(), clang::InitializedEntity::getKind(), clang::Sema::getLocForEndOfToken(), clang::InitializedEntity::getType(), clang::ValueDecl::getType(), clang::SourceLocation::isMacroID(), and clang::InitializationSequence::SetZeroInitializationFixit().

Referenced by TryConstructorInitialization(), and TryDefaultInitialization().

## ◆ NarrowingErrs()

static bool NarrowingErrs | ( | const LangOptions & | L | ) |
| static

Definition at line 9495 of file SemaInit.cpp.

References clang::LangOptions::isCompatibleWithMSVC(), and clang::LangOptions::MSVC2015.

Referenced by DiagnoseNarrowingInInitList().

## ◆ nextPathEntryRange()

static SourceRange nextPathEntryRange | ( | const IndirectLocalPath & | Path,
|  | unsigned | I,
|  | Expr * | E
| ) |  |
| static

Find the range for the first interesting entry in the path at or after I.

Definition at line 7287 of file SemaInit.cpp.

References clang::Stmt::getSourceRange().

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

## ◆ pathContainsInit()

static bool pathContainsInit | ( | IndirectLocalPath & | Path | ) |
| static

Definition at line 6675 of file SemaInit.cpp.

References visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

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

## ◆ pathOnlyInitializesGslPointer()

static bool pathOnlyInitializesGslPointer | ( | IndirectLocalPath & | Path | ) |
| static

Definition at line 7311 of file SemaInit.cpp.

References End.

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

## ◆ PerformConstructorInitialization()

static ExprResult PerformConstructorInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | MultiExprArg | Args,
|  | const InitializationSequence::Step & | Step,
|  | bool & | ConstructorInitRequiresZeroInit,
|  | bool | IsListInitialization,
|  | bool | IsStdInitListInitialization,
|  | SourceLocation | LBraceLoc,
|  | SourceLocation | RBraceLoc
| ) |  |
| static

Definition at line 6342 of file SemaInit.cpp.

References clang::InitializationKind::AllowExplicit(), clang::InitializedEntity::allowsNRVO(), clang::Sema::BuildCXXConstructExpr(), clang::Sema::CheckConstructorAccess(), checkDestructorReference(), clang::CXXConstructExpr::CK_Complete, clang::CXXConstructExpr::CK_Delegating, clang::CXXConstructExpr::CK_NonVirtualBase, clang::CXXConstructExpr::CK_VirtualBase, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::CXXTemporaryObjectExpr::Create(), clang::Sema::DefineImplicitDefaultConstructor(), clang::Sema::DiagnoseUseOfDecl(), clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Delegating, clang::ExprError(), clang::Sema::findInheritingConstructor(), clang::InitializationSequence::Step::F::FoundDecl, clang::InitializationSequence::Step::F::Function, clang::InitializationSequence::Step::Function, clang::ASTContext::getAsArrayType(), clang::ASTContext::getBaseElementType(), clang::InitializedEntity::getBaseSpecifier(), clang::getConstructorInfo(), clang::DeclAccessPair::getDecl(), clang::InitializationKind::getEqualLoc(), clang::InitializedEntity::getKind(), clang::InitializationKind::getKind(), clang::InitializationKind::getLocation(), clang::QualType::getNonLValueExprType(), clang::InitializationKind::getParenOrBraceRange(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::InitializedEntity::getType(), clang::InitializedEntity::getTypeSourceInfo(), clang::InitializationSequence::Step::F::HadMultipleCandidates, hasCopyOrMoveCtorParam(), clang::InitializationKind::IK_Default, clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_DirectList, clang::InitializationKind::isCopyInit(), clang::CXXConstructorDecl::isDefaultConstructor(), clang::FunctionDecl::isDefaulted(), isExplicitTemporary(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::FunctionDecl::isTrivial(), clang::Decl::isUsed(), clang::SourceLocation::isValid(), clang::CXXBaseSpecifier::isVirtual(), clang::Sema::MarkFunctionReferenced(), clang::Sema::runWithSufficientStackSpace(), and clang::InitializationSequence::Step::Type.

Referenced by clang::InitializationSequence::Perform().

## ◆ ResolveConstructorOverload()

static OverloadingResult ResolveConstructorOverload | ( | Sema & | S,
|  | SourceLocation | DeclLoc,
|  | MultiExprArg | Args,
|  | OverloadCandidateSet & | CandidateSet,
|  | QualType | DestType,
|  | DeclContext::lookup_result | Ctors,
|  | OverloadCandidateSet::iterator & | Best,
|  | bool | CopyInitializing,
|  | bool | AllowExplicit,
|  | bool | OnlyListConstructors,
|  | bool | IsListInit,
|  | bool | SecondStepOfCopyInit = `false`
| ) |  |
| static

Definition at line 3863 of file SemaInit.cpp.

References clang::Sema::AddConversionCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByConstructor, clang::Qualifiers::getAddressSpace(), clang::Type::getAsCXXRecordDecl(), clang::getConstructorInfo(), clang::Decl::getDeclContext(), clang::Sema::getLangOpts(), clang::QualType::getQualifiers(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::Expr::getType(), clang::NamedDecl::getUnderlyingDecl(), clang::CXXRecordDecl::getVisibleConversionFunctions(), hasCopyOrMoveCtorParam(), clang::Initializer, clang::Sema::isCompleteType(), clang::Sema::isInitListConstructor(), and clang::OverloadCandidateSet::setDestAS().

Referenced by CheckCXX98CompatAccessibleCopy(), CopyObject(), and TryConstructorInitialization().

## ◆ ResolveOverloadedFunctionForReferenceBinding()

static bool ResolveOverloadedFunctionForReferenceBinding | ( | Sema & | S,
|  | Expr * | Initializer,
|  | QualType & | SourceType,
|  | QualType & | UnqualifiedSourceType,
|  | QualType | UnqualifiedTargetType,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Definition at line 4143 of file SemaInit.cpp.

References clang::InitializationSequence::AddAddressOverloadResolutionStep(), clang::Sema::Context, clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::ASTContext::getCanonicalType(), clang::QualType::getUnqualifiedType(), clang::Initializer, clang::Type::isRecordType(), clang::ASTContext::OverloadTy, clang::Sema::ResolveAddressOfOverloadedFunction(), clang::InitializationSequence::SetFailed(), TryReferenceInitializationCore(), and TryValueInitialization().

Referenced by TryReferenceInitialization(), and TryReferenceListInitialization().

## ◆ shouldBindAsTemporary()

static bool shouldBindAsTemporary | ( | const InitializedEntity & | Entity | ) |
| static

Whether we should bind a created object as a temporary when initializing the given entity.

Definition at line 5971 of file SemaInit.cpp.

References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, and clang::InitializedEntity::getKind().

Referenced by CopyObject(), and clang::InitializationSequence::Perform().

## ◆ shouldDestroyEntity()

static bool shouldDestroyEntity | ( | const InitializedEntity & | Entity | ) |
| static

Whether the given entity, when initialized with an object created for that initialization, requires destruction.

Definition at line 6003 of file SemaInit.cpp.

References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, and clang::InitializedEntity::getKind().

Referenced by clang::InitializationSequence::Perform().

## ◆ shouldLifetimeExtendThroughPath()

static bool shouldLifetimeExtendThroughPath | ( | const IndirectLocalPath & | Path | ) |
| static

Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along (but don't).

Definition at line 7278 of file SemaInit.cpp.

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

## ◆ shouldTrackFirstArgument()

static bool shouldTrackFirstArgument | ( | const FunctionDecl * | FD | ) |
| static

Definition at line 6749 of file SemaInit.cpp.

References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Type::getPointeeCXXRecordDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::Decl::isInStdNamespace(), clang::Type::isPointerType(), and clang::Type::isReferenceType().

Referenced by handleGslAnnotatedTypes().

## ◆ shouldTrackImplicitObjectArg()

static bool shouldTrackImplicitObjectArg | ( | const CXXMethodDecl * | Callee | ) |
| static

Definition at line 6716 of file SemaInit.cpp.

References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::FunctionDecl::getOverloadedOperator(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getReturnType(), clang::CXXMethodDecl::getThisObjectType(), isInStlNamespace(), clang::Type::isPointerType(), and clang::Type::isReferenceType().

Referenced by handleGslAnnotatedTypes().

## ◆ TryConstructorInitialization()

static void TryConstructorInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | MultiExprArg | Args,
|  | QualType | DestType,
|  | QualType | DestArrayType,
|  | InitializationSequence & | Sequence,
|  | bool | IsListInit = `false`,
|  | bool | IsInitListCopy = `false`
| ) |  |
| static

Attempt initialization by constructor (C++ [dcl.init]), which enumerates the constructors of the initialized entity and performs overload resolution to select the best.

Parameters

  DestType | The destination class type.
  DestArrayType | The destination type, which is either DestType or a (possibly multidimensional) array of DestType.
  IsListInit | Is this list-initialization?
  IsInitListCopy | Is this non-list-initialization resulting from a list-initialization from {x} where x is the same type as the entity?

Definition at line 3979 of file SemaInit.cpp.

References clang::InitializationSequence::AddConstructorInitializationStep(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddUserConversionStep(), clang::CXXRecordDecl::allowConstDefaultInit(), clang::InitializationKind::AllowExplicit(), clang::Sema::Context, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializationSequence::FK_ConstructorOverloadFailed, clang::InitializationSequence::FK_DefaultInitOfConst, clang::InitializationSequence::FK_ExplicitConstructor, clang::InitializationSequence::FK_ListConstructorOverloadFailed, clang::Type::getAs(), clang::RecordType::getDecl(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitListExpr::getInits(), clang::InitializedEntity::getKind(), clang::InitializationKind::getKind(), clang::Sema::getLangOpts(), clang::InitializationKind::getLocation(), clang::InitListExpr::getNumInits(), clang::CXXMethodDecl::getParent(), clang::InitializedEntity::getType(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::InitializationKind::IK_Copy, clang::InitializationKind::IK_Default, clang::Sema::isCompleteType(), clang::QualType::isConstQualified(), clang::CXXConstructorDecl::isExplicit(), clang::Sema::LookupConstructors(), clang::Sema::LookupDefaultConstructor(), maybeRecoverWithZeroInitialization(), clang::OR_No_Viable_Function, ResolveConstructorOverload(), clang::Result, clang::InitializationSequence::RewrapReferenceInitList(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::setIncompleteTypeFailure(), clang::InitializationSequence::SetOverloadFailure(), and clang::VK_RValue.

Referenced by TryDefaultInitialization(), TryListInitialization(), and TryValueInitialization().

## ◆ TryDefaultInitialization()

static void TryDefaultInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Attempt default initialization (C++ [dcl.init]p6).

Definition at line 5074 of file SemaInit.cpp.

References clang::InitializationSequence::AddZeroInitializationStep(), clang::Sema::Context, clang::InitializationSequence::FK_DefaultInitOfConst, clang::ASTContext::getBaseElementType(), clang::InitializationKind::getKind(), clang::Sema::getLangOpts(), clang::InitializedEntity::getType(), clang::InitializationKind::IK_Default, maybeRecoverWithZeroInitialization(), clang::None, clang::InitializationSequence::SetFailed(), and TryConstructorInitialization().

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ TryInitializerListConstruction()

static bool TryInitializerListConstruction | ( | Sema & | S,
|  | InitListExpr * | List,
|  | QualType | DestType,
|  | InitializationSequence & | Sequence,
|  | bool | TreatUnavailableAsInvalid
| ) |  |
| static

When initializing from init list via constructor, handle initialization of an object of type std::initializer_list<T>.

Returns
  true if we have handled initialization of an object of type std::initializer_list<T>, false otherwise.

Definition at line 3814 of file SemaInit.cpp.

Referenced by TryListInitialization().

## ◆ TryListInitialization()

static void TryListInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | InitListExpr * | InitList,
|  | InitializationSequence & | Sequence,
|  | bool | TreatUnavailableAsInvalid
| ) |  |
| static

Attempt list initialization (C++0x [dcl.init.list])

Definition at line 4259 of file SemaInit.cpp.

References clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddListInitializationStep(), clang::Sema::Context, clang::InitializationKind::CreateDirect(), clang::StandardConversionSequence::First, clang::InitializationSequence::FK_InitListBadDestinationType, clang::InitializationSequence::FK_ListInitializationFailed, clang::InitializationSequence::FK_TooManyInitsForScalar, clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCXXRecordDecl(), clang::InitListExpr::getBeginLoc(), clang::InitListExpr::getInit(), clang::InitializationKind::getKind(), clang::Sema::getLangOpts(), clang::InitListExpr::getLBraceLoc(), clang::InitializationKind::getLocation(), clang::InitListExpr::getNumInits(), clang::InitListExpr::getRBraceLoc(), clang::StandardConversionSequence::getToType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Floating_Integral, clang::ICK_Integral_Conversion, clang::ICK_Lvalue_To_Rvalue, clang::InitializationKind::IK_DirectList, clang::InitializationSequence::InitializeFrom(), clang::Type::isAggregateType(), clang::Type::isAnyComplexType(), clang::Sema::isCompleteType(), clang::Sema::IsDerivedFrom(), clang::Type::isFloatingType(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Expr::isRValue(), clang::Type::isScalarType(), clang::Sema::isStdInitializerList(), IsStringInit(), clang::Sema::LookupDefaultConstructor(), clang::InitializationSequence::RewrapReferenceInitList(), clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAsIdentityConversion(), clang::InitializationSequence::SetFailed(), clang::StandardConversionSequence::setFromType(), clang::InitializationSequence::setIncompleteTypeFailure(), clang::ImplicitConversionSequence::setStandard(), clang::StandardConversionSequence::setToType(), SIF_None, clang::ImplicitConversionSequence::Standard, TryConstructorInitialization(), TryInitializerListConstruction(), TryReferenceListInitialization(), and TryValueInitialization().

Referenced by clang::InitializationSequence::InitializeFrom(), MaybeProduceObjCObject(), and TryReferenceListInitialization().

## ◆ tryObjCWritebackConversion()

static bool tryObjCWritebackConversion | ( | Sema & | S,
|  | InitializationSequence & | Sequence,
|  | const InitializedEntity & | Entity,
|  | Expr * | Initializer
| ) |  |
| static

Definition at line 5410 of file SemaInit.cpp.

References clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddPassByIndirectCopyRestoreStep(), clang::Sema::Context, clang::StandardConversionSequence::First, clang::ASTContext::getAsArrayType(), clang::InitializedEntity::getDecl(), clang::QualType::getNonLValueExprType(), clang::ASTContext::getPointerType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ICK_Array_To_Pointer, clang::ICK_Lvalue_To_Rvalue, clang::Expr::isGLValue(), clang::Sema::isObjCWritebackConversion(), clang::Decl::OBJC_TQ_Out, clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setStandard(), and clang::ImplicitConversionSequence::Standard.

## ◆ TryOCLSamplerInitialization()

static bool TryOCLSamplerInitialization | ( | Sema & | S,
|  | InitializationSequence & | Sequence,
|  | QualType | DestType,
|  | Expr * | Initializer
| ) |  |
| static

Definition at line 5457 of file SemaInit.cpp.

References clang::InitializationSequence::AddOCLSamplerInitStep(), clang::Sema::Context, clang::Sema::getLangOpts(), clang::Expr::getType(), clang::Expr::isIntegerConstantExpr(), and clang::Type::isSamplerT().

## ◆ TryOCLZeroOpaqueTypeInitialization()

static bool TryOCLZeroOpaqueTypeInitialization | ( | Sema & | S,
|  | InitializationSequence & | Sequence,
|  | QualType | DestType,
|  | Expr * | Initializer
| ) |  |
| static

Definition at line 5475 of file SemaInit.cpp.

References clang::InitializationSequence::AddOCLZeroOpaqueTypeStep(), clang::Sema::getLangOpts(), clang::Sema::getOpenCLOptions(), clang::OpenCLOptions::isEnabled(), clang::Type::isEventT(), clang::Type::isOCLIntelSubgroupAVCType(), clang::Type::isQueueT(), and IsZeroInitializer().

## ◆ TryReferenceInitialization()

static void TryReferenceInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | Expr * | Initializer,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Attempt reference initialization (C++0x [dcl.init.ref])

Definition at line 4640 of file SemaInit.cpp.

References clang::Type::castAs(), clang::Sema::Context, clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::getUnqualifiedArrayType(), ResolveOverloadedFunctionForReferenceBinding(), and TryReferenceInitializationCore().

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ TryReferenceInitializationCore()

static void TryReferenceInitializationCore | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | Expr * | Initializer,
|  | QualType | cv1T1,
|  | QualType | T1,
|  | Qualifiers | T1Quals,
|  | QualType | cv2T2,
|  | QualType | T2,
|  | Qualifiers | T2Quals,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Reference initialization without resolving overloaded functions.

Definition at line 4673 of file SemaInit.cpp.

References clang::Qualifiers::addAddressSpace(), clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddDerivedToBaseCastStep(), clang::InitializationSequence::AddExtraneousCopyToTemporary(), clang::InitializationSequence::AddObjCObjectConversionStep(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddReferenceBindingStep(), CheckCXX98CompatAccessibleCopy(), clang::Expr::Classify(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::Default, clang::OverloadCandidateSet::empty(), clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToTemporary, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToUnrelated, clang::InitializationSequence::FK_ReferenceAddrspaceMismatchTemporary, clang::InitializationSequence::FK_ReferenceInitDropsQualifiers, clang::InitializationSequence::FK_ReferenceInitFailed, clang::InitializationSequence::FK_ReferenceInitOverloadFailed, clang::InitializationSequence::FK_RValueReferenceBindingToLValue, clang::XRayInstrKind::Function, clang::Qualifiers::getAddressSpace(), clang::Stmt::getBeginLoc(), clang::ASTContext::getCanonicalType(), clang::Qualifiers::getCVRQualifiers(), clang::InitializationSequence::getFailedCandidateSet(), clang::Sema::getLangOpts(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::InitializedEntity::getType(), clang::Expr::getValueKind(), clang::Qualifiers::hasAddressSpace(), clang::Qualifiers::hasConst(), clang::ASTContext::hasSameType(), clang::Qualifiers::hasVolatile(), clang::InitializedEntity::InitializeTemporary(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::Type::isArrayType(), clang::ImplicitConversionSequence::isBad(), clang::InitializationKind::isCStyleOrFunctionalCast(), clang::Type::isFunctionType(), clang::Expr::Classification::isLValue(), clang::Type::isLValueReferenceType(), isNonReferenceableGLValue(), clang::Expr::Classification::isPRValue(), clang::Type::isRecordType(), clang::Expr::Classification::isRValue(), isRValueRef(), clang::Expr::Classification::isXValue(), AttributeLangSupport::ObjC, clang::OR_No_Viable_Function, clang::OR_Success, clang::ASTContext::OverloadTy, clang::Sema::Ref_Compatible, clang::Sema::Ref_Incompatible, clang::Sema::Ref_Related, clang::Expr::refersToBitField(), clang::Expr::refersToVectorElement(), clang::Qualifiers::removeAddressSpace(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::SetOverloadFailure(), clang::Sema::TryImplicitConversion(), TryRefInitWithConversionFunction(), clang::VK_LValue, clang::VK_RValue, clang::VK_XValue, and clang::Qualifiers::withoutAddressSpace().

Referenced by ResolveOverloadedFunctionForReferenceBinding(), TryReferenceInitialization(), and TryReferenceListInitialization().

## ◆ TryReferenceListInitialization()

static void TryReferenceListInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | InitListExpr * | InitList,
|  | InitializationSequence & | Sequence,
|  | bool | TreatUnavailableAsInvalid
| ) |  |
| static

Attempt list initialization of a reference.

Definition at line 4187 of file SemaInit.cpp.

References clang::InitializationSequence::AddReferenceBindingStep(), clang::Type::castAs(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToTemporary, clang::InitializationSequence::FK_ReferenceBindingToInitList, clang::Stmt::getBeginLoc(), clang::InitListExpr::getInit(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::InitListExpr::getNumInits(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::getUnqualifiedArrayType(), clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), clang::InitializedEntity::InitializeTemporary(), clang::Type::isRValueReferenceType(), clang::Sema::Ref_Related, ResolveOverloadedFunctionForReferenceBinding(), clang::InitializationSequence::RewrapReferenceInitList(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::step_begin(), clang::InitializationSequence::step_end(), TryListInitialization(), and TryReferenceInitializationCore().

Referenced by TryListInitialization().

## ◆ TryRefInitWithConversionFunction()

static OverloadingResult TryRefInitWithConversionFunction | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | Expr * | Initializer,
|  | bool | AllowRValues,
|  | bool | IsLValueRef,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Try a reference initialization that involves calling a conversion function.

Definition at line 4455 of file SemaInit.cpp.

References clang::Sema::AddConversionCandidate(), clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddDerivedToBaseCastStep(), clang::InitializationSequence::AddObjCObjectConversionStep(), clang::Sema::AddOverloadCandidate(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddReferenceBindingStep(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::InitializationSequence::AddUserConversionStep(), clang::InitializationKind::allowExplicitConversionFunctionsInRefBinding(), clang::OverloadCandidateSet::BestViableFunction(), clang::Type::castAs(), CheckCXX98CompatAccessibleCopy(), clang::OverloadCandidateSet::clear(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, clang::XRayInstrKind::Function, clang::Type::getAs(), clang::Stmt::getBeginLoc(), clang::getConstructorInfo(), clang::RecordType::getDecl(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitializationKind::getLocation(), clang::QualType::getNonLValueExprType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::FunctionDecl::getReturnType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::StandardConversionSequence::getToType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::QualType::getUnqualifiedType(), clang::CXXRecordDecl::getVisibleConversionFunctions(), clang::ASTContext::hasSameType(), clang::Initializer, clang::Sema::isCompleteType(), clang::Decl::isInvalidDecl(), clang::Type::isLValueReferenceType(), clang::Sema::LookupConstructors(), AttributeLangSupport::ObjC, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::Ref_Incompatible, clang::Result, clang::Decl::setReferenced(), clang::ImplicitConversionSequence::setStandard(), clang::OverloadCandidateSet::size(), clang::ImplicitConversionSequence::Standard, clang::VK_LValue, clang::VK_RValue, and clang::VK_XValue.

Referenced by TryReferenceInitializationCore().

## ◆ TryStringLiteralInitialization()

static void TryStringLiteralInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | Expr * | Initializer,
|  | InitializationSequence & | Sequence
| ) |  |
| static

Attempt character array initialization from a string literal (C++ [dcl.init.string], C99 6.7.8).

Definition at line 4987 of file SemaInit.cpp.

References clang::InitializationSequence::AddStringInitStep(), and clang::InitializedEntity::getType().

Referenced by clang::InitializationSequence::InitializeFrom().

## ◆ TryUserDefinedConversion()

static void TryUserDefinedConversion | ( | Sema & | S,
|  | QualType | DestType,
|  | const InitializationKind & | Kind,
|  | Expr * | Initializer,
|  | InitializationSequence & | Sequence,
|  | bool | TopLevelOfInitList
| ) |  |
| static

Attempt a user-defined conversion between two types (C++ [dcl.init]), which enumerates all conversion functions and performs overload resolution to select the best.

Definition at line 5115 of file SemaInit.cpp.

References clang::Sema::AddConversionCandidate(), clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddFinalCopy(), clang::Sema::AddOverloadCandidate(), clang::InitializationSequence::AddQualificationConversionStep(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::InitializationSequence::AddUserConversionStep(), clang::InitializationKind::AllowExplicit(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, clang::InitializationSequence::FK_UserConversionOverloadFailed, clang::Qualifiers::getAddressSpace(), clang::Type::getAs(), clang::Stmt::getBeginLoc(), clang::FunctionDecl::getCallResultType(), clang::getConstructorInfo(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::Sema::getLangOpts(), clang::InitializationKind::getLocation(), clang::QualType::getQualifiers(), clang::FunctionDecl::getReturnType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::CXXRecordDecl::getVisibleConversionFunctions(), clang::QualType::hasQualifiers(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Initializer, clang::Sema::isCompleteType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Sema::LookupConstructors(), clang::Result, clang::OverloadCandidateSet::setDestAS(), clang::InitializationSequence::SetOverloadFailure(), clang::Decl::setReferenced(), clang::ImplicitConversionSequence::setStandard(), clang::OverloadCandidateSet::size(), clang::ImplicitConversionSequence::Standard, and clang::VK_RValue.

## ◆ TryValueInitialization()

static void TryValueInitialization | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | const InitializationKind & | Kind,
|  | InitializationSequence & | Sequence,
|  | InitListExpr * | InitList = `nullptr`
| ) |  |
| static

Attempt value initialization (C++ [dcl.init]p7).

Definition at line 4996 of file SemaInit.cpp.

References clang::InitializationSequence::AddZeroInitializationStep(), clang::Sema::Context, clang::InitializationSequence::FK_TooManyInitsForReference, clang::Type::getAs(), clang::ASTContext::getBaseElementType(), clang::CXXConstructorDecl::getCanonicalDecl(), clang::Sema::getLangOpts(), clang::InitListExpr::getNumInits(), clang::InitializedEntity::getType(), clang::FunctionDecl::isDefaulted(), clang::FunctionDecl::isDeleted(), clang::Sema::LookupDefaultConstructor(), clang::InitializationSequence::SetFailed(), and TryConstructorInitialization().

Referenced by clang::InitializationSequence::InitializeFrom(), ResolveOverloadedFunctionForReferenceBinding(), and TryListInitialization().

## ◆ updateGNUCompoundLiteralRValue()

static void updateGNUCompoundLiteralRValue | ( | Expr * | E | ) |
| static

Fix a compound literal initializing an array so it's correctly marked as an rvalue.

Definition at line 168 of file SemaInit.cpp.

References clang::Expr::setValueKind(), and clang::VK_RValue.

## ◆ updateStringLiteralType()

static void updateStringLiteralType | ( | Expr * | E,
|  | QualType | Ty
| ) |  |
| static

Update the type of a string literal, including any surrounding parentheses, to match the type of the object which it is initializing.

Definition at line 145 of file SemaInit.cpp.

References clang::Expr::setType(), clang::Expr::setValueKind(), and clang::VK_RValue.

## ◆ visitLifetimeBoundArguments()

static void visitLifetimeBoundArguments | ( | IndirectLocalPath & | Path,
|  | Expr * | Call,
|  | LocalVisitor | Visit
| ) |  |
| static

Definition at line 6849 of file SemaInit.cpp.

References clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), implicitObjectParamIsLifetimeBound(), clang::NamedDecl::isCXXInstanceMember(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

Referenced by visitLocalsRetainedByReferenceBinding().

## ◆ visitLocalsRetainedByInitializer()

static void visitLocalsRetainedByInitializer | ( | IndirectLocalPath & | Path,
|  | Expr * | Init,
|  | LocalVisitor | Visit,
|  | bool | RevisitSubinits,
|  | bool | EnableLifetimeWarnings
| ) |  |
| static

Visit the locals that would be reachable through an object initialized by the prvalue expression `Init`.

Definition at line 7026 of file SemaInit.cpp.

References clang::Type::getAsCXXRecordDecl(), clang::InitListExpr::getInit(), clang::InitListExpr::getInitializedFieldInUnion(), clang::InitListExpr::getNumInits(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::IgnoreParens(), clang::Type::isArrayType(), clang::Type::isReferenceType(), clang::InitListExpr::isTransparent(), isVarOnPath(), clang::Expr::skipRValueSubobjectAdjustments(), and visitLocalsRetainedByReferenceBinding().

Referenced by clang::Sema::checkInitializerLifetime(), handleGslAnnotatedTypes(), pathContainsInit(), visitLifetimeBoundArguments(), and visitLocalsRetainedByReferenceBinding().

## ◆ visitLocalsRetainedByReferenceBinding()

static void visitLocalsRetainedByReferenceBinding | ( | IndirectLocalPath & | Path,
|  | Expr * | Init,
|  | ReferenceKind | RK,
|  | LocalVisitor | Visit,
|  | bool | EnableLifetimeWarnings
| ) |  |
| static

Visit the locals that would be reachable through a reference bound to the glvalue expression `Init`.

Definition at line 6898 of file SemaInit.cpp.

References clang::C, clang::InitListExpr::getInit(), clang::UnaryOperator::getOpcode(), clang::Stmt::getStmtClass(), clang::UnaryOperator::getSubExpr(), handleGslAnnotatedTypes(), clang::InitListExpr::isTransparent(), isVarOnPath(), clang::Expr::skipRValueSubobjectAdjustments(), visitLifetimeBoundArguments(), and visitLocalsRetainedByInitializer().

Referenced by clang::Sema::checkInitializerLifetime(), handleGslAnnotatedTypes(), pathContainsInit(), visitLifetimeBoundArguments(), and visitLocalsRetainedByInitializer().

## ◆ warnBracedScalarInit()

static void warnBracedScalarInit | ( | Sema & | S,
|  | const InitializedEntity & | Entity,
|  | SourceRange | Braces
| ) |  |
| static

Warn that `Entity` was of scalar type and was initialized by a single-element braced initializer list.

Definition at line 1103 of file SemaInit.cpp.

References clang::FixItHint::CreateRemoval(), clang::Sema::Diag(), clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), and clang::Sema::inTemplateInstantiation().