diff options
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 2a3ab80ba4f..8e52e620a77 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1027,7 +1027,7 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old, (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(), OldTemplate->getTemplateParameters(), false, TPL_TemplateMatch) || - OldType->getResultType() != NewType->getResultType())) + OldType->getReturnType() != NewType->getReturnType())) return true; // If the function is a class member, its signature includes the @@ -2303,11 +2303,11 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, return false; bool HasObjCConversion = false; - if (Context.getCanonicalType(FromFunctionType->getResultType()) - == Context.getCanonicalType(ToFunctionType->getResultType())) { + if (Context.getCanonicalType(FromFunctionType->getReturnType()) == + Context.getCanonicalType(ToFunctionType->getReturnType())) { // Okay, the types match exactly. Nothing to do. - } else if (isObjCPointerConversion(FromFunctionType->getResultType(), - ToFunctionType->getResultType(), + } else if (isObjCPointerConversion(FromFunctionType->getReturnType(), + ToFunctionType->getReturnType(), ConvertedType, IncompatibleObjC)) { // Okay, we have an Objective-C pointer conversion. HasObjCConversion = true; @@ -2455,12 +2455,12 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, return false; bool IncompatibleObjC = false; - if (Context.hasSameType(FromFunctionType->getResultType(), - ToFunctionType->getResultType())) { + if (Context.hasSameType(FromFunctionType->getReturnType(), + ToFunctionType->getReturnType())) { // Okay, the types match exactly. Nothing to do. } else { - QualType RHS = FromFunctionType->getResultType(); - QualType LHS = ToFunctionType->getResultType(); + QualType RHS = FromFunctionType->getReturnType(); + QualType LHS = ToFunctionType->getReturnType(); if ((!getLangOpts().CPlusPlus || !RHS->isRecordType()) && !RHS.hasQualifiers() && LHS.hasQualifiers()) LHS = LHS.getUnqualifiedType(); @@ -2583,10 +2583,10 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, } // Handle different return type. - if (!Context.hasSameType(FromFunction->getResultType(), - ToFunction->getResultType())) { - PDiag << ft_return_type << ToFunction->getResultType() - << FromFunction->getResultType(); + if (!Context.hasSameType(FromFunction->getReturnType(), + ToFunction->getReturnType())) { + PDiag << ft_return_type << ToFunction->getReturnType() + << FromFunction->getReturnType(); return; } @@ -4439,9 +4439,9 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, } else if (ICS.isUserDefined()) { // Don't allow rvalue references to bind to lvalues. if (DeclType->isRValueReferenceType()) { - if (const ReferenceType *RefType - = ICS.UserDefined.ConversionFunction->getResultType() - ->getAs<LValueReferenceType>()) { + if (const ReferenceType *RefType = + ICS.UserDefined.ConversionFunction->getReturnType() + ->getAs<LValueReferenceType>()) { if (!RefType->getPointeeType()->isFunctionType()) { ICS.setBad(BadConversionSequence::lvalue_ref_to_rvalue, Init, DeclType); @@ -9718,7 +9718,7 @@ private: // If any candidate has a placeholder return type, trigger its deduction // now. if (S.getLangOpts().CPlusPlus1y && - FunDecl->getResultType()->isUndeducedType() && + FunDecl->getReturnType()->isUndeducedType() && S.DeduceReturnType(FunDecl, SourceExpr->getLocStart(), Complain)) return false; @@ -10023,7 +10023,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, } if (Matched && getLangOpts().CPlusPlus1y && - Matched->getResultType()->isUndeducedType() && + Matched->getReturnType()->isUndeducedType() && DeduceReturnType(Matched, ovl->getExprLoc(), Complain)) return 0; @@ -10717,7 +10717,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, return ExprError(); // Determine the result type. - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -10726,8 +10726,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.take(), ArgsArray, ResultTy, VK, OpLoc, false); - if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall, - FnDecl)) + if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -10952,7 +10951,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, return ExprError(); // Determine the result type. - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -10961,7 +10960,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, Args, ResultTy, VK, OpLoc, FPFeatures.fp_contract); - if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall, + if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl)) return ExprError(); @@ -11168,7 +11167,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, return ExprError(); // Determine the result type - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11178,8 +11177,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, ResultTy, VK, RLoc, false); - if (CheckCallReturnType(FnDecl->getResultType(), LLoc, TheCall, - FnDecl)) + if (CheckCallReturnType(FnDecl->getReturnType(), LLoc, TheCall, FnDecl)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -11271,7 +11269,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, const FunctionProtoType *proto = fnType->castAs<FunctionProtoType>(); QualType resultType = proto->getCallResultType(Context); - ExprValueKind valueKind = Expr::getValueKindForType(proto->getResultType()); + ExprValueKind valueKind = Expr::getValueKindForType(proto->getReturnType()); // Check that the object type isn't more qualified than the // member function we're calling. @@ -11297,8 +11295,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, = new (Context) CXXMemberCallExpr(Context, MemExprE, Args, resultType, valueKind, RParenLoc); - if (CheckCallReturnType(proto->getResultType(), - op->getRHS()->getLocStart(), + if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(), call, 0)) return ExprError(); @@ -11437,7 +11434,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, MemExpr = cast<MemberExpr>(MemExprE->IgnoreParens()); } - QualType ResultType = Method->getResultType(); + QualType ResultType = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultType); ResultType = ResultType.getNonLValueExprType(Context); @@ -11447,7 +11444,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, ResultType, VK, RParenLoc); // Check for a valid return type. - if (CheckCallReturnType(Method->getResultType(), MemExpr->getMemberLoc(), + if (CheckCallReturnType(Method->getReturnType(), MemExpr->getMemberLoc(), TheCall, Method)) return ExprError(); @@ -11696,7 +11693,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, // Once we've built TheCall, all of the expressions are properly // owned. - QualType ResultTy = Method->getResultType(); + QualType ResultTy = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11706,8 +11703,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, ResultTy, VK, RParenLoc, false); MethodArgs.reset(); - if (CheckCallReturnType(Method->getResultType(), LParenLoc, TheCall, - Method)) + if (CheckCallReturnType(Method->getReturnType(), LParenLoc, TheCall, Method)) return true; // We may have default arguments. If so, we need to allocate more @@ -11879,15 +11875,14 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, if (FnExpr.isInvalid()) return ExprError(); - QualType ResultTy = Method->getResultType(); + QualType ResultTy = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); CXXOperatorCallExpr *TheCall = new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr.take(), Base, ResultTy, VK, OpLoc, false); - if (CheckCallReturnType(Method->getResultType(), OpLoc, TheCall, - Method)) + if (CheckCallReturnType(Method->getReturnType(), OpLoc, TheCall, Method)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -11948,7 +11943,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R, ConvArgs[ArgIdx] = InputInit.take(); } - QualType ResultTy = FD->getResultType(); + QualType ResultTy = FD->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11957,7 +11952,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R, llvm::makeArrayRef(ConvArgs, Args.size()), ResultTy, VK, LitEndLoc, UDSuffixLoc); - if (CheckCallReturnType(FD->getResultType(), UDSuffixLoc, UDL, FD)) + if (CheckCallReturnType(FD->getReturnType(), UDSuffixLoc, UDL, FD)) return ExprError(); if (CheckFunctionCall(FD, UDL, NULL)) |

