39 #include "llvm/ADT/SmallString.h"
41 using namespace clang;
48 unsigned MSPropertySubscriptCount;
50 const SpecificRebuilderRefTy &SpecificCallback;
51 Rebuilder(
Sema &S,
const SpecificRebuilderRefTy &SpecificCallback)
52 : S(S), MSPropertySubscriptCount(0),
53 SpecificCallback(SpecificCallback) {}
97 auto *NewBase = rebuild(refExpr->
getBase());
98 ++MSPropertySubscriptCount;
101 SpecificCallback(refExpr->
getIdx(), MSPropertySubscriptCount),
108 if (
auto *PRE = dyn_cast<ObjCPropertyRefExpr>(e))
109 return rebuildObjCPropertyRefExpr(PRE);
110 if (
auto *SRE = dyn_cast<ObjCSubscriptRefExpr>(e))
111 return rebuildObjCSubscriptRefExpr(SRE);
112 if (
auto *MSPRE = dyn_cast<MSPropertyRefExpr>(e))
113 return rebuildMSPropertyRefExpr(MSPRE);
114 if (
auto *MSPSE = dyn_cast<MSPropertySubscriptExpr>(e))
115 return rebuildMSPropertySubscriptExpr(MSPSE);
120 if (
ParenExpr *parens = dyn_cast<ParenExpr>(e)) {
121 e = rebuild(parens->getSubExpr());
128 assert(uop->getOpcode() == UO_Extension);
129 e = rebuild(uop->getSubExpr());
131 S.
Context, e, uop->getOpcode(), uop->getType(), uop->getValueKind(),
132 uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow(),
137 assert(!gse->isResultDependent());
138 unsigned resultIndex = gse->getResultIndex();
139 unsigned numAssocs = gse->getNumAssocs();
143 assocExprs.reserve(numAssocs);
144 assocTypes.reserve(numAssocs);
147 gse->associations()) {
148 Expr *assocExpr = assoc.getAssociationExpr();
149 if (assoc.isSelected())
150 assocExpr = rebuild(assocExpr);
151 assocExprs.push_back(assocExpr);
152 assocTypes.push_back(assoc.getTypeSourceInfo());
156 S.
Context, gse->getGenericLoc(), gse->getControllingExpr(),
157 assocTypes, assocExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
158 gse->containsUnexpandedParameterPack(), resultIndex);
161 if (
ChooseExpr *ce = dyn_cast<ChooseExpr>(e)) {
162 assert(!ce->isConditionDependent());
164 Expr *LHS = ce->getLHS(), *RHS = ce->getRHS();
165 Expr *&rebuiltExpr = ce->isConditionTrue() ? LHS : RHS;
166 rebuiltExpr = rebuild(rebuiltExpr);
169 ChooseExpr(ce->getBuiltinLoc(), ce->getCond(), LHS, RHS,
172 ce->isConditionTrue());
175 llvm_unreachable(
"bad expression to rebuild!");
179 class PseudoOpBuilder {
182 unsigned ResultIndex;
189 GenericLoc(genericLoc), IsUnique(IsUnique) {}
191 virtual ~PseudoOpBuilder() {}
194 void addSemanticExpr(
Expr *semantic) {
195 Semantics.push_back(semantic);
199 void addResultSemanticExpr(
Expr *resultExpr) {
201 ResultIndex = Semantics.size();
202 Semantics.push_back(resultExpr);
204 if (
auto *OVE = dyn_cast<OpaqueValueExpr>(Semantics.back()))
205 OVE->setIsUnique(
false);
222 void setResultToLastSemantic() {
224 ResultIndex = Semantics.size() - 1;
226 if (
auto *OVE = dyn_cast<OpaqueValueExpr>(Semantics.back()))
227 OVE->setIsUnique(
false);
231 static bool CanCaptureValue(
Expr *
exp) {
232 if (
exp->isGLValue())
239 return ClassDecl->isTriviallyCopyable();
243 virtual Expr *rebuildAndCaptureObject(
Expr *) = 0;
246 bool captureSetValueAsResult) = 0;
260 virtual bool captureSetValueAsResult()
const {
return true; }
264 class ObjCPropertyOpBuilder :
public PseudoOpBuilder {
276 : PseudoOpBuilder(S, refExpr->getLocation(), IsUnique),
277 RefExpr(refExpr), SyntacticRefExpr(nullptr),
278 InstanceReceiver(nullptr), Getter(nullptr), Setter(nullptr) {
291 bool findSetter(
bool warn=
true);
293 void DiagnoseUnsupportedPropertyUse();
295 Expr *rebuildAndCaptureObject(
Expr *syntacticBase)
override;
300 bool isWeakProperty()
const;
304 class ObjCSubscriptOpBuilder :
public PseudoOpBuilder {
316 : PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
317 RefExpr(refExpr), InstanceBase(nullptr), InstanceKey(nullptr),
318 AtIndexGetter(nullptr), AtIndexSetter(nullptr) {}
325 Expr *rebuildAndCaptureObject(
Expr *syntacticBase)
override;
327 bool findAtIndexGetter();
328 bool findAtIndexSetter();
334 class MSPropertyOpBuilder :
public PseudoOpBuilder {
343 : PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
344 RefExpr(refExpr), InstanceBase(nullptr) {}
346 : PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
347 InstanceBase(nullptr) {
348 RefExpr = getBaseMSProperty(refExpr);
351 Expr *rebuildAndCaptureObject(
Expr *)
override;
354 bool captureSetValueAsResult()
const override {
return false; }
369 addSemanticExpr(captured);
384 if (!isa<OpaqueValueExpr>(e)) {
386 setResultToLastSemantic();
394 assert(index < Semantics.size() &&
395 "captured expression not found in semantics!");
396 if (e == Semantics[index])
break;
400 cast<OpaqueValueExpr>(e)->setIsUnique(
false);
401 return cast<OpaqueValueExpr>(e);
407 Semantics, ResultIndex);
412 Expr *syntacticBase = rebuildAndCaptureObject(op);
416 addResultSemanticExpr(getExpr.
get());
418 return complete(syntacticBase);
429 Expr *syntacticLHS = rebuildAndCaptureObject(LHS);
438 Expr *semanticRHS = capturedRHS;
441 Semantics.pop_back();
447 if (opcode == BO_Assign) {
448 result = semanticRHS;
450 opcode, capturedRHS->
getType(),
461 result = S.
BuildBinOp(Sc, opcLoc, nonCompound, opLHS.
get(), semanticRHS);
465 S.
Context, syntacticLHS, capturedRHS, opcode, result.
get()->getType(),
468 result.
get()->getType());
473 result = buildSet(result.
get(), opcLoc, captureSetValueAsResult());
475 addSemanticExpr(result.
get());
476 if (!captureSetValueAsResult() && !result.
get()->getType()->isVoidType() &&
477 (result.
get()->isTypeDependent() || CanCaptureValue(result.
get())))
478 setResultToLastSemantic();
480 return complete(syntactic);
491 Expr *syntacticOp = rebuildAndCaptureObject(op);
501 (result.
get()->isTypeDependent() || CanCaptureValue(result.
get()))) {
502 result = capture(result.
get());
503 setResultToLastSemantic();
512 result = S.
BuildBinOp(Sc, opcLoc, BO_Add, result.
get(), one);
514 result = S.
BuildBinOp(Sc, opcLoc, BO_Sub, result.
get(), one);
521 captureSetValueAsResult());
523 addSemanticExpr(result.
get());
525 !result.
get()->getType()->isVoidType() &&
526 (result.
get()->isTypeDependent() || CanCaptureValue(result.
get())))
527 setResultToLastSemantic();
537 return complete(syntactic);
581 bool ObjCPropertyOpBuilder::isWeakProperty()
const {
583 if (RefExpr->isExplicitProperty()) {
590 T = Getter->getReturnType();
598 bool ObjCPropertyOpBuilder::findGetter() {
599 if (Getter)
return true;
602 if (RefExpr->isImplicitProperty()) {
603 if ((Getter = RefExpr->getImplicitPropertyGetter())) {
604 GetterSelector = Getter->getSelector();
610 assert(setter &&
"both setter and getter are null - cannot happen");
623 return (Getter !=
nullptr);
630 bool ObjCPropertyOpBuilder::findSetter(
bool warn) {
632 if (RefExpr->isImplicitProperty()) {
633 if (
ObjCMethodDecl *setter = RefExpr->getImplicitPropertySetter()) {
639 RefExpr->getImplicitPropertyGetter()->getSelector()
640 .getIdentifierInfoForSlot(0);
659 StringRef thisPropertyName = prop->
getName();
661 char front = thisPropertyName.front();
664 PropertyName[0] = front;
668 if (prop != prop1 && (prop1->getSetterMethodDecl() == setter)) {
669 S.
Diag(RefExpr->getExprLoc(), diag::err_property_setter_ambiguous_use)
672 S.
Diag(prop1->getLocation(), diag::note_property_declare);
687 void ObjCPropertyOpBuilder::DiagnoseUnsupportedPropertyUse() {
692 S.
Diag(RefExpr->getLocation(),
693 diag::err_property_function_in_objc_container);
700 Expr *ObjCPropertyOpBuilder::rebuildAndCaptureObject(
Expr *syntacticBase) {
701 assert(InstanceReceiver ==
nullptr);
705 if (RefExpr->isObjectReceiver()) {
706 InstanceReceiver = capture(RefExpr->getBase());
707 syntacticBase = Rebuilder(S, [=](
Expr *,
unsigned) ->
Expr * {
708 return InstanceReceiver;
709 }).rebuild(syntacticBase);
713 refE = dyn_cast<ObjCPropertyRefExpr>(syntacticBase->
IgnoreParens()))
714 SyntacticRefExpr = refE;
716 return syntacticBase;
720 ExprResult ObjCPropertyOpBuilder::buildGet() {
723 DiagnoseUnsupportedPropertyUse();
727 if (SyntacticRefExpr)
728 SyntacticRefExpr->setIsMessagingGetter();
731 if (!Getter->isImplicit())
735 if ((Getter->isInstanceMethod() && !RefExpr->isClassReceiver()) ||
736 RefExpr->isObjectReceiver()) {
737 assert(InstanceReceiver || RefExpr->isSuperReceiver());
739 GenericLoc, Getter->getSelector(),
743 GenericLoc, Getter->getSelector(),
754 bool captureSetValueAsResult) {
755 if (!findSetter(
false)) {
756 DiagnoseUnsupportedPropertyUse();
760 if (SyntacticRefExpr)
761 SyntacticRefExpr->setIsMessagingSetter();
769 QualType paramType = (*Setter->param_begin())->getType()
772 Setter->getDeclContext(),
785 assert(op &&
"successful assignment left argument invalid?");
790 Expr *args[] = { op };
794 if (!Setter->isImplicit())
796 if ((Setter->isInstanceMethod() && !RefExpr->isClassReceiver()) ||
797 RefExpr->isObjectReceiver()) {
799 GenericLoc, SetterSelector, Setter,
804 SetterSelector, Setter,
808 if (!msg.
isInvalid() && captureSetValueAsResult) {
810 cast<ObjCMessageExpr>(msg.
get()->IgnoreImplicit());
812 if (CanCaptureValue(
arg))
813 msgExpr->
setArg(0, captureValueAsResult(
arg));
820 ExprResult ObjCPropertyOpBuilder::buildRValueOperation(
Expr *op) {
823 if (RefExpr->isImplicitProperty() && !RefExpr->getImplicitPropertyGetter()) {
824 S.
Diag(RefExpr->getLocation(), diag::err_getter_not_found)
825 << RefExpr->getSourceRange();
829 ExprResult result = PseudoOpBuilder::buildRValueOperation(op);
832 if (RefExpr->isExplicitProperty() && !Getter->hasRelatedResultType())
834 Getter, RefExpr->getLocation());
838 if (RefExpr->isExplicitProperty() && result.
get()->isPRValue()) {
840 QualType propType = RefExpr->getExplicitProperty()
841 ->getUsageType(receiverType);
842 if (result.
get()->getType()->isObjCIdType()) {
845 if (!ptr->isObjCIdType())
851 RefExpr->getLocation()))
862 bool ObjCPropertyOpBuilder::tryBuildGetOfReference(
Expr *op,
875 QualType resultType = Getter->getReturnType();
878 result = buildRValueOperation(op);
884 ObjCPropertyOpBuilder::buildAssignmentOperation(
Scope *Sc,
894 if (tryBuildGetOfReference(LHS, result)) {
900 S.
Diag(opcLoc, diag::err_nosetter_property_assignment)
901 <<
unsigned(RefExpr->isImplicitProperty())
910 if (opcode != BO_Assign && !findGetter()) {
911 S.
Diag(opcLoc, diag::err_nogetter_property_compound_assignment)
917 PseudoOpBuilder::buildAssignmentOperation(Sc, opcLoc, opcode, LHS, RHS);
921 if (S.
getLangOpts().ObjCAutoRefCount && InstanceReceiver) {
938 if (tryBuildGetOfReference(op, result)) {
944 S.
Diag(opcLoc, diag::err_nosetter_property_incdec)
945 <<
unsigned(RefExpr->isImplicitProperty())
956 assert(RefExpr->isImplicitProperty());
957 S.
Diag(opcLoc, diag::err_nogetter_property_incdec)
964 return PseudoOpBuilder::buildIncDecOperation(Sc, opcLoc, opcode, op);
972 SyntacticRefExpr->isMessagingGetter());
974 return PseudoOpBuilder::complete(SyntacticForm);
984 ExprResult ObjCSubscriptOpBuilder::buildRValueOperation(
Expr *op) {
985 ExprResult result = PseudoOpBuilder::buildRValueOperation(op);
992 ObjCSubscriptOpBuilder::buildAssignmentOperation(
Scope *Sc,
998 if (!findAtIndexSetter())
1002 if (opcode != BO_Assign && !findAtIndexGetter())
1006 PseudoOpBuilder::buildAssignmentOperation(Sc, opcLoc, opcode, LHS, RHS);
1010 if (S.
getLangOpts().ObjCAutoRefCount && InstanceBase) {
1019 Expr *ObjCSubscriptOpBuilder::rebuildAndCaptureObject(
Expr *syntacticBase) {
1020 assert(InstanceBase ==
nullptr);
1024 InstanceBase = capture(RefExpr->getBaseExpr());
1025 InstanceKey = capture(RefExpr->getKeyExpr());
1028 Rebuilder(S, [=](
Expr *,
unsigned Idx) ->
Expr * {
1031 return InstanceBase;
1035 llvm_unreachable(
"Unexpected index for ObjCSubscriptExpr");
1037 }).rebuild(syntacticBase);
1039 return syntacticBase;
1058 return OS_Dictionary;
1059 if (!getLangOpts().CPlusPlus ||
1063 if (isa<StringLiteral>(IndexExpr))
1067 Diag(FromE->
getExprLoc(), diag::err_objc_subscript_type_conversion)
1073 if (RequireCompleteType(FromE->
getExprLoc(), T,
1074 diag::err_objc_index_incomplete_class_type, FromE))
1079 int NoIntegrals=0, NoObjCIdPointers=0;
1083 ->getVisibleConversionFunctions()) {
1085 dyn_cast<CXXConversionDecl>(D->getUnderlyingDecl())) {
1086 QualType CT = Conversion->getConversionType().getNonReferenceType();
1089 ConversionDecls.push_back(Conversion);
1093 ConversionDecls.push_back(Conversion);
1097 if (NoIntegrals ==1 && NoObjCIdPointers == 0)
1099 if (NoIntegrals == 0 && NoObjCIdPointers == 1)
1100 return OS_Dictionary;
1101 if (NoIntegrals == 0 && NoObjCIdPointers == 0) {
1103 Diag(FromE->
getExprLoc(), diag::err_objc_subscript_type_conversion)
1107 Diag(FromE->
getExprLoc(), diag::err_objc_multiple_subscript_type_conversion)
1109 for (
unsigned int i = 0; i < ConversionDecls.size(); i++)
1110 Diag(ConversionDecls[i]->getLocation(),
1111 diag::note_conv_function_declared_at);
1137 bool ObjCSubscriptOpBuilder::findAtIndexGetter() {
1141 Expr *BaseExpr = RefExpr->getBaseExpr();
1154 RefExpr->getKeyExpr());
1159 if (ResultType.
isNull()) {
1160 S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_base_type)
1161 << BaseExpr->
getType() << arrayRef;
1184 if (!AtIndexGetter && S.
getLangOpts().DebuggerObjCLiteral) {
1203 AtIndexGetter->setMethodParams(S.
Context, Argument, None);
1206 if (!AtIndexGetter) {
1208 S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_method_not_found)
1209 << BaseExpr->
getType() << 0 << arrayRef;
1214 RefExpr->getSourceRange(),
1218 if (AtIndexGetter) {
1219 QualType T = AtIndexGetter->parameters()[0]->getType();
1222 S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1223 arrayRef ? diag::err_objc_subscript_index_type
1224 : diag::err_objc_subscript_key_type) << T;
1225 S.
Diag(AtIndexGetter->parameters()[0]->getLocation(),
1226 diag::note_parameter_type) << T;
1229 QualType R = AtIndexGetter->getReturnType();
1231 S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1232 diag::err_objc_indexing_method_result_type) << R << arrayRef;
1233 S.
Diag(AtIndexGetter->getLocation(), diag::note_method_declared_at) <<
1234 AtIndexGetter->getDeclName();
1240 bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
1244 Expr *BaseExpr = RefExpr->getBaseExpr();
1258 RefExpr->getKeyExpr());
1263 if (ResultType.
isNull()) {
1264 S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_base_type)
1265 << BaseExpr->
getType() << arrayRef;
1289 if (!AtIndexSetter && S.
getLangOpts().DebuggerObjCLiteral) {
1308 Params.push_back(
object);
1318 Params.push_back(key);
1319 AtIndexSetter->setMethodParams(S.
Context, Params, None);
1322 if (!AtIndexSetter) {
1325 diag::err_objc_subscript_method_not_found)
1326 << BaseExpr->
getType() << 1 << arrayRef;
1331 RefExpr->getSourceRange(),
1336 if (AtIndexSetter && arrayRef) {
1337 QualType T = AtIndexSetter->parameters()[1]->getType();
1339 S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1340 diag::err_objc_subscript_index_type) << T;
1341 S.
Diag(AtIndexSetter->parameters()[1]->getLocation(),
1342 diag::note_parameter_type) << T;
1345 T = AtIndexSetter->parameters()[0]->getType();
1347 S.
Diag(RefExpr->getBaseExpr()->getExprLoc(),
1348 diag::err_objc_subscript_object_type) << T << arrayRef;
1349 S.
Diag(AtIndexSetter->parameters()[0]->getLocation(),
1350 diag::note_parameter_type) << T;
1354 else if (AtIndexSetter && !arrayRef)
1355 for (
unsigned i=0; i <2; i++) {
1356 QualType T = AtIndexSetter->parameters()[i]->getType();
1359 S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1360 diag::err_objc_subscript_key_type) << T;
1362 S.
Diag(RefExpr->getBaseExpr()->getExprLoc(),
1363 diag::err_objc_subscript_dic_object_type) << T;
1364 S.
Diag(AtIndexSetter->parameters()[i]->getLocation(),
1365 diag::note_parameter_type) << T;
1375 ExprResult ObjCSubscriptOpBuilder::buildGet() {
1376 if (!findAtIndexGetter())
1379 QualType receiverType = InstanceBase->getType();
1383 Expr *Index = InstanceKey;
1386 Expr *args[] = { Index };
1387 assert(InstanceBase);
1392 AtIndexGetterSelector, AtIndexGetter,
1403 bool captureSetValueAsResult) {
1404 if (!findAtIndexSetter())
1408 QualType receiverType = InstanceBase->getType();
1409 Expr *Index = InstanceKey;
1412 Expr *args[] = { op, Index };
1417 AtIndexSetterSelector,
1421 if (!msg.
isInvalid() && captureSetValueAsResult) {
1423 cast<ObjCMessageExpr>(msg.
get()->IgnoreImplicit());
1425 if (CanCaptureValue(
arg))
1426 msgExpr->
setArg(0, captureValueAsResult(
arg));
1438 CallArgs.insert(CallArgs.begin(), E->
getIdx());
1440 while (
auto *MSPropSubscript = dyn_cast<MSPropertySubscriptExpr>(
Base)) {
1441 CallArgs.insert(CallArgs.begin(), MSPropSubscript->getIdx());
1442 Base = MSPropSubscript->getBase()->IgnoreParens();
1444 return cast<MSPropertyRefExpr>(
Base);
1447 Expr *MSPropertyOpBuilder::rebuildAndCaptureObject(
Expr *syntacticBase) {
1448 InstanceBase = capture(RefExpr->getBaseExpr());
1449 llvm::for_each(CallArgs, [
this](
Expr *&Arg) { Arg = capture(Arg); });
1450 syntacticBase = Rebuilder(S, [=](
Expr *,
unsigned Idx) ->
Expr * {
1453 return InstanceBase;
1455 assert(Idx <= CallArgs.size());
1456 return CallArgs[Idx - 1];
1458 }).rebuild(syntacticBase);
1460 return syntacticBase;
1464 if (!RefExpr->getPropertyDecl()->hasGetter()) {
1465 S.
Diag(RefExpr->getMemberLoc(), diag::err_no_accessor_for_property)
1466 << 0 << RefExpr->getPropertyDecl();
1474 SS.
Adopt(RefExpr->getQualifierLoc());
1477 RefExpr->isArrow() ? tok::arrow : tok::period, SS,
1480 S.
Diag(RefExpr->getMemberLoc(),
1481 diag::err_cannot_find_suitable_accessor) << 0
1482 << RefExpr->getPropertyDecl();
1487 RefExpr->getSourceRange().getBegin(), CallArgs,
1488 RefExpr->getSourceRange().getEnd());
1492 bool captureSetValueAsResult) {
1493 if (!RefExpr->getPropertyDecl()->hasSetter()) {
1494 S.
Diag(RefExpr->getMemberLoc(), diag::err_no_accessor_for_property)
1495 << 1 << RefExpr->getPropertyDecl();
1503 SS.
Adopt(RefExpr->getQualifierLoc());
1506 RefExpr->isArrow() ? tok::arrow : tok::period, SS,
1509 S.
Diag(RefExpr->getMemberLoc(),
1510 diag::err_cannot_find_suitable_accessor) << 1
1511 << RefExpr->getPropertyDecl();
1516 ArgExprs.append(CallArgs.begin(), CallArgs.end());
1517 ArgExprs.push_back(op);
1519 RefExpr->getSourceRange().getBegin(), ArgExprs,
1530 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1531 ObjCPropertyOpBuilder builder(*
this, refExpr,
true);
1532 return builder.buildRValueOperation(E);
1535 = dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1536 ObjCSubscriptOpBuilder builder(*
this, refExpr,
true);
1537 return builder.buildRValueOperation(E);
1539 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1540 MSPropertyOpBuilder builder(*
this, refExpr,
true);
1541 return builder.buildRValueOperation(E);
1543 dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1544 MSPropertyOpBuilder Builder(*
this, RefExpr,
true);
1545 return Builder.buildRValueOperation(E);
1547 llvm_unreachable(
"unknown pseudo-object kind!");
1558 CurFPFeatureOverrides());
1563 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1564 ObjCPropertyOpBuilder builder(*
this, refExpr,
false);
1565 return builder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1566 }
else if (isa<ObjCSubscriptRefExpr>(opaqueRef)) {
1567 Diag(opcLoc, diag::err_illegal_container_subscripting_op);
1570 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1571 MSPropertyOpBuilder builder(*
this, refExpr,
false);
1572 return builder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1574 = dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1575 MSPropertyOpBuilder Builder(*
this, RefExpr,
false);
1576 return Builder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1578 llvm_unreachable(
"unknown pseudo-object kind!");
1589 opcLoc, CurFPFeatureOverrides());
1593 ExprResult result = CheckPlaceholderExpr(RHS);
1598 bool IsSimpleAssign = opcode == BO_Assign;
1601 = dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1602 ObjCPropertyOpBuilder builder(*
this, refExpr, IsSimpleAssign);
1603 return builder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1605 = dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1606 ObjCSubscriptOpBuilder builder(*
this, refExpr, IsSimpleAssign);
1607 return builder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1609 = dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1610 MSPropertyOpBuilder builder(*
this, refExpr, IsSimpleAssign);
1611 return builder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1613 = dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1614 MSPropertyOpBuilder Builder(*
this, RefExpr, IsSimpleAssign);
1615 return Builder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1617 llvm_unreachable(
"unknown pseudo-object kind!");
1627 return cast<OpaqueValueExpr>(E)->getSourceExpr();
1643 uop->getValueKind(), uop->getObjectKind(),
1644 uop->getOperatorLoc(), uop->canOverflow(),
1645 CurFPFeatureOverrides());
1647 = dyn_cast<CompoundAssignOperator>(syntax)) {
1649 Expr *rhs = cast<OpaqueValueExpr>(cop->getRHS())->getSourceExpr();
1651 Context, lhs, rhs, cop->getOpcode(), cop->
getType(),
1652 cop->getValueKind(), cop->getObjectKind(), cop->getOperatorLoc(),
1653 CurFPFeatureOverrides(), cop->getComputationLHSType(),
1654 cop->getComputationResultType());
1656 }
else if (
BinaryOperator *bop = dyn_cast<BinaryOperator>(syntax)) {
1658 Expr *rhs = cast<OpaqueValueExpr>(bop->getRHS())->getSourceExpr();
1660 bop->
getType(), bop->getValueKind(),
1661 bop->getObjectKind(), bop->getOperatorLoc(),
1662 CurFPFeatureOverrides());
1664 }
else if (isa<CallExpr>(syntax)) {