diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3731,8 +3731,7 @@ const ObjCPropertyRefExpr *Expr::getObjCProperty() const { const Expr *E = this; while (true) { - assert((E->getValueKind() == VK_LValue && - E->getObjectKind() == OK_ObjCProperty) && + assert((E->isLValue() && E->getObjectKind() == OK_ObjCProperty) && "expression is not a property reference"); E = E->IgnoreParenCasts(); if (const BinaryOperator *BO = dyn_cast(E)) { @@ -3771,7 +3770,7 @@ while (ImplicitCastExpr *ICE = dyn_cast(E)) { if (ICE->getCastKind() == CK_LValueToRValue || - (ICE->getValueKind() != VK_RValue && ICE->getCastKind() == CK_NoOp)) + (!ICE->isRValue() && ICE->getCastKind() == CK_NoOp)) E = ICE->getSubExpr()->IgnoreParens(); else break; @@ -3818,8 +3817,7 @@ const Expr *E = this->IgnoreParens(); while (const ImplicitCastExpr *ICE = dyn_cast(E)) { - if (ICE->getValueKind() != VK_RValue && - ICE->getCastKind() == CK_NoOp) + if (!ICE->isRValue() && ICE->getCastKind() == CK_NoOp) E = ICE->getSubExpr()->IgnoreParens(); else break; diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -53,8 +53,12 @@ // Enable this assertion for testing. switch (kind) { - case Cl::CL_LValue: assert(getValueKind() == VK_LValue); break; - case Cl::CL_XValue: assert(getValueKind() == VK_XValue); break; + case Cl::CL_LValue: + assert(isLValue()); + break; + case Cl::CL_XValue: + assert(isXValue()); + break; case Cl::CL_Function: case Cl::CL_Void: case Cl::CL_AddressableVoid: @@ -64,7 +68,9 @@ case Cl::CL_ClassTemporary: case Cl::CL_ArrayTemporary: case Cl::CL_ObjCMessageRValue: - case Cl::CL_PRValue: assert(getValueKind() == VK_RValue); break; + case Cl::CL_PRValue: + assert(isRValue()); + break; } Cl::ModifiableType modifiable = Cl::CM_Untested; diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -708,10 +708,10 @@ } // If it was an l-value, use objc_copyWeak. - if (srcExpr->getValueKind() == VK_LValue) { + if (srcExpr->isLValue()) { CGF.EmitARCCopyWeak(destLV.getAddress(CGF), srcAddr); } else { - assert(srcExpr->getValueKind() == VK_XValue); + assert(srcExpr->isXValue()); CGF.EmitARCMoveWeak(destLV.getAddress(CGF), srcAddr); } return true; diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1947,7 +1947,7 @@ if (const ImplicitCastExpr *ICE = dyn_cast(CE)) { // And that glvalue casts are never null. - if (ICE->getValueKind() != VK_RValue) + if (!ICE->isRValue()) return false; } diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -614,7 +614,7 @@ // C++1z [conv.array]: The temporary materialization conversion is applied. // We also use this to fuel C++ DR1213, which applies to C++11 onwards. if (Kind == CK_ArrayToPointerDecay && getLangOpts().CPlusPlus && - E->getValueKind() == VK_RValue) { + E->isRValue()) { // The temporary is an lvalue in C++98 and an xvalue otherwise. ExprResult Materialized = CreateMaterializeTemporaryExpr( E->getType(), E, !getLangOpts().CPlusPlus11); diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -897,7 +897,7 @@ // If the expression is a temporary, materialize it as an lvalue so that we // can use it multiple times. - if (E->getValueKind() == VK_RValue) + if (E->isRValue()) E = CreateMaterializeTemporaryExpr(E->getType(), E, true); // The location of the `co_await` token cannot be used when constructing @@ -957,7 +957,7 @@ // If the expression is a temporary, materialize it as an lvalue so that we // can use it multiple times. - if (E->getValueKind() == VK_RValue) + if (E->isRValue()) E = CreateMaterializeTemporaryExpr(E->getType(), E, true); // Build the await_ready, await_suspend, await_resume calls. diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5513,7 +5513,7 @@ BaseExpr = LHSExp; // vectors: V[123] IndexExpr = RHSExp; // We apply C++ DR1213 to vector subscripting too. - if (getLangOpts().CPlusPlus11 && LHSExp->getValueKind() == VK_RValue) { + if (getLangOpts().CPlusPlus11 && LHSExp->isRValue()) { ExprResult Materialized = TemporaryMaterializationConversion(LHSExp); if (Materialized.isInvalid()) return ExprError(); @@ -10093,7 +10093,7 @@ RHSType, DiagID)) return RHSType; } else { - if (LHS.get()->getValueKind() == VK_LValue || + if (LHS.get()->isLValue() || !tryGCCVectorConvertAndSplat(*this, &LHS, &RHS)) return RHSType; } @@ -14816,7 +14816,7 @@ // complex l-values to ordinary l-values and all other values to r-values. if (Input.isInvalid()) return ExprError(); if (Opc == UO_Real || Input.get()->getType()->isAnyComplexType()) { - if (Input.get()->getValueKind() != VK_RValue && + if (!Input.get()->isRValue() && Input.get()->getObjectKind() == OK_Ordinary) VK = Input.get()->getValueKind(); } else if (!getLangOpts().CPlusPlus) { @@ -18985,7 +18985,7 @@ Expr *SubExpr = SubResult.get(); E->setSubExpr(SubExpr); E->setType(S.Context.getPointerType(SubExpr->getType())); - assert(E->getValueKind() == VK_RValue); + assert(E->isRValue()); assert(E->getObjectKind() == OK_Ordinary); return E; } @@ -18995,7 +18995,7 @@ E->setType(VD->getType()); - assert(E->getValueKind() == VK_RValue); + assert(E->isRValue()); if (S.getLangOpts().CPlusPlus && !(isa(VD) && cast(VD)->isInstance())) @@ -19086,7 +19086,7 @@ return ExprError(); } - assert(E->getValueKind() == VK_RValue); + assert(E->isRValue()); assert(E->getObjectKind() == OK_Ordinary); E->setType(DestType); @@ -19240,7 +19240,7 @@ ExprResult RebuildUnknownAnyExpr::VisitImplicitCastExpr(ImplicitCastExpr *E) { // The only case we should ever see here is a function-to-pointer decay. if (E->getCastKind() == CK_FunctionToPointerDecay) { - assert(E->getValueKind() == VK_RValue); + assert(E->isRValue()); assert(E->getObjectKind() == OK_Ordinary); E->setType(DestType); @@ -19254,7 +19254,7 @@ E->setSubExpr(Result.get()); return E; } else if (E->getCastKind() == CK_LValueToRValue) { - assert(E->getValueKind() == VK_RValue); + assert(E->isRValue()); assert(E->getObjectKind() == OK_Ordinary); assert(isa(E->getType())); diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5830,7 +5830,7 @@ Entity.getType()) && canPerformArrayCopy(Entity)) { // If source is a prvalue, use it directly. - if (Initializer->getValueKind() == VK_RValue) { + if (Initializer->isRValue()) { AddArrayInitStep(DestType, /*IsGNUExtension*/false); return; }