clang 20.0.0git
|
#include "CheckExprLifetime.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/Designator.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Ownership.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
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... | |
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. | |
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. | |
static void | updateGNUCompoundLiteralRValue (Expr *E) |
Fix a compound literal initializing an array so it's correctly marked as an rvalue. | |
static bool | initializingConstexprVariable (const InitializedEntity &Entity) |
static void | CheckC23ConstexprInitStringLiteral (const StringLiteral *SE, Sema &SemaRef, QualType &TT) |
static void | CheckStringInit (Expr *Str, QualType &DeclT, const ArrayType *AT, Sema &S, bool CheckC23ConstexprInit=false) |
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. | |
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. | |
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. | |
static bool | canInitializeArrayWithEmbedDataString (ArrayRef< Expr * > ExprList, const InitializedEntity &Entity, ASTContext &Context) |
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) |
Check that the given Index expression is a valid array designator value. | |
static bool | maybeRecoverWithZeroInitialization (Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity) |
Tries to add a zero initializer. Returns true if that worked. | |
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]) | |
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>. | |
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. | |
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 RequireActualConstructor, 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. | |
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, bool TopLevelOfInitList) |
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, bool TreatUnavailableAsInvalid) |
Attempt list initialization of a reference. | |
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. | |
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. | |
static void | TryReferenceInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, Expr *Initializer, InitializationSequence &Sequence, bool TopLevelOfInitList) |
Attempt reference initialization (C++0x [dcl.init.ref]) | |
static bool | isNonReferenceableGLValue (Expr *E) |
Determine whether an expression is a non-referenceable glvalue (one to which a reference can never bind). | |
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 | TryOrBuildParenListInitialization (Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args, InitializationSequence &Sequence, bool VerifyOnly, ExprResult *Result=nullptr) |
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) |
An egregious hack for compatibility with libstdc++-4.2: in <tr1/hashtable>, a function with a pointer return type contains a 'return false;' statement. | |
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) |
Check whether the given expression is a valid operand for an indirect copy/restore. | |
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 | 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 . | |
static bool | canPerformArrayCopy (const InitializedEntity &Entity) |
Determine whether we can perform an elementwise array copy for this kind of entity. | |
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 | shouldDestroyEntity (const InitializedEntity &Entity) |
Whether the given entity, when initialized with an object created for that initialization, requires destruction. | |
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 | 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. | |
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 void | DiagnoseNarrowingInInitList (Sema &S, const ImplicitConversionSequence &ICS, QualType PreNarrowingType, QualType EntityType, const Expr *PostInit) |
static void | CheckC23ConstexprInitConversion (Sema &S, QualType FromType, QualType ToType, Expr *Init) |
static void | CheckMoveOnConstruction (Sema &S, const Expr *InitExpr, bool IsReturnStmt) |
Provide warnings when std::move is used on construction. | |
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. | |
static void | emitBadConversionNotes (Sema &S, const InitializedEntity &entity, Expr *op) |
Emit notes associated with an initialization that failed due to a "simple" conversion failure. | |
static void | diagnoseListInit (Sema &S, const InitializedEntity &Entity, InitListExpr *InitList) |
static bool | isOrIsDerivedFromSpecializationOf (CXXRecordDecl *RD, ClassTemplateDecl *CTD) |
Determine whether RD is, or is derived from, a specialization of CTD. | |
enum InvalidICRKind |
The non-zero enum values here are indexes into diagnostic alternatives.
Enumerator | |
---|---|
IIK_okay | |
IIK_nonlocal | |
IIK_nonscalar |
Definition at line 6052 of file SemaInit.cpp.
Enumerator | |
---|---|
SIF_None | |
SIF_NarrowStringIntoWideChar | |
SIF_WideStringIntoChar | |
SIF_IncompatWideStringIntoWideChar | |
SIF_UTF8StringIntoPlainChar | |
SIF_PlainStringIntoUTF8Char | |
SIF_Other |
Definition at line 61 of file SemaInit.cpp.
|
static |
Definition at line 2000 of file SemaInit.cpp.
References clang::Type::getAsArrayTypeUnsafe(), clang::EmbedExpr::getDataStringLiteral(), clang::ArrayType::getElementType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::Type::isArrayType(), clang::Type::isCharType(), Parent, and clang::ASTContext::typesAreCompatible().
|
static |
Determine whether we can perform an elementwise array copy for this kind of entity.
Definition at line 6285 of file SemaInit.cpp.
References canPerformArrayCopy(), E, 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 canPerformArrayCopy(), and clang::InitializationSequence::InitializeFrom().
|
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 3461 of file SemaInit.cpp.
References clang::Sema::AllowFold, clang::SemaBase::Diag(), Loc, clang::Result, toString(), and clang::Sema::VerifyIntegerConstantExpression().
Referenced by clang::Sema::ActOnDesignatedInitializer().
|
static |
Definition at line 9573 of file SemaInit.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::StandardConversionSequence::getNarrowingKind(), clang::Init, clang::ImplicitConversionSequence::isStandard(), clang::NK_Constant_Narrowing, clang::NK_Dependent_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, clang::ImplicitConversionSequence::Standard, and clang::Sema::TryImplicitConversion().
Referenced by clang::InitializationSequence::Perform().
|
static |
Definition at line 9614 of file SemaInit.cpp.
References clang::C, clang::Sema::Context, clang::SemaBase::Diag(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getCharWidth(), clang::StringLiteral::getCodeUnitS(), clang::ArrayType::getElementType(), clang::Sema::getLangOpts(), clang::StringLiteral::getLength(), clang::Sema::getLocationOfStringLiteralByte(), clang::ASTContext::getTypeSize(), isUnsigned(), and clang::Type::isUnsignedIntegerType().
Referenced by CheckStringInit().
|
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 7088 of file SemaInit.cpp.
References clang::Sema::CheckConstructorAccess(), clang::OverloadCandidateSet::CSK_Normal, Diag(), clang::SemaBase::Diag(), clang::Sema::Diags, clang::Type::getAs(), getInitializationLoc(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), int, clang::DiagnosticsEngine::isIgnored(), Loc, 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::SemaBase::PDiag(), and ResolveConstructorOverload().
Referenced by TryReferenceInitializationCore().
|
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 1982 of file SemaInit.cpp.
References clang::Sema::CheckDestructorAccess(), clang::Destructor, clang::Sema::DiagnoseUseOfDecl(), clang::Type::getAsCXXRecordDecl(), Loc, clang::Sema::LookupDestructor(), clang::Sema::MarkFunctionReferenced(), and clang::SemaBase::PDiag().
Referenced by PerformConstructorInitialization().
Definition at line 7450 of file SemaInit.cpp.
References clang::Sema::Context, clang::Sema::DiagRuntimeBehavior(), E, clang::Expr::IgnoreParenCasts(), clang::Expr::NPC_ValueDependentIsNotNull, and clang::SemaBase::PDiag().
Check whether the given expression is a valid operand for an indirect copy/restore.
Definition at line 6122 of file SemaInit.cpp.
References clang::Sema::Cleanup, clang::Sema::Context, clang::SemaBase::Diag(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), IIK_okay, isInvalidICRSource(), clang::Expr::isPRValue(), and clang::CleanupInfo::setExprNeedsCleanups().
Referenced by clang::InitializationSequence::Perform().
Provide warnings when std::move is used on construction.
Definition at line 7353 of file SemaInit.cpp.
References clang::Sema::Context, clang::FixItHint::CreateRemoval(), clang::SemaBase::Diag(), clang::CallExpr::getArg(), clang::CXXConstructExpr::getArg(), clang::CharSourceRange::getBegin(), clang::CallExpr::getBeginLoc(), clang::Stmt::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::ValueDecl::getType(), clang::Expr::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::Expr::isPRValue(), clang::Type::isRecordType(), and clang::DeclRefExpr::refersToEnclosingVariableOrCapture().
Referenced by clang::InitializationSequence::Perform().
|
static |
Definition at line 214 of file SemaInit.cpp.
References CheckC23ConstexprInitStringLiteral(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Type::getAsArrayTypeUnsafe(), clang::Stmt::getBeginLoc(), clang::ASTContext::getConstantArrayType(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ConstantArrayType::getZExtSize(), clang::Expr::IgnoreParens(), clang::Normal, and updateStringLiteralType().
Referenced by clang::InitializationSequence::Perform().
|
static |
Definition at line 2611 of file SemaInit.cpp.
References clang::Sema::Context, clang::DesignatedInitExpr::Create(), clang::DesignatedInitExpr::designators(), clang::DesignatedInitExpr::getEqualOrColonLoc(), clang::DesignatedInitExpr::getInit(), clang::DesignatedInitExpr::getNumSubExprs(), clang::DesignatedInitExpr::getSubExpr(), and clang::DesignatedInitExpr::usesGNUSyntax().
|
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 6937 of file SemaInit.cpp.
References clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::CheckConstructorAccess(), clang::Class, clang::Complete, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_Normal, clang::SemaBase::Diag(), clang::ExprError(), clang::ActionResult< PtrTy, Compress >::get(), clang::ActionResult< PtrTy, Compress >::getAs(), clang::Type::getAs(), getInitializationLoc(), clang::InitializedEntity::getKind(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), int, clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Expr::isTemporaryObject(), Loc, 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::SemaBase::PDiag(), clang::Sema::RequireCompleteType(), ResolveConstructorOverload(), shouldBindAsTemporary(), clang::OverloadCandidateSet::size(), and clang::T.
Referenced by clang::InitializationSequence::Perform().
|
static |
Definition at line 8573 of file SemaInit.cpp.
References clang::Type::castAs(), clang::Sema::Context, D, clang::SemaBase::Diag(), diagnoseListInit(), E, clang::InitListExpr::getBeginLoc(), clang::ASTContext::getConstantArrayType(), clang::InitializedEntity::getDecl(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::InitListExpr::getNumInits(), getPointeeType(), clang::ASTContext::getSizeType(), clang::InitializedEntity::getType(), clang::ASTContext::getTypeSize(), clang::InitializedEntity::InitializeTemporary(), clang::Type::isReferenceType(), clang::Sema::isStdInitializerList(), Loc, clang::Normal, and clang::T.
Referenced by clang::InitializationSequence::Diagnose(), and diagnoseListInit().
|
static |
Definition at line 9469 of file SemaInit.cpp.
References clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::AmbiguousConversion, clang::ImplicitConversionSequence::BadConversion, clang::Sema::Context, clang::FixItHint::CreateInsertion(), clang::SemaBase::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::QualType::getNonReferenceType(), clang::Stmt::getSourceRange(), clang::LangOptionsBase::MSVC2015, 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::StaticObjectArgumentConversion, clang::T, clang::ImplicitConversionSequence::UserDefined, and clang::ImplicitConversionSequence::UserDefinedConversion.
Referenced by clang::InitializationSequence::Perform().
|
static |
Somewhere within T there is an uninitialized reference subobject.
Dig it out and diagnose it.
Definition at line 8503 of file SemaInit.cpp.
References clang::CXXRecordDecl::bases(), clang::SemaBase::Diag(), DiagnoseUninitializedReference(), clang::RecordDecl::fields(), clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::CXXRecordDecl::hasUninitializedReferenceMember(), clang::Type::isReferenceType(), Loc, and clang::T.
Referenced by clang::InitializationSequence::Diagnose(), and DiagnoseUninitializedReference().
|
static |
Emit notes associated with an initialization that failed due to a "simple" conversion failure.
Definition at line 8542 of file SemaInit.cpp.
References clang::Qualifiers::compatiblyIncludes(), clang::SemaBase::Diag(), clang::InitializedEntity::EK_Result, clang::SemaObjC::EmitRelatedResultTypeNote(), clang::SemaObjC::EmitRelatedResultTypeNoteForReturn(), clang::Sema::getASTContext(), clang::QualType::getCanonicalType(), clang::InitializedEntity::getKind(), clang::QualType::getNonReferenceType(), clang::Type::getPointeeCXXRecordDecl(), clang::Type::getPointeeType(), clang::QualType::getQualifiers(), clang::ASTContext::getTagDeclType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::Type::isObjCObjectPointerType(), and clang::Sema::ObjC().
Referenced by clang::InitializationSequence::Diagnose().
|
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 2583 of file SemaInit.cpp.
References clang::IndirectFieldDecl::chain_begin(), clang::IndirectFieldDecl::chain_end(), clang::Sema::Context, clang::Designator::CreateFieldDesignator(), clang::DesignatedInitExpr::ExpandDesignator(), clang::DesignatedInitExpr::getDesignator(), clang::DesignatedInitExpr::Designator::getDotLoc(), and clang::DesignatedInitExpr::Designator::getFieldLoc().
|
static |
Definition at line 6757 of file SemaInit.cpp.
References clang::Sema::AA_Casting, clang::Sema::AA_Converting, 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_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_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, 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 |
Get the location at which initialization diagnostics should appear.
Definition at line 6879 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_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, 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::InitializedEntity::getReturnLoc(), clang::InitializedEntity::getThrowLoc(), and clang::Initializer.
Referenced by CheckCXX98CompatAccessibleCopy(), and CopyObject().
|
static |
Definition at line 1008 of file SemaInit.cpp.
References clang::Init.
|
static |
Determine whether we have compatible array types for the purposes of GNU by-copy array initialization.
Definition at line 6140 of file SemaInit.cpp.
References clang::ArrayType::getElementType(), clang::ASTContext::hasSameType(), clang::Type::isConstantArrayType(), and clang::Type::isIncompleteArrayType().
Referenced by clang::InitializationSequence::InitializeFrom().
|
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 4217 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().
|
static |
Definition at line 196 of file SemaInit.cpp.
References D, clang::InitializedEntity::getDecl(), and Parent.
Referenced by clang::InitializationSequence::Perform().
|
static |
Returns true if the parameters describe a constructor initialization of an explicit temporary object, e.g.
"Point(x, y)".
Definition at line 7164 of file SemaInit.cpp.
References clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::getKind(), clang::InitializationKind::IK_Direct, clang::InitializationKind::IK_DirectList, and clang::InitializationKind::IK_Value.
Referenced by PerformConstructorInitialization().
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 6274 of file SemaInit.cpp.
References clang::Sema::checkAddressOfFunctionIsAvailable(), and E.
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Determine whether Entity is an entity for which it is idiomatic to elide the braces in aggregate initialization.
Definition at line 1082 of file SemaInit.cpp.
References clang::Type::castAs(), clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Member, clang::RecordDecl::field_empty(), clang::InitializedEntity::getKind(), clang::CXXRecordDecl::getNumBases(), clang::InitializedEntity::getParent(), and clang::InitializedEntity::getType().
|
static |
Determines whether this expression is an acceptable ICR source.
Definition at line 6055 of file SemaInit.cpp.
References clang::C, clang::QualType::getObjCLifetime(), clang::Expr::getType(), clang::Expr::IgnoreParens(), IIK_nonlocal, IIK_nonscalar, IIK_okay, isInvalidICRSource(), clang::Expr::isNullPointerConstant(), clang::Expr::NPC_ValueDependentIsNull, and clang::Qualifiers::OCL_Weak.
Referenced by checkIndirectCopyRestoreSource(), and isInvalidICRSource().
|
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 6040 of file SemaInit.cpp.
References clang::InitializedEntity::EK_Result, clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::Sema::getSourceManager(), clang::InitializedEntity::getType(), clang::Init, clang::SourceManager::isInSystemHeader(), and clang::Type::isPointerType().
Referenced by clang::InitializationSequence::InitializeFrom().
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 5139 of file SemaInit.cpp.
References E, clang::Expr::refersToBitField(), clang::Expr::refersToMatrixElement(), and clang::Expr::refersToVectorElement().
Referenced by TryReferenceInitializationCore().
|
static |
Determine whether RD is, or is derived from, a specialization of CTD.
Definition at line 9716 of file SemaInit.cpp.
References clang::declaresSameEntity(), and clang::CXXRecordDecl::forallBases().
Referenced by clang::Sema::DeduceTemplateSpecializationFromInitializer().
|
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 75 of file SemaInit.cpp.
References clang::ASTContext::Char16Ty, clang::ASTContext::Char32Ty, clang::QualType::getCanonicalType(), clang::ASTContext::getCanonicalType(), clang::ArrayType::getElementType(), clang::StringLiteral::getKind(), clang::BuiltinType::getKind(), clang::ASTContext::getLangOpts(), clang::CanQual< T >::getUnqualifiedType(), clang::ASTContext::getWideCharType(), clang::Init, clang::Type::isChar8Type(), clang::Type::isCharType(), IsWideCharCompatible(), SIF_IncompatWideStringIntoWideChar, SIF_NarrowStringIntoWideChar, SIF_None, SIF_Other, SIF_PlainStringIntoUTF8Char, SIF_UTF8StringIntoPlainChar, SIF_WideStringIntoChar, clang::T, and clang::ASTContext::typesAreCompatible().
Referenced by clang::InitializationSequence::InitializeFrom(), IsStringInit(), and TryListInitialization().
|
static |
Definition at line 161 of file SemaInit.cpp.
References clang::ast_matchers::arrayType, clang::ASTContext::getAsArrayType(), IsStringInit(), and SIF_Other.
|
static |
Check whether T is compatible with a wide character type (wchar_t, char16_t or char32_t).
Definition at line 51 of file SemaInit.cpp.
References clang::ASTContext::Char16Ty, clang::ASTContext::Char32Ty, clang::ASTContext::getLangOpts(), clang::ASTContext::getWideCharType(), clang::T, and clang::ASTContext::typesAreCompatible().
Referenced by clang::InitializationSequence::InitializeFrom(), and IsStringInit().
Definition at line 6216 of file SemaInit.cpp.
References clang::Sema::getASTContext(), and clang::Initializer.
Referenced by TryOCLZeroOpaqueTypeInitialization().
|
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 4142 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(), and clang::InitializedEntity::isParameterKind().
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Tries to add a zero initializer. Returns true if that worked.
Definition at line 4122 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::ValueDecl::getType(), clang::InitializedEntity::getType(), clang::Init, clang::SourceLocation::isMacroID(), Loc, and clang::InitializationSequence::SetZeroInitializationFixit().
Referenced by TryConstructorInitialization(), and TryDefaultInitialization().
|
static |
Definition at line 7189 of file SemaInit.cpp.
References clang::InitializedEntity::allowsNRVO(), clang::Sema::BuildCXXConstructExpr(), clang::Sema::CheckConstructorAccess(), checkDestructorReference(), clang::Sema::CheckForImmediateInvocation(), clang::Complete, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::CXXTemporaryObjectExpr::Create(), clang::Sema::DefineImplicitDefaultConstructor(), clang::Delegating, clang::Sema::diagnoseNullableToNonnullConversion(), 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::ActionResult< PtrTy, Compress >::get(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getBaseElementType(), clang::InitializedEntity::getBaseSpecifier(), clang::getConstructorInfo(), clang::DeclAccessPair::getDecl(), clang::InitializedEntity::getKind(), clang::QualType::getNonLValueExprType(), 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, isExplicitTemporary(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::CXXBaseSpecifier::isVirtual(), Loc, clang::Sema::MarkFunctionReferenced(), clang::Sema::MaybeBindToTemporary(), clang::NonVirtualBase, clang::Sema::runWithSufficientStackSpace(), shouldBindAsTemporary(), clang::InitializationSequence::Step::Type, and clang::VirtualBase.
Referenced by clang::InitializationSequence::Perform().
|
static |
Definition at line 4230 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, D, E, clang::Qualifiers::getAddressSpace(), clang::getConstructorInfo(), clang::Decl::getDeclContext(), clang::Sema::getLangOpts(), clang::QualType::getQualifiers(), clang::FunctionTemplateDecl::getTemplatedDecl(), hasCopyOrMoveCtorParam(), clang::Initializer, clang::Sema::isCompleteType(), clang::Sema::isInitListConstructor(), and clang::OverloadCandidateSet::setDestAS().
Referenced by CheckCXX98CompatAccessibleCopy(), CopyObject(), and TryConstructorInitialization().
|
static |
Definition at line 4560 of file SemaInit.cpp.
References clang::InitializationSequence::AddAddressOverloadResolutionStep(), clang::Sema::Context, clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::Found, clang::ASTContext::getCanonicalType(), clang::QualType::getUnqualifiedType(), clang::Initializer, clang::Type::isRecordType(), clang::ASTContext::OverloadTy, clang::Sema::ResolveAddressOfOverloadedFunction(), and clang::InitializationSequence::SetFailed().
Referenced by TryReferenceInitialization(), and TryReferenceListInitialization().
|
static |
Whether we should bind a created object as a temporary when initializing the given entity.
Definition at line 6812 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_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, 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 |
Whether the given entity, when initialized with an object created for that initialization, requires destruction.
Definition at line 6846 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_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, and clang::InitializedEntity::getKind().
Referenced by clang::InitializationSequence::Perform().
|
static |
Attempt initialization by constructor (C++ [dcl.init]), which enumerates the constructors of the initialized entity and performs overload resolution to select the best.
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 aggregate type as the entity? |
Definition at line 4344 of file SemaInit.cpp.
References clang::InitializationSequence::AddConstructorInitializationStep(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddUserConversionStep(), clang::CXXRecordDecl::allowConstDefaultInit(), 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::Sema::getLangOpts(), clang::InitListExpr::getNumInits(), clang::CXXMethodDecl::getParent(), clang::InitializedEntity::getType(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::InitializationKind::IK_Copy, clang::InitializationKind::IK_Default, clang::Type::isAggregateType(), clang::Sema::isCompleteType(), clang::QualType::isConstQualified(), clang::CXXConstructorDecl::isExplicit(), clang::Sema::LookupConstructors(), clang::Sema::LookupDefaultConstructor(), maybeRecoverWithZeroInitialization(), clang::OR_Deleted, clang::OR_No_Viable_Function, ResolveConstructorOverload(), clang::Result, clang::InitializationSequence::RewrapReferenceInitList(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::setIncompleteTypeFailure(), clang::InitializationSequence::SetOverloadFailure(), clang::OverloadCandidateSet::size(), and clang::VK_PRValue.
Referenced by clang::InitializationSequence::InitializeFrom(), TryDefaultInitialization(), TryListInitialization(), and TryValueInitialization().
|
static |
Attempt default initialization (C++ [dcl.init]p6).
Definition at line 5559 of file SemaInit.cpp.
References clang::InitializationSequence::AddZeroInitializationStep(), clang::Sema::Context, clang::InitializationSequence::FK_DefaultInitOfConst, clang::ASTContext::getBaseElementType(), clang::Sema::getLangOpts(), clang::QualType::getQualifiers(), clang::InitializedEntity::getType(), clang::Qualifiers::hasObjCLifetime(), clang::InitializationKind::IK_Default, clang::QualType::isConstQualified(), clang::Type::isRecordType(), maybeRecoverWithZeroInitialization(), clang::InitializationSequence::SetFailed(), and TryConstructorInitialization().
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
When initializing from init list via constructor, handle initialization of an object of type std::initializer_list<T>.
Definition at line 4182 of file SemaInit.cpp.
References clang::InitializationSequence::AddStdInitializerListConstructionStep(), clang::Sema::Context, clang::InitializationKind::CreateDirectList(), E, clang::ASTContext::getConstantArrayType(), clang::ASTContext::getSizeType(), clang::ASTContext::getTypeSize(), clang::InitializedEntity::InitializeTemporary(), clang::Sema::isCompleteType(), clang::Sema::isStdInitializerList(), clang::Normal, clang::InitializationSequence::setIncompleteTypeFailure(), and TryListInitialization().
Referenced by TryListInitialization().
|
static |
Attempt list initialization (C++0x [dcl.init.list])
Definition at line 4708 of file SemaInit.cpp.
References clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddListInitializationStep(), clang::Sema::Context, clang::InitializationKind::CreateDirect(), E, clang::StandardConversionSequence::First, clang::InitializationSequence::FK_DesignatedInitForNonAggregate, 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::Sema::getLangOpts(), clang::InitListExpr::getLBraceLoc(), clang::InitListExpr::getNumInits(), clang::InitListExpr::getRBraceLoc(), clang::StandardConversionSequence::getToType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::InitListExpr::hasDesignatedInit(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Floating_Integral, clang::ICK_Integral_Conversion, clang::ICK_Lvalue_To_Rvalue, clang::InitializationKind::IK_DirectList, clang::Init, clang::InitializationSequence::InitializeFrom(), clang::Type::isAggregateType(), clang::Type::isAnyComplexType(), clang::Type::isBooleanType(), clang::Sema::isCompleteType(), clang::Sema::IsDerivedFrom(), clang::Type::isFloatingType(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Expr::isPRValue(), clang::Type::isRecordType(), clang::Type::isReferenceType(), 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(), TryInitializerListConstruction(), and TryReferenceListInitialization().
|
static |
Definition at line 6156 of file SemaInit.cpp.
References clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddPassByIndirectCopyRestoreStep(), clang::Sema::Context, clang::StandardConversionSequence::First, clang::ASTContext::getAsArrayType(), clang::InitializedEntity::getDecl(), clang::ASTContext::getPointerType(), clang::InitializedEntity::getType(), clang::ICK_Array_To_Pointer, clang::ICK_Lvalue_To_Rvalue, clang::Initializer, clang::SemaObjC::isObjCWritebackConversion(), clang::Sema::ObjC(), clang::Decl::OBJC_TQ_Out, clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setStandard(), and clang::ImplicitConversionSequence::Standard.
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Definition at line 6203 of file SemaInit.cpp.
References clang::InitializationSequence::AddOCLSamplerInitStep(), clang::Sema::Context, clang::Sema::getLangOpts(), clang::Initializer, and clang::Type::isSamplerT().
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Definition at line 6221 of file SemaInit.cpp.
References clang::InitializationSequence::AddOCLZeroOpaqueTypeStep(), clang::Sema::getLangOpts(), clang::Sema::getOpenCLOptions(), clang::Initializer, clang::OpenCLOptions::isAvailableOption(), clang::Type::isEventT(), clang::Type::isOCLIntelSubgroupAVCType(), clang::Type::isQueueT(), and IsZeroInitializer().
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Definition at line 5597 of file SemaInit.cpp.
References clang::InitializationSequence::AddParenthesizedListInitStep(), clang::CXXRecordDecl::bases(), clang::Sema::BuildCXXDefaultInitExpr(), clang::Sema::checkInitializerLifetime(), clang::Sema::Context, clang::CXXParenListInitExpr::Create(), clang::InitializationKind::CreateForInit(), clang::InitializationKind::CreateValue(), clang::SemaBase::Diag(), clang::InitializationSequence::Diagnose(), E, clang::InitializationSequence::Failed(), clang::RecordDecl::fields(), clang::InitializationSequence::FK_ParenthesizedListInitFailed, clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::Sema::getASTContext(), clang::ASTContext::getAsVariableArrayType(), clang::SourceRange::getBegin(), clang::Stmt::getBeginLoc(), clang::ASTContext::getConstantArrayType(), clang::ArrayType::getElementType(), clang::SourceRange::getEnd(), clang::Stmt::getEndLoc(), clang::Expr::getExprLoc(), clang::Decl::getLocation(), clang::Stmt::getSourceRange(), clang::ValueDecl::getType(), clang::InitializedEntity::getType(), clang::FieldDecl::hasInClassInitializer(), clang::InitializedEntity::InitializeBase(), clang::InitializedEntity::InitializeElement(), clang::InitializedEntity::InitializeMemberFromParenAggInit(), clang::Type::isArrayType(), clang::Type::isIncompleteArrayType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Decl::isInvalidDecl(), clang::QualType::isNull(), clang::Type::isReferenceType(), clang::Type::isUnionType(), clang::FieldDecl::isUnnamedBitField(), clang::InitializedEntity::isVariableLengthArrayNew(), clang::Normal, clang::InitializationSequence::NormalSequence, clang::InitializationSequence::Perform(), clang::Result, clang::InitializationSequence::SetFailed(), clang::InitializationSequence::setSequenceKind(), and clang::T.
Referenced by clang::InitializationSequence::Diagnose(), clang::InitializationSequence::InitializeFrom(), and clang::InitializationSequence::Perform().
|
static |
Attempt reference initialization (C++0x [dcl.init.ref])
Definition at line 5110 of file SemaInit.cpp.
References clang::Type::castAs(), clang::Sema::Context, clang::Sema::getCompletedType(), getPointeeType(), clang::InitializedEntity::getType(), clang::ASTContext::getUnqualifiedArrayType(), clang::Initializer, ResolveOverloadedFunctionForReferenceBinding(), and TryReferenceInitializationCore().
Referenced by clang::InitializationSequence::InitializeFrom().
|
static |
Reference initialization without resolving overloaded functions.
We also can get here in C if we call a builtin which is declared as a function with a parameter of reference type (such as __builtin_va_end()).
Definition at line 5148 of file SemaInit.cpp.
References clang::Qualifiers::addAddressSpace(), clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddDerivedToBaseCastStep(), clang::InitializationSequence::AddExtraneousCopyToTemporary(), clang::InitializationSequence::AddFunctionReferenceConversionStep(), clang::InitializationSequence::AddObjCObjectConversionStep(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddReferenceBindingStep(), CheckCXX98CompatAccessibleCopy(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::Default, clang::OverloadCandidateSet::empty(), clang::InitializationSequence::FK_AddressOfOverloadFailed, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToBitfield, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToMatrixElement, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToTemporary, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToUnrelated, clang::InitializationSequence::FK_NonConstLValueReferenceBindingToVectorElement, clang::InitializationSequence::FK_ReferenceAddrspaceMismatchTemporary, clang::InitializationSequence::FK_ReferenceInitDropsQualifiers, clang::InitializationSequence::FK_ReferenceInitFailed, clang::InitializationSequence::FK_ReferenceInitOverloadFailed, clang::InitializationSequence::FK_RValueReferenceBindingToLValue, clang::Qualifiers::getAddressSpace(), clang::ASTContext::getCanonicalType(), clang::Qualifiers::getCVRQualifiers(), clang::InitializationSequence::getFailedCandidateSet(), clang::Sema::getLangOpts(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::InitializedEntity::getType(), clang::Qualifiers::hasAddressSpace(), clang::Qualifiers::hasConst(), clang::ASTContext::hasSameType(), clang::Qualifiers::hasVolatile(), clang::Initializer, clang::InitializedEntity::InitializeTemporary(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::Type::isArrayType(), clang::ImplicitConversionSequence::isBad(), 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(), clang::OR_No_Viable_Function, clang::OR_Success, clang::ASTContext::OverloadTy, clang::Sema::Ref_Compatible, clang::Sema::Ref_Incompatible, clang::Sema::Ref_Related, clang::Qualifiers::removeAddressSpace(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::SetOverloadFailure(), clang::Sema::TryImplicitConversion(), TryRefInitWithConversionFunction(), clang::VK_LValue, clang::VK_PRValue, clang::VK_XValue, and clang::Qualifiers::withoutAddressSpace().
Referenced by TryReferenceInitialization(), and TryReferenceListInitialization().
|
static |
Attempt list initialization of a reference.
Definition at line 4605 of file SemaInit.cpp.
References clang::InitializationSequence::AddQualificationConversionStep(), 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::InitializationSequence::FK_ReferenceInitDropsQualifiers, clang::Sema::getCompletedType(), clang::InitListExpr::getInit(), clang::InitializedEntity::getKind(), clang::Sema::getLangOpts(), clang::InitListExpr::getNumInits(), getPointeeType(), clang::ASTContext::getQualifiedType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ASTContext::getUnqualifiedArrayType(), clang::Type::getUnqualifiedDesugaredType(), clang::Qualifiers::hasAddressSpace(), clang::Qualifiers::hasConst(), clang::Qualifiers::hasVolatile(), clang::Initializer, clang::InitializedEntity::InitializeTemporary(), clang::Qualifiers::isAddressSpaceSupersetOf(), clang::Type::isRValueReferenceType(), clang::Sema::Ref_Related, ResolveOverloadedFunctionForReferenceBinding(), clang::InitializationSequence::RewrapReferenceInitList(), clang::InitializationSequence::SetFailed(), clang::InitializationSequence::step_begin(), clang::InitializationSequence::step_end(), TryListInitialization(), TryReferenceInitializationCore(), clang::VK_LValue, clang::VK_PRValue, clang::VK_XValue, and clang::Qualifiers::withoutAddressSpace().
Referenced by TryListInitialization().
|
static |
Try a reference initialization that involves calling a conversion function.
Definition at line 4925 of file SemaInit.cpp.
References clang::Sema::AddConversionCandidate(), clang::InitializationSequence::AddConversionSequenceStep(), clang::InitializationSequence::AddDerivedToBaseCastStep(), clang::InitializationSequence::AddFunctionReferenceConversionStep(), clang::InitializationSequence::AddObjCObjectConversionStep(), clang::Sema::AddOverloadCandidate(), clang::InitializationSequence::AddQualificationConversionStep(), clang::InitializationSequence::AddReferenceBindingStep(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::InitializationSequence::AddUserConversionStep(), clang::OverloadCandidateSet::BestViableFunction(), clang::Type::castAs(), clang::OverloadCandidateSet::clear(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, D, E, clang::Function, clang::Type::getAs(), clang::getConstructorInfo(), clang::CXXConversionDecl::getConversionType(), clang::RecordType::getDecl(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::QualType::getNonLValueExprType(), getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::StandardConversionSequence::getToType(), 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(), clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::Ref_Incompatible, clang::Result, clang::ImplicitConversionSequence::setStandard(), clang::OverloadCandidateSet::size(), clang::ImplicitConversionSequence::Standard, clang::VK_LValue, clang::VK_PRValue, and clang::VK_XValue.
Referenced by TryReferenceInitializationCore().
|
static |
Attempt character array initialization from a string literal (C++ [dcl.init.string], C99 6.7.8).
Definition at line 5472 of file SemaInit.cpp.
References clang::InitializationSequence::AddStringInitStep(), and clang::InitializedEntity::getType().
Referenced by clang::InitializationSequence::InitializeFrom().
|
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 5853 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::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, D, E, clang::InitializationSequence::FK_UserConversionOverloadFailed, clang::Function, clang::Qualifiers::getAddressSpace(), clang::Type::getAs(), clang::getConstructorInfo(), clang::Decl::getDeclContext(), clang::InitializationSequence::getFailedCandidateSet(), clang::Sema::getLangOpts(), clang::QualType::getQualifiers(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::QualType::getUnqualifiedType(), clang::CXXRecordDecl::getVisibleConversionFunctions(), clang::QualType::hasQualifiers(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::InitializationKind::IK_Copy, clang::Initializer, clang::Sema::isCompleteType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Sema::LookupConstructors(), clang::OR_Deleted, clang::Result, clang::OverloadCandidateSet::setDestAS(), clang::InitializationSequence::SetOverloadFailure(), clang::ImplicitConversionSequence::setStandard(), clang::OverloadCandidateSet::size(), clang::ImplicitConversionSequence::Standard, and clang::VK_PRValue.
Referenced by clang::InitializationSequence::InitializeFrom(), TryImplicitConversion(), and TryListConversion().
|
static |
Attempt value initialization (C++ [dcl.init]p7).
Definition at line 5481 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(), clang::T, and TryConstructorInitialization().
Referenced by clang::InitializationSequence::InitializeFrom(), and TryListInitialization().
|
static |
Fix a compound literal initializing an array so it's correctly marked as an rvalue.
Definition at line 187 of file SemaInit.cpp.
References E, clang::IgnoreParensSingleStep(), clang::Expr::setValueKind(), and clang::VK_PRValue.
Referenced by clang::InitializationSequence::Perform().
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 175 of file SemaInit.cpp.
References E, clang::IgnoreParensSingleStep(), clang::Expr::setType(), clang::Expr::setValueKind(), and clang::VK_PRValue.
Referenced by CheckStringInit().
|
static |
Warn that Entity
was of scalar type and was initialized by a single-element braced initializer list.
Definition at line 1205 of file SemaInit.cpp.
References clang::Braces, clang::FixItHint::CreateRemoval(), clang::SemaBase::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_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), clang::InitializedEntity::getType(), clang::Sema::inTemplateInstantiation(), and clang::Type::isSizelessBuiltinType().