forked from OSchip/llvm-project
parent
1ee9fc02c9
commit
d68b2d0438
|
@ -791,9 +791,7 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV) {
|
|||
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));
|
||||
|
|
|
@ -4461,7 +4461,16 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) {
|
|||
// [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) {
|
||||
|
|
Loading…
Reference in New Issue