aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-12 06:04:24 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-12 06:04:24 +0000
commit32baf62b9a3aea3b63be6925b64aa182b0a2278e (patch)
tree4184b9b367454b14d6343b01f6a2767593c83307 /lib/CodeGen/CGExprScalar.cpp
parent191dfe909d6cc18e9134ac23ac4daaedeceb862f (diff)
When necessary, null check the base value in GetAddressCXXOfBaseClass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 7adbc9fd3b..aee5446434 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -669,8 +669,16 @@ Value *ScalarExprEmitter::EmitCastExpr(const Expr *E, QualType DestTy,
CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(BaseClassTy->getDecl());
Value *Src = Visit(const_cast<Expr*>(E));
+
+ // FIXME: This should be true, but that leads to a failure in virt.cpp
+ bool NullCheckValue = false;
+
+ // We always assume that 'this' is never null.
+ if (isa<CXXThisExpr>(E))
+ NullCheckValue = false;
+
return CGF.GetAddressCXXOfBaseClass(Src, DerivedClassDecl, BaseClassDecl,
- /*NullCheckValue=*/true);
+ NullCheckValue);
}
}