clang  3.7.0
Public Member Functions | Public Attributes | List of all members
clang::StandardConversionSequence Class Reference

#include <Overload.h>

Collaboration diagram for clang::StandardConversionSequence:
[legend]

Public Member Functions

void setFromType (QualType T)
 
void setToType (unsigned Idx, QualType T)
 
void setAllToTypes (QualType T)
 
QualType getFromType () const
 
QualType getToType (unsigned Idx) const
 
void setAsIdentityConversion ()
 
bool isIdentityConversion () const
 
ImplicitConversionRank getRank () const
 
NarrowingKind getNarrowingKind (ASTContext &Context, const Expr *Converted, APValue &ConstantValue, QualType &ConstantType) const
 
bool isPointerConversionToBool () const
 
bool isPointerConversionToVoidPointer (ASTContext &Context) const
 
void dump () const
 

Public Attributes

ImplicitConversionKind First: 8
 
ImplicitConversionKind Second: 8
 
ImplicitConversionKind Third: 8
 Third - The third conversion can be a qualification conversion. More...
 
unsigned DeprecatedStringLiteralToCharPtr: 1
 Whether this is the deprecated conversion of a string literal to a pointer to non-const character data (C++ 4.2p2). More...
 
unsigned QualificationIncludesObjCLifetime: 1
 Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic reference counting). More...
 
unsigned IncompatibleObjC: 1
 
unsigned ReferenceBinding: 1
 
unsigned DirectBinding: 1
 
unsigned IsLvalueReference: 1
 Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding). More...
 
unsigned BindsToFunctionLvalue: 1
 Whether we're binding to a function lvalue. More...
 
unsigned BindsToRvalue: 1
 Whether we're binding to an rvalue. More...
 
unsigned BindsImplicitObjectArgumentWithoutRefQualifier: 1
 Whether this binds an implicit object argument to a non-static member function without a ref-qualifier. More...
 
unsigned ObjCLifetimeConversionBinding: 1
 Whether this binds a reference to an object with a different Objective-C lifetime qualifier. More...
 
void * FromTypePtr
 
void * ToTypePtrs [3]
 
CXXConstructorDeclCopyConstructor
 

Detailed Description

StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3.1.1). A standard conversion sequence contains between zero and three conversions. If a particular conversion is not needed, it will be set to the identity conversion (ICK_Identity). Note that the three conversions are specified as separate members (rather than in an array) so that we can keep the size of a standard conversion sequence to a single word.

Definition at line 128 of file Overload.h.

Member Function Documentation

void StandardConversionSequence::dump ( ) const

dump - Print this standard conversion sequence to standard error. Useful for debugging overloading issues.

Definition at line 428 of file SemaOverload.cpp.

References GetImplicitConversionName(), and clang::ICK_Identity.

QualType clang::StandardConversionSequence::getFromType ( ) const
inline
NarrowingKind StandardConversionSequence::getNarrowingKind ( ASTContext Ctx,
const Expr Converted,
APValue ConstantValue,
QualType ConstantType 
) const

Check if this standard conversion sequence represents a narrowing conversion, according to C++11 [dcl.init.list]p7.

Parameters
CtxThe AST context.
ConvertedThe result of applying this standard conversion sequence.
ConstantValueIf this is an NK_Constant_Narrowing conversion, the value of the expression prior to the narrowing conversion.
ConstantTypeIf this is an NK_Constant_Narrowing conversion, the type of the expression prior to the narrowing conversion.

Definition at line 278 of file SemaOverload.cpp.

References clang::APValue::getFloat(), clang::ASTContext::getFloatingTypeOrder(), clang::ASTContext::getFloatTypeSemantics(), clang::ASTContext::getIntWidth(), clang::ASTContext::getLangOpts(), clang::Expr::getType(), clang::ICK_Boolean_Conversion, clang::ICK_Floating_Conversion, clang::ICK_Floating_Integral, clang::ICK_Integral_Conversion, IgnoreNarrowingConversion(), clang::Expr::isCXX11ConstantExpr(), clang::APValue::isFloat(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Type::isIntegralType(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::NK_Constant_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, and clang::Result.

Referenced by CheckConvertedConstantExpression(), and DiagnoseNarrowingInInitList().

ImplicitConversionRank StandardConversionSequence::getRank ( ) const

getRank - Retrieve the rank of this standard conversion sequence (C++ 13.3.3.1.1p3). The rank is the largest rank of each of the implicit conversions.

Definition at line 191 of file SemaOverload.cpp.

References clang::GetConversionRank(), and clang::ICR_Exact_Match.

Referenced by CompareStandardConversionSequences().

QualType clang::StandardConversionSequence::getToType ( unsigned  Idx) const
inline
bool clang::StandardConversionSequence::isIdentityConversion ( ) const
inline

Definition at line 221 of file Overload.h.

References clang::ICK_Identity, Second, and Third.

Referenced by compareStandardConversionSubsets().

bool StandardConversionSequence::isPointerConversionToBool ( ) const

isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointer-to-member to bool. This is used as part of the ranking of standard conversion sequences (C++ 13.3.3.2p4).

Definition at line 206 of file SemaOverload.cpp.

References clang::ICK_Array_To_Pointer, clang::ICK_Function_To_Pointer, and isBooleanType().

Referenced by CompareStandardConversionSequences().

bool StandardConversionSequence::isPointerConversionToVoidPointer ( ASTContext Context) const

isPointerConversionToVoidPointer - Determines whether this conversion is a conversion of a pointer to a void pointer. This is used as part of the ranking of standard conversion sequences (C++ 13.3.3.2p4).

Definition at line 228 of file SemaOverload.cpp.

References clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::Type::getPointeeType(), clang::ICK_Array_To_Pointer, clang::ICK_Pointer_Conversion, clang::Type::isAnyPointerType(), and clang::Type::isVoidType().

Referenced by CompareStandardConversionSequences().

void clang::StandardConversionSequence::setAllToTypes ( QualType  T)
inline
void StandardConversionSequence::setAsIdentityConversion ( )
void clang::StandardConversionSequence::setFromType ( QualType  T)
inline
void clang::StandardConversionSequence::setToType ( unsigned  Idx,
QualType  T 
)
inline

Definition at line 201 of file Overload.h.

References clang::QualType::getAsOpaquePtr(), and ToTypePtrs.

Referenced by IsStandardConversion(), and tryAtomicConversion().

Member Data Documentation

unsigned clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier

Whether this binds an implicit object argument to a non-static member function without a ref-qualifier.

Definition at line 177 of file Overload.h.

Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().

unsigned clang::StandardConversionSequence::BindsToFunctionLvalue

Whether we're binding to a function lvalue.

Definition at line 170 of file Overload.h.

Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().

unsigned clang::StandardConversionSequence::BindsToRvalue

Whether we're binding to an rvalue.

Definition at line 173 of file Overload.h.

Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().

CXXConstructorDecl* clang::StandardConversionSequence::CopyConstructor

CopyConstructor - The copy constructor that is used to perform this conversion, when the conversion is actually just the initialization of an object via copy constructor. Such conversions are either identity conversions or derived-to-base conversions.

Definition at line 198 of file Overload.h.

Referenced by IsStandardConversion(), clang::Sema::PerformImplicitConversion(), TryImplicitConversion(), and TryUserDefinedConversion().

unsigned clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr

Whether this is the deprecated conversion of a string literal to a pointer to non-const character data (C++ 4.2p2).

Definition at line 147 of file Overload.h.

Referenced by CompareQualificationConversions(), hasDeprecatedStringLiteralToCharPtrConversion(), IsStandardConversion(), and clang::Sema::PerformImplicitConversion().

unsigned clang::StandardConversionSequence::DirectBinding

DirectBinding - True when this is a reference binding that is a direct binding (C++ [dcl.init.ref]).

Definition at line 163 of file Overload.h.

Referenced by CheckConvertedConstantExpression(), FindConversionForRefInit(), and TryObjectArgumentInitialization().

ImplicitConversionKind clang::StandardConversionSequence::First

First – The first conversion can be an lvalue-to-rvalue conversion, array-to-pointer conversion, or function-to-pointer conversion.

Definition at line 133 of file Overload.h.

Referenced by CompareDerivedToBaseConversions(), CompareQualificationConversions(), CompareStandardConversionSequences(), clang::InitializationSequence::InitializeFrom(), IsStandardConversion(), clang::Sema::PerformImplicitConversion(), and tryObjCWritebackConversion().

void* clang::StandardConversionSequence::FromTypePtr

FromType - The type that this conversion is converting from. This is an opaque pointer that can be translated into a QualType.

Definition at line 186 of file Overload.h.

Referenced by getFromType(), and setFromType().

unsigned clang::StandardConversionSequence::IncompatibleObjC

IncompatibleObjC - Whether this is an Objective-C conversion that we should warn about (if we actually use it).

Definition at line 155 of file Overload.h.

Referenced by IsStandardConversion(), and clang::Sema::PerformImplicitConversion().

unsigned clang::StandardConversionSequence::IsLvalueReference

Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).

Definition at line 167 of file Overload.h.

Referenced by isBetterReferenceBindingKind(), TryListConversion(), and TryObjectArgumentInitialization().

unsigned clang::StandardConversionSequence::ObjCLifetimeConversionBinding

Whether this binds a reference to an object with a different Objective-C lifetime qualifier.

Definition at line 181 of file Overload.h.

Referenced by CompareStandardConversionSequences(), and TryListConversion().

unsigned clang::StandardConversionSequence::QualificationIncludesObjCLifetime

Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic reference counting).

Definition at line 151 of file Overload.h.

Referenced by CompareQualificationConversions(), IsStandardConversion(), and tryAtomicConversion().

unsigned clang::StandardConversionSequence::ReferenceBinding

ReferenceBinding - True when this is a reference binding (C++ [over.ics.ref]).

Definition at line 159 of file Overload.h.

Referenced by CheckConvertedConstantExpression(), CompareStandardConversionSequences(), FindConversionForRefInit(), TryListConversion(), and TryObjectArgumentInitialization().

ImplicitConversionKind clang::StandardConversionSequence::Second
ImplicitConversionKind clang::StandardConversionSequence::Third
void* clang::StandardConversionSequence::ToTypePtrs[3]

ToType - The types that this conversion is converting to in each step. This is an opaque pointer that can be translated into a QualType.

Definition at line 191 of file Overload.h.

Referenced by dropPointerConversion(), getToType(), setAllToTypes(), and setToType().


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