r213402 - Address Richard's comments.

David Majnemer david.majnemer at gmail.com
Fri Jul 18 12:53:21 PDT 2014


Author: majnemer
Date: Fri Jul 18 14:53:21 2014
New Revision: 213402

URL: http://llvm.org/viewvc/llvm-project?rev=213402&view=rev
Log:
Address Richard's comments.

Modified:
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/test/CodeGenCXX/typeid-should-throw.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=213402&r1=213401&r2=213402&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Fri Jul 18 14:53:21 2014
@@ -1618,6 +1618,9 @@ void CodeGenFunction::EmitCXXDeleteExpr(
 static bool isGLValueFromPointerDeref(const Expr *E) {
   E = E->IgnoreParenCasts();
 
+  if (isa<ArraySubscriptExpr>(E))
+    return true;
+
   if (const auto *UO = dyn_cast<UnaryOperator>(E))
     if (UO->getOpcode() == UO_Deref)
       return true;

Modified: cfe/trunk/test/CodeGenCXX/typeid-should-throw.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/typeid-should-throw.cpp?rev=213402&r1=213401&r2=213402&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/typeid-should-throw.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/typeid-should-throw.cpp Fri Jul 18 14:53:21 2014
@@ -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





More information about the cfe-commits mailing list