summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-24 21:06:20 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-24 21:06:20 +0000
commit34a2d384c745ebc39cae45dc1c0c4a6a7012e09b (patch)
tree56ff3f9462b1b8abb47c45c50c30d8aa7d2262ed /lib/CodeGen/CGExprScalar.cpp
parentd1a272204cef9304df3930d94f66713b05db27d6 (diff)
downloadclang-34a2d384c745ebc39cae45dc1c0c4a6a7012e09b.tar.gz
clang-34a2d384c745ebc39cae45dc1c0c4a6a7012e09b.tar.bz2
clang-34a2d384c745ebc39cae45dc1c0c4a6a7012e09b.tar.xz
Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index e1e22cef56..f38126b8e7 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -840,15 +840,9 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
CXXRecordDecl *DerivedClassDecl =
cast<CXXRecordDecl>(DerivedClassTy->getDecl());
- const RecordType *BaseClassTy =
- DestTy->getAs<PointerType>()->getPointeeType()->getAs<RecordType>();
- CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseClassTy->getDecl());
-
- Value *Src = Visit(const_cast<Expr*>(E));
-
- bool NullCheckValue = ShouldNullCheckClassCastValue(CE);
- return CGF.GetAddressOfBaseClass(Src, DerivedClassDecl, BaseClassDecl,
- NullCheckValue);
+ return CGF.GetAddressOfBaseClass(Visit(E), DerivedClassDecl,
+ CE->getBasePath(),
+ ShouldNullCheckClassCastValue(CE));
}
case CastExpr::CK_Dynamic: {
Value *V = Visit(const_cast<Expr*>(E));