[cfe-commits] r117479 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenCXX/stmtexpr.cpp

Fariborz Jahanian fjahanian at apple.com
Wed Oct 27 13:10:29 PDT 2010


Author: fjahanian
Date: Wed Oct 27 15:10:28 2010
New Revision: 117479

URL: http://llvm.org/viewvc/llvm-project?rev=117479&view=rev
Log:
patch to do array-to-pointer conversion in a
statement-expression. // rdar: //8600553

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/CodeGenCXX/stmtexpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=117479&r1=117478&r2=117479&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Oct 27 15:10:28 2010
@@ -7072,6 +7072,8 @@
     }
     if (Expr *LastExpr = dyn_cast<Expr>(LastStmt)) {
       Ty = LastExpr->getType();
+      if (Ty->isArrayType())
+        Ty = Context.getArrayDecayedType(Ty);
       if (!Ty->isDependentType() && !LastExpr->isTypeDependent()) {
         ExprResult Res = PerformCopyInitialization(
                             InitializedEntity::InitializeResult(LPLoc, 

Modified: cfe/trunk/test/CodeGenCXX/stmtexpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/stmtexpr.cpp?rev=117479&r1=117478&r2=117479&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/stmtexpr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/stmtexpr.cpp Wed Oct 27 15:10:28 2010
@@ -63,3 +63,13 @@
   foo4();
   return foo(1).i-1;
 }
+
+// rdar: // 8600553
+int a[128];
+int* foo5() {
+// CHECK-NOT: memcpy
+  // Check that array-to-pointer conversion occurs in a
+  // statement-expression.
+  return (({ a; }));
+}
+





More information about the cfe-commits mailing list