diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
commit | 5ffd83dbcc34f10e07f6d3e968ae6365869615f4 (patch) | |
tree | 0e9f5cf729dde39f949698fddef45a34e2bc7f44 /contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp | |
parent | 1799696096df87b52968b8996d00c91e0a5de8d9 (diff) | |
parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
download | src-5ffd83dbcc34f10e07f6d3e968ae6365869615f4.tar.gz src-5ffd83dbcc34f10e07f6d3e968ae6365869615f4.zip |
Notes
Diffstat (limited to 'contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp b/contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp index 5587e0d24c7f..d17599a6ed14 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaPseudoObject.cpp @@ -127,12 +127,10 @@ namespace { if (UnaryOperator *uop = dyn_cast<UnaryOperator>(e)) { assert(uop->getOpcode() == UO_Extension); e = rebuild(uop->getSubExpr()); - return new (S.Context) UnaryOperator(e, uop->getOpcode(), - uop->getType(), - uop->getValueKind(), - uop->getObjectKind(), - uop->getOperatorLoc(), - uop->canOverflow()); + return UnaryOperator::Create( + S.Context, e, uop->getOpcode(), uop->getType(), uop->getValueKind(), + uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow(), + S.CurFPFeatureOverrides()); } if (GenericSelectionExpr *gse = dyn_cast<GenericSelectionExpr>(e)) { @@ -167,16 +165,11 @@ namespace { Expr *&rebuiltExpr = ce->isConditionTrue() ? LHS : RHS; rebuiltExpr = rebuild(rebuiltExpr); - return new (S.Context) ChooseExpr(ce->getBuiltinLoc(), - ce->getCond(), - LHS, RHS, - rebuiltExpr->getType(), - rebuiltExpr->getValueKind(), - rebuiltExpr->getObjectKind(), - ce->getRParenLoc(), - ce->isConditionTrue(), - rebuiltExpr->isTypeDependent(), - rebuiltExpr->isValueDependent()); + return new (S.Context) + ChooseExpr(ce->getBuiltinLoc(), ce->getCond(), LHS, RHS, + rebuiltExpr->getType(), rebuiltExpr->getValueKind(), + rebuiltExpr->getObjectKind(), ce->getRParenLoc(), + ce->isConditionTrue()); } llvm_unreachable("bad expression to rebuild!"); @@ -453,11 +446,11 @@ PseudoOpBuilder::buildAssignmentOperation(Scope *Sc, SourceLocation opcLoc, ExprResult result; if (opcode == BO_Assign) { result = semanticRHS; - syntactic = new (S.Context) BinaryOperator(syntacticLHS, capturedRHS, - opcode, capturedRHS->getType(), - capturedRHS->getValueKind(), - OK_Ordinary, opcLoc, - FPOptions()); + syntactic = BinaryOperator::Create(S.Context, syntacticLHS, capturedRHS, + opcode, capturedRHS->getType(), + capturedRHS->getValueKind(), OK_Ordinary, + opcLoc, S.CurFPFeatureOverrides()); + } else { ExprResult opLHS = buildGet(); if (opLHS.isInvalid()) return ExprError(); @@ -468,14 +461,11 @@ PseudoOpBuilder::buildAssignmentOperation(Scope *Sc, SourceLocation opcLoc, result = S.BuildBinOp(Sc, opcLoc, nonCompound, opLHS.get(), semanticRHS); if (result.isInvalid()) return ExprError(); - syntactic = - new (S.Context) CompoundAssignOperator(syntacticLHS, capturedRHS, opcode, - result.get()->getType(), - result.get()->getValueKind(), - OK_Ordinary, - opLHS.get()->getType(), - result.get()->getType(), - opcLoc, FPOptions()); + syntactic = CompoundAssignOperator::Create( + S.Context, syntacticLHS, capturedRHS, opcode, result.get()->getType(), + result.get()->getValueKind(), OK_Ordinary, opcLoc, + S.CurFPFeatureOverrides(), opLHS.get()->getType(), + result.get()->getType()); } // The result of the assignment, if not void, is the value set into @@ -536,12 +526,14 @@ PseudoOpBuilder::buildIncDecOperation(Scope *Sc, SourceLocation opcLoc, (result.get()->isTypeDependent() || CanCaptureValue(result.get()))) setResultToLastSemantic(); - UnaryOperator *syntactic = new (S.Context) UnaryOperator( - syntacticOp, opcode, resultType, VK_LValue, OK_Ordinary, opcLoc, - !resultType->isDependentType() - ? S.Context.getTypeSize(resultType) >= - S.Context.getTypeSize(S.Context.IntTy) - : false); + UnaryOperator *syntactic = + UnaryOperator::Create(S.Context, syntacticOp, opcode, resultType, + VK_LValue, OK_Ordinary, opcLoc, + !resultType->isDependentType() + ? S.Context.getTypeSize(resultType) >= + S.Context.getTypeSize(S.Context.IntTy) + : false, + S.CurFPFeatureOverrides()); return complete(syntactic); } @@ -590,7 +582,7 @@ bool ObjCPropertyOpBuilder::isWeakProperty() const { QualType T; if (RefExpr->isExplicitProperty()) { const ObjCPropertyDecl *Prop = RefExpr->getExplicitProperty(); - if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak) + if (Prop->getPropertyAttributes() & ObjCPropertyAttribute::kind_weak) return true; T = Prop->getType(); @@ -1561,8 +1553,9 @@ ExprResult Sema::checkPseudoObjectIncDec(Scope *Sc, SourceLocation opcLoc, UnaryOperatorKind opcode, Expr *op) { // Do nothing if the operand is dependent. if (op->isTypeDependent()) - return new (Context) UnaryOperator(op, opcode, Context.DependentTy, - VK_RValue, OK_Ordinary, opcLoc, false); + return UnaryOperator::Create(Context, op, opcode, Context.DependentTy, + VK_RValue, OK_Ordinary, opcLoc, false, + CurFPFeatureOverrides()); assert(UnaryOperator::isIncrementDecrementOp(opcode)); Expr *opaqueRef = op->IgnoreParens(); @@ -1591,9 +1584,9 @@ ExprResult Sema::checkPseudoObjectAssignment(Scope *S, SourceLocation opcLoc, Expr *LHS, Expr *RHS) { // Do nothing if either argument is dependent. if (LHS->isTypeDependent() || RHS->isTypeDependent()) - return new (Context) BinaryOperator(LHS, RHS, opcode, Context.DependentTy, - VK_RValue, OK_Ordinary, opcLoc, - FPOptions()); + return BinaryOperator::Create(Context, LHS, RHS, opcode, + Context.DependentTy, VK_RValue, OK_Ordinary, + opcLoc, CurFPFeatureOverrides()); // Filter out non-overload placeholder types in the RHS. if (RHS->getType()->isNonOverloadPlaceholderType()) { @@ -1646,28 +1639,30 @@ Expr *Sema::recreateSyntacticForm(PseudoObjectExpr *E) { Expr *syntax = E->getSyntacticForm(); if (UnaryOperator *uop = dyn_cast<UnaryOperator>(syntax)) { Expr *op = stripOpaqueValuesFromPseudoObjectRef(*this, uop->getSubExpr()); - return new (Context) UnaryOperator( - op, uop->getOpcode(), uop->getType(), uop->getValueKind(), - uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow()); + return UnaryOperator::Create(Context, op, uop->getOpcode(), uop->getType(), + uop->getValueKind(), uop->getObjectKind(), + uop->getOperatorLoc(), uop->canOverflow(), + CurFPFeatureOverrides()); } else if (CompoundAssignOperator *cop = dyn_cast<CompoundAssignOperator>(syntax)) { Expr *lhs = stripOpaqueValuesFromPseudoObjectRef(*this, cop->getLHS()); Expr *rhs = cast<OpaqueValueExpr>(cop->getRHS())->getSourceExpr(); - return new (Context) CompoundAssignOperator(lhs, rhs, cop->getOpcode(), - cop->getType(), - cop->getValueKind(), - cop->getObjectKind(), - cop->getComputationLHSType(), - cop->getComputationResultType(), - cop->getOperatorLoc(), - FPOptions()); + return CompoundAssignOperator::Create( + Context, lhs, rhs, cop->getOpcode(), cop->getType(), + cop->getValueKind(), cop->getObjectKind(), cop->getOperatorLoc(), + CurFPFeatureOverrides(), cop->getComputationLHSType(), + cop->getComputationResultType()); + } else if (BinaryOperator *bop = dyn_cast<BinaryOperator>(syntax)) { Expr *lhs = stripOpaqueValuesFromPseudoObjectRef(*this, bop->getLHS()); Expr *rhs = cast<OpaqueValueExpr>(bop->getRHS())->getSourceExpr(); - return new (Context) BinaryOperator(lhs, rhs, bop->getOpcode(), - bop->getType(), bop->getValueKind(), - bop->getObjectKind(), - bop->getOperatorLoc(), FPOptions()); + return BinaryOperator::Create(Context, lhs, rhs, bop->getOpcode(), + bop->getType(), bop->getValueKind(), + bop->getObjectKind(), bop->getOperatorLoc(), + CurFPFeatureOverrides()); + + } else if (isa<CallExpr>(syntax)) { + return syntax; } else { assert(syntax->hasPlaceholderType(BuiltinType::PseudoObject)); return stripOpaqueValuesFromPseudoObjectRef(*this, syntax); |