From: David Majnemer Date: Fri, 18 Jul 2014 19:53:21 +0000 (+0000) Subject: Address Richard's comments. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=595a314713b6568c0377eff74f20b259551afa3d;p=clang Address Richard's comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213402 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index f09c279d0c..8cadd6c1eb 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -1618,6 +1618,9 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { static bool isGLValueFromPointerDeref(const Expr *E) { E = E->IgnoreParenCasts(); + if (isa(E)) + return true; + if (const auto *UO = dyn_cast(E)) if (UO->getOpcode() == UO_Deref) return true; diff --git a/test/CodeGenCXX/typeid-should-throw.cpp b/test/CodeGenCXX/typeid-should-throw.cpp index e3cbea8c6f..66abf4c663 100644 --- a/test/CodeGenCXX/typeid-should-throw.cpp +++ b/test/CodeGenCXX/typeid-should-throw.cpp @@ -42,3 +42,13 @@ void f7(A *x) { typeid((*x)); } // CHECK-LABEL: define void @_Z2f7P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 + +void f8(A *x) { typeid(x[0]); } +// CHECK-LABEL: define void @_Z2f8P1A +// CHECK: icmp eq {{.*}}, null +// CHECK-NEXT: br i1 + +void f9(A *x) { typeid(0[x]); } +// CHECK-LABEL: define void @_Z2f9P1A +// CHECK: icmp eq {{.*}}, null +// CHECK-NEXT: br i1