From 7d99bc37e77157523e3bfbc6c077842b74e6690f Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 10 Apr 2011 20:33:22 +0000 Subject: As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind which represents a dynamic cast where we know that the result is always null. For example: struct A { virtual ~A(); }; struct B final : A { }; struct C { }; bool f(B* b) { return dynamic_cast(b); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129256 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprAgg.cpp') diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 75e3a7879d..5e1ac3cbac 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -255,7 +255,10 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { } switch (E->getCastKind()) { - case CK_Dynamic: { + case CK_Dynamic: + case CK_DynamicToNull: { + + // FIXME: Actually handle DynamicToNull here. assert(isa(E) && "CK_Dynamic without a dynamic_cast?"); LValue LV = CGF.EmitCheckedLValue(E->getSubExpr()); // FIXME: Do we also need to handle property references here? -- cgit v1.2.3