diff options
-rw-r--r-- | include/clang/AST/ExprCXX.h | 2 | ||||
-rw-r--r-- | lib/AST/Decl.cpp | 3 | ||||
-rw-r--r-- | lib/AST/Expr.cpp | 4 | ||||
-rw-r--r-- | lib/AST/ExprClassification.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 4 |
5 files changed, 4 insertions, 11 deletions
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 1b1019e554..aec2c6a8bf 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -3029,7 +3029,7 @@ public: /// \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; } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index cdec049cb1..7ca936abc9 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1313,8 +1313,7 @@ void VarDecl::setInit(Expr *I) { } bool VarDecl::extendsLifetimeOfTemporary() const { - if (!getType()->isReferenceType()) - return false; + assert(getType()->isReferenceType() &&"Non-references never extend lifetime"); const Expr *E = getInit(); if (!E) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 1faceb9425..2adaba11a0 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1573,10 +1573,6 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, 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)); diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp index 2d824ce8fd..2a05c1fccf 100644 --- a/lib/AST/ExprClassification.cpp +++ b/lib/AST/ExprClassification.cpp @@ -343,7 +343,7 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { 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; } diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index d5c18eba70..2c00b9bf06 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2078,9 +2078,7 @@ LValue CodeGenFunction::EmitMaterializeTemporaryExpr( 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()); } |