diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Expr.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/ExprClassification.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/StmtDumper.cpp | 8 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Rewrite/RewriteObjC.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 66 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 2 |
18 files changed, 83 insertions, 93 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 5feaa22be45..f63df46f526 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2947,7 +2947,7 @@ Expr *ASTNodeImporter::VisitImplicitCastExpr(ImplicitCastExpr *E) { return 0; return ImplicitCastExpr::Create(Importer.getToContext(), T, E->getCastKind(), - SubExpr, &BasePath, E->getCategory()); + SubExpr, &BasePath, E->getValueKind()); } Expr *ASTNodeImporter::VisitCStyleCastExpr(CStyleCastExpr *E) { diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 1399e004675..5efc6675f7f 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -802,12 +802,12 @@ void CastExpr::setCastPath(const CXXCastPath &Path) { ImplicitCastExpr *ImplicitCastExpr::Create(ASTContext &C, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, - ResultCategory Cat) { + ExprValueKind VK) { unsigned PathSize = (BasePath ? BasePath->size() : 0); void *Buffer = C.Allocate(sizeof(ImplicitCastExpr) + PathSize * sizeof(CXXBaseSpecifier*)); ImplicitCastExpr *E = - new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, Cat); + new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, VK); if (PathSize) E->setCastPath(*BasePath); return E; } @@ -1600,7 +1600,7 @@ FieldDecl *Expr::getBitField() { Expr *E = this->IgnoreParens(); while (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) { - if (ICE->getCategory() != ImplicitCastExpr::RValue && + if (ICE->getValueKind() != VK_RValue && ICE->getCastKind() == CastExpr::CK_NoOp) E = ICE->getSubExpr()->IgnoreParens(); else @@ -1623,7 +1623,7 @@ bool Expr::refersToVectorElement() const { const Expr *E = this->IgnoreParens(); while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) { - if (ICE->getCategory() != ImplicitCastExpr::RValue && + if (ICE->getValueKind() != VK_RValue && ICE->getCastKind() == CastExpr::CK_NoOp) E = ICE->getSubExpr()->IgnoreParens(); else diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp index 429366ee890..80e07c5f084 100644 --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -134,13 +134,13 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // Implicit casts are lvalues if they're lvalue casts. Other than that, we // only specifically record class temporaries. case Expr::ImplicitCastExprClass: - switch (cast<ImplicitCastExpr>(E)->getCategory()) { - case ImplicitCastExpr::RValue: + switch (cast<ImplicitCastExpr>(E)->getValueKind()) { + case VK_RValue: return Lang.CPlusPlus && E->getType()->isRecordType() ? Cl::CL_ClassTemporary : Cl::CL_PRValue; - case ImplicitCastExpr::LValue: + case VK_LValue: return Cl::CL_LValue; - case ImplicitCastExpr::XValue: + case VK_XValue: return Cl::CL_XValue; } llvm_unreachable("Invalid value category of implicit cast."); diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index 3707b618488..44601e0bdf3 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -340,14 +340,14 @@ void StmtDumper::VisitCastExpr(CastExpr *Node) { void StmtDumper::VisitImplicitCastExpr(ImplicitCastExpr *Node) { VisitCastExpr(Node); - switch (Node->getCategory()) { - case ImplicitCastExpr::LValue: + switch (Node->getValueKind()) { + case VK_LValue: OS << " lvalue"; break; - case ImplicitCastExpr::XValue: + case VK_XValue: OS << " xvalue"; break; - default: + case VK_RValue: break; } } diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index e7aa9db7e7e..4e8fc5fe706 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -325,7 +325,7 @@ void StmtProfiler::VisitCastExpr(CastExpr *S) { void StmtProfiler::VisitImplicitCastExpr(ImplicitCastExpr *S) { VisitCastExpr(S); - ID.AddInteger(S->getCategory()); + ID.AddInteger(S->getValueKind()); } void StmtProfiler::VisitExplicitCastExpr(ExplicitCastExpr *S) { diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 6901f9b924f..ec491f72409 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -893,7 +893,7 @@ static bool ShouldNullCheckClassCastValue(const CastExpr *CE) { if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(CE)) { // And that glvalue casts are never null. - if (ICE->getCategory() != ImplicitCastExpr::RValue) + if (ICE->getValueKind() != VK_RValue) return false; } diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 255898b0aa7..1c12d7f1adb 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -405,7 +405,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP, getContext().getCanonicalType(ArgDecl->getType())) { ImplicitCastExpr ArgCasted(ImplicitCastExpr::OnStack, Ivar->getType(), CastExpr::CK_BitCast, &Arg, - ImplicitCastExpr::RValue); + VK_RValue); BinaryOperator Assign(&IvarRef, &ArgCasted, BinaryOperator::Assign, Ivar->getType(), Loc); EmitStmt(&Assign); diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index 4cabf0623ba..e91c31bfd06 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -2055,7 +2055,7 @@ CallExpr *RewriteObjC::SynthesizeCallToFunctionDecl( QualType pToFunc = Context->getPointerType(msgSendType); ImplicitCastExpr *ICE = ImplicitCastExpr::Create(*Context, pToFunc, CastExpr::CK_Unknown, - DRE, 0, ImplicitCastExpr::RValue); + DRE, 0, VK_RValue); const FunctionType *FT = msgSendType->getAs<FunctionType>(); diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 6143492ea76..120035c923a 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -191,8 +191,7 @@ Sema::~Sema() { /// If there is already an implicit cast, merge into the existing one. /// The result is of the given category. void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, - CastExpr::CastKind Kind, - ImplicitCastExpr::ResultCategory Category, + CastKind Kind, ExprValueKind VK, const CXXCastPath *BasePath) { QualType ExprTy = Context.getCanonicalType(Expr->getType()); QualType TypeTy = Context.getCanonicalType(Ty); @@ -224,21 +223,18 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) { if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) { ImpCast->setType(Ty); - ImpCast->setCategory(Category); + ImpCast->setValueKind(VK); return; } } - Expr = ImplicitCastExpr::Create(Context, Ty, Kind, Expr, BasePath, Category); + Expr = ImplicitCastExpr::Create(Context, Ty, Kind, Expr, BasePath, VK); } -ImplicitCastExpr::ResultCategory Sema::CastCategory(Expr *E) { +ExprValueKind Sema::CastCategory(Expr *E) { Expr::Classification Classification = E->Classify(Context); - return Classification.isRValue() ? - ImplicitCastExpr::RValue : - (Classification.isLValue() ? - ImplicitCastExpr::LValue : - ImplicitCastExpr::XValue); + return Classification.isRValue() ? VK_RValue : + (Classification.isLValue() ? VK_LValue : VK_XValue); } void Sema::DeleteExpr(ExprTy *E) { diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 7ea96f4014e..271a02dc11b 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -555,7 +555,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { // pass in 42. The 42 gets converted to char. This is even more strange // for things like 45.123 -> char, etc. // FIXME: Do this check. - ImpCastExprToType(Arg, ValType, Kind, ImplicitCastExpr::RValue, &BasePath); + ImpCastExprToType(Arg, ValType, Kind, VK_RValue, &BasePath); TheCall->setArg(i+1, Arg); } @@ -1966,7 +1966,7 @@ do { switch (E->getStmtClass()) { case Stmt::ImplicitCastExprClass: { ImplicitCastExpr *IE = cast<ImplicitCastExpr>(E); - if (IE->getCategory() == ImplicitCastExpr::LValue) { + if (IE->getValueKind() == VK_LValue) { E = IE->getSubExpr(); continue; } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 659c0d1a92b..9b6680f312d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -7085,7 +7085,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, CastExpr::CK_IntegralCast, ECD->getInitExpr(), /*base paths*/ 0, - ImplicitCastExpr::RValue)); + VK_RValue)); if (getLangOptions().CPlusPlus) // C++ [dcl.enum]p4: Following the closing brace of an // enum-specifier, each enumerator has the type of its diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 7761ac910ed..dbf22eba500 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1540,7 +1540,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, BasePath.push_back(BaseSpec); SemaRef.ImpCastExprToType(CopyCtorArg, ArgTy, CastExpr::CK_UncheckedDerivedToBase, - ImplicitCastExpr::LValue, &BasePath); + VK_LValue, &BasePath); InitializationKind InitKind = InitializationKind::CreateDirect(Constructor->getLocation(), @@ -4979,25 +4979,25 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, // appropriately-qualified base type. Expr *From = OtherRef->Retain(); ImpCastExprToType(From, Context.getQualifiedType(BaseType, OtherQuals), - CastExpr::CK_UncheckedDerivedToBase, - ImplicitCastExpr::LValue, &BasePath); + CK_UncheckedDerivedToBase, + VK_LValue, &BasePath); // Dereference "this". - ExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This); + ExprResult To = CreateBuiltinUnaryOp(Loc, UO_Deref, This); // Implicitly cast "this" to the appropriately-qualified base type. Expr *ToE = To.takeAs<Expr>(); ImpCastExprToType(ToE, Context.getCVRQualifiedType(BaseType, CopyAssignOperator->getTypeQualifiers()), - CastExpr::CK_UncheckedDerivedToBase, - ImplicitCastExpr::LValue, &BasePath); + CK_UncheckedDerivedToBase, + VK_LValue, &BasePath); To = Owned(ToE); // Build the copy. StmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType, - To.get(), From, - /*CopyingBaseSubobject=*/true); + To.get(), From, + /*CopyingBaseSubobject=*/true); if (Copy.isInvalid()) { Diag(CurrentLocation, diag::note_member_synthesized_at) << CXXCopyAssignment << Context.getTagDeclType(ClassDecl); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 197c44dfa47..c8e8ecda861 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1480,7 +1480,7 @@ Sema::PerformObjectMemberConversion(Expr *&From, SourceRange FromRange = From->getSourceRange(); SourceLocation FromLoc = FromRange.getBegin(); - ImplicitCastExpr::ResultCategory Category = CastCategory(From); + ExprValueKind VK = CastCategory(From); // C++ [class.member.lookup]p8: // [...] Ambiguities can often be resolved by qualifying a name with its @@ -1518,8 +1518,8 @@ Sema::PerformObjectMemberConversion(Expr *&From, if (PointerConversions) QType = Context.getPointerType(QType); - ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase, - Category, &BasePath); + ImpCastExprToType(From, QType, CK_UncheckedDerivedToBase, + VK, &BasePath); FromType = QType; FromRecordType = QRecordType; @@ -1556,7 +1556,7 @@ Sema::PerformObjectMemberConversion(Expr *&From, if (PointerConversions) UType = Context.getPointerType(UType); ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase, - Category, &BasePath); + VK, &BasePath); FromType = UType; FromRecordType = URecordType; } @@ -1573,7 +1573,7 @@ Sema::PerformObjectMemberConversion(Expr *&From, return true; ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase, - Category, &BasePath); + VK, &BasePath); return false; } diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index afca7dc7da8..6b54e2e6718 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1841,7 +1841,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, CXXCastPath BasePath; if (CheckPointerConversion(From, ToType, Kind, BasePath, IgnoreBaseAccess)) return true; - ImpCastExprToType(From, ToType, Kind, ImplicitCastExpr::RValue, &BasePath); + ImpCastExprToType(From, ToType, Kind, VK_RValue, &BasePath); break; } @@ -1853,7 +1853,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, return true; if (CheckExceptionSpecCompatibility(From, ToType)) return true; - ImpCastExprToType(From, ToType, Kind, ImplicitCastExpr::RValue, &BasePath); + ImpCastExprToType(From, ToType, Kind, VK_RValue, &BasePath); break; } case ICK_Boolean_Conversion: { @@ -1910,10 +1910,10 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, case ICK_Qualification: { // The qualification keeps the category of the inner expression, unless the // target type isn't a reference. - ImplicitCastExpr::ResultCategory Category = ToType->isReferenceType() ? - CastCategory(From) : ImplicitCastExpr::RValue; + ExprValueKind VK = ToType->isReferenceType() ? + CastCategory(From) : VK_RValue; ImpCastExprToType(From, ToType.getNonLValueExprType(Context), - CastExpr::CK_NoOp, Category); + CastExpr::CK_NoOp, VK); if (SCS.DeprecatedStringLiteralToCharPtr) Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion) @@ -2007,13 +2007,12 @@ QualType Sema::CheckPointerToMemberOperands( } // Cast LHS to type of use. QualType UseType = isIndirect ? Context.getPointerType(Class) : Class; - ImplicitCastExpr::ResultCategory Category = - isIndirect ? ImplicitCastExpr::RValue : CastCategory(lex); + ExprValueKind VK = + isIndirect ? VK_RValue : CastCategory(lex); CXXCastPath BasePath; BuildBasePathArray(Paths, BasePath); - ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, Category, - &BasePath); + ImpCastExprToType(lex, UseType, CK_DerivedToBase, VK, &BasePath); } if (isa<CXXScalarValueInitExpr>(rex->IgnoreParens())) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 034099eac43..57a1874ed47 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2095,12 +2095,12 @@ void InitializationSequence::AddAddressOverloadResolutionStep( } void InitializationSequence::AddDerivedToBaseCastStep(QualType BaseType, - ImplicitCastExpr::ResultCategory Category) { + ExprValueKind VK) { Step S; - switch (Category) { - case ImplicitCastExpr::RValue: S.Kind = SK_CastDerivedToBaseRValue; break; - case ImplicitCastExpr::XValue: S.Kind = SK_CastDerivedToBaseXValue; break; - case ImplicitCastExpr::LValue: S.Kind = SK_CastDerivedToBaseLValue; break; + switch (VK) { + case VK_RValue: S.Kind = SK_CastDerivedToBaseRValue; break; + case VK_XValue: S.Kind = SK_CastDerivedToBaseXValue; break; + case VK_LValue: S.Kind = SK_CastDerivedToBaseLValue; break; default: llvm_unreachable("No such category"); } S.Type = BaseType; @@ -2134,19 +2134,18 @@ void InitializationSequence::AddUserConversionStep(FunctionDecl *Function, } void InitializationSequence::AddQualificationConversionStep(QualType Ty, - ImplicitCastExpr::ResultCategory Category) { + ExprValueKind VK) { Step S; - switch (Category) { - case ImplicitCastExpr::RValue: + switch (VK) { + case VK_RValue: S.Kind = SK_QualificationConversionRValue; break; - case ImplicitCastExpr::XValue: + case VK_XValue: S.Kind = SK_QualificationConversionXValue; break; - case ImplicitCastExpr::LValue: + case VK_LValue: S.Kind = SK_QualificationConversionLValue; break; - default: llvm_unreachable("No such category"); } S.Type = Ty; Steps.push_back(S); @@ -2409,12 +2408,11 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, // Determine whether we need to perform derived-to-base or // cv-qualification adjustments. - ImplicitCastExpr::ResultCategory Category = ImplicitCastExpr::RValue; + ExprValueKind VK = VK_RValue; if (T2->isLValueReferenceType()) - Category = ImplicitCastExpr::LValue; + VK = VK_LValue; else if (const RValueReferenceType *RRef = T2->getAs<RValueReferenceType>()) - Category = RRef->getPointeeType()->isFunctionType() ? - ImplicitCastExpr::LValue : ImplicitCastExpr::XValue; + VK = RRef->getPointeeType()->isFunctionType() ? VK_LValue : VK_XValue; bool NewDerivedToBase = false; bool NewObjCConversion = false; @@ -2436,14 +2434,14 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, Sequence.AddDerivedToBaseCastStep( S.Context.getQualifiedType(T1, T2.getNonReferenceType().getQualifiers()), - Category); + VK); else if (NewObjCConversion) Sequence.AddObjCObjectConversionStep( S.Context.getQualifiedType(T1, T2.getNonReferenceType().getQualifiers())); if (cv1T1.getQualifiers() != T2.getNonReferenceType().getQualifiers()) - Sequence.AddQualificationConversionStep(cv1T1, Category); + Sequence.AddQualificationConversionStep(cv1T1, VK); Sequence.AddReferenceBindingStep(cv1T1, !T2->isReferenceType()); return OR_Success; @@ -2520,13 +2518,13 @@ static void TryReferenceInitialization(Sema &S, if (DerivedToBase) Sequence.AddDerivedToBaseCastStep( S.Context.getQualifiedType(T1, T2Quals), - ImplicitCastExpr::LValue); + VK_LValue); else if (ObjCConversion) Sequence.AddObjCObjectConversionStep( S.Context.getQualifiedType(T1, T2Quals)); if (T1Quals != T2Quals) - Sequence.AddQualificationConversionStep(cv1T1,ImplicitCastExpr::LValue); + Sequence.AddQualificationConversionStep(cv1T1, VK_LValue); bool BindingTemporary = T1Quals.hasConst() && !T1Quals.hasVolatile() && (Initializer->getBitField() || Initializer->refersToVectorElement()); Sequence.AddReferenceBindingStep(cv1T1, BindingTemporary); @@ -2603,16 +2601,14 @@ static void TryReferenceInitialization(Sema &S, if (DerivedToBase) Sequence.AddDerivedToBaseCastStep( S.Context.getQualifiedType(T1, T2Quals), - isXValue ? ImplicitCastExpr::XValue - : ImplicitCastExpr::RValue); + isXValue ? VK_XValue : VK_RValue); else if (ObjCConversion) Sequence.AddObjCObjectConversionStep( S.Context.getQualifiedType(T1, T2Quals)); if (T1Quals != T2Quals) Sequence.AddQualificationConversionStep(cv1T1, - isXValue ? ImplicitCastExpr::XValue - : ImplicitCastExpr::RValue); + isXValue ? VK_XValue : VK_RValue); Sequence.AddReferenceBindingStep(cv1T1, /*bindingTemporary=*/!isXValue); return; } @@ -3617,17 +3613,17 @@ InitializationSequence::Perform(Sema &S, cast<CXXRecordDecl>(RecordTy->getDecl())); } - ImplicitCastExpr::ResultCategory Category = + ExprValueKind VK = Step->Kind == SK_CastDerivedToBaseLValue ? - ImplicitCastExpr::LValue : + VK_LValue : (Step->Kind == SK_CastDerivedToBaseXValue ? - ImplicitCastExpr::XValue : - ImplicitCastExpr::RValue); + VK_XValue : + VK_RValue); CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type, CastExpr::CK_DerivedToBase, - (Expr*)CurInit.release(), - &BasePath, Category)); + CurInit.get(), + &BasePath, VK)); break; } @@ -3765,7 +3761,7 @@ InitializationSequence::Perform(Sema &S, CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, CurInitExpr->getType(), CastKind, CurInitExpr, 0, - IsLvalue ? ImplicitCastExpr::LValue : ImplicitCastExpr::RValue)); + IsLvalue ? VK_LValue : VK_RValue)); if (RequiresCopy) CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity, @@ -3778,13 +3774,13 @@ InitializationSequence::Perform(Sema &S, case SK_QualificationConversionXValue: case SK_QualificationConversionRValue: { // Perform a qualification conversion; these can never go wrong. - ImplicitCastExpr::ResultCategory Category = + ExprValueKind VK = Step->Kind == SK_QualificationConversionLValue ? - ImplicitCastExpr::LValue : + VK_LValue : (Step->Kind == SK_QualificationConversionXValue ? - ImplicitCastExpr::XValue : - ImplicitCastExpr::RValue); - S.ImpCastExprToType(CurInitExpr, Step->Type, CastExpr::CK_NoOp, Category); + VK_XValue : + VK_RValue); + S.ImpCastExprToType(CurInitExpr, Step->Type, CastExpr::CK_NoOp, VK); CurInit.release(); CurInit = S.Owned(CurInitExpr); break; diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index bb291bb4535..0645d97617e 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -3161,8 +3161,7 @@ Sema::PerformObjectArgumentInitialization(Expr *&From, if (!Context.hasSameType(From->getType(), DestType)) ImpCastExprToType(From, DestType, CastExpr::CK_NoOp, - From->getType()->isPointerType() ? - ImplicitCastExpr::RValue : ImplicitCastExpr::LValue); + From->getType()->isPointerType() ? VK_RValue : VK_LValue); return false; } @@ -3848,7 +3847,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion, ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack, Context.getPointerType(Conversion->getType()), CastExpr::CK_FunctionToPointerDecay, - &ConversionRef, ImplicitCastExpr::RValue); + &ConversionRef, VK_RValue); // Note that it is safe to allocate CallExpr on the stack here because // there are 0 arguments (i.e., nothing is allocated using ASTContext's @@ -7790,7 +7789,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found, return ImplicitCastExpr::Create(Context, ICE->getType(), ICE->getCastKind(), SubExpr, 0, - ICE->getCategory()); + ICE->getValueKind()); } if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(E)) { diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index cd1105f3363..ff2d39e6ec7 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -598,7 +598,7 @@ void ASTStmtReader::VisitConditionalOperator(ConditionalOperator *E) { void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) { VisitCastExpr(E); - E->setCategory(static_cast<ImplicitCastExpr::ResultCategory>(Record[Idx++])); + E->setValueKind(static_cast<ExprValueKind>(Record[Idx++])); } void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) { diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 1bb9d1934fa..4bde550e0d7 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -605,7 +605,7 @@ void ASTStmtWriter::VisitConditionalOperator(ConditionalOperator *E) { void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) { VisitCastExpr(E); - Record.push_back(E->getCategory()); + Record.push_back(E->getValueKind()); Code = serialization::EXPR_IMPLICIT_CAST; } |