;
48 unsignedMSPropertySubscriptCount;
49 typedefllvm::function_ref<
Expr*(
Expr*,
unsigned)> SpecificRebuilderRefTy;
50 constSpecificRebuilderRefTy &SpecificCallback;
51Rebuilder(
Sema&S,
constSpecificRebuilderRefTy &SpecificCallback)
52: S(S), MSPropertySubscriptCount(0),
53SpecificCallback(SpecificCallback) {}
95assert(refExpr->
getIdx());
97 auto*NewBase = rebuild(refExpr->
getBase());
98++MSPropertySubscriptCount;
101SpecificCallback(refExpr->
getIdx(), MSPropertySubscriptCount),
108 if(
auto*PRE = dyn_cast<ObjCPropertyRefExpr>(e))
109 returnrebuildObjCPropertyRefExpr(PRE);
110 if(
auto*SRE = dyn_cast<ObjCSubscriptRefExpr>(e))
111 returnrebuildObjCSubscriptRefExpr(SRE);
112 if(
auto*MSPRE = dyn_cast<MSPropertyRefExpr>(e))
113 returnrebuildMSPropertyRefExpr(MSPRE);
114 if(
auto*MSPSE = dyn_cast<MSPropertySubscriptExpr>(e))
115 returnrebuildMSPropertySubscriptExpr(MSPSE);
120 if(
ParenExpr*parens = dyn_cast<ParenExpr>(e)) {
121e = rebuild(parens->getSubExpr());
128assert(uop->getOpcode() == UO_Extension);
129e = rebuild(uop->getSubExpr());
131S.
Context, e, uop->getOpcode(), uop->getType(), uop->getValueKind(),
132uop->getObjectKind(), uop->getOperatorLoc(), uop->canOverflow(),
137assert(!gse->isResultDependent());
138 unsignedresultIndex = gse->getResultIndex();
139 unsignednumAssocs = gse->getNumAssocs();
143assocExprs.reserve(numAssocs);
144assocTypes.reserve(numAssocs);
147gse->associations()) {
148 Expr*assocExpr = assoc.getAssociationExpr();
149 if(assoc.isSelected())
150assocExpr = rebuild(assocExpr);
151assocExprs.push_back(assocExpr);
152assocTypes.push_back(assoc.getTypeSourceInfo());
155 if(gse->isExprPredicate())
157S.
Context, gse->getGenericLoc(), gse->getControllingExpr(),
158assocTypes, assocExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
159gse->containsUnexpandedParameterPack(), resultIndex);
161S.
Context, gse->getGenericLoc(), gse->getControllingType(),
162assocTypes, assocExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
163gse->containsUnexpandedParameterPack(), resultIndex);
166 if(
ChooseExpr*ce = dyn_cast<ChooseExpr>(e)) {
167assert(!ce->isConditionDependent());
169 Expr*LHS = ce->getLHS(), *RHS = ce->getRHS();
170 Expr*&rebuiltExpr = ce->isConditionTrue() ? LHS : RHS;
171rebuiltExpr = rebuild(rebuiltExpr);
174 ChooseExpr(ce->getBuiltinLoc(), ce->getCond(), LHS, RHS,
177ce->isConditionTrue());
180llvm_unreachable(
"bad expression to rebuild!");
184 classPseudoOpBuilder {
187 unsignedResultIndex;
194GenericLoc(genericLoc), IsUnique(IsUnique) {}
196 virtual~PseudoOpBuilder() {}
199 voidaddSemanticExpr(
Expr*semantic) {
200Semantics.push_back(semantic);
204 voidaddResultSemanticExpr(
Expr*resultExpr) {
206ResultIndex = Semantics.size();
207Semantics.push_back(resultExpr);
209 if(
auto*OVE = dyn_cast<OpaqueValueExpr>(Semantics.back()))
210OVE->setIsUnique(
false);
227 voidsetResultToLastSemantic() {
229ResultIndex = Semantics.size() - 1;
231 if(
auto*OVE = dyn_cast<OpaqueValueExpr>(Semantics.back()))
232OVE->setIsUnique(
false);
236 static boolCanCaptureValue(
Expr*
exp) {
237 if(
exp->isGLValue())
244 returnClassDecl->isTriviallyCopyable();
248 virtual Expr*rebuildAndCaptureObject(
Expr*) = 0;
251 boolcaptureSetValueAsResult) = 0;
265 virtual boolcaptureSetValueAsResult()
const{
return true; }
269 classObjCPropertyOpBuilder :
publicPseudoOpBuilder {
281: PseudoOpBuilder(S, refExpr->getLocation(), IsUnique),
282RefExpr(refExpr), SyntacticRefExpr(nullptr),
283InstanceReceiver(nullptr), Getter(nullptr), Setter(nullptr) {
296 boolfindSetter(
boolwarn=
true);
298 voidDiagnoseUnsupportedPropertyUse();
300 Expr*rebuildAndCaptureObject(
Expr*syntacticBase)
override;
305 boolisWeakProperty()
const;
309 classObjCSubscriptOpBuilder :
publicPseudoOpBuilder {
321: PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
322RefExpr(refExpr), InstanceBase(nullptr), InstanceKey(nullptr),
323AtIndexGetter(nullptr), AtIndexSetter(nullptr) {}
330 Expr*rebuildAndCaptureObject(
Expr*syntacticBase)
override;
332 boolfindAtIndexGetter();
333 boolfindAtIndexSetter();
339 classMSPropertyOpBuilder :
publicPseudoOpBuilder {
348: PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
349RefExpr(refExpr), InstanceBase(nullptr) {}
351: PseudoOpBuilder(S, refExpr->
getSourceRange().getBegin(), IsUnique),
352InstanceBase(nullptr) {
353RefExpr = getBaseMSProperty(refExpr);
356 Expr*rebuildAndCaptureObject(
Expr*)
override;
359 boolcaptureSetValueAsResult()
const override{
return false; }
374addSemanticExpr(captured);
389 if(!isa<OpaqueValueExpr>(e)) {
391setResultToLastSemantic();
399assert(index < Semantics.size() &&
400 "captured expression not found in semantics!");
401 if(e == Semantics[index])
break;
405cast<OpaqueValueExpr>(e)->setIsUnique(
false);
406 returncast<OpaqueValueExpr>(e);
412Semantics, ResultIndex);
417 Expr*syntacticBase = rebuildAndCaptureObject(op);
421addResultSemanticExpr(getExpr.
get());
423 returncomplete(syntacticBase);
434 Expr*syntacticLHS = rebuildAndCaptureObject(LHS);
443 Expr*semanticRHS = capturedRHS;
446Semantics.pop_back();
452 if(opcode == BO_Assign) {
453result = semanticRHS;
455opcode, capturedRHS->
getType(),
466result = S.
BuildBinOp(Sc, opcLoc, nonCompound, opLHS.
get(), semanticRHS);
478result = buildSet(result.
get(), opcLoc, captureSetValueAsResult());
480addSemanticExpr(result.
get());
483setResultToLastSemantic();
485 returncomplete(syntactic);
496 Expr*syntacticOp = rebuildAndCaptureObject(op);
507result = capture(result.
get());
508setResultToLastSemantic();
517result = S.
BuildBinOp(Sc, opcLoc, BO_Add, result.
get(), one);
519result = S.
BuildBinOp(Sc, opcLoc, BO_Sub, result.
get(), one);
526captureSetValueAsResult());
528addSemanticExpr(result.
get());
532setResultToLastSemantic();
542 returncomplete(syntactic);
587boolObjCPropertyOpBuilder::isWeakProperty()
const{
589 if(RefExpr->isExplicitProperty()) {
604boolObjCPropertyOpBuilder::findGetter() {
605 if(Getter)
return true;
608 if(RefExpr->isImplicitProperty()) {
609 if((Getter = RefExpr->getImplicitPropertyGetter())) {
610GetterSelector = Getter->getSelector();
616assert(setter &&
"both setter and getter are null - cannot happen");
629 return(Getter !=
nullptr);
636boolObjCPropertyOpBuilder::findSetter(
boolwarn) {
638 if(RefExpr->isImplicitProperty()) {
639 if(
ObjCMethodDecl*setter = RefExpr->getImplicitPropertySetter()) {
644 const IdentifierInfo*getterName = RefExpr->getImplicitPropertyGetter()
646.getIdentifierInfoForSlot(0);
665StringRef thisPropertyName = prop->
getName();
667 charfront = thisPropertyName.front();
670PropertyName[0] = front;
675 if(prop != prop1 && (prop1->getSetterMethodDecl() == setter)) {
676S.
Diag(RefExpr->getExprLoc(), diag::err_property_setter_ambiguous_use)
679S.
Diag(prop1->getLocation(), diag::note_property_declare);
694voidObjCPropertyOpBuilder::DiagnoseUnsupportedPropertyUse() {
699S.
Diag(RefExpr->getLocation(),
700diag::err_property_function_in_objc_container);
707Expr*ObjCPropertyOpBuilder::rebuildAndCaptureObject(
Expr*syntacticBase) {
708assert(InstanceReceiver ==
nullptr);
712 if(RefExpr->isObjectReceiver()) {
713InstanceReceiver = capture(RefExpr->getBase());
714syntacticBase = Rebuilder(S, [=](
Expr*,
unsigned) ->
Expr* {
715 returnInstanceReceiver;
716}).rebuild(syntacticBase);
720refE = dyn_cast<ObjCPropertyRefExpr>(syntacticBase->
IgnoreParens()))
721SyntacticRefExpr = refE;
723 returnsyntacticBase;
730DiagnoseUnsupportedPropertyUse();
734 if(SyntacticRefExpr)
735SyntacticRefExpr->setIsMessagingGetter();
738 if(!Getter->isImplicit())
742 if((Getter->isInstanceMethod() && !RefExpr->isClassReceiver()) ||
743RefExpr->isObjectReceiver()) {
744assert(InstanceReceiver || RefExpr->isSuperReceiver());
746InstanceReceiver, receiverType, GenericLoc, Getter->getSelector(),
750receiverType, RefExpr->isSuperReceiver(), GenericLoc,
751Getter->getSelector(), Getter, {});
761 boolcaptureSetValueAsResult) {
762 if(!findSetter(
false)) {
763DiagnoseUnsupportedPropertyUse();
767 if(SyntacticRefExpr)
768SyntacticRefExpr->setIsMessagingSetter();
776 QualTypeparamType = (*Setter->param_begin())->getType()
779Setter->getDeclContext(),
780ObjCSubstitutionContext::Parameter);
788AssignmentAction::Assigning))
791op = opResult.
get();
792assert(op &&
"successful assignment left argument invalid?");
797 Expr*args[] = { op };
801 if(!Setter->isImplicit())
803 if((Setter->isInstanceMethod() && !RefExpr->isClassReceiver()) ||
804RefExpr->isObjectReceiver()) {
806GenericLoc, SetterSelector,
810receiverType, RefExpr->isSuperReceiver(), GenericLoc, SetterSelector,
814 if(!msg.
isInvalid() && captureSetValueAsResult) {
818 if(CanCaptureValue(arg))
819msgExpr->
setArg(0, captureValueAsResult(arg));
826ExprResultObjCPropertyOpBuilder::buildRValueOperation(
Expr*op) {
829 if(RefExpr->isImplicitProperty() && !RefExpr->getImplicitPropertyGetter()) {
830S.
Diag(RefExpr->getLocation(), diag::err_getter_not_found)
831<< RefExpr->getSourceRange();
835 ExprResultresult = PseudoOpBuilder::buildRValueOperation(op);
838 if(RefExpr->isExplicitProperty() && !Getter->hasRelatedResultType())
840Getter, RefExpr->getLocation());
844 if(RefExpr->isExplicitProperty() && result.
get()->
isPRValue()) {
846 QualTypepropType = RefExpr->getExplicitProperty()
847->getUsageType(receiverType);
851 if(!ptr->isObjCIdType())
857RefExpr->getLocation()))
868boolObjCPropertyOpBuilder::tryBuildGetOfReference(
Expr*op,
881 QualTyperesultType = Getter->getReturnType();
884result = buildRValueOperation(op);
890ObjCPropertyOpBuilder::buildAssignmentOperation(
Scope*Sc,
900 if(tryBuildGetOfReference(LHS, result)) {
902 returnS.
BuildBinOp(Sc, opcLoc, opcode, result.
get(), RHS);
906S.
Diag(opcLoc, diag::err_nosetter_property_assignment)
907<<
unsigned(RefExpr->isImplicitProperty())
916 if(opcode != BO_Assign && !findGetter()) {
917S.
Diag(opcLoc, diag::err_nogetter_property_compound_assignment)
923PseudoOpBuilder::buildAssignmentOperation(Sc, opcLoc, opcode, LHS, RHS);
927 if(S.
getLangOpts().ObjCAutoRefCount && InstanceReceiver) {
944 if(tryBuildGetOfReference(op, result)) {
950S.
Diag(opcLoc, diag::err_nosetter_property_incdec)
951<<
unsigned(RefExpr->isImplicitProperty())
962assert(RefExpr->isImplicitProperty());
963S.
Diag(opcLoc, diag::err_nogetter_property_incdec)
970 returnPseudoOpBuilder::buildIncDecOperation(Sc, opcLoc, opcode, op);
978SyntacticRefExpr->isMessagingGetter());
980 returnPseudoOpBuilder::complete(SyntacticForm);
990ExprResultObjCSubscriptOpBuilder::buildRValueOperation(
Expr*op) {
991 ExprResultresult = PseudoOpBuilder::buildRValueOperation(op);
998ObjCSubscriptOpBuilder::buildAssignmentOperation(
Scope*Sc,
1004 if(!findAtIndexSetter())
1008 if(opcode != BO_Assign && !findAtIndexGetter())
1012PseudoOpBuilder::buildAssignmentOperation(Sc, opcLoc, opcode, LHS, RHS);
1016 if(S.
getLangOpts().ObjCAutoRefCount && InstanceBase) {
1025Expr*ObjCSubscriptOpBuilder::rebuildAndCaptureObject(
Expr*syntacticBase) {
1026assert(InstanceBase ==
nullptr);
1030InstanceBase = capture(RefExpr->getBaseExpr());
1031InstanceKey = capture(RefExpr->getKeyExpr());
1034Rebuilder(S, [=](
Expr*,
unsignedIdx) ->
Expr* {
1037 returnInstanceBase;
1041llvm_unreachable(
"Unexpected index for ObjCSubscriptExpr");
1043}).rebuild(syntacticBase);
1045 returnsyntacticBase;
1052 if(ContainerT.
isNull())
1060GetterSelector, ContainerT,
true);
1065CheckedConversionKind::Implicit);
1068boolObjCSubscriptOpBuilder::findAtIndexGetter() {
1072 Expr*BaseExpr = RefExpr->getBaseExpr();
1085RefExpr->getKeyExpr());
1090 if(ResultType.
isNull()) {
1091S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_base_type)
1092<< BaseExpr->
getType() << arrayRef;
1111AtIndexGetterSelector, ResultType,
true);
1113 if(!AtIndexGetter && S.
getLangOpts().DebuggerObjCLiteral) {
1122ObjCImplementationControl::Required,
false);
1132AtIndexGetter->setMethodParams(S.
Context, Argument, {});
1135 if(!AtIndexGetter) {
1137S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_method_not_found)
1138<< BaseExpr->
getType() << 0 << arrayRef;
1142AtIndexGetterSelector, RefExpr->getSourceRange(),
true);
1145 if(AtIndexGetter) {
1146 QualType T= AtIndexGetter->parameters()[0]->getType();
1149S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1150arrayRef ? diag::err_objc_subscript_index_type
1151: diag::err_objc_subscript_key_type) <<
T;
1152S.
Diag(AtIndexGetter->parameters()[0]->getLocation(),
1153diag::note_parameter_type) <<
T;
1156 QualTypeR = AtIndexGetter->getReturnType();
1158S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1159diag::err_objc_indexing_method_result_type) << R << arrayRef;
1160S.
Diag(AtIndexGetter->getLocation(), diag::note_method_declared_at) <<
1161AtIndexGetter->getDeclName();
1167boolObjCSubscriptOpBuilder::findAtIndexSetter() {
1171 Expr*BaseExpr = RefExpr->getBaseExpr();
1185RefExpr->getKeyExpr());
1190 if(ResultType.
isNull()) {
1191S.
Diag(BaseExpr->
getExprLoc(), diag::err_objc_subscript_base_type)
1192<< BaseExpr->
getType() << arrayRef;
1212AtIndexSetterSelector, ResultType,
true);
1214 if(!AtIndexSetter && S.
getLangOpts().DebuggerObjCLiteral) {
1224ObjCImplementationControl::Required,
false);
1233Params.push_back(
object);
1243Params.push_back(key);
1244AtIndexSetter->setMethodParams(S.
Context, Params, {});
1247 if(!AtIndexSetter) {
1250diag::err_objc_subscript_method_not_found)
1251<< BaseExpr->
getType() << 1 << arrayRef;
1255AtIndexSetterSelector, RefExpr->getSourceRange(),
true);
1259 if(AtIndexSetter && arrayRef) {
1260 QualType T= AtIndexSetter->parameters()[1]->getType();
1262S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1263diag::err_objc_subscript_index_type) <<
T;
1264S.
Diag(AtIndexSetter->parameters()[1]->getLocation(),
1265diag::note_parameter_type) <<
T;
1268 T= AtIndexSetter->parameters()[0]->getType();
1270S.
Diag(RefExpr->getBaseExpr()->getExprLoc(),
1271diag::err_objc_subscript_object_type) <<
T<< arrayRef;
1272S.
Diag(AtIndexSetter->parameters()[0]->getLocation(),
1273diag::note_parameter_type) <<
T;
1277 else if(AtIndexSetter && !arrayRef)
1278 for(
unsignedi=0; i <2; i++) {
1279 QualType T= AtIndexSetter->parameters()[i]->getType();
1282S.
Diag(RefExpr->getKeyExpr()->getExprLoc(),
1283diag::err_objc_subscript_key_type) <<
T;
1285S.
Diag(RefExpr->getBaseExpr()->getExprLoc(),
1286diag::err_objc_subscript_dic_object_type) <<
T;
1287S.
Diag(AtIndexSetter->parameters()[i]->getLocation(),
1288diag::note_parameter_type) <<
T;
1298ExprResultObjCSubscriptOpBuilder::buildGet() {
1299 if(!findAtIndexGetter())
1302 QualTypereceiverType = InstanceBase->getType();
1306 Expr*Index = InstanceKey;
1309 Expr*args[] = { Index };
1310assert(InstanceBase);
1314InstanceBase, receiverType, GenericLoc, AtIndexGetterSelector,
1325 boolcaptureSetValueAsResult) {
1326 if(!findAtIndexSetter())
1330 QualTypereceiverType = InstanceBase->getType();
1331 Expr*Index = InstanceKey;
1334 Expr*args[] = { op, Index };
1338InstanceBase, receiverType, GenericLoc, AtIndexSetterSelector,
1341 if(!msg.
isInvalid() && captureSetValueAsResult) {
1345 if(CanCaptureValue(arg))
1346msgExpr->
setArg(0, captureValueAsResult(arg));
1358CallArgs.insert(CallArgs.begin(),
E->getIdx());
1360 while(
auto*MSPropSubscript = dyn_cast<MSPropertySubscriptExpr>(
Base)) {
1361CallArgs.insert(CallArgs.begin(), MSPropSubscript->getIdx());
1362 Base= MSPropSubscript->getBase()->IgnoreParens();
1364 returncast<MSPropertyRefExpr>(
Base);
1367Expr*MSPropertyOpBuilder::rebuildAndCaptureObject(
Expr*syntacticBase) {
1368InstanceBase = capture(RefExpr->getBaseExpr());
1369 for(
Expr*&Arg : CallArgs)
1371syntacticBase = Rebuilder(S, [=](
Expr*,
unsignedIdx) ->
Expr* {
1374 returnInstanceBase;
1376assert(Idx <= CallArgs.size());
1377 returnCallArgs[Idx - 1];
1379}).rebuild(syntacticBase);
1381 returnsyntacticBase;
1385 if(!RefExpr->getPropertyDecl()->hasGetter()) {
1386S.
Diag(RefExpr->getMemberLoc(), diag::err_no_accessor_for_property)
1387<< 0
<< RefExpr->getPropertyDecl();
1392 const IdentifierInfo*II = RefExpr->getPropertyDecl()->getGetterId();
1395SS.
Adopt(RefExpr->getQualifierLoc());
1398RefExpr->isArrow() ? tok::arrow : tok::period, SS,
1401S.
Diag(RefExpr->getMemberLoc(),
1402diag::err_cannot_find_suitable_accessor) << 0
1403<< RefExpr->getPropertyDecl();
1409RefExpr->getSourceRange().getEnd());
1413 boolcaptureSetValueAsResult) {
1414 if(!RefExpr->getPropertyDecl()->hasSetter()) {
1415S.
Diag(RefExpr->getMemberLoc(), diag::err_no_accessor_for_property)
1416<< 1
<< RefExpr->getPropertyDecl();
1421 const IdentifierInfo*II = RefExpr->getPropertyDecl()->getSetterId();
1424SS.
Adopt(RefExpr->getQualifierLoc());
1427RefExpr->isArrow() ? tok::arrow : tok::period, SS,
1430S.
Diag(RefExpr->getMemberLoc(),
1431diag::err_cannot_find_suitable_accessor) << 1
1432<< RefExpr->getPropertyDecl();
1437ArgExprs.append(CallArgs.begin(), CallArgs.end());
1438ArgExprs.push_back(op);
1451= dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1452ObjCPropertyOpBuilder builder(
SemaRef, refExpr,
true);
1453 returnbuilder.buildRValueOperation(
E);
1456= dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1457ObjCSubscriptOpBuilder builder(
SemaRef, refExpr,
true);
1458 returnbuilder.buildRValueOperation(
E);
1460= dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1461MSPropertyOpBuilder builder(
SemaRef, refExpr,
true);
1462 returnbuilder.buildRValueOperation(
E);
1464dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1465MSPropertyOpBuilder Builder(
SemaRef, RefExpr,
true);
1466 returnBuilder.buildRValueOperation(
E);
1468llvm_unreachable(
"unknown pseudo-object kind!");
1484= dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1485ObjCPropertyOpBuilder builder(
SemaRef, refExpr,
false);
1486 returnbuilder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1487}
else if(isa<ObjCSubscriptRefExpr>(opaqueRef)) {
1488 Diag(opcLoc, diag::err_illegal_container_subscripting_op);
1491= dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1492MSPropertyOpBuilder builder(
SemaRef, refExpr,
false);
1493 returnbuilder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1495= dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1496MSPropertyOpBuilder Builder(
SemaRef, RefExpr,
false);
1497 returnBuilder.buildIncDecOperation(Sc, opcLoc, opcode, op);
1499llvm_unreachable(
"unknown pseudo-object kind!");
1516RHS = result.
get();
1519 boolIsSimpleAssign = opcode == BO_Assign;
1522= dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
1523ObjCPropertyOpBuilder builder(
SemaRef, refExpr, IsSimpleAssign);
1524 returnbuilder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1526= dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
1527ObjCSubscriptOpBuilder builder(
SemaRef, refExpr, IsSimpleAssign);
1528 returnbuilder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1530= dyn_cast<MSPropertyRefExpr>(opaqueRef)) {
1531MSPropertyOpBuilder builder(
SemaRef, refExpr, IsSimpleAssign);
1532 returnbuilder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1534= dyn_cast<MSPropertySubscriptExpr>(opaqueRef)) {
1535MSPropertyOpBuilder Builder(
SemaRef, RefExpr, IsSimpleAssign);
1536 returnBuilder.buildAssignmentOperation(S, opcLoc, opcode, LHS, RHS);
1538llvm_unreachable(
"unknown pseudo-object kind!");
1548 returncast<OpaqueValueExpr>(
E)->getSourceExpr();
1560 Expr*syntax =
E->getSyntacticForm();
1561 if(
UnaryOperator*uop = dyn_cast<UnaryOperator>(syntax)) {
1565uop->getValueKind(), uop->getObjectKind(), uop->getOperatorLoc(),
1568= dyn_cast<CompoundAssignOperator>(syntax)) {
1570 Expr*rhs = cast<OpaqueValueExpr>(cop->getRHS())->getSourceExpr();
1573cop->getValueKind(), cop->getObjectKind(), cop->getOperatorLoc(),
1575cop->getComputationResultType());
1577}
else if(
BinaryOperator*bop = dyn_cast<BinaryOperator>(syntax)) {
1579 Expr*rhs = cast<OpaqueValueExpr>(bop->getRHS())->getSourceExpr();
1581bop->
getType(), bop->getValueKind(),
1582bop->getObjectKind(), bop->getOperatorLoc(),
1585}
else if(isa<CallExpr>(syntax)) {
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::Preprocessor interface.
This file declares semantic analysis for Objective-C.
static ObjCMethodDecl * LookupMethodInReceiverType(Sema &S, Selector sel, const ObjCPropertyRefExpr *PRE)
Look up a method in the receiver type of an Objective-C property reference.
static Expr * stripOpaqueValuesFromPseudoObjectRef(Sema &S, Expr *E)
Given a pseudo-object reference, rebuild it without the opaque values.
static void CheckKeyForObjCARCConversion(Sema &S, QualType ContainerT, Expr *Key)
CheckKeyForObjCARCConversion - This routine suggests bridge casting of CF objects used as dictionary ...
This file declares semantic analysis for expressions involving.
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
SelectorTable & Selectors
CanQualType UnsignedLongTy
QualType getObjCIdType() const
Represents the Objective-CC id type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
A builtin binary operation expression such as "x + y" or "x <= y".
static Opcode getOpForCompoundAssignment(Opcode Opc)
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
bool isAssignmentOp() const
Represents a C++ struct/union/class.
Represents a C++ nested-name-specifier or a global scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
CompoundAssignOperator - For compound assignments (e.g.
static CompoundAssignOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures, QualType CompLHSType=QualType(), QualType CompResultType=QualType())
Decl * getNonClosureAncestor()
Find the nearest non-closure ancestor of this context, i.e.
bool isObjCContainer() const
Decl::Kind getDeclKind() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
This represents one expression.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
QualType getReturnType() const
Represents a C11 generic selection.
AssociationTy< false > Association
static GenericSelectionExpr * Create(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
Create a non-result-dependent generic selection expression accepting an expression predicate.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
A member reference to an MSPropertyDecl.
NestedNameSpecifierLoc getQualifierLoc() const
MSPropertyDecl * getPropertyDecl() const
Expr * getBaseExpr() const
SourceLocation getMemberLoc() const
MS property subscript expression.
SourceLocation getRBracketLoc() const
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Represents an ObjC class declaration.
An expression that sends a message to the given Objective-C object or class.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
ObjCMethodDecl - Represents an instance or class method declaration.
ArrayRef< ParmVarDecl * > parameters() const
bool isPropertyAccessor() const
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isSynthesizedAccessorStub=false, bool isImplicitlyDeclared=false, bool isDefined=false, ObjCImplementationControl impControl=ObjCImplementationControl::None, bool HasRelatedResultType=false)
Selector getSelector() const
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
Represents one property declaration in an Objective-C interface.
ObjCPropertyQueryKind getQueryKind() const
Selector getSetterName() const
Selector getGetterName() const
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCPropertyDecl * getExplicitProperty() const
ObjCMethodDecl * getImplicitPropertyGetter() const
const Expr * getBase() const
bool isObjectReceiver() const
bool isExplicitProperty() const
QualType getSuperReceiverType() const
ObjCMethodDecl * getImplicitPropertySetter() const
ObjCInterfaceDecl * getClassReceiver() const
SourceLocation getLocation() const
bool isClassReceiver() const
bool isSuperReceiver() const
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Expr * getKeyExpr() const
Expr * getBaseExpr() const
ObjCMethodDecl * getAtIndexMethodDecl() const
SourceLocation getRBracket() const
ObjCMethodDecl * setAtIndexMethodDecl() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
ParenExpr - This represents a parenthesized expression, e.g.
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
IdentifierTable & getIdentifierTable()
SelectorTable & getSelectorTable()
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
static PseudoObjectExpr * Create(const ASTContext &Context, Expr *syntactic, ArrayRef< Expr * > semantic, unsigned resultIndex)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
@ OCL_Weak
Reading or writing from this object requires a barrier call.
Scope - A scope is a transient data structure that is used while parsing the program.
static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name)
Return the default setter selector for the given identifier.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Smart pointer class that efficiently represents Objective-C method names.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SemaPseudoObject(Sema &S)
ExprResult checkAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
ExprResult checkIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult checkRValue(Expr *E)
Sema - This implements semantic analysis and AST building for C.
Scope * getCurScope() const
Retrieve the parser's current scope.
FPOptionsOverride CurFPFeatureOverrides()
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
const LangOptions & getLangOpts() const
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
DeclContext * getCurLexicalContext() const
sema::FunctionScopeInfo * getCurFunction() const
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
DiagnosticsEngine & Diags
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
Encodes a location in the source.
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
A container of type source information.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
bool isLValueReferenceType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isObjCIdType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
bool isDecrementOp() const
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
bool isIncrementDecrementOp() const
bool isIncrementOp() const
Represents a C++ unqualified-id that has been parsed.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
void markSafeWeakUse(const Expr *E)
Record that a given expression is a "safe" access of a weak object (e.g.
The JSON file list parser is used to communicate input to InstallAPI.
LLVM_READONLY char toLowercase(char c)
Converts the given ASCII character to its lowercase equivalent.
@ OK_Ordinary
An ordinary object is located at an address in memory.
LLVM_READONLY bool isLowercase(unsigned char c)
Return true if this character is a lowercase ASCII letter: [a-z].
LLVM_READONLY char toUppercase(char c)
Converts the given ASCII character to its uppercase equivalent.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
MutableArrayRef< Expr * > MultiExprArg
__DEVICE__ _Tp arg(const std::complex< _Tp > &__c)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4