2929//
3030// ===----------------------------------------------------------------------===//
3131
32+ #include " clang/Sema/SemaPseudoObject.h"
3233#include " clang/AST/ExprCXX.h"
3334#include " clang/AST/ExprObjC.h"
3435#include " clang/Basic/CharInfo.h"
@@ -1446,73 +1447,73 @@ ExprResult MSPropertyOpBuilder::buildSet(Expr *op, SourceLocation sl,
14461447// General Sema routines.
14471448// ===----------------------------------------------------------------------===//
14481449
1449- ExprResult Sema::checkPseudoObjectRValue (Expr *E) {
1450+ ExprResult SemaPseudoObject::checkRValue (Expr *E) {
14501451 Expr *opaqueRef = E->IgnoreParens ();
14511452 if (ObjCPropertyRefExpr *refExpr
14521453 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1453- ObjCPropertyOpBuilder builder (* this , refExpr, true );
1454+ ObjCPropertyOpBuilder builder (SemaRef , refExpr, true );
14541455 return builder.buildRValueOperation (E);
14551456 }
14561457 else if (ObjCSubscriptRefExpr *refExpr
14571458 = dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1458- ObjCSubscriptOpBuilder builder (* this , refExpr, true );
1459+ ObjCSubscriptOpBuilder builder (SemaRef , refExpr, true );
14591460 return builder.buildRValueOperation (E);
14601461 } else if (MSPropertyRefExpr *refExpr
14611462 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1462- MSPropertyOpBuilder builder (* this , refExpr, true );
1463+ MSPropertyOpBuilder builder (SemaRef , refExpr, true );
14631464 return builder.buildRValueOperation (E);
14641465 } else if (MSPropertySubscriptExpr *RefExpr =
14651466 dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1466- MSPropertyOpBuilder Builder (* this , RefExpr, true );
1467+ MSPropertyOpBuilder Builder (SemaRef , RefExpr, true );
14671468 return Builder.buildRValueOperation (E);
14681469 } else {
14691470 llvm_unreachable (" unknown pseudo-object kind!" );
14701471 }
14711472}
14721473
14731474// / Check an increment or decrement of a pseudo-object expression.
1474- ExprResult Sema::checkPseudoObjectIncDec (Scope *Sc, SourceLocation opcLoc,
1475+ ExprResult SemaPseudoObject::checkIncDec (Scope *Sc, SourceLocation opcLoc,
14751476 UnaryOperatorKind opcode, Expr *op) {
14761477 // Do nothing if the operand is dependent.
14771478 if (op->isTypeDependent ())
1478- return UnaryOperator::Create (Context, op, opcode, Context. DependentTy ,
1479- VK_PRValue, OK_Ordinary, opcLoc, false ,
1480- CurFPFeatureOverrides ());
1479+ return UnaryOperator::Create (
1480+ SemaRef. Context , op, opcode, SemaRef. Context . DependentTy , VK_PRValue ,
1481+ OK_Ordinary, opcLoc, false , SemaRef. CurFPFeatureOverrides ());
14811482
14821483 assert (UnaryOperator::isIncrementDecrementOp (opcode));
14831484 Expr *opaqueRef = op->IgnoreParens ();
14841485 if (ObjCPropertyRefExpr *refExpr
14851486 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1486- ObjCPropertyOpBuilder builder (* this , refExpr, false );
1487+ ObjCPropertyOpBuilder builder (SemaRef , refExpr, false );
14871488 return builder.buildIncDecOperation (Sc, opcLoc, opcode, op);
14881489 } else if (isa<ObjCSubscriptRefExpr>(opaqueRef)) {
14891490 Diag (opcLoc, diag::err_illegal_container_subscripting_op);
14901491 return ExprError ();
14911492 } else if (MSPropertyRefExpr *refExpr
14921493 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1493- MSPropertyOpBuilder builder (* this , refExpr, false );
1494+ MSPropertyOpBuilder builder (SemaRef , refExpr, false );
14941495 return builder.buildIncDecOperation (Sc, opcLoc, opcode, op);
14951496 } else if (MSPropertySubscriptExpr *RefExpr
14961497 = dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1497- MSPropertyOpBuilder Builder (* this , RefExpr, false );
1498+ MSPropertyOpBuilder Builder (SemaRef , RefExpr, false );
14981499 return Builder.buildIncDecOperation (Sc, opcLoc, opcode, op);
14991500 } else {
15001501 llvm_unreachable (" unknown pseudo-object kind!" );
15011502 }
15021503}
15031504
1504- ExprResult Sema::checkPseudoObjectAssignment (Scope *S, SourceLocation opcLoc,
1505+ ExprResult SemaPseudoObject::checkAssignment (Scope *S, SourceLocation opcLoc,
15051506 BinaryOperatorKind opcode,
15061507 Expr *LHS, Expr *RHS) {
15071508 // Do nothing if either argument is dependent.
15081509 if (LHS->isTypeDependent () || RHS->isTypeDependent ())
1509- return BinaryOperator::Create (Context, LHS, RHS, opcode,
1510- Context.DependentTy , VK_PRValue, OK_Ordinary ,
1511- opcLoc, CurFPFeatureOverrides ());
1510+ return BinaryOperator::Create (
1511+ SemaRef. Context , LHS, RHS, opcode, SemaRef. Context .DependentTy ,
1512+ VK_PRValue, OK_Ordinary, opcLoc, SemaRef. CurFPFeatureOverrides ());
15121513
15131514 // Filter out non-overload placeholder types in the RHS.
15141515 if (RHS->getType ()->isNonOverloadPlaceholderType ()) {
1515- ExprResult result = CheckPlaceholderExpr (RHS);
1516+ ExprResult result = SemaRef. CheckPlaceholderExpr (RHS);
15161517 if (result.isInvalid ()) return ExprError ();
15171518 RHS = result.get ();
15181519 }
@@ -1521,20 +1522,20 @@ ExprResult Sema::checkPseudoObjectAssignment(Scope *S, SourceLocation opcLoc,
15211522 Expr *opaqueRef = LHS->IgnoreParens ();
15221523 if (ObjCPropertyRefExpr *refExpr
15231524 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1524- ObjCPropertyOpBuilder builder (* this , refExpr, IsSimpleAssign);
1525+ ObjCPropertyOpBuilder builder (SemaRef , refExpr, IsSimpleAssign);
15251526 return builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
15261527 } else if (ObjCSubscriptRefExpr *refExpr
15271528 = dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1528- ObjCSubscriptOpBuilder builder (* this , refExpr, IsSimpleAssign);
1529+ ObjCSubscriptOpBuilder builder (SemaRef , refExpr, IsSimpleAssign);
15291530 return builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
15301531 } else if (MSPropertyRefExpr *refExpr
15311532 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1532- MSPropertyOpBuilder builder (* this , refExpr, IsSimpleAssign);
1533- return builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
1533+ MSPropertyOpBuilder builder (SemaRef , refExpr, IsSimpleAssign);
1534+ return builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
15341535 } else if (MSPropertySubscriptExpr *RefExpr
15351536 = dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1536- MSPropertyOpBuilder Builder (* this , RefExpr, IsSimpleAssign);
1537- return Builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
1537+ MSPropertyOpBuilder Builder (SemaRef , RefExpr, IsSimpleAssign);
1538+ return Builder.buildAssignmentOperation (S, opcLoc, opcode, LHS, RHS);
15381539 } else {
15391540 llvm_unreachable (" unknown pseudo-object kind!" );
15401541 }
@@ -1557,36 +1558,38 @@ static Expr *stripOpaqueValuesFromPseudoObjectRef(Sema &S, Expr *E) {
15571558// / This is a hack which should be removed when TreeTransform is
15581559// / capable of rebuilding a tree without stripping implicit
15591560// / operations.
1560- Expr *Sema ::recreateSyntacticForm (PseudoObjectExpr *E) {
1561+ Expr *SemaPseudoObject ::recreateSyntacticForm (PseudoObjectExpr *E) {
15611562 Expr *syntax = E->getSyntacticForm ();
15621563 if (UnaryOperator *uop = dyn_cast<UnaryOperator>(syntax)) {
1563- Expr *op = stripOpaqueValuesFromPseudoObjectRef (* this , uop->getSubExpr ());
1564- return UnaryOperator::Create (Context, op, uop-> getOpcode (), uop-> getType (),
1565- uop->getValueKind (), uop->getObjectKind (),
1566- uop->getOperatorLoc (), uop->canOverflow (),
1567- CurFPFeatureOverrides ());
1564+ Expr *op = stripOpaqueValuesFromPseudoObjectRef (SemaRef , uop->getSubExpr ());
1565+ return UnaryOperator::Create (
1566+ SemaRef. Context , op, uop->getOpcode (), uop->getType (),
1567+ uop-> getValueKind (), uop->getObjectKind (), uop->getOperatorLoc (),
1568+ uop-> canOverflow (), SemaRef. CurFPFeatureOverrides ());
15681569 } else if (CompoundAssignOperator *cop
15691570 = dyn_cast<CompoundAssignOperator>(syntax)) {
1570- Expr *lhs = stripOpaqueValuesFromPseudoObjectRef (* this , cop->getLHS ());
1571+ Expr *lhs = stripOpaqueValuesFromPseudoObjectRef (SemaRef , cop->getLHS ());
15711572 Expr *rhs = cast<OpaqueValueExpr>(cop->getRHS ())->getSourceExpr ();
15721573 return CompoundAssignOperator::Create (
1573- Context, lhs, rhs, cop->getOpcode (), cop->getType (),
1574+ SemaRef. Context , lhs, rhs, cop->getOpcode (), cop->getType (),
15741575 cop->getValueKind (), cop->getObjectKind (), cop->getOperatorLoc (),
1575- CurFPFeatureOverrides (), cop->getComputationLHSType (),
1576+ SemaRef. CurFPFeatureOverrides (), cop->getComputationLHSType (),
15761577 cop->getComputationResultType ());
15771578
15781579 } else if (BinaryOperator *bop = dyn_cast<BinaryOperator>(syntax)) {
1579- Expr *lhs = stripOpaqueValuesFromPseudoObjectRef (* this , bop->getLHS ());
1580+ Expr *lhs = stripOpaqueValuesFromPseudoObjectRef (SemaRef , bop->getLHS ());
15801581 Expr *rhs = cast<OpaqueValueExpr>(bop->getRHS ())->getSourceExpr ();
1581- return BinaryOperator::Create (Context, lhs, rhs, bop->getOpcode (),
1582+ return BinaryOperator::Create (SemaRef. Context , lhs, rhs, bop->getOpcode (),
15821583 bop->getType (), bop->getValueKind (),
15831584 bop->getObjectKind (), bop->getOperatorLoc (),
1584- CurFPFeatureOverrides ());
1585+ SemaRef. CurFPFeatureOverrides ());
15851586
15861587 } else if (isa<CallExpr>(syntax)) {
15871588 return syntax;
15881589 } else {
15891590 assert (syntax->hasPlaceholderType (BuiltinType::PseudoObject));
1590- return stripOpaqueValuesFromPseudoObjectRef (* this , syntax);
1591+ return stripOpaqueValuesFromPseudoObjectRef (SemaRef , syntax);
15911592 }
15921593}
1594+
1595+ SemaPseudoObject::SemaPseudoObject (Sema &S) : SemaBase(S) {}
0 commit comments