]> granicus.if.org Git - clang/commitdiff
Address Richard's comments.
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 18 Jul 2014 19:53:21 +0000 (19:53 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 18 Jul 2014 19:53:21 +0000 (19:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213402 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprCXX.cpp
test/CodeGenCXX/typeid-should-throw.cpp

index f09c279d0c9a0ca62bbaf62c0a062df87d39ac7a..8cadd6c1eb2c9e4697ad7f616a466486bb16fe8b 100644 (file)
@@ -1618,6 +1618,9 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
 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;
index e3cbea8c6fa969883b9dde784f6cc97d16fb1138..66abf4c663186a9c4795107db6e653ba4c89dd88 100644 (file)
@@ -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