diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-20 04:20:21 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-07-20 04:20:21 +0000 |
commit | 906082edf2aea1c6de2926f93a8d7121e49d2a54 (patch) | |
tree | 40ad6a9e39aa0c1554391f03c4dd14cab9e668c1 /lib/Sema/Sema.cpp | |
parent | 0b42659e76ec32cee3f59bc206e93b4c917e9df5 (diff) |
Update ImplicitCastExpr to be able to represent an XValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index cddc84eeed..33a111f395 100644 --- a/lib/Sema/Sema.cpp +++ b/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) { |