зеркало из https://github.com/microsoft/clang-1.git
Pass the location of the start of the selector to ActOnClassMessage/ActOnInstanceMessage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
e308c413fa
Коммит
ff975cfab9
|
@ -1292,8 +1292,8 @@ public:
|
||||||
Scope *S,
|
Scope *S,
|
||||||
IdentifierInfo *receivingClassName,
|
IdentifierInfo *receivingClassName,
|
||||||
Selector Sel,
|
Selector Sel,
|
||||||
SourceLocation lbrac,
|
SourceLocation lbrac, SourceLocation receiverLoc,
|
||||||
SourceLocation receiverLoc,
|
SourceLocation selectorLoc,
|
||||||
SourceLocation rbrac,
|
SourceLocation rbrac,
|
||||||
ExprTy **ArgExprs, unsigned NumArgs) {
|
ExprTy **ArgExprs, unsigned NumArgs) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1303,7 +1303,7 @@ public:
|
||||||
// is obtained from NumArgs.
|
// is obtained from NumArgs.
|
||||||
virtual ExprResult ActOnInstanceMessage(
|
virtual ExprResult ActOnInstanceMessage(
|
||||||
ExprTy *receiver, Selector Sel,
|
ExprTy *receiver, Selector Sel,
|
||||||
SourceLocation lbrac, SourceLocation rbrac,
|
SourceLocation lbrac, SourceLocation selectorLoc, SourceLocation rbrac,
|
||||||
ExprTy **ArgExprs, unsigned NumArgs) {
|
ExprTy **ArgExprs, unsigned NumArgs) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1491,6 +1491,8 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
SourceLocation Loc;
|
SourceLocation Loc;
|
||||||
IdentifierInfo *selIdent = ParseObjCSelector(Loc);
|
IdentifierInfo *selIdent = ParseObjCSelector(Loc);
|
||||||
|
|
||||||
|
SourceLocation SelectorLoc = Loc;
|
||||||
|
|
||||||
llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
|
llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
|
||||||
ExprVector KeyExprs(Actions);
|
ExprVector KeyExprs(Actions);
|
||||||
|
|
||||||
|
@ -1573,10 +1575,11 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
// We've just parsed a keyword message.
|
// We've just parsed a keyword message.
|
||||||
if (ReceiverName)
|
if (ReceiverName)
|
||||||
return Owned(Actions.ActOnClassMessage(CurScope, ReceiverName, Sel,
|
return Owned(Actions.ActOnClassMessage(CurScope, ReceiverName, Sel,
|
||||||
LBracLoc, NameLoc, RBracLoc,
|
LBracLoc, NameLoc, SelectorLoc,
|
||||||
|
RBracLoc,
|
||||||
KeyExprs.take(), KeyExprs.size()));
|
KeyExprs.take(), KeyExprs.size()));
|
||||||
return Owned(Actions.ActOnInstanceMessage(ReceiverExpr.release(), Sel,
|
return Owned(Actions.ActOnInstanceMessage(ReceiverExpr.release(), Sel,
|
||||||
LBracLoc, RBracLoc,
|
LBracLoc, SelectorLoc, RBracLoc,
|
||||||
KeyExprs.take(), KeyExprs.size()));
|
KeyExprs.take(), KeyExprs.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1667,8 +1667,8 @@ public:
|
||||||
// is obtained from NumArgs.
|
// is obtained from NumArgs.
|
||||||
virtual ExprResult ActOnClassMessage(
|
virtual ExprResult ActOnClassMessage(
|
||||||
Scope *S,
|
Scope *S,
|
||||||
IdentifierInfo *receivingClassName, Selector Sel,
|
IdentifierInfo *receivingClassName, Selector Sel, SourceLocation lbrac,
|
||||||
SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac,
|
SourceLocation receiverLoc, SourceLocation selectorLoc,SourceLocation rbrac,
|
||||||
ExprTy **ArgExprs, unsigned NumArgs);
|
ExprTy **ArgExprs, unsigned NumArgs);
|
||||||
|
|
||||||
// ActOnInstanceMessage - used for both unary and keyword messages.
|
// ActOnInstanceMessage - used for both unary and keyword messages.
|
||||||
|
@ -1676,7 +1676,7 @@ public:
|
||||||
// is obtained from NumArgs.
|
// is obtained from NumArgs.
|
||||||
virtual ExprResult ActOnInstanceMessage(
|
virtual ExprResult ActOnInstanceMessage(
|
||||||
ExprTy *receiver, Selector Sel,
|
ExprTy *receiver, Selector Sel,
|
||||||
SourceLocation lbrac, SourceLocation rbrac,
|
SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac,
|
||||||
ExprTy **ArgExprs, unsigned NumArgs);
|
ExprTy **ArgExprs, unsigned NumArgs);
|
||||||
|
|
||||||
/// ActOnPragmaPack - Called on well formed #pragma pack(...).
|
/// ActOnPragmaPack - Called on well formed #pragma pack(...).
|
||||||
|
|
|
@ -177,7 +177,8 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
|
||||||
Sema::ExprResult Sema::ActOnClassMessage(
|
Sema::ExprResult Sema::ActOnClassMessage(
|
||||||
Scope *S,
|
Scope *S,
|
||||||
IdentifierInfo *receiverName, Selector Sel,
|
IdentifierInfo *receiverName, Selector Sel,
|
||||||
SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac,
|
SourceLocation lbrac, SourceLocation receiverLoc,
|
||||||
|
SourceLocation selectorLoc, SourceLocation rbrac,
|
||||||
ExprTy **Args, unsigned NumArgs)
|
ExprTy **Args, unsigned NumArgs)
|
||||||
{
|
{
|
||||||
assert(receiverName && "missing receiver class name");
|
assert(receiverName && "missing receiver class name");
|
||||||
|
@ -202,8 +203,8 @@ Sema::ExprResult Sema::ActOnClassMessage(
|
||||||
ExprResult ReceiverExpr = new (Context) ObjCSuperExpr(SourceLocation(),
|
ExprResult ReceiverExpr = new (Context) ObjCSuperExpr(SourceLocation(),
|
||||||
superTy);
|
superTy);
|
||||||
// We are really in an instance method, redirect.
|
// We are really in an instance method, redirect.
|
||||||
return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
|
return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac,
|
||||||
Args, NumArgs);
|
selectorLoc, rbrac, Args, NumArgs);
|
||||||
}
|
}
|
||||||
// We are sending a message to 'super' within a class method. Do nothing,
|
// We are sending a message to 'super' within a class method. Do nothing,
|
||||||
// the receiver will pass through as 'super' (how convenient:-).
|
// the receiver will pass through as 'super' (how convenient:-).
|
||||||
|
@ -216,8 +217,8 @@ Sema::ExprResult Sema::ActOnClassMessage(
|
||||||
ExprResult ReceiverExpr = new (Context) DeclRefExpr(VD, VD->getType(),
|
ExprResult ReceiverExpr = new (Context) DeclRefExpr(VD, VD->getType(),
|
||||||
receiverLoc);
|
receiverLoc);
|
||||||
// We are really in an instance method, redirect.
|
// We are really in an instance method, redirect.
|
||||||
return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
|
return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac,
|
||||||
Args, NumArgs);
|
selectorLoc, rbrac, Args, NumArgs);
|
||||||
}
|
}
|
||||||
return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
|
return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
|
||||||
}
|
}
|
||||||
|
@ -290,6 +291,7 @@ Sema::ExprResult Sema::ActOnClassMessage(
|
||||||
// is obtained from Sel.getNumArgs().
|
// is obtained from Sel.getNumArgs().
|
||||||
Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
||||||
SourceLocation lbrac,
|
SourceLocation lbrac,
|
||||||
|
SourceLocation receiverLoc,
|
||||||
SourceLocation rbrac,
|
SourceLocation rbrac,
|
||||||
ExprTy **Args, unsigned NumArgs) {
|
ExprTy **Args, unsigned NumArgs) {
|
||||||
assert(receiver && "missing receiver expression");
|
assert(receiver && "missing receiver expression");
|
||||||
|
@ -310,6 +312,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
||||||
if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass())
|
if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass())
|
||||||
Method = SuperDecl->lookupInstanceMethod(Sel);
|
Method = SuperDecl->lookupInstanceMethod(Sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
|
if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
|
||||||
lbrac, rbrac, returnType))
|
lbrac, rbrac, returnType))
|
||||||
return true;
|
return true;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче