diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-14 21:15:49 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-11-14 21:15:49 +0000 |
commit | 7c353685bcb7ffed368f524af687af70578672cd (patch) | |
tree | 3dcd378188398a193abb4c3c7dbe20aa1d269da7 /clang/lib/Sema/SemaOverload.cpp | |
parent | 0acee6e0d722ba41026bf01bdd7b5f7ebbfc32b0 (diff) | |
download | bcm5719-llvm-7c353685bcb7ffed368f524af687af70578672cd.tar.gz bcm5719-llvm-7c353685bcb7ffed368f524af687af70578672cd.zip |
- Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.
llvm-svn: 88809
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 53e64dfc685..b324068ea83 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1155,7 +1155,8 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, /// true. It returns true and produces a diagnostic if there was an /// error, or returns false otherwise. bool Sema::CheckPointerConversion(Expr *From, QualType ToType, - CastExpr::CastKind &Kind) { + CastExpr::CastKind &Kind, + bool IgnoreBaseAccess) { QualType FromType = From->getType(); if (const PointerType *FromPtrType = FromType->getAs<PointerType>()) @@ -1169,7 +1170,8 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType, // ambiguous or inaccessible conversion. if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType, From->getExprLoc(), - From->getSourceRange())) + From->getSourceRange(), + IgnoreBaseAccess)) return true; // The conversion was successful. @@ -1238,7 +1240,9 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType, /// true and produces a diagnostic if there was an error, or returns false /// otherwise. bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType, - CastExpr::CastKind &Kind) { + CastExpr::CastKind &Kind, + bool IgnoreBaseAccess) { + (void)IgnoreBaseAccess; QualType FromType = From->getType(); const MemberPointerType *FromPtrType = FromType->getAs<MemberPointerType>(); if (!FromPtrType) { |