diff options
author | dim <dim@FreeBSD.org> | 2016-02-13 15:58:51 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-02-13 15:58:51 +0000 |
commit | 7024e27ddea8cff63ccd142987756cba5001628d (patch) | |
tree | 788dd2f48fde34dee962a966ebc3d94510e29a47 /contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp | |
parent | 0fcbd80cfc7cfbf997f34115b7b17d8c679c71fc (diff) | |
parent | 97a7b8a20a989eb4cf3d9465e1451de6cd05fa41 (diff) | |
download | FreeBSD-src-7024e27ddea8cff63ccd142987756cba5001628d.zip FreeBSD-src-7024e27ddea8cff63ccd142987756cba5001628d.tar.gz |
Update llvm, clang and lldb to release_38 branch r260756.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp index 663da0c..d6a0ff7 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp @@ -2687,15 +2687,16 @@ bool Sema::FunctionParamTypesAreEqual(const FunctionProtoType *OldType, bool Sema::CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath& BasePath, - bool IgnoreBaseAccess) { + bool IgnoreBaseAccess, + bool Diagnose) { QualType FromType = From->getType(); bool IsCStyleOrFunctionalCast = IgnoreBaseAccess; Kind = CK_BitCast; - if (!IsCStyleOrFunctionalCast && !FromType->isAnyPointerType() && + if (Diagnose && !IsCStyleOrFunctionalCast && !FromType->isAnyPointerType() && From->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull) == - Expr::NPCK_ZeroExpression) { + Expr::NPCK_ZeroExpression) { if (Context.hasSameUnqualifiedType(From->getType(), Context.BoolTy)) DiagRuntimeBehavior(From->getExprLoc(), From, PDiag(diag::warn_impcast_bool_to_null_pointer) @@ -2713,18 +2714,24 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType, !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType)) { // We must have a derived-to-base conversion. Check an // ambiguous or inaccessible conversion. - if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType, - From->getExprLoc(), - From->getSourceRange(), &BasePath, - IgnoreBaseAccess)) + unsigned InaccessibleID = 0; + unsigned AmbigiousID = 0; + if (Diagnose) { + InaccessibleID = diag::err_upcast_to_inaccessible_base; + AmbigiousID = diag::err_ambiguous_derived_to_base_conv; + } + if (CheckDerivedToBaseConversion( + FromPointeeType, ToPointeeType, InaccessibleID, AmbigiousID, + From->getExprLoc(), From->getSourceRange(), DeclarationName(), + &BasePath, IgnoreBaseAccess)) return true; // The conversion was successful. Kind = CK_DerivedToBase; } - if (!IsCStyleOrFunctionalCast && FromPointeeType->isFunctionType() && - ToPointeeType->isVoidType()) { + if (Diagnose && !IsCStyleOrFunctionalCast && + FromPointeeType->isFunctionType() && ToPointeeType->isVoidType()) { assert(getLangOpts().MSVCCompat && "this should only be possible with MSVCCompat!"); Diag(From->getExprLoc(), diag::ext_ms_impcast_fn_obj) |