Thanks! On Mon, Jun 27, 2011 at 2:24 PM, John McCall <[email protected]> wrote: > Author: rjmccall > Date: Mon Jun 27 16:24:11 2011 > New Revision: 133943 > > URL: http://llvm.org/viewvc/llvm-project?rev=133943&view=rev > Log: > Fix PR10204 in a better way. > > > Modified: > cfe/trunk/lib/CodeGen/CGExpr.cpp > cfe/trunk/lib/Sema/SemaExprCXX.cpp > > Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=133943&r1=133942&r2=133943&view=diff > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Jun 27 16:24:11 2011 > @@ -791,9 +791,7 @@ > return RValue::get(EmitARCLoadWeak(LV.getAddress())); > > if (LV.isSimple()) { > - // Functions are l-values that don't require loading. > - if (LV.getType()->isFunctionType()) > - return RValue::get(LV.getAddress()); > + assert(!LV.getType()->isFunctionType()); > > // Everything needs a load. > return RValue::get(EmitLoadOfScalar(LV)); > > Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=133943&r1=133942&r2=133943&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) > +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Jun 27 16:24:11 2011 > @@ -4461,7 +4461,16 @@ > // [Except in specific positions,] an lvalue that does not have > // array type is converted to the value stored in the > // designated object (and is no longer an lvalue). > - if (E->isRValue()) return Owned(E); > + if (E->isRValue()) { > + // In C, function designators (i.e. expressions of function type) > + // are r-values, but we still want to do function-to-pointer decay > + // on them. This is both technically correct and convenient for > + // some clients. > + if (!getLangOptions().CPlusPlus && E->getType()->isFunctionType()) > + return DefaultFunctionArrayConversion(E); > + > + return Owned(E); > + } > > // We always want to do this on ObjC property references. > if (E->getObjectKind() == OK_ObjCProperty) { > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
