[cfe-commits] r133528 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/AST/Decl.cpp lib/AST/Expr.cpp lib/AST/ExprClassification.cpp lib/CodeGen/CGExpr.cpp
Douglas Gregor
dgregor at apple.com
Tue Jun 21 11:20:46 PDT 2011
Author: dgregor
Date: Tue Jun 21 13:20:46 2011
New Revision: 133528
URL: http://llvm.org/viewvc/llvm-project?rev=133528&view=rev
Log:
A few tweaks to MaterializeTemporaryExpr suggested by John.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=133528&r1=133527&r2=133528&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Jun 21 13:20:46 2011
@@ -3029,7 +3029,7 @@
/// \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;
}
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=133528&r1=133527&r2=133528&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Jun 21 13:20:46 2011
@@ -1313,8 +1313,7 @@
}
bool VarDecl::extendsLifetimeOfTemporary() const {
- if (!getType()->isReferenceType())
- return false;
+ assert(getType()->isReferenceType() &&"Non-references never extend lifetime");
const Expr *E = getInit();
if (!E)
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=133528&r1=133527&r2=133528&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Jun 21 13:20:46 2011
@@ -1573,10 +1573,6 @@
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));
Modified: cfe/trunk/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=133528&r1=133527&r2=133528&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprClassification.cpp (original)
+++ cfe/trunk/lib/AST/ExprClassification.cpp Tue Jun 21 13:20:46 2011
@@ -343,7 +343,7 @@
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;
}
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=133528&r1=133527&r2=133528&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jun 21 13:20:46 2011
@@ -2078,9 +2078,7 @@
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());
}
More information about the cfe-commits
mailing list