clang API Documentation
#include "clang/Sema/Initialization.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/Designator.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 <map>
Go to the source code of this file.
Enumerations | |
enum | StringInitFailureKind { SIF_None, SIF_NarrowStringIntoWideChar, SIF_WideStringIntoChar, SIF_IncompatWideStringIntoWideChar, SIF_Other } |
enum | InvalidICRKind { IIK_okay, IIK_nonlocal, IIK_nonscalar } |
The non-zero enum values here are indexes into diagnostic alternatives. More... | |
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). | |
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. Returns SIF_None if so, otherwise returns a StringInitFailureKind that describes why the initialization would not work. | |
static StringInitFailureKind | IsStringInit (Expr *init, QualType declType, ASTContext &Context) |
static void | updateStringLiteralType (Expr *E, QualType Ty) |
static void | CheckStringInit (Expr *Str, QualType &DeclT, const ArrayType *AT, Sema &S) |
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. | |
static DesignatedInitExpr * | CloneDesignatedInitExpr (Sema &SemaRef, DesignatedInitExpr *DIE) |
static ExprResult | CheckArrayDesignatorExpr (Sema &S, Expr *Index, llvm::APSInt &Value) |
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) |
Attempt list initialization (C++0x [dcl.init.list]) | |
static bool | TryInitializerListConstruction (Sema &S, InitListExpr *List, QualType DestType, InitializationSequence &Sequence) |
When initializing from init list via constructor, handle initialization of an object of type std::initializer_list<T>. | |
static OverloadingResult | ResolveConstructorOverload (Sema &S, SourceLocation DeclLoc, MultiExprArg Args, OverloadCandidateSet &CandidateSet, ArrayRef< NamedDecl * > Ctors, OverloadCandidateSet::iterator &Best, bool CopyInitializing, bool AllowExplicit, bool OnlyListConstructors, bool InitListSyntax) |
static void | TryConstructorInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType DestType, InitializationSequence &Sequence, bool InitListSyntax=false) |
Attempt initialization by constructor (C++ [dcl.init]), which enumerates the constructors of the initialized entity and performs overload resolution to select the best. If InitListSyntax is true, this is list-initialization of a non-aggregate class type. | |
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. | |
static void | TryValueInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitializationSequence &Sequence, InitListExpr *InitList) |
Attempt value initialization (C++ [dcl.init]p7). | |
static void | TryReferenceListInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitListExpr *InitList, InitializationSequence &Sequence) |
Attempt list initialization of a reference. | |
static OverloadingResult | TryRefInitWithConversionFunction (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, bool AllowRValues, InitializationSequence &Sequence) |
Try a reference initialization that involves calling a conversion function. | |
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. | |
static void | TryReferenceInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, InitializationSequence &Sequence) |
Attempt reference initialization (C++0x [dcl.init.ref]) | |
static ExprValueKind | convertQualifiersAndValueKindIfNecessary (Sema &S, InitializationSequence &Sequence, Expr *Initializer, QualType cv1T1, Qualifiers T1Quals, Qualifiers T2Quals, bool IsLValueRef) |
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). | |
static void | TryDefaultInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, InitializationSequence &Sequence) |
Attempt default initialization (C++ [dcl.init]p6). | |
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. | |
static bool | isLibstdcxxPointerReturnFalseHack (Sema &S, const InitializedEntity &Entity, const Expr *Init) |
static InvalidICRKind | isInvalidICRSource (ASTContext &C, Expr *e, bool isAddressOf, bool &isWeakAccess) |
Determines whether this expression is an acceptable ICR source. | |
static void | checkIndirectCopyRestoreSource (Sema &S, Expr *src) |
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. | |
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 | TryOCLZeroEventInitialization (Sema &S, InitializationSequence &Sequence, QualType DestType, Expr *Initializer) |
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. | |
static bool | shouldDestroyTemporary (const InitializedEntity &Entity) |
Whether the given entity, when initialized with an object created for that initialization, requires destruction. | |
static void | LookupCopyAndMoveConstructors (Sema &S, OverloadCandidateSet &CandidateSet, CXXRecordDecl *Class, Expr *CurInitExpr) |
Look for copy and move constructors and constructor templates, for copying an object via direct-initialization (per C++11 [dcl.init]p16). | |
static SourceLocation | getInitializationLoc (const InitializedEntity &Entity, Expr *Initializer) |
Get the location at which initialization diagnostics should appear. | |
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. | |
static bool | isReferenceBinding (const InitializationSequence::Step &s) |
static bool | isExplicitTemporary (const InitializedEntity &Entity, const InitializationKind &Kind, unsigned NumArgs) |
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 bool | InitializedEntityOutlivesFullExpression (const InitializedEntity &Entity) |
static const InitializedEntity * | getEntityForTemporaryLifetimeExtension (const InitializedEntity *Entity, const InitializedEntity *FallbackDecl=nullptr) |
static void | performLifetimeExtension (Expr *Init, const InitializedEntity *ExtendingEntity) |
static bool | performReferenceExtension (Expr *Init, const InitializedEntity *ExtendingEntity) |
static void | warnOnLifetimeExtension (Sema &S, const InitializedEntity &Entity, const Expr *Init, bool IsInitializerList, const ValueDecl *ExtendingDecl) |
static void | DiagnoseNarrowingInInitList (Sema &S, const ImplicitConversionSequence &ICS, QualType PreNarrowingType, QualType EntityType, const Expr *PostInit) |
static bool | DiagnoseUninitializedReference (Sema &S, SourceLocation Loc, QualType T) |
static void | emitBadConversionNotes (Sema &S, const InitializedEntity &entity, Expr *op) |
static void | diagnoseListInit (Sema &S, const InitializedEntity &Entity, InitListExpr *InitList) |
static void | maybeEmitZeroInitializationFixit (Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity) |
enum InvalidICRKind |
The non-zero enum values here are indexes into diagnostic alternatives.
Definition at line 4323 of file SemaInit.cpp.
SIF_None | |
SIF_NarrowStringIntoWideChar | |
SIF_WideStringIntoChar | |
SIF_IncompatWideStringIntoWideChar | |
SIF_Other |
Definition at line 47 of file SemaInit.cpp.
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 2428 of file SemaInit.cpp.
References clang::Sema::Diag(), clang::Stmt::getLocStart(), clang::Stmt::getSourceRange(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and clang::Sema::VerifyIntegerConstantExpression().
Referenced by clang::Sema::ActOnDesignatedInitializer().
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 5153 of file SemaInit.cpp.
References clang::OverloadCandidateSet::BestViableFunction(), clang::Sema::CheckConstructorAccess(), clang::OverloadCandidateSet::CSK_Normal, Diag(), clang::Sema::Diag(), clang::Sema::Diags, clang::Type::getAs(), getInitializationLoc(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::DiagnosticsEngine::isIgnored(), LookupCopyAndMoveConstructors(), clang::OverloadCandidateSet::NoteCandidates(), clang::Sema::NoteDeletedFunction(), clang::OCD_AllCandidates, clang::OCD_ViableCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::PDiag(), and Record.
Referenced by TryReferenceInitializationCore().
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 4393 of file SemaInit.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::Sema::ExprNeedsCleanups, clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), IIK_okay, isInvalidICRSource(), and clang::Expr::isRValue().
Referenced by clang::InitializationSequence::Perform().
static void CheckStringInit | ( | Expr * | Str, |
QualType & | DeclT, | ||
const ArrayType * | AT, | ||
Sema & | S | ||
) | [static] |
Definition at line 149 of file SemaInit.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::ASTContext::getConstantArrayType(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), clang::ConstantArrayType::getSize(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::ArrayType::Normal, and updateStringLiteralType().
Referenced by clang::InitializationSequence::Perform().
static DesignatedInitExpr* CloneDesignatedInitExpr | ( | Sema & | SemaRef, |
DesignatedInitExpr * | DIE | ||
) | [static] |
Definition at line 1742 of file SemaInit.cpp.
References clang::Sema::Context, clang::DesignatedInitExpr::designators_begin(), clang::DesignatedInitExpr::getEqualOrColonLoc(), clang::DesignatedInitExpr::getInit(), clang::DesignatedInitExpr::getNumSubExprs(), clang::DesignatedInitExpr::getSubExpr(), clang::DesignatedInitExpr::size(), and clang::DesignatedInitExpr::usesGNUSyntax().
static ExprValueKind convertQualifiersAndValueKindIfNecessary | ( | Sema & | S, |
InitializationSequence & | Sequence, | ||
Expr * | Initializer, | ||
QualType | cv1T1, | ||
Qualifiers | T1Quals, | ||
Qualifiers | T2Quals, | ||
bool | IsLValueRef | ||
) | [static] |
Converts the target of reference initialization so that it has the appropriate qualifiers and value kind.
In this case, 'x' is an 'int' lvalue, but it needs to be 'const int'.
int x; const int &r = x;
In this case the reference is binding to a bitfield lvalue, which isn't valid. Perform a load to create a lifetime-extended temporary instead.
const int &r = someStruct.bitfield;
Definition at line 3743 of file SemaInit.cpp.
References clang::InitializationSequence::AddLValueToRValueStep(), clang::InitializationSequence::AddQualificationConversionStep(), clang::QualType::getUnqualifiedType(), clang::Expr::getValueKind(), clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), clang::Expr::isGLValue(), clang::Expr::refersToBitField(), clang::Expr::refersToVectorElement(), and clang::VK_RValue.
Referenced by TryReferenceInitializationCore().
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.
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. |
Definition at line 5020 of file SemaInit.cpp.
References clang::OverloadCandidateSet::BestViableFunction(), 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::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Expr::isTemporaryObject(), LookupCopyAndMoveConstructors(), clang::Sema::MaybeBindToTemporary(), clang::OverloadCandidateSet::NoteCandidates(), clang::Sema::NoteDeletedFunction(), clang::OCD_AllCandidates, clang::OCD_ViableCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, Record, clang::Sema::RequireCompleteType(), shouldBindAsTemporary(), and clang::OverloadCandidateSet::size().
Referenced by clang::InitializationSequence::Perform().
static void diagnoseListInit | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
InitListExpr * | InitList | ||
) | [static] |
Definition at line 6423 of file SemaInit.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::Type::getAs(), clang::ASTContext::getConstantArrayType(), clang::InitializedEntity::getDecl(), clang::Sema::getLangOpts(), clang::InitListExpr::getLocStart(), 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().
Referenced by clang::InitializationSequence::Diagnose().
static void DiagnoseNarrowingInInitList | ( | Sema & | S, |
const ImplicitConversionSequence & | ICS, | ||
QualType | PreNarrowingType, | ||
QualType | EntityType, | ||
const Expr * | PostInit | ||
) | [static] |
Definition at line 7139 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::ImplicitConversionSequence::getKind(), clang::Sema::getLangOpts(), clang::QualType::getLocalUnqualifiedType(), clang::Stmt::getLocEnd(), clang::Sema::getLocForEndOfToken(), clang::Stmt::getLocStart(), clang::StandardConversionSequence::getNarrowingKind(), clang::Stmt::getSourceRange(), clang::NK_Constant_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::InitializationSequence::Perform().
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 6367 of file SemaInit.cpp.
References clang::CXXRecordDecl::bases(), clang::Sema::Diag(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::QualType::getNonReferenceType(), clang::CXXRecordDecl::hasUninitializedReferenceMember(), and clang::Type::isReferenceType().
Referenced by clang::InitializationSequence::Diagnose().
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 6406 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().
Referenced by clang::InitializationSequence::Diagnose().
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 1714 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().
static Sema::AssignmentAction getAssignmentAction | ( | const InitializedEntity & | Entity, |
bool | Diagnose = false |
||
) | [static] |
Definition at line 4815 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::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getDecl(), clang::Decl::getDeclContext(), and clang::InitializedEntity::getKind().
Referenced by clang::InitializationSequence::Perform().
static const InitializedEntity* getEntityForTemporaryLifetimeExtension | ( | const InitializedEntity * | Entity, |
const InitializedEntity * | FallbackDecl = 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 5425 of file SemaInit.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getKind(), and clang::InitializedEntity::getParent().
Referenced by clang::InitializationSequence::Perform().
static SourceLocation getInitializationLoc | ( | const InitializedEntity & | Entity, |
Expr * | Initializer | ||
) | [static] |
Get the location at which initialization diagnostics should appear.
Definition at line 4967 of file SemaInit.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getCaptureLoc(), clang::InitializedEntity::getDecl(), clang::InitializedEntity::getKind(), clang::Decl::getLocation(), clang::Stmt::getLocStart(), clang::InitializedEntity::getReturnLoc(), and clang::InitializedEntity::getThrowLoc().
Referenced by CheckCXX98CompatAccessibleCopy(), and CopyObject().
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 4411 of file SemaInit.cpp.
References clang::ArrayType::getElementType(), clang::ASTContext::hasSameType(), clang::Type::isConstantArrayType(), and clang::Type::isIncompleteArrayType().
Referenced by clang::InitializationSequence::InitializeFrom().
static bool InitializedEntityOutlivesFullExpression | ( | const InitializedEntity & | Entity | ) | [static] |
Determine whether the specified InitializedEntity definitely has a lifetime longer than the current full-expression. Conservatively returns false if it's unclear.
Definition at line 5386 of file SemaInit.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getKind(), and clang::InitializedEntity::getParent().
Referenced by clang::InitializationSequence::Perform().
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 5229 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().
static InvalidICRKind isInvalidICRSource | ( | ASTContext & | C, |
Expr * | e, | ||
bool | isAddressOf, | ||
bool & | isWeakAccess | ||
) | [static] |
Determines whether this expression is an acceptable ICR source.
Definition at line 4326 of file SemaInit.cpp.
References clang::CK_ArrayToPointerDecay, clang::CK_BitCast, clang::CK_Dependent, clang::CK_LValueBitCast, clang::CK_NoOp, clang::CK_NullToPointer, 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, clang::Qualifiers::OCL_Weak, and clang::UO_AddrOf.
Referenced by checkIndirectCopyRestoreSource().
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 4311 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().
Referenced by clang::InitializationSequence::InitializeFrom().
static bool isReferenceBinding | ( | const InitializationSequence::Step & | s | ) | [static] |
Definition at line 5222 of file SemaInit.cpp.
References clang::InitializationSequence::Step::Kind, clang::InitializationSequence::SK_BindReference, and clang::InitializationSequence::SK_BindReferenceToTemporary.
Referenced by clang::InitializationSequence::Perform().
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 59 of file SemaInit.cpp.
References clang::StringLiteral::Ascii, clang::ASTContext::Char16Ty, clang::ASTContext::Char32Ty, clang::ASTContext::getCanonicalType(), clang::ArrayType::getElementType(), clang::StringLiteral::getKind(), clang::ASTContext::getWideCharType(), clang::Expr::IgnoreParens(), clang::Type::isCharType(), IsWideCharCompatible(), SIF_IncompatWideStringIntoWideChar, SIF_NarrowStringIntoWideChar, SIF_None, SIF_Other, SIF_WideStringIntoChar, clang::ASTContext::typesAreCompatible(), clang::StringLiteral::UTF16, clang::StringLiteral::UTF32, clang::StringLiteral::UTF8, and clang::StringLiteral::Wide.
Referenced by clang::InitializationSequence::InitializeFrom(), and IsStringInit().
static StringInitFailureKind IsStringInit | ( | Expr * | init, |
QualType | declType, | ||
ASTContext & | Context | ||
) | [static] |
Definition at line 123 of file SemaInit.cpp.
References clang::ASTContext::getAsArrayType(), IsStringInit(), and SIF_Other.
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 37 of file SemaInit.cpp.
References clang::ASTContext::Char16Ty, clang::ASTContext::Char32Ty, clang::ASTContext::getLangOpts(), clang::ASTContext::getWideCharType(), and clang::ASTContext::typesAreCompatible().
Referenced by clang::InitializationSequence::InitializeFrom(), and IsStringInit().
static void LookupCopyAndMoveConstructors | ( | Sema & | S, |
OverloadCandidateSet & | CandidateSet, | ||
CXXRecordDecl * | Class, | ||
Expr * | CurInitExpr | ||
) | [static] |
Look for copy and move constructors and constructor templates, for copying an object via direct-initialization (per C++11 [dcl.init]p16).
Definition at line 4919 of file SemaInit.cpp.
References clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::Decl::getAccess(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::CXXConstructorDecl::isConvertingConstructor(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::Decl::isInvalidDecl(), clang::Sema::LookupConstructors(), and clang::DeclAccessPair::make().
Referenced by CheckCXX98CompatAccessibleCopy(), and CopyObject().
static void maybeEmitZeroInitializationFixit | ( | Sema & | S, |
InitializationSequence & | Sequence, | ||
const InitializedEntity & | Entity | ||
) | [static] |
Prints a fixit for adding a null initializer for |Entity|. Call this only right after emitting a diagnostic.
Definition at line 6460 of file SemaInit.cpp.
References clang::FixItHint::CreateInsertion(), clang::Sema::Diag(), clang::InitializedEntity::EK_Variable, clang::QualType::getCanonicalType(), clang::InitializedEntity::getDecl(), clang::Sema::getFixItZeroInitializerForType(), clang::VarDecl::getInit(), clang::InitializedEntity::getKind(), clang::Decl::getLocEnd(), clang::Sema::getLocForEndOfToken(), clang::ValueDecl::getType(), and clang::SourceLocation::isMacroID().
Referenced by clang::InitializationSequence::Diagnose().
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 3040 of file SemaInit.cpp.
References clang::InitializationSequence::AddProduceObjCObjectStep(), clang::InitializedEntity::EK_Result, clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::InitializedEntity::getType(), clang::Type::isObjCRetainableType(), clang::InitializedEntity::isParameterConsumed(), and clang::InitializedEntity::isParameterKind().
Referenced by clang::InitializationSequence::InitializeFrom().
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 5254 of file SemaInit.cpp.
References clang::InitializationKind::AllowExplicit(), clang::InitializedEntity::allowsNRVO(), clang::Sema::BuildCXXConstructExpr(), clang::Sema::CheckConstructorAccess(), clang::CXXConstructExpr::CK_Complete, clang::CXXConstructExpr::CK_Delegating, clang::CXXConstructExpr::CK_NonVirtualBase, clang::CXXConstructExpr::CK_VirtualBase, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::Sema::DefineImplicitDefaultConstructor(), clang::Sema::DiagnoseUseOfDecl(), clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Delegating, clang::ExprError(), clang::InitializationSequence::Step::F::FoundDecl, clang::InitializationSequence::Step::F::Function, clang::InitializationSequence::Step::Function, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::DeclAccessPair::getAccess(), clang::InitializedEntity::getBaseSpecifier(), clang::InitializationKind::getEqualLoc(), clang::InitializedEntity::getKind(), clang::InitializationKind::getKind(), clang::InitializationKind::getLocation(), clang::InitializationKind::getParenRange(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::InitializedEntity::getType(), clang::InitializedEntity::getTypeSourceInfo(), clang::InitializationSequence::Step::F::HadMultipleCandidates, clang::InitializationKind::IK_Default, clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_DirectList, clang::InitializationKind::isCopyInit(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), 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::MaybeBindToTemporary(), and shouldBindAsTemporary().
Referenced by clang::InitializationSequence::Perform().
static void performLifetimeExtension | ( | Expr * | Init, |
const InitializedEntity * | ExtendingEntity | ||
) | [static] |
Update a prvalue expression that is going to be materialized as a lifetime-extended temporary.
Definition at line 5544 of file SemaInit.cpp.
References clang::TagDecl::isUnion(), performReferenceExtension(), and clang::Expr::skipRValueSubobjectAdjustments().
Referenced by performReferenceExtension().
static bool performReferenceExtension | ( | Expr * | Init, |
const InitializedEntity * | ExtendingEntity | ||
) | [static] |
Update a glvalue expression that is used as the initializer of a reference to note that its lifetime is extended.
true
if any temporary had its lifetime extended. Definition at line 5498 of file SemaInit.cpp.
References clang::InitializedEntity::allocateManglingNumber(), clang::InitializedEntity::getDecl(), performLifetimeExtension(), and clang::Expr::skipRValueSubobjectAdjustments().
Referenced by clang::InitializationSequence::Perform(), and performLifetimeExtension().
static OverloadingResult ResolveConstructorOverload | ( | Sema & | S, |
SourceLocation | DeclLoc, | ||
MultiExprArg | Args, | ||
OverloadCandidateSet & | CandidateSet, | ||
ArrayRef< NamedDecl * > | Ctors, | ||
OverloadCandidateSet::iterator & | Best, | ||
bool | CopyInitializing, | ||
bool | AllowExplicit, | ||
bool | OnlyListConstructors, | ||
bool | InitListSyntax | ||
) | [static] |
Definition at line 3107 of file SemaInit.cpp.
References clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Decl::getAccess(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::CXXConstructorDecl::isExplicit(), clang::Sema::isInitListConstructor(), clang::Decl::isInvalidDecl(), and clang::DeclAccessPair::make().
Referenced by TryConstructorInitialization().
static bool ResolveOverloadedFunctionForReferenceBinding | ( | Sema & | S, |
Expr * | Initializer, | ||
QualType & | SourceType, | ||
QualType & | UnqualifiedSourceType, | ||
QualType | UnqualifiedTargetType, | ||
InitializationSequence & | Sequence | ||
) | [static] |
Definition at line 3299 of file SemaInit.cpp.
References clang::InitializationSequence::AddAddressOverloadResolutionStep(), clang::Sema::Context, clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::ASTContext::getCanonicalType(), clang::QualType::getUnqualifiedType(), clang::Type::isRecordType(), clang::ASTContext::OverloadTy, clang::Sema::ResolveAddressOfOverloadedFunction(), and clang::InitializationSequence::SetFailed().
Referenced by TryReferenceInitialization(), and TryReferenceListInitialization().
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 4861 of file SemaInit.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, and clang::InitializedEntity::getKind().
Referenced by CopyObject(), clang::InitializationSequence::Perform(), and PerformConstructorInitialization().
static bool shouldDestroyTemporary | ( | const InitializedEntity & | Entity | ) | [static] |
Whether the given entity, when initialized with an object created for that initialization, requires destruction.
Definition at line 4890 of file SemaInit.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, 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_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_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, and clang::InitializedEntity::getKind().
Referenced by clang::InitializationSequence::Perform().
static void TryConstructorInitialization | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const InitializationKind & | Kind, | ||
MultiExprArg | Args, | ||
QualType | DestType, | ||
InitializationSequence & | Sequence, | ||
bool | InitListSyntax = 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. If InitListSyntax is true, this is list-initialization of a non-aggregate class type.
Definition at line 3183 of file SemaInit.cpp.
References clang::InitializationSequence::AddConstructorInitializationStep(), clang::InitializationKind::AllowExplicit(), clang::InitializationSequence::FK_ConstructorOverloadFailed, clang::InitializationSequence::FK_DefaultInitOfConst, clang::InitializationSequence::FK_ExplicitConstructor, clang::InitializationSequence::FK_ListConstructorOverloadFailed, clang::Decl::getAccess(), clang::Type::getAs(), clang::RecordType::getDecl(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitListExpr::getInits(), clang::InitializationKind::getKind(), clang::InitializationKind::getLocation(), clang::InitListExpr::getNumInits(), clang::InitializedEntity::getType(), clang::CXXRecordDecl::hasDefaultConstructor(), clang::InitializationKind::IK_Copy, clang::InitializationKind::IK_Default, clang::QualType::isConstQualified(), clang::CXXConstructorDecl::isExplicit(), clang::Sema::LookupConstructors(), clang::OR_No_Viable_Function, clang::Sema::RequireCompleteType(), ResolveConstructorOverload(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::setIncompleteTypeFailure(), and clang::InitializationSequence::SetOverloadFailure().
Referenced by clang::InitializationSequence::InitializeFrom(), TryDefaultInitialization(), TryListInitialization(), and TryValueInitialization().
static void TryDefaultInitialization | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const InitializationKind & | Kind, | ||
InitializationSequence & | Sequence | ||
) | [static] |
Attempt default initialization (C++ [dcl.init]p6).
Definition at line 4105 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, clang::InitializationSequence::SetFailed(), and TryConstructorInitialization().
Referenced by clang::InitializationSequence::InitializeFrom().
static bool TryInitializerListConstruction | ( | Sema & | S, |
InitListExpr * | List, | ||
QualType | DestType, | ||
InitializationSequence & | Sequence | ||
) | [static] |
When initializing from init list via constructor, handle initialization of an object of type std::initializer_list<T>.
Definition at line 3078 of file SemaInit.cpp.
References clang::InitializationSequence::AddStdInitializerListConstructionStep(), clang::Sema::Context, clang::InitializationKind::CreateDirectList(), clang::ASTContext::getConstantArrayType(), clang::Expr::getExprLoc(), clang::InitListExpr::getNumInits(), clang::ASTContext::getSizeType(), clang::ASTContext::getTypeSize(), clang::InitializedEntity::InitializeTemporary(), clang::Sema::isStdInitializerList(), clang::ArrayType::Normal, clang::Sema::RequireCompleteType(), clang::InitializationSequence::setIncompleteTypeFailure(), TryListInitialization(), and clang::QualType::withConst().
Referenced by TryListInitialization().
static void TryListInitialization | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const InitializationKind & | Kind, | ||
InitListExpr * | InitList, | ||
InitializationSequence & | Sequence | ||
) | [static] |
Attempt list initialization (C++0x [dcl.init.list])
Definition at line 3410 of file SemaInit.cpp.
References clang::InitializationSequence::AddListInitializationStep(), clang::InitializationKind::CreateDirect(), clang::InitializationSequence::FK_InitListBadDestinationType, clang::InitializationSequence::FK_ListInitializationFailed, clang::InitializationSequence::FK_TooManyInitsForScalar, clang::Type::getAsCXXRecordDecl(), clang::InitListExpr::getInit(), clang::InitializationKind::getKind(), clang::Sema::getLangOpts(), clang::InitListExpr::getLBraceLoc(), clang::InitializationKind::getLocation(), clang::InitListExpr::getLocStart(), clang::InitListExpr::getNumInits(), clang::InitListExpr::getRBraceLoc(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::CXXRecordDecl::hasDefaultConstructor(), clang::InitializationKind::IK_DirectList, clang::InitializationSequence::InitializeFrom(), clang::Type::isAggregateType(), clang::Type::isAnyComplexType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isScalarType(), clang::Sema::RequireCompleteType(), clang::InitializationSequence::RewrapReferenceInitList(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::setIncompleteTypeFailure(), TryConstructorInitialization(), TryInitializerListConstruction(), TryReferenceListInitialization(), and TryValueInitialization().
Referenced by clang::InitializationSequence::InitializeFrom(), TryInitializerListConstruction(), and TryReferenceListInitialization().
static bool tryObjCWritebackConversion | ( | Sema & | S, |
InitializationSequence & | Sequence, | ||
const InitializedEntity & | Entity, | ||
Expr * | Initializer | ||
) | [static] |
Definition at line 4428 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.
Referenced by clang::InitializationSequence::InitializeFrom().
static bool TryOCLSamplerInitialization | ( | Sema & | S, |
InitializationSequence & | Sequence, | ||
QualType | DestType, | ||
Expr * | Initializer | ||
) | [static] |
Definition at line 4475 of file SemaInit.cpp.
References clang::InitializationSequence::AddOCLSamplerInitStep(), clang::Sema::getASTContext(), clang::Sema::getLangOpts(), clang::Expr::isIntegerConstantExpr(), and clang::Type::isSamplerT().
Referenced by clang::InitializationSequence::InitializeFrom().
static bool TryOCLZeroEventInitialization | ( | Sema & | S, |
InitializationSequence & | Sequence, | ||
QualType | DestType, | ||
Expr * | Initializer | ||
) | [static] |
Definition at line 4495 of file SemaInit.cpp.
References clang::InitializationSequence::AddOCLZeroEventStep(), clang::Expr::EvaluateKnownConstInt(), clang::Sema::getASTContext(), clang::Sema::getLangOpts(), clang::Type::isEventT(), and clang::Expr::isIntegerConstantExpr().
Referenced by clang::InitializationSequence::InitializeFrom().
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 3703 of file SemaInit.cpp.
References clang::Sema::Context, clang::Type::getAs(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::getUnqualifiedArrayType(), ResolveOverloadedFunctionForReferenceBinding(), and TryReferenceInitializationCore().
Referenced by clang::InitializationSequence::InitializeFrom().
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 3780 of file SemaInit.cpp.
References clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddDerivedToBaseCastStep(), clang::InitializationSequence::AddExtraneousCopyToTemporary(), clang::InitializationSequence::AddObjCObjectConversionStep(), clang::InitializationSequence::AddReferenceBindingStep(), CheckCXX98CompatAccessibleCopy(), clang::Expr::Classify(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, convertQualifiersAndValueKindIfNecessary(), clang::OverloadCandidateSet::empty(), clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToTemporary, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToUnrelated, clang::InitializationSequence::FK_ReferenceInitDropsQualifiers, clang::InitializationSequence::FK_ReferenceInitFailed, clang::InitializationSequence::FK_ReferenceInitOverloadFailed, clang::InitializationSequence::FK_RValueReferenceBindingToLValue, clang::ASTContext::getCanonicalType(), clang::Qualifiers::getCVRQualifiers(), clang::InitializationSequence::getFailedCandidateSet(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), clang::ASTContext::getQualifiedType(), clang::InitializedEntity::getType(), clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), clang::InitializedEntity::InitializeTemporary(), clang::Type::isArrayType(), clang::ImplicitConversionSequence::isBad(), clang::InitializationKind::isCStyleOrFunctionalCast(), clang::Type::isFunctionType(), clang::Expr::Classification::isLValue(), clang::Type::isLValueReferenceType(), clang::Expr::Classification::isPRValue(), clang::Type::isRecordType(), clang::Expr::Classification::isRValue(), isRValueRef(), clang::Expr::Classification::isXValue(), clang::OR_No_Viable_Function, clang::OR_Success, clang::ASTContext::OverloadTy, clang::Sema::Ref_Compatible, clang::Sema::Ref_Compatible_With_Added_Qualification, clang::Sema::Ref_Incompatible, clang::Sema::Ref_Related, clang::InitializationSequence::SetFailed(), clang::InitializationSequence::SetOverloadFailure(), clang::Sema::TryImplicitConversion(), TryRefInitWithConversionFunction(), clang::VK_LValue, clang::VK_RValue, and clang::VK_XValue.
Referenced by TryReferenceInitialization(), and TryReferenceListInitialization().
static void TryReferenceListInitialization | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const InitializationKind & | Kind, | ||
InitListExpr * | InitList, | ||
InitializationSequence & | Sequence | ||
) | [static] |
Attempt list initialization of a reference.
Definition at line 3343 of file SemaInit.cpp.
References clang::InitializationSequence::AddReferenceBindingStep(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToTemporary, clang::InitializationSequence::FK_ReferenceBindingToInitList, clang::Type::getAs(), clang::InitListExpr::getInit(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), 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().
static OverloadingResult TryRefInitWithConversionFunction | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const InitializationKind & | Kind, | ||
Expr * | Initializer, | ||
bool | AllowRValues, | ||
InitializationSequence & | Sequence | ||
) | [static] |
Try a reference initialization that involves calling a conversion function.
Definition at line 3505 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::AllowExplicit(), clang::InitializationKind::allowExplicitConversionFunctionsInRefBinding(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::Decl::getAccess(), clang::Type::getAs(), clang::RecordType::getDecl(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitializationKind::getLocation(), clang::Stmt::getLocStart(), clang::QualType::getNonLValueExprType(), clang::QualType::getNonReferenceType(), 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::Decl::isInvalidDecl(), clang::Type::isReferenceType(), clang::Sema::LookupConstructors(), clang::DeclAccessPair::make(), clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::Ref_Incompatible, clang::Sema::RequireCompleteType(), 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().
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 4018 of file SemaInit.cpp.
References clang::InitializationSequence::AddStringInitStep(), and clang::InitializedEntity::getType().
Referenced by clang::InitializationSequence::InitializeFrom().
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 4144 of file SemaInit.cpp.
References clang::Sema::AddConversionCandidate(), clang::InitializationSequence::AddConversionSequenceStep(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::InitializationSequence::AddUserConversionStep(), clang::InitializationKind::AllowExplicit(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::InitializationSequence::FK_UserConversionOverloadFailed, clang::Decl::getAccess(), clang::Type::getAs(), clang::FunctionDecl::getCallResultType(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::InitializationKind::getLocation(), clang::Stmt::getLocStart(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::CXXRecordDecl::getVisibleConversionFunctions(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Sema::LookupConstructors(), clang::DeclAccessPair::make(), clang::Sema::RequireCompleteType(), clang::InitializationSequence::SetOverloadFailure(), clang::Decl::setReferenced(), clang::ImplicitConversionSequence::setStandard(), clang::OverloadCandidateSet::size(), and clang::ImplicitConversionSequence::Standard.
Referenced by clang::InitializationSequence::InitializeFrom().
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 4027 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::RecordType::getDecl(), 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(), and TryListInitialization().
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 133 of file SemaInit.cpp.
References clang::Expr::setType().
Referenced by CheckStringInit().
static void warnOnLifetimeExtension | ( | Sema & | S, |
const InitializedEntity & | Entity, | ||
const Expr * | Init, | ||
bool | IsInitializerList, | ||
const ValueDecl * | ExtendingDecl | ||
) | [static] |
Definition at line 5600 of file SemaInit.cpp.
References clang::Sema::Diag(), clang::InitializedEntity::EK_Base, clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::InitializedEntity::getParent(), and clang::Stmt::getSourceRange().
Referenced by clang::InitializationSequence::Perform().