aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-03-30 23:58:03 +0000
committerJohn McCall <rjmccall@apple.com>2010-03-30 23:58:03 +0000
commit23cba801e11b03929c44f8cf54578305963a3476 (patch)
tree7a1edfa728d0b5e9f0a9732d0faaec43ad2aa242 /lib/Sema/SemaExpr.cpp
parent658f679b63cf92204d707c5dfc1251ae8f3c0762 (diff)
Introduce a new kind of derived-to-base cast which bypasses the need for
null checks, and make sure we elide null checks when accessing base class members. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index e232230db7..0980710b3d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1461,7 +1461,7 @@ Sema::PerformObjectMemberConversion(Expr *&From,
if (PointerConversions)
QType = Context.getPointerType(QType);
- ImpCastExprToType(From, QType, CastExpr::CK_DerivedToBase,
+ ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase,
/*isLvalue*/ !PointerConversions);
FromType = QType;
@@ -1497,7 +1497,7 @@ Sema::PerformObjectMemberConversion(Expr *&From,
QualType UType = URecordType;
if (PointerConversions)
UType = Context.getPointerType(UType);
- ImpCastExprToType(From, UType, CastExpr::CK_DerivedToBase,
+ ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase,
/*isLvalue*/ !PointerConversions);
FromType = UType;
FromRecordType = URecordType;
@@ -1517,8 +1517,8 @@ Sema::PerformObjectMemberConversion(Expr *&From,
// FIXME: isLvalue should be !PointerConversions here, but codegen
// does very silly things.
- ImpCastExprToType(From, DestType, CastExpr::CK_DerivedToBase,
- /*isLvalue=*/ true);
+ ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase,
+ /*isLvalue=*/ !PointerConversions);
return false;
}