[cfe-commits] r117479 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenCXX/stmtexpr.cpp
Douglas Gregor
dgregor at apple.com
Wed Oct 27 13:15:17 PDT 2010
On Oct 27, 2010, at 1:10 PM, Fariborz Jahanian wrote:
> 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
What about function-to-pointer conversions? DefaultFunctionArrayLvalueConversion would cover all of the appropriate conversions, I think.
- Doug
> 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; }));
> +}
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list