summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-20 04:20:21 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-20 04:20:21 +0000
commitc57d34bc3566d0ed2dca22b3b74267a10dcef083 (patch)
treea09932c20e137d0b6c0158e587db3c278464dcf7 /clang/lib/Sema/Sema.cpp
parent08d047666a81bca31c39fb071c2c81cc93854a46 (diff)
downloadbcm5719-llvm-c57d34bc3566d0ed2dca22b3b74267a10dcef083.tar.gz
bcm5719-llvm-c57d34bc3566d0ed2dca22b3b74267a10dcef083.zip
Update ImplicitCastExpr to be able to represent an XValue.
llvm-svn: 108807
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index cddc84eeedf..33a111f395c 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -152,10 +152,11 @@ Sema::~Sema() {
/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
/// If there is already an implicit cast, merge into the existing one.
-/// If isLvalue, the result of the cast is an lvalue.
+/// The result is of the given category.
void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
CastExpr::CastKind Kind,
- bool isLvalue, CXXBaseSpecifierArray BasePath) {
+ ImplicitCastExpr::ResultCategory Category,
+ CXXBaseSpecifierArray BasePath) {
QualType ExprTy = Context.getCanonicalType(Expr->getType());
QualType TypeTy = Context.getCanonicalType(Ty);
@@ -186,12 +187,21 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
if (ImpCast->getCastKind() == Kind && BasePath.empty()) {
ImpCast->setType(Ty);
- ImpCast->setLvalueCast(isLvalue);
+ ImpCast->setCategory(Category);
return;
}
}
- Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, BasePath, isLvalue);
+ Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, BasePath, Category);
+}
+
+ImplicitCastExpr::ResultCategory Sema::CastCategory(Expr *E) {
+ Expr::Classification Classification = E->Classify(Context);
+ return Classification.isRValue() ?
+ ImplicitCastExpr::RValue :
+ (Classification.isLValue() ?
+ ImplicitCastExpr::LValue :
+ ImplicitCastExpr::XValue);
}
void Sema::DeleteExpr(ExprTy *E) {
OpenPOWER on IntegriCloud