From a6011e25a1c77de6eba3974737a5c21c319602c6 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 3 Oct 2011 06:36:51 +0000 Subject: Allow getting all source locations of selector identifiers in a ObjCMessageExpr. Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: [foo first:1 second:2] -With a space between the arguments: [foo first: 1 second: 2] -For nullary selectors, immediately before ']': [foo release] In such cases we infer the locations instead of storing them. llvm-svn: 140987 --- clang/lib/Sema/TreeTransform.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'clang/lib/Sema/TreeTransform.h') diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 509c450ced7..99ddd239129 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -2152,7 +2152,7 @@ public: /// \brief Build a new Objective-C class message. ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo, Selector Sel, - SourceLocation SelectorLoc, + ArrayRef SelectorLocs, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, @@ -2160,14 +2160,14 @@ public: return SemaRef.BuildClassMessage(ReceiverTypeInfo, ReceiverTypeInfo->getType(), /*SuperLoc=*/SourceLocation(), - Sel, Method, LBracLoc, SelectorLoc, + Sel, Method, LBracLoc, SelectorLocs, RBracLoc, move(Args)); } /// \brief Build a new Objective-C instance message. ExprResult RebuildObjCMessageExpr(Expr *Receiver, Selector Sel, - SourceLocation SelectorLoc, + ArrayRef SelectorLocs, ObjCMethodDecl *Method, SourceLocation LBracLoc, MultiExprArg Args, @@ -2175,7 +2175,7 @@ public: return SemaRef.BuildInstanceMessage(Receiver, Receiver->getType(), /*SuperLoc=*/SourceLocation(), - Sel, Method, LBracLoc, SelectorLoc, + Sel, Method, LBracLoc, SelectorLocs, RBracLoc, move(Args)); } @@ -7794,9 +7794,11 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { return SemaRef.Owned(E); // Build a new class message send. + SmallVector SelLocs; + E->getSelectorLocs(SelLocs); return getDerived().RebuildObjCMessageExpr(ReceiverTypeInfo, E->getSelector(), - E->getSelectorLoc(), + SelLocs, E->getMethodDecl(), E->getLeftLoc(), move_arg(Args), @@ -7817,9 +7819,11 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { return SemaRef.Owned(E); // Build a new instance message send. + SmallVector SelLocs; + E->getSelectorLocs(SelLocs); return getDerived().RebuildObjCMessageExpr(Receiver.get(), E->getSelector(), - E->getSelectorLoc(), + SelLocs, E->getMethodDecl(), E->getLeftLoc(), move_arg(Args), -- cgit v1.2.3