aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp642
1 files changed, 321 insertions, 321 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 1e8f315c95..e8a04bbd74 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -340,7 +340,7 @@ namespace {
TemplateArgument SecondArg;
};
}
-
+
/// \brief Convert from Sema's representation of template deduction information
/// to the form used in overload-candidate information.
OverloadCandidate::DeductionFailureInfo
@@ -356,12 +356,12 @@ static MakeDeductionFailureInfo(ASTContext &Context,
case Sema::TDK_TooManyArguments:
case Sema::TDK_TooFewArguments:
break;
-
+
case Sema::TDK_Incomplete:
case Sema::TDK_InvalidExplicitArguments:
Result.Data = Info.Param.getOpaqueValue();
break;
-
+
case Sema::TDK_Inconsistent:
case Sema::TDK_Underqualified: {
// FIXME: Should allocate from normal heap so that we can free this later.
@@ -372,16 +372,16 @@ static MakeDeductionFailureInfo(ASTContext &Context,
Result.Data = Saved;
break;
}
-
+
case Sema::TDK_SubstitutionFailure:
Result.Data = Info.take();
break;
-
+
case Sema::TDK_NonDeducedMismatch:
case Sema::TDK_FailedOverloadResolution:
- break;
+ break;
}
-
+
return Result;
}
@@ -394,7 +394,7 @@ void OverloadCandidate::DeductionFailureInfo::Destroy() {
case Sema::TDK_TooFewArguments:
case Sema::TDK_InvalidExplicitArguments:
break;
-
+
case Sema::TDK_Inconsistent:
case Sema::TDK_Underqualified:
// FIXME: Destroy the data?
@@ -405,15 +405,15 @@ void OverloadCandidate::DeductionFailureInfo::Destroy() {
// FIXME: Destroy the template arugment list?
Data = 0;
break;
-
+
// Unhandled
case Sema::TDK_NonDeducedMismatch:
case Sema::TDK_FailedOverloadResolution:
break;
}
}
-
-TemplateParameter
+
+TemplateParameter
OverloadCandidate::DeductionFailureInfo::getTemplateParameter() {
switch (static_cast<Sema::TemplateDeductionResult>(Result)) {
case Sema::TDK_Success:
@@ -422,24 +422,24 @@ OverloadCandidate::DeductionFailureInfo::getTemplateParameter() {
case Sema::TDK_TooFewArguments:
case Sema::TDK_SubstitutionFailure:
return TemplateParameter();
-
+
case Sema::TDK_Incomplete:
case Sema::TDK_InvalidExplicitArguments:
- return TemplateParameter::getFromOpaqueValue(Data);
+ return TemplateParameter::getFromOpaqueValue(Data);
case Sema::TDK_Inconsistent:
case Sema::TDK_Underqualified:
return static_cast<DFIParamWithArguments*>(Data)->Param;
-
+
// Unhandled
case Sema::TDK_NonDeducedMismatch:
case Sema::TDK_FailedOverloadResolution:
break;
}
-
+
return TemplateParameter();
}
-
+
TemplateArgumentList *
OverloadCandidate::DeductionFailureInfo::getTemplateArgumentList() {
switch (static_cast<Sema::TemplateDeductionResult>(Result)) {
@@ -455,7 +455,7 @@ OverloadCandidate::DeductionFailureInfo::getTemplateArgumentList() {
case Sema::TDK_SubstitutionFailure:
return static_cast<TemplateArgumentList*>(Data);
-
+
// Unhandled
case Sema::TDK_NonDeducedMismatch:
case Sema::TDK_FailedOverloadResolution:
@@ -478,16 +478,16 @@ const TemplateArgument *OverloadCandidate::DeductionFailureInfo::getFirstArg() {
case Sema::TDK_Inconsistent:
case Sema::TDK_Underqualified:
- return &static_cast<DFIParamWithArguments*>(Data)->FirstArg;
+ return &static_cast<DFIParamWithArguments*>(Data)->FirstArg;
// Unhandled
case Sema::TDK_NonDeducedMismatch:
case Sema::TDK_FailedOverloadResolution:
break;
}
-
+
return 0;
-}
+}
const TemplateArgument *
OverloadCandidate::DeductionFailureInfo::getSecondArg() {
@@ -510,7 +510,7 @@ OverloadCandidate::DeductionFailureInfo::getSecondArg() {
case Sema::TDK_FailedOverloadResolution:
break;
}
-
+
return 0;
}
@@ -518,7 +518,7 @@ void OverloadCandidateSet::clear() {
inherited::clear();
Functions.clear();
}
-
+
// IsOverload - Determine whether the given New declaration is an
// overload of the declarations in Old. This routine returns false if
// New and Old cannot be overloaded, e.g., if New has the same
@@ -701,19 +701,19 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old,
(OldMethod->getRefQualifier() == RQ_None ||
NewMethod->getRefQualifier() == RQ_None)) {
// C++0x [over.load]p2:
- // - Member function declarations with the same name and the same
- // parameter-type-list as well as member function template
- // declarations with the same name, the same parameter-type-list, and
- // the same template parameter lists cannot be overloaded if any of
+ // - Member function declarations with the same name and the same
+ // parameter-type-list as well as member function template
+ // declarations with the same name, the same parameter-type-list, and
+ // the same template parameter lists cannot be overloaded if any of
// them, but not all, have a ref-qualifier (8.3.5).
Diag(NewMethod->getLocation(), diag::err_ref_qualifier_overload)
<< NewMethod->getRefQualifier() << OldMethod->getRefQualifier();
Diag(OldMethod->getLocation(), diag::note_previous_declaration);
}
-
+
return true;
}
-
+
// The signatures match; this is not an overload.
return false;
}
@@ -744,7 +744,7 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old,
static ImplicitConversionSequence
TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
bool SuppressUserConversions,
- bool AllowExplicit,
+ bool AllowExplicit,
bool InOverloadResolution,
bool CStyle) {
ImplicitConversionSequence ICS;
@@ -774,20 +774,20 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
ICS.Standard.setAsIdentityConversion();
ICS.Standard.setFromType(FromType);
ICS.Standard.setAllToTypes(ToType);
-
+
// We don't actually check at this point whether there is a valid
// copy/move constructor, since overloading just assumes that it
// exists. When we actually perform initialization, we'll find the
// appropriate constructor to copy the returned object, if needed.
ICS.Standard.CopyConstructor = 0;
-
+
// Determine whether this is considered a derived-to-base conversion.
if (!S.Context.hasSameUnqualifiedType(FromType, ToType))
ICS.Standard.Second = ICK_Derived_To_Base;
-
+
return ICS;
}
-
+
if (SuppressUserConversions) {
// We're not in the case above, so there is no conversion that
// we can perform.
@@ -865,7 +865,7 @@ bool Sema::TryImplicitConversion(InitializationSequence &Sequence,
ImplicitConversionSequence ICS
= clang::TryImplicitConversion(*this, Initializer, Entity.getType(),
SuppressUserConversions,
- AllowExplicitConversions,
+ AllowExplicitConversions,
InOverloadResolution,
CStyle);
if (ICS.isBad()) return true;
@@ -899,14 +899,14 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
/*CStyle=*/false);
return PerformImplicitConversion(From, ToType, ICS, Action);
}
-
-/// \brief Determine whether the conversion from FromType to ToType is a valid
+
+/// \brief Determine whether the conversion from FromType to ToType is a valid
/// conversion that strips "noreturn" off the nested function type.
-static bool IsNoReturnConversion(ASTContext &Context, QualType FromType,
+static bool IsNoReturnConversion(ASTContext &Context, QualType FromType,
QualType ToType, QualType &ResultTy) {
if (Context.hasSameUnqualifiedType(FromType, ToType))
return false;
-
+
// Permit the conversion F(t __attribute__((noreturn))) -> F(t)
// where F adds one of the following at most once:
// - a pointer
@@ -947,14 +947,14 @@ static bool IsNoReturnConversion(ASTContext &Context, QualType FromType,
ResultTy = ToType;
return true;
}
-
+
/// \brief Determine whether the conversion from FromType to ToType is a valid
/// vector conversion.
///
/// \param ICK Will be set to the vector conversion kind, if this is a vector
/// conversion.
-static bool IsVectorConversion(ASTContext &Context, QualType FromType,
- QualType ToType, ImplicitConversionKind &ICK) {
+static bool IsVectorConversion(ASTContext &Context, QualType FromType,
+ QualType ToType, ImplicitConversionKind &ICK) {
// We need at least one of these types to be a vector type to have a vector
// conversion.
if (!ToType->isVectorType() && !FromType->isVectorType())
@@ -970,7 +970,7 @@ static bool IsVectorConversion(ASTContext &Context, QualType FromType,
// identity conversion.
if (FromType->isExtVectorType())
return false;
-
+
// Vector splat from any arithmetic type to a vector.
if (FromType->isArithmeticType()) {
ICK = ICK_Vector_Splat;
@@ -993,7 +993,7 @@ static bool IsVectorConversion(ASTContext &Context, QualType FromType,
return false;
}
-
+
/// IsStandardConversion - Determines whether there is a standard
/// conversion sequence (C++ [conv], C++ [over.ics.scs]) from the
/// expression From to the type ToType. Standard conversion sequences
@@ -1007,7 +1007,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
StandardConversionSequence &SCS,
bool CStyle) {
QualType FromType = From->getType();
-
+
// Standard conversions (C++ [conv])
SCS.setAsIdentityConversion();
SCS.DeprecatedStringLiteralToCharPtr = false;
@@ -1031,26 +1031,26 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
if (FromType == S.Context.OverloadTy) {
DeclAccessPair AccessPair;
if (FunctionDecl *Fn
- = S.ResolveAddressOfOverloadedFunction(From, ToType, false,
+ = S.ResolveAddressOfOverloadedFunction(From, ToType, false,
AccessPair)) {
// We were able to resolve the address of the overloaded function,
// so we can convert to the type of that function.
FromType = Fn->getType();
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
if (!Method->isStatic()) {
- const Type *ClassType
+ const Type *ClassType
= S.Context.getTypeDeclType(Method->getParent()).getTypePtr();
FromType = S.Context.getMemberPointerType(FromType, ClassType);
}
}
-
+
// If the "from" expression takes the address of the overloaded
// function, update the type of the resulting expression accordingly.
if (FromType->getAs<FunctionType>())
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(From->IgnoreParens()))
if (UnOp->getOpcode() == UO_AddrOf)
FromType = S.Context.getPointerType(FromType);
-
+
// Check that we've computed the proper type after overload resolution.
assert(S.Context.hasSameType(FromType,
S.FixOverloadedFunctionReference(From, AccessPair, Fn)->getType()));
@@ -1159,7 +1159,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
// Floating point conversions (C++ 4.8).
SCS.Second = ICK_Floating_Conversion;
FromType = ToType.getUnqualifiedType();
- } else if ((FromType->isRealFloatingType() &&
+ } else if ((FromType->isRealFloatingType() &&
ToType->isIntegralType(S.Context)) ||
(FromType->isIntegralOrUnscopedEnumerationType() &&
ToType->isRealFloatingType())) {
@@ -1171,7 +1171,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
// Pointer conversions (C++ 4.10).
SCS.Second = ICK_Pointer_Conversion;
SCS.IncompatibleObjC = IncompatibleObjC;
- } else if (S.IsMemberPointerConversion(From, FromType, ToType,
+ } else if (S.IsMemberPointerConversion(From, FromType, ToType,
InOverloadResolution, FromType)) {
// Pointer to member conversions (4.11).
SCS.Second = ICK_Pointer_Member;
@@ -1210,7 +1210,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
// a conversion. [...]
CanonFrom = S.Context.getCanonicalType(FromType);
CanonTo = S.Context.getCanonicalType(ToType);
- if (CanonFrom.getLocalUnqualifiedType()
+ if (CanonFrom.getLocalUnqualifiedType()
== CanonTo.getLocalUnqualifiedType() &&
(CanonFrom.getLocalCVRQualifiers() != CanonTo.getLocalCVRQualifiers()
|| CanonFrom.getObjCGCAttr() != CanonTo.getObjCGCAttr())) {
@@ -1258,17 +1258,17 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
return To->getKind() == BuiltinType::UInt;
}
- // C++0x [conv.prom]p3:
- // A prvalue of an unscoped enumeration type whose underlying type is not
- // fixed (7.2) can be converted to an rvalue a prvalue of the first of the
- // following types that can represent all the values of the enumeration
- // (i.e., the values in the range bmin to bmax as described in 7.2): int,
- // unsigned int, long int, unsigned long int, long long int, or unsigned
+ // C++0x [conv.prom]p3:
+ // A prvalue of an unscoped enumeration type whose underlying type is not
+ // fixed (7.2) can be converted to an rvalue a prvalue of the first of the
+ // following types that can represent all the values of the enumeration
+ // (i.e., the values in the range bmin to bmax as described in 7.2): int,
+ // unsigned int, long int, unsigned long int, long long int, or unsigned
// long long int. If none of the types in that list can represent all the
- // values of the enumeration, an rvalue a prvalue of an unscoped enumeration
+ // values of the enumeration, an rvalue a prvalue of an unscoped enumeration
// type can be converted to an rvalue a prvalue of the extended integer type
- // with lowest integer conversion rank (4.13) greater than the rank of long
- // long in which all the values of the enumeration can be represented. If
+ // with lowest integer conversion rank (4.13) greater than the rank of long
+ // long in which all the values of the enumeration can be represented. If
// there are two such extended types, the signed one is chosen.
if (const EnumType *FromEnumType = FromType->getAs<EnumType>()) {
// C++0x 7.2p9: Note that this implicit enum to int conversion is not
@@ -1277,28 +1277,28 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
return false;
// We have already pre-calculated the promotion type, so this is trivial.
- if (ToType->isIntegerType() &&
+ if (ToType->isIntegerType() &&
!RequireCompleteType(From->getLocStart(), FromType, PDiag()))
return Context.hasSameUnqualifiedType(ToType,
FromEnumType->getDecl()->getPromotionType());
}
// C++0x [conv.prom]p2:
- // A prvalue of type char16_t, char32_t, or wchar_t (3.9.1) can be converted
- // to an rvalue a prvalue of the first of the following types that can
- // represent all the values of its underlying type: int, unsigned int,
+ // A prvalue of type char16_t, char32_t, or wchar_t (3.9.1) can be converted
+ // to an rvalue a prvalue of the first of the following types that can
+ // represent all the values of its underlying type: int, unsigned int,
// long int, unsigned long int, long long int, or unsigned long long int.
- // If none of the types in that list can represent all the values of its
+ // If none of the types in that list can represent all the values of its
// underlying type, an rvalue a prvalue of type char16_t, char32_t,
- // or wchar_t can be converted to an rvalue a prvalue of its underlying
+ // or wchar_t can be converted to an rvalue a prvalue of its underlying
// type.
- if (FromType->isAnyCharacterType() && !FromType->isCharType() &&
+ if (FromType->isAnyCharacterType() && !FromType->isCharType() &&
ToType->isIntegerType()) {
// Determine whether the type we're converting from is signed or
// unsigned.
bool FromIsSigned;
uint64_t FromSize = Context.getTypeSize(FromType);
-
+
// FIXME: Is wchar_t signed or unsigned? We assume it's signed for now.
FromIsSigned = true;
@@ -1422,12 +1422,12 @@ BuildSimilarlyQualifiedPointerType(const Type *FromPtr,
assert((FromPtr->getTypeClass() == Type::Pointer ||
FromPtr->getTypeClass() == Type::ObjCObjectPointer) &&
"Invalid similarly-qualified pointer type");
-
+
/// \brief Conversions to 'id' subsume cv-qualifier conversions.
if (ToType->isObjCIdType() || ToType->isObjCQualifiedIdType())
return ToType.getUnqualifiedType();
-
- QualType CanonFromPointee
+
+ QualType CanonFromPointee
= Context.getCanonicalType(FromPtr->getPointeeType());
QualType CanonToPointee = Context.getCanonicalType(ToPointee);
Qualifiers Quals = CanonFromPointee.getQualifiers();
@@ -1448,12 +1448,12 @@ BuildSimilarlyQualifiedPointerType(const Type *FromPtr,
// Just build a canonical type that has the right qualifiers.
QualType QualifiedCanonToPointee
= Context.getQualifiedType(CanonToPointee.getLocalUnqualifiedType(), Quals);
-
+
if (isa<ObjCObjectPointerType>(ToType))
return Context.getObjCObjectPointerType(QualifiedCanonToPointee);
return Context.getPointerType(QualifiedCanonToPointee);
}
-
+
static bool isNullPointerConstantForConversion(Expr *Expr,
bool InOverloadResolution,
ASTContext &Context) {
@@ -1532,7 +1532,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
return true;
}
- // Beyond this point, both types need to be pointers
+ // Beyond this point, both types need to be pointers
// , including objective-c pointers.
QualType ToPointeeType = ToTypePtr->getPointeeType();
if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType()) {
@@ -1548,7 +1548,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
QualType FromPointeeType = FromTypePtr->getPointeeType();
- // If the unqualified pointee types are the same, this can't be a
+ // If the unqualified pointee types are the same, this can't be a
// pointer conversion, so don't do all of the work below.
if (Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType))
return false;
@@ -1609,7 +1609,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
bool &IncompatibleObjC) {
if (!getLangOptions().ObjC1)
return false;
-
+
// First, we handle all conversions on ObjC object pointer types.
const ObjCObjectPointerType* ToObjCPtr =
ToType->getAs<ObjCObjectPointerType>();
@@ -1646,7 +1646,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
!ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs(
FromObjCPtr->getPointeeType()))
return false;
- ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
+ ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
ToObjCPtr->getPointeeType(),
ToType, Context);
return true;
@@ -1657,7 +1657,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
// interfaces, which is permitted. However, we're going to
// complain about it.
IncompatibleObjC = true;
- ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
+ ConvertedType = BuildSimilarlyQualifiedPointerType(FromObjCPtr,
ToObjCPtr->getPointeeType(),
ToType, Context);
return true;
@@ -1667,7 +1667,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
QualType ToPointeeType;
if (const PointerType *ToCPtr = ToType->getAs<PointerType>())
ToPointeeType = ToCPtr->getPointeeType();
- else if (const BlockPointerType *ToBlockPtr =
+ else if (const BlockPointerType *ToBlockPtr =
ToType->getAs<BlockPointerType>()) {
// Objective C++: We're able to convert from a pointer to any object
// to a block pointer type.
@@ -1677,9 +1677,9 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
}
ToPointeeType = ToBlockPtr->getPointeeType();
}
- else if (FromType->getAs<BlockPointerType>() &&
+ else if (FromType->getAs<BlockPointerType>() &&
ToObjCPtr && ToObjCPtr->isObjCBuiltinType()) {
- // Objective C++: We're able to convert from a block pointer type to a
+ // Objective C++: We're able to convert from a block pointer type to a
// pointer to any object.
ConvertedType = ToType;
return true;
@@ -1715,7 +1715,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
ConvertedType = Context.getPointerType(ConvertedType);
return true;
}
-
+
// If we have pointers to functions or blocks, check whether the only
// differences in the argument and result types are in Objective-C
// pointer conversions. If so, we permit the conversion (but
@@ -1781,17 +1781,17 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType,
return false;
}
-
+
/// FunctionArgTypesAreEqual - This routine checks two function proto types
/// for equlity of their argument types. Caller has already checked that
/// they have same number of arguments. This routine assumes that Objective-C
/// pointer types which only differ in their protocol qualifiers are equal.
-bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
+bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
const FunctionProtoType *NewType) {
if (!getLangOptions().ObjC1)
return std::equal(OldType->arg_type_begin(), OldType->arg_type_end(),
NewType->arg_type_begin());
-
+
for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(),
N = NewType->arg_type_begin(),
E = OldType->arg_type_end(); O && (O != E); ++O, ++N) {
@@ -1808,12 +1808,12 @@ bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType,
}
else if (const ObjCObjectPointerType *PTTo =
ToType->getAs<ObjCObjectPointerType>()) {
- if (const ObjCObjectPointerType *PTFr =
+ if (const ObjCObjectPointerType *PTFr =
FromType->getAs<ObjCObjectPointerType>())
if (PTTo->getInterfaceDecl() == PTFr->getInterfaceDecl())
continue;
}
- return false;
+ return false;
}
}
return true;
@@ -1854,7 +1854,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
From->getSourceRange(), &BasePath,
IgnoreBaseAccess))
return true;
-
+
// The conversion was successful.
Kind = CK_DerivedToBase;
}
@@ -1885,7 +1885,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
/// If so, returns true and places the converted type (that might differ from
/// ToType in its cv-qualifiers at some level) into ConvertedType.
bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
- QualType ToType,
+ QualType ToType,
bool InOverloadResolution,
QualType &ConvertedType) {
const MemberPointerType *ToTypePtr = ToType->getAs<MemberPointerType>();
@@ -1920,7 +1920,7 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
return false;
}
-
+
/// CheckMemberPointerConversion - Check the member pointer conversion from the
/// expression From to the type ToType. This routine checks for ambiguous or
/// virtual or inaccessible base-to-derived member pointer conversions
@@ -1935,7 +1935,7 @@ bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>();
if (!FromPtrType) {
// This must be a null pointer to member pointer conversion
- assert(From->isNullPointerConstant(Context,
+ assert(From->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull) &&
"Expr must be null pointer constant!");
Kind = CK_NullToMemberPointer;
@@ -1990,7 +1990,7 @@ bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
/// an rvalue of type FromType to ToType is a qualification conversion
/// (C++ 4.4).
bool
-Sema::IsQualificationConversion(QualType FromType, QualType ToType,
+Sema::IsQualificationConversion(QualType FromType, QualType ToType,
bool CStyle) {
FromType = Context.getCanonicalType(FromType);
ToType = Context.getCanonicalType(ToType);
@@ -2092,13 +2092,13 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
= cast<CXXConstructorDecl>(ConstructorTmpl->getTemplatedDecl());
else
Constructor = cast<CXXConstructorDecl>(D);
-
+
if (!Constructor->isInvalidDecl() &&
Constructor->isConvertingConstructor(AllowExplicit)) {
if (ConstructorTmpl)
S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
/*ExplicitArgs*/ 0,
- &From, 1, CandidateSet,
+ &From, 1, CandidateSet,
/*SuppressUserConversions=*/
!ConstructorsOnly);
else
@@ -2212,19 +2212,19 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
case OR_Deleted:
// No conversion here! We're done.
return OR_Deleted;
-
+
case OR_Ambiguous:
return OR_Ambiguous;
}
return OR_No_Viable_Function;
}
-
+
bool
Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
ImplicitConversionSequence ICS;
OverloadCandidateSet CandidateSet(From->getExprLoc());
- OverloadingResult OvResult =
+ OverloadingResult OvResult =
IsUserDefinedConversion(*this, From, ToType, ICS.UserDefined,
CandidateSet, false);
if (OvResult == OR_Ambiguous)
@@ -2238,7 +2238,7 @@ Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
else
return false;
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, &From, 1);
- return true;
+ return true;
}
/// CompareImplicitConversionSequences - Compare two implicit
@@ -2299,12 +2299,12 @@ static bool hasSimilarType(ASTContext &Context, QualType T1, QualType T2) {
while (Context.UnwrapSimilarPointerTypes(T1, T2)) {
Qualifiers Quals;
T1 = Context.getUnqualifiedArrayType(T1, Quals);
- T2 = Context.getUnqualifiedArrayType(T2, Quals);
+ T2 = Context.getUnqualifiedArrayType(T2, Quals);
}
-
+
return Context.hasSameUnqualifiedType(T1, T2);
}
-
+
// Per 13.3.3.2p3, compare the given standard conversion sequences to
// determine if one is a proper subset of the other.
static ImplicitConversionSequence::CompareKind
@@ -2314,7 +2314,7 @@ compareStandardConversionSubsets(ASTContext &Context,
ImplicitConversionSequence::CompareKind Result
= ImplicitConversionSequence::Indistinguishable;
- // the identity conversion sequence is considered to be a subsequence of
+ // the identity conversion sequence is considered to be a subsequence of
// any non-identity conversion sequence
if (SCS1.ReferenceBinding == SCS2.ReferenceBinding) {
if (SCS1.isIdentityConversion() && !SCS2.isIdentityConversion())
@@ -2322,7 +2322,7 @@ compareStandardConversionSubsets(ASTContext &Context,
else if (!SCS1.isIdentityConversion() && SCS2.isIdentityConversion())
return ImplicitConversionSequence::Worse;
}
-
+
if (SCS1.Second != SCS2.Second) {
if (SCS1.Second == ICK_Identity)
Result = ImplicitConversionSequence::Better;
@@ -2347,7 +2347,7 @@ compareStandardConversionSubsets(ASTContext &Context,
return Result == ImplicitConversionSequence::Better
? ImplicitConversionSequence::Indistinguishable
: ImplicitConversionSequence::Worse;
-
+
return ImplicitConversionSequence::Indistinguishable;
}
@@ -2358,9 +2358,9 @@ static bool isBetterReferenceBindingKind(const StandardConversionSequence &SCS1,
// C++0x [over.ics.rank]p3b4:
// -- S1 and S2 are reference bindings (8.5.3) and neither refers to an
// implicit object parameter of a non-static member function declared
- // without a ref-qualifier, and *either* S1 binds an rvalue reference
+ // without a ref-qualifier, and *either* S1 binds an rvalue reference
// to an rvalue and S2 binds an lvalue reference *or S1 binds an
- // lvalue reference to a function lvalue and S2 binds an rvalue
+ // lvalue reference to a function lvalue and S2 binds an rvalue
// reference*.
//
// FIXME: Rvalue references. We're going rogue with the above edits,
@@ -2371,13 +2371,13 @@ static bool isBetterReferenceBindingKind(const StandardConversionSequence &SCS1,
if (SCS1.BindsImplicitObjectArgumentWithoutRefQualifier ||
SCS2.BindsImplicitObjectArgumentWithoutRefQualifier)
return false;
-
+
return (!SCS1.IsLvalueReference && SCS1.BindsToRvalue &&
SCS2.IsLvalueReference) ||
(SCS1.IsLvalueReference && SCS1.BindsToFunctionLvalue &&
!SCS2.IsLvalueReference);
}
-
+
/// CompareStandardConversionSequences - Compare two standard
/// conversion sequences to determine whether one is better than the
/// other or if they are indistinguishable (C++ 13.3.3.2p3).
@@ -2488,7 +2488,7 @@ CompareStandardConversionSequences(Sema &S,
return ImplicitConversionSequence::Better;
else if (isBetterReferenceBindingKind(SCS2, SCS1))
return ImplicitConversionSequence::Worse;
-
+
// C++ [over.ics.rank]p3b4:
// -- S1 and S2 are reference bindings (8.5.3), and the types to
// which the references refer are the same type except for
@@ -2709,13 +2709,13 @@ CompareDerivedToBaseConversions(Sema &S,
if (SCS1.Second == ICK_Pointer_Member && SCS2.Second == ICK_Pointer_Member &&
FromType1->isMemberPointerType() && FromType2->isMemberPointerType() &&
ToType1->isMemberPointerType() && ToType2->isMemberPointerType()) {
- const MemberPointerType * FromMemPointer1 =
+ const MemberPointerType * FromMemPointer1 =
FromType1->getAs<MemberPointerType>();
- const MemberPointerType * ToMemPointer1 =
+ const MemberPointerType * ToMemPointer1 =
ToType1->getAs<MemberPointerType>();
- const MemberPointerType * FromMemPointer2 =
+ const MemberPointerType * FromMemPointer2 =
FromType2->getAs<MemberPointerType>();
- const MemberPointerType * ToMemPointer2 =
+ const MemberPointerType * ToMemPointer2 =
ToType2->getAs<MemberPointerType>();
const Type *FromPointeeType1 = FromMemPointer1->getClass();
const Type *ToPointeeType1 = ToMemPointer1->getClass();
@@ -2740,7 +2740,7 @@ CompareDerivedToBaseConversions(Sema &S,
return ImplicitConversionSequence::Worse;
}
}
-
+
if (SCS1.Second == ICK_Derived_To_Base) {
// -- conversion of C to B is better than conversion of C to A,
// -- binding of an expression of type C to a reference of type
@@ -2864,11 +2864,11 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
else
Conv = cast<CXXConversionDecl>(D);
- // If this is an explicit conversion, and we're not allowed to consider
+ // If this is an explicit conversion, and we're not allowed to consider
// explicit conversions, skip it.
if (!AllowExplicit && Conv->isExplicit())
continue;
-
+
if (AllowRvalues) {
bool DerivedToBase = false;
bool ObjCConversion = false;
@@ -2893,7 +2893,7 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
!RefType->getPointeeType()->isFunctionType()))
continue;
}
-
+
if (ConvTemplate)
S.AddTemplateConversionCandidate(ConvTemplate, I.getPair(), ActingDC,
Init, DeclType, CandidateSet);
@@ -2943,7 +2943,7 @@ FindConversionForRefInit(Sema &S, ImplicitConversionSequence &ICS,
// conversion; continue with other checks.
return false;
}
-
+
return false;
}
@@ -3035,7 +3035,7 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
// conversion functions (13.3.1.6) and choosing the best
// one through overload resolution (13.3)),
if (!SuppressUserConversions && T2->isRecordType() &&
- !S.RequireCompleteType(DeclLoc, T2, 0) &&
+ !S.RequireCompleteType(DeclLoc, T2, 0) &&
RefRelationship == Sema::Ref_Incompatible) {
if (FindConversionForRefInit(S, ICS, DeclType, DeclLoc,
Init, T2, /*AllowRvalues=*/false,
@@ -3047,7 +3047,7 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
// -- Otherwise, the reference shall be an lvalue reference to a
// non-volatile const type (i.e., cv1 shall be const), or the reference
// shall be an rvalue reference.
- //
+ //
// We actually handle one oddity of C++ [over.ics.ref] at this
// point, which is that, due to p2 (which short-circuits reference
// binding by only attempting a simple conversion for non-direct
@@ -3070,7 +3070,7 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
(InitCategory.isLValue() && T2->isFunctionType()))) {
ICS.setStandard();
ICS.Standard.First = ICK_Identity;
- ICS.Standard.Second = DerivedToBase? ICK_Derived_To_Base
+ ICS.Standard.Second = DerivedToBase? ICK_Derived_To_Base
: ObjCConversion? ICK_Compatible_Conversion
: ICK_Identity;
ICS.Standard.Third = ICK_Identity;
@@ -3084,29 +3084,29 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
// Note: Although xvalues wouldn't normally show up in C++98/03 code, we
// allow the use of rvalue references in C++98/03 for the benefit of
// standard library implementors; therefore, we need the xvalue check here.
- ICS.Standard.DirectBinding =
- S.getLangOptions().CPlusPlus0x ||
+ ICS.Standard.DirectBinding =
+ S.getLangOptions().CPlusPlus0x ||
(InitCategory.isPRValue() && !T2->isRecordType());
ICS.Standard.IsLvalueReference = !isRValRef;
ICS.Standard.BindsToFunctionLvalue = T2->isFunctionType();
- ICS.Standard.BindsToRvalue = InitCategory.isRValue();
+ ICS.Standard.BindsToRvalue = InitCategory.isRValue();
ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
ICS.Standard.CopyConstructor = 0;
- return ICS;
+ return ICS;
}
-
+
// -- has a class type (i.e., T2 is a class type), where T1 is not
// reference-related to T2, and can be implicitly converted to
- // an xvalue, class prvalue, or function lvalue of type
- // "cv3 T3", where "cv1 T1" is reference-compatible with
+ // an xvalue, class prvalue, or function lvalue of type
+ // "cv3 T3", where "cv1 T1" is reference-compatible with
// "cv3 T3",
//
- // then the reference is bound to the value of the initializer
+ // then the reference is bound to the value of the initializer
// expression in the first case and to the result of the conversion
- // in the second case (or, in either case, to an appropriate base
+ // in the second case (or, in either case, to an appropriate base
// class subobject).
if (!SuppressUserConversions && RefRelationship == Sema::Ref_Incompatible &&
- T2->isRecordType() && !S.RequireCompleteType(DeclLoc, T2, 0) &&
+ T2->isRecordType() && !S.RequireCompleteType(DeclLoc, T2, 0) &&
FindConversionForRefInit(S, ICS, DeclType, DeclLoc,
Init, T2, /*AllowRvalues=*/true,
AllowExplicit)) {
@@ -3114,13 +3114,13 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
// and the second standard conversion sequence of the
// user-defined conversion sequence includes an lvalue-to-rvalue
// conversion, the program is ill-formed.
- if (ICS.isUserDefined() && isRValRef &&
+ if (ICS.isUserDefined() && isRValRef &&
ICS.UserDefined.After.First == ICK_Lvalue_To_Rvalue)
ICS.setBad(BadConversionSequence::no_conversion, Init, DeclType);
return ICS;
}
-
+
// -- Otherwise, a temporary of type "cv1 T1" is created and
// initialized from the initializer expression using the
// rules for a non-reference copy initialization (8.5). The
@@ -3192,7 +3192,7 @@ TryReferenceInit(Sema &S, Expr *&Init, QualType DeclType,
/// do not permit any user-defined conversion sequences.
static ImplicitConversionSequence
TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
- bool SuppressUserConversions,
+ bool SuppressUserConversions,
bool InOverloadResolution) {
if (ToType->isReferenceType())
return TryReferenceInit(S, From, ToType,
@@ -3239,7 +3239,7 @@ TryObjectArgumentInitialization(Sema &S, QualType OrigFromType,
assert(FromType->isRecordType());
// C++0x [over.match.funcs]p4:
- // For non-static member functions, the type of the implicit object
+ // For non-static member functions, the type of the implicit object
// parameter is
//
// - "lvalue reference to cv X" for functions declared without a
@@ -3247,10 +3247,10 @@ TryObjectArgumentInitialization(Sema &S, QualType OrigFromType,
// - "rvalue reference to cv X" for functions declared with the &&
// ref-qualifier
//
- // where X is the class of which the function is a member and cv is the
+ // where X is the class of which the function is a member and cv is the