diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-12-10 20:08:27 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-12-10 20:08:27 +0000 |
commit | d0039e56f28bc2ba9091abdc30d3f8ea79c4293d (patch) | |
tree | e4df3688c6c33aae735301baf2a92f6f7b003142 /clang/lib/Sema | |
parent | e54c2a8fd8e6842572d19acb64dd61b3e8d1f76f (diff) | |
download | bcm5719-llvm-d0039e56f28bc2ba9091abdc30d3f8ea79c4293d.tar.gz bcm5719-llvm-d0039e56f28bc2ba9091abdc30d3f8ea79c4293d.zip |
Keep the source location of the selector in ObjCMessageExpr.
llvm-svn: 121516
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 51 | ||||
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 12 |
2 files changed, 35 insertions, 28 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index d63b228f36c..5d5e8a528bb 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -716,16 +716,16 @@ ExprResult Sema::ActOnSuperMessage(Scope *S, QualType SuperTy = Context.getObjCInterfaceType(Super); SuperTy = Context.getObjCObjectPointerType(SuperTy); return BuildInstanceMessage(0, SuperTy, SuperLoc, - Sel, /*Method=*/0, LBracLoc, RBracLoc, - move(Args)); + Sel, /*Method=*/0, + LBracLoc, SelectorLoc, RBracLoc, move(Args)); } // Since we are in a class method, this is a class message to // the superclass. return BuildClassMessage(/*ReceiverTypeInfo=*/0, Context.getObjCInterfaceType(Super), - SuperLoc, Sel, /*Method=*/0, LBracLoc, RBracLoc, - move(Args)); + SuperLoc, Sel, /*Method=*/0, + LBracLoc, SelectorLoc, RBracLoc, move(Args)); } /// \brief Build an Objective-C class message expression. @@ -762,6 +762,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, + SourceLocation SelectorLoc, SourceLocation RBracLoc, MultiExprArg ArgsIn) { SourceLocation Loc = SuperLoc.isValid()? SuperLoc @@ -780,7 +781,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, assert(SuperLoc.isInvalid() && "Message to super with dependent type"); return Owned(ObjCMessageExpr::Create(Context, ReceiverType, VK_RValue, LBracLoc, ReceiverTypeInfo, - Sel, /*Method=*/0, + Sel, SelectorLoc, /*Method=*/0, Args, NumArgs, RBracLoc)); } @@ -831,12 +832,12 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, if (SuperLoc.isValid()) Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc, SuperLoc, /*IsInstanceSuper=*/false, - ReceiverType, Sel, Method, Args, - NumArgs, RBracLoc); + ReceiverType, Sel, SelectorLoc, + Method, Args, NumArgs, RBracLoc); else Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc, - ReceiverTypeInfo, Sel, Method, Args, - NumArgs, RBracLoc); + ReceiverTypeInfo, Sel, SelectorLoc, + Method, Args, NumArgs, RBracLoc); return MaybeBindToTemporary(Result); } @@ -861,7 +862,7 @@ ExprResult Sema::ActOnClassMessage(Scope *S, return BuildClassMessage(ReceiverTypeInfo, ReceiverType, /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0, - LBracLoc, RBracLoc, move(Args)); + LBracLoc, SelectorLoc, RBracLoc, move(Args)); } /// \brief Build an Objective-C instance message expression. @@ -893,13 +894,14 @@ ExprResult Sema::ActOnClassMessage(Scope *S, /// /// \param Args The message arguments. ExprResult Sema::BuildInstanceMessage(Expr *Receiver, - QualType ReceiverType, - SourceLocation SuperLoc, - Selector Sel, - ObjCMethodDecl *Method, - SourceLocation LBracLoc, - SourceLocation RBracLoc, - MultiExprArg ArgsIn) { + QualType ReceiverType, + SourceLocation SuperLoc, + Selector Sel, + ObjCMethodDecl *Method, + SourceLocation LBracLoc, + SourceLocation SelectorLoc, + SourceLocation RBracLoc, + MultiExprArg ArgsIn) { // The location of the receiver. SourceLocation Loc = SuperLoc.isValid()? SuperLoc : Receiver->getLocStart(); @@ -920,8 +922,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, assert(SuperLoc.isInvalid() && "Message to super with dependent type"); return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy, VK_RValue, LBracLoc, Receiver, Sel, - /*Method=*/0, Args, NumArgs, - RBracLoc)); + SelectorLoc, /*Method=*/0, + Args, NumArgs, RBracLoc)); } // If necessary, apply function/array conversion to the receiver. @@ -1064,7 +1066,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, SuperLoc, Sel, Method, - LBracLoc, + LBracLoc, + SelectorLoc, RBracLoc, move(ArgsIn)); } else { @@ -1098,12 +1101,12 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, if (SuperLoc.isValid()) Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc, SuperLoc, /*IsInstanceSuper=*/true, - ReceiverType, Sel, Method, + ReceiverType, Sel, SelectorLoc, Method, Args, NumArgs, RBracLoc); else Result = ObjCMessageExpr::Create(Context, ReturnType, VK, LBracLoc, - Receiver, - Sel, Method, Args, NumArgs, RBracLoc); + Receiver, Sel, SelectorLoc, Method, + Args, NumArgs, RBracLoc); return MaybeBindToTemporary(Result); } @@ -1122,6 +1125,6 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S, return BuildInstanceMessage(Receiver, Receiver->getType(), /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0, - LBracLoc, RBracLoc, move(Args)); + LBracLoc, SelectorLoc, RBracLoc, move(Args)); } diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 9f6f84bec89..f4a4ae28cf6 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1815,6 +1815,7 @@ public: /// \brief Build a new Objective-C class message. ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo, Selector Sel, + SourceLocation SelectorLoc, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, @@ -1822,13 +1823,14 @@ public: return SemaRef.BuildClassMessage(ReceiverTypeInfo, ReceiverTypeInfo->getType(), /*SuperLoc=*/SourceLocation(), - Sel, Method, LBracLoc, RBracLoc, - move(Args)); + Sel, Method, LBracLoc, SelectorLoc, + RBracLoc, move(Args)); } /// \brief Build a new Objective-C instance message. ExprResult RebuildObjCMessageExpr(Expr *Receiver, Selector Sel, + SourceLocation SelectorLoc, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, @@ -1836,8 +1838,8 @@ public: return SemaRef.BuildInstanceMessage(Receiver, Receiver->getType(), /*SuperLoc=*/SourceLocation(), - Sel, Method, LBracLoc, RBracLoc, - move(Args)); + Sel, Method, LBracLoc, SelectorLoc, + RBracLoc, move(Args)); } /// \brief Build a new Objective-C ivar reference expression. @@ -6165,6 +6167,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { // Build a new class message send. return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo, E->getSelector(), + E->getSelectorLoc(), E->getMethodDecl(), E->getLeftLoc(), move_arg(Args), @@ -6187,6 +6190,7 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { // Build a new instance message send. return getDerived().RebuildObjCMessageExpr(Receiver.get(), E->getSelector(), + E->getSelectorLoc(), E->getMethodDecl(), E->getLeftLoc(), move_arg(Args), |