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 | c57d34bc3566d0ed2dca22b3b74267a10dcef083 (patch) | |
| tree | a09932c20e137d0b6c0158e587db3c278464dcf7 /clang/lib/Sema/Sema.cpp | |
| parent | 08d047666a81bca31c39fb071c2c81cc93854a46 (diff) | |
| download | bcm5719-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.cpp | 18 |
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) { |

