forked from OSchip/llvm-project
Pass all the locations of the selector identifiers for a message expression from the parser.
They are not kept in the AST yet. llvm-svn: 140982
This commit is contained in:
parent
413e5ac2a5
commit
f934ec8b7b
|
@ -570,7 +570,7 @@ public:
|
||||||
bool IsInstanceSuper,
|
bool IsInstanceSuper,
|
||||||
QualType SuperType,
|
QualType SuperType,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SelLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc);
|
SourceLocation RBracLoc);
|
||||||
|
@ -605,7 +605,7 @@ public:
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
TypeSourceInfo *Receiver,
|
TypeSourceInfo *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SelLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc);
|
SourceLocation RBracLoc);
|
||||||
|
@ -640,7 +640,7 @@ public:
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
Expr *Receiver,
|
Expr *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SeLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc);
|
SourceLocation RBracLoc);
|
||||||
|
|
|
@ -5270,7 +5270,7 @@ public:
|
||||||
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
|
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args);
|
MultiExprArg Args);
|
||||||
|
|
||||||
|
@ -5280,7 +5280,7 @@ public:
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args);
|
MultiExprArg Args);
|
||||||
|
|
||||||
|
@ -5288,7 +5288,7 @@ public:
|
||||||
ParsedType Receiver,
|
ParsedType Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args);
|
MultiExprArg Args);
|
||||||
|
|
||||||
|
@ -5298,7 +5298,7 @@ public:
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args);
|
MultiExprArg Args);
|
||||||
|
|
||||||
|
@ -5306,7 +5306,7 @@ public:
|
||||||
Expr *Receiver,
|
Expr *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args);
|
MultiExprArg Args);
|
||||||
|
|
||||||
|
|
|
@ -2811,7 +2811,7 @@ ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||||
bool IsInstanceSuper,
|
bool IsInstanceSuper,
|
||||||
QualType SuperType,
|
QualType SuperType,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SelLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc) {
|
SourceLocation RBracLoc) {
|
||||||
|
@ -2819,8 +2819,8 @@ ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||||
NumArgs * sizeof(Expr *);
|
NumArgs * sizeof(Expr *);
|
||||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||||
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, SuperLoc, IsInstanceSuper,
|
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, SuperLoc, IsInstanceSuper,
|
||||||
SuperType, Sel, SelLoc, Method, Args,NumArgs,
|
SuperType, Sel, SelLocs.front(), Method,
|
||||||
RBracLoc);
|
Args, NumArgs, RBracLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||||
|
@ -2828,14 +2828,15 @@ ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
TypeSourceInfo *Receiver,
|
TypeSourceInfo *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SelLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc) {
|
SourceLocation RBracLoc) {
|
||||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||||
NumArgs * sizeof(Expr *);
|
NumArgs * sizeof(Expr *);
|
||||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||||
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel, SelLoc,
|
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel,
|
||||||
|
SelLocs.front(),
|
||||||
Method, Args, NumArgs, RBracLoc);
|
Method, Args, NumArgs, RBracLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2844,14 +2845,15 @@ ObjCMessageExpr *ObjCMessageExpr::Create(ASTContext &Context, QualType T,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
Expr *Receiver,
|
Expr *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation SelLoc,
|
ArrayRef<SourceLocation> SelLocs,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
Expr **Args, unsigned NumArgs,
|
Expr **Args, unsigned NumArgs,
|
||||||
SourceLocation RBracLoc) {
|
SourceLocation RBracLoc) {
|
||||||
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) +
|
||||||
NumArgs * sizeof(Expr *);
|
NumArgs * sizeof(Expr *);
|
||||||
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
void *Mem = Context.Allocate(Size, llvm::AlignOf<ObjCMessageExpr>::Alignment);
|
||||||
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel, SelLoc,
|
return new (Mem) ObjCMessageExpr(T, VK, LBracLoc, Receiver, Sel,
|
||||||
|
SelLocs.front(),
|
||||||
Method, Args, NumArgs, RBracLoc);
|
Method, Args, NumArgs, RBracLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2219,15 +2219,15 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
SourceLocation Loc;
|
SourceLocation Loc;
|
||||||
IdentifierInfo *selIdent = ParseObjCSelectorPiece(Loc);
|
IdentifierInfo *selIdent = ParseObjCSelectorPiece(Loc);
|
||||||
|
|
||||||
SourceLocation SelectorLoc = Loc;
|
|
||||||
|
|
||||||
SmallVector<IdentifierInfo *, 12> KeyIdents;
|
SmallVector<IdentifierInfo *, 12> KeyIdents;
|
||||||
|
SmallVector<SourceLocation, 12> KeyLocs;
|
||||||
ExprVector KeyExprs(Actions);
|
ExprVector KeyExprs(Actions);
|
||||||
|
|
||||||
if (Tok.is(tok::colon)) {
|
if (Tok.is(tok::colon)) {
|
||||||
while (1) {
|
while (1) {
|
||||||
// Each iteration parses a single keyword argument.
|
// Each iteration parses a single keyword argument.
|
||||||
KeyIdents.push_back(selIdent);
|
KeyIdents.push_back(selIdent);
|
||||||
|
KeyLocs.push_back(Loc);
|
||||||
|
|
||||||
if (Tok.isNot(tok::colon)) {
|
if (Tok.isNot(tok::colon)) {
|
||||||
Diag(Tok, diag::err_expected_colon);
|
Diag(Tok, diag::err_expected_colon);
|
||||||
|
@ -2342,24 +2342,26 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
SourceLocation RBracLoc = ConsumeBracket(); // consume ']'
|
SourceLocation RBracLoc = ConsumeBracket(); // consume ']'
|
||||||
|
|
||||||
unsigned nKeys = KeyIdents.size();
|
unsigned nKeys = KeyIdents.size();
|
||||||
if (nKeys == 0)
|
if (nKeys == 0) {
|
||||||
KeyIdents.push_back(selIdent);
|
KeyIdents.push_back(selIdent);
|
||||||
|
KeyLocs.push_back(Loc);
|
||||||
|
}
|
||||||
Selector Sel = PP.getSelectorTable().getSelector(nKeys, &KeyIdents[0]);
|
Selector Sel = PP.getSelectorTable().getSelector(nKeys, &KeyIdents[0]);
|
||||||
|
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
return Actions.ActOnSuperMessage(getCurScope(), SuperLoc, Sel,
|
return Actions.ActOnSuperMessage(getCurScope(), SuperLoc, Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, KeyLocs, RBracLoc,
|
||||||
MultiExprArg(Actions,
|
MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
KeyExprs.size()));
|
KeyExprs.size()));
|
||||||
else if (ReceiverType)
|
else if (ReceiverType)
|
||||||
return Actions.ActOnClassMessage(getCurScope(), ReceiverType, Sel,
|
return Actions.ActOnClassMessage(getCurScope(), ReceiverType, Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, KeyLocs, RBracLoc,
|
||||||
MultiExprArg(Actions,
|
MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
KeyExprs.size()));
|
KeyExprs.size()));
|
||||||
return Actions.ActOnInstanceMessage(getCurScope(), ReceiverExpr, Sel,
|
return Actions.ActOnInstanceMessage(getCurScope(), ReceiverExpr, Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, KeyLocs, RBracLoc,
|
||||||
MultiExprArg(Actions,
|
MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
KeyExprs.size()));
|
KeyExprs.size()));
|
||||||
|
|
|
@ -961,7 +961,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
|
||||||
SourceLocation SuperLoc,
|
SourceLocation SuperLoc,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args) {
|
MultiExprArg Args) {
|
||||||
// Determine whether we are inside a method or not.
|
// Determine whether we are inside a method or not.
|
||||||
|
@ -1000,7 +1000,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
|
||||||
SuperTy = Context.getObjCObjectPointerType(SuperTy);
|
SuperTy = Context.getObjCObjectPointerType(SuperTy);
|
||||||
return BuildInstanceMessage(0, SuperTy, SuperLoc,
|
return BuildInstanceMessage(0, SuperTy, SuperLoc,
|
||||||
Sel, /*Method=*/0,
|
Sel, /*Method=*/0,
|
||||||
LBracLoc, SelectorLoc, RBracLoc, move(Args));
|
LBracLoc, SelectorLocs, RBracLoc, move(Args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since we are in a class method, this is a class message to
|
// Since we are in a class method, this is a class message to
|
||||||
|
@ -1008,7 +1008,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
|
||||||
return BuildClassMessage(/*ReceiverTypeInfo=*/0,
|
return BuildClassMessage(/*ReceiverTypeInfo=*/0,
|
||||||
Context.getObjCInterfaceType(Super),
|
Context.getObjCInterfaceType(Super),
|
||||||
SuperLoc, Sel, /*Method=*/0,
|
SuperLoc, Sel, /*Method=*/0,
|
||||||
LBracLoc, SelectorLoc, RBracLoc, move(Args));
|
LBracLoc, SelectorLocs, RBracLoc, move(Args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Build an Objective-C class message expression.
|
/// \brief Build an Objective-C class message expression.
|
||||||
|
@ -1045,7 +1045,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg ArgsIn) {
|
MultiExprArg ArgsIn) {
|
||||||
SourceLocation Loc = SuperLoc.isValid()? SuperLoc
|
SourceLocation Loc = SuperLoc.isValid()? SuperLoc
|
||||||
|
@ -1064,7 +1064,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
|
||||||
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
|
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
|
||||||
return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
|
return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
|
||||||
VK_RValue, LBracLoc, ReceiverTypeInfo,
|
VK_RValue, LBracLoc, ReceiverTypeInfo,
|
||||||
Sel, SelectorLoc, /*Method=*/0,
|
Sel, SelectorLocs, /*Method=*/0,
|
||||||
Args, NumArgs, RBracLoc));
|
Args, NumArgs, RBracLoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1126,11 +1126,11 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
||||||
SuperLoc, /*IsInstanceSuper=*/false,
|
SuperLoc, /*IsInstanceSuper=*/false,
|
||||||
ReceiverType, Sel, SelectorLoc,
|
ReceiverType, Sel, SelectorLocs,
|
||||||
Method, Args, NumArgs, RBracLoc);
|
Method, Args, NumArgs, RBracLoc);
|
||||||
else
|
else
|
||||||
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
||||||
ReceiverTypeInfo, Sel, SelectorLoc,
|
ReceiverTypeInfo, Sel, SelectorLocs,
|
||||||
Method, Args, NumArgs, RBracLoc);
|
Method, Args, NumArgs, RBracLoc);
|
||||||
return MaybeBindToTemporary(Result);
|
return MaybeBindToTemporary(Result);
|
||||||
}
|
}
|
||||||
|
@ -1142,7 +1142,7 @@ ExprResult Sema::ActOnClassMessage(Scope *S,
|
||||||
ParsedType Receiver,
|
ParsedType Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args) {
|
MultiExprArg Args) {
|
||||||
TypeSourceInfo *ReceiverTypeInfo;
|
TypeSourceInfo *ReceiverTypeInfo;
|
||||||
|
@ -1156,7 +1156,7 @@ ExprResult Sema::ActOnClassMessage(Scope *S,
|
||||||
|
|
||||||
return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
|
return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
|
||||||
/*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
|
/*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
|
||||||
LBracLoc, SelectorLoc, RBracLoc, move(Args));
|
LBracLoc, SelectorLocs, RBracLoc, move(Args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Build an Objective-C instance message expression.
|
/// \brief Build an Objective-C instance message expression.
|
||||||
|
@ -1193,7 +1193,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
ObjCMethodDecl *Method,
|
ObjCMethodDecl *Method,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg ArgsIn) {
|
MultiExprArg ArgsIn) {
|
||||||
// The location of the receiver.
|
// The location of the receiver.
|
||||||
|
@ -1216,7 +1216,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
|
assert(SuperLoc.isInvalid() && "Message to super with dependent type");
|
||||||
return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
|
return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
|
||||||
VK_RValue, LBracLoc, Receiver, Sel,
|
VK_RValue, LBracLoc, Receiver, Sel,
|
||||||
SelectorLoc, /*Method=*/0,
|
SelectorLocs, /*Method=*/0,
|
||||||
Args, NumArgs, RBracLoc));
|
Args, NumArgs, RBracLoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1386,7 +1386,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
Sel,
|
Sel,
|
||||||
Method,
|
Method,
|
||||||
LBracLoc,
|
LBracLoc,
|
||||||
SelectorLoc,
|
SelectorLocs,
|
||||||
RBracLoc,
|
RBracLoc,
|
||||||
move(ArgsIn));
|
move(ArgsIn));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1416,6 +1416,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
diag::err_illegal_message_expr_incomplete_type))
|
diag::err_illegal_message_expr_incomplete_type))
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
|
||||||
|
SourceLocation SelLoc = SelectorLocs.front();
|
||||||
|
|
||||||
// In ARC, forbid the user from sending messages to
|
// In ARC, forbid the user from sending messages to
|
||||||
// retain/release/autorelease/dealloc/retainCount explicitly.
|
// retain/release/autorelease/dealloc/retainCount explicitly.
|
||||||
if (getLangOptions().ObjCAutoRefCount) {
|
if (getLangOptions().ObjCAutoRefCount) {
|
||||||
|
@ -1441,7 +1443,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
case OMF_autorelease:
|
case OMF_autorelease:
|
||||||
case OMF_retainCount:
|
case OMF_retainCount:
|
||||||
Diag(Loc, diag::err_arc_illegal_explicit_message)
|
Diag(Loc, diag::err_arc_illegal_explicit_message)
|
||||||
<< Sel << SelectorLoc;
|
<< Sel << SelLoc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OMF_performSelector:
|
case OMF_performSelector:
|
||||||
|
@ -1467,7 +1469,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
// Issue error, unless ns_returns_not_retained.
|
// Issue error, unless ns_returns_not_retained.
|
||||||
if (!SelMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
|
if (!SelMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
|
||||||
// selector names a +1 method
|
// selector names a +1 method
|
||||||
Diag(SelectorLoc,
|
Diag(SelLoc,
|
||||||
diag::err_arc_perform_selector_retains);
|
diag::err_arc_perform_selector_retains);
|
||||||
Diag(SelMethod->getLocation(), diag::note_method_declared_at);
|
Diag(SelMethod->getLocation(), diag::note_method_declared_at);
|
||||||
}
|
}
|
||||||
|
@ -1476,7 +1478,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
// +0 call. OK. unless ns_returns_retained.
|
// +0 call. OK. unless ns_returns_retained.
|
||||||
if (SelMethod->hasAttr<NSReturnsRetainedAttr>()) {
|
if (SelMethod->hasAttr<NSReturnsRetainedAttr>()) {
|
||||||
// selector names a +1 method
|
// selector names a +1 method
|
||||||
Diag(SelectorLoc,
|
Diag(SelLoc,
|
||||||
diag::err_arc_perform_selector_retains);
|
diag::err_arc_perform_selector_retains);
|
||||||
Diag(SelMethod->getLocation(), diag::note_method_declared_at);
|
Diag(SelMethod->getLocation(), diag::note_method_declared_at);
|
||||||
}
|
}
|
||||||
|
@ -1485,7 +1487,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// error (may leak).
|
// error (may leak).
|
||||||
Diag(SelectorLoc, diag::warn_arc_perform_selector_leaks);
|
Diag(SelLoc, diag::warn_arc_perform_selector_leaks);
|
||||||
Diag(Args[0]->getExprLoc(), diag::note_used_here);
|
Diag(Args[0]->getExprLoc(), diag::note_used_here);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1498,11 +1500,11 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
||||||
SuperLoc, /*IsInstanceSuper=*/true,
|
SuperLoc, /*IsInstanceSuper=*/true,
|
||||||
ReceiverType, Sel, SelectorLoc, Method,
|
ReceiverType, Sel, SelectorLocs, Method,
|
||||||
Args, NumArgs, RBracLoc);
|
Args, NumArgs, RBracLoc);
|
||||||
else
|
else
|
||||||
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc,
|
||||||
Receiver, Sel, SelectorLoc, Method,
|
Receiver, Sel, SelectorLocs, Method,
|
||||||
Args, NumArgs, RBracLoc);
|
Args, NumArgs, RBracLoc);
|
||||||
|
|
||||||
if (getLangOptions().ObjCAutoRefCount) {
|
if (getLangOptions().ObjCAutoRefCount) {
|
||||||
|
@ -1535,7 +1537,7 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
|
||||||
Expr *Receiver,
|
Expr *Receiver,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation LBracLoc,
|
SourceLocation LBracLoc,
|
||||||
SourceLocation SelectorLoc,
|
ArrayRef<SourceLocation> SelectorLocs,
|
||||||
SourceLocation RBracLoc,
|
SourceLocation RBracLoc,
|
||||||
MultiExprArg Args) {
|
MultiExprArg Args) {
|
||||||
if (!Receiver)
|
if (!Receiver)
|
||||||
|
@ -1543,7 +1545,7 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
|
||||||
|
|
||||||
return BuildInstanceMessage(Receiver, Receiver->getType(),
|
return BuildInstanceMessage(Receiver, Receiver->getType(),
|
||||||
/*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
|
/*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
|
||||||
LBracLoc, SelectorLoc, RBracLoc, move(Args));
|
LBracLoc, SelectorLocs, RBracLoc, move(Args));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ARCConversionTypeClass {
|
enum ARCConversionTypeClass {
|
||||||
|
|
Loading…
Reference in New Issue