/// \brief Determine whether this materialized temporary is bound to an
/// lvalue reference; otherwise, it's bound to an rvalue reference.
- bool BoundToLvalueReference() const {
+ bool isBoundToLvalueReference() const {
return getValueKind() == VK_LValue;
}
}
bool VarDecl::extendsLifetimeOfTemporary() const {
- if (!getType()->isReferenceType())
- return false;
+ assert(getType()->isReferenceType() &&"Non-references never extend lifetime");
const Expr *E = getInit();
if (!E)
return (cast<ImplicitCastExpr>(this)
->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
- case MaterializeTemporaryExprClass:
- return cast<MaterializeTemporaryExpr>(this)->GetTemporaryExpr()
- ->isUnusedResultAWarning(Loc, R1, R2, Ctx);
-
case CXXDefaultArgExprClass:
return (cast<CXXDefaultArgExpr>(this)
->getExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx));
return ClassifyInternal(Ctx, cast<PackExpansionExpr>(E)->getPattern());
case Expr::MaterializeTemporaryExprClass:
- return cast<MaterializeTemporaryExpr>(E)->BoundToLvalueReference()
+ return cast<MaterializeTemporaryExpr>(E)->isBoundToLvalueReference()
? Cl::CL_LValue
: Cl::CL_XValue;
}
const MaterializeTemporaryExpr *E) {
RValue RV = EmitReferenceBindingToExpr(E->GetTemporaryExpr(),
/*InitializedDecl=*/0);
- return LValue::MakeAddr(RV.getScalarVal(), E->getType(),
- CGM.getContext().getTypeAlign(E->getType()),
- CGM.getContext());
+ return MakeAddrLValue(RV.getScalarVal(), E->getType());
}