aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-03-16 23:22:08 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-03-16 23:22:08 +0000
commit7c80bd64032e610c0dbd74fc0ef6ea334447f2fd (patch)
tree063757ae5ba5bc99323c26d4590654ed2f82a1b4 /lib/AST/Expr.cpp
parenta393e9eedcc28b25f521a4feceb3b56e3d0d360f (diff)
Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 669f5c8225..2f7e3630fd 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -575,10 +575,7 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const {
if (TR->isVoidType() && !Ctx.getCanonicalType(TR).getCVRQualifiers())
return LV_IncompleteVoidType;
- /// FIXME: Expressions can't have reference type, so the following
- /// isn't needed.
- if (TR->isReferenceType()) // C++ [expr]
- return LV_Valid;
+ assert(!TR->isReferenceType() && "Expressions can't have reference type.");
// the type looks fine, now check the expression
switch (getStmtClass()) {
@@ -691,16 +688,16 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const {
case CallExprClass:
case CXXOperatorCallExprClass:
case CXXMemberCallExprClass: {
- // C++ [expr.call]p10:
+ // C++0x [expr.call]p10
// A function call is an lvalue if and only if the result type
- // is a reference.
+ // is an lvalue reference.
QualType CalleeType = cast<CallExpr>(this)->getCallee()->getType();
if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
CalleeType = FnTypePtr->getPointeeType();
if (const FunctionType *FnType = CalleeType->getAsFunctionType())
- if (FnType->getResultType()->isReferenceType())
+ if (FnType->getResultType()->isLValueReferenceType())
return LV_Valid;
-
+
break;
}
case CompoundLiteralExprClass: // C99 6.5.2.5p5
@@ -733,10 +730,11 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const {
case CXXReinterpretCastExprClass:
case CXXConstCastExprClass:
// The result of an explicit cast is an lvalue if the type we are
- // casting to is a reference type. See C++ [expr.cast]p1,
+ // casting to is an lvalue reference type. See C++ [expr.cast]p1,
// C++ [expr.static.cast]p2, C++ [expr.dynamic.cast]p2,
// C++ [expr.reinterpret.cast]p1, C++ [expr.const.cast]p1.
- if (cast<ExplicitCastExpr>(this)->getTypeAsWritten()->isReferenceType())
+ if (cast<ExplicitCastExpr>(this)->getTypeAsWritten()->
+ isLValueReferenceType())
return LV_Valid;
break;
case CXXTypeidExprClass: