From 1569f95831a8c99e9f664137bf8f40e47ee3d90f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 21 Apr 2010 20:38:13 +0000 Subject: Migrate the responsibility for turning the receiver name in an Objective-C class message expression into a type from the parser (which was doing so in two places) to Action::getObjCMessageKind() which, in the case of Sema, reduces the number of name lookups we need to perform. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102026 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/MinimalAction.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib/Parse/MinimalAction.cpp') diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp index fc06a0d6a5..5a03767811 100644 --- a/lib/Parse/MinimalAction.cpp +++ b/lib/Parse/MinimalAction.cpp @@ -27,15 +27,30 @@ ActionBase::~ActionBase() {} Action::~Action() {} Action::ObjCMessageKind Action::getObjCMessageKind(Scope *S, - IdentifierInfo *&Name, + IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, - bool HasTrailingDot) { + bool HasTrailingDot, + TypeTy *&ReceiverType) { + ReceiverType = 0; + if (IsSuper && !HasTrailingDot && S->isInObjcMethodScope()) return ObjCSuperMessage; - if (getTypeName(*Name, NameLoc, S)) + if (TypeTy *TyName = getTypeName(*Name, NameLoc, S)) { + DeclSpec DS; + const char *PrevSpec = 0; + unsigned DiagID = 0; + if (!DS.SetTypeSpecType(DeclSpec::TST_typename, NameLoc, PrevSpec, + DiagID, TyName)) { + DS.SetRangeEnd(NameLoc); + Declarator DeclaratorInfo(DS, Declarator::TypeNameContext); + TypeResult Ty = ActOnTypeName(S, DeclaratorInfo); + if (!Ty.isInvalid()) + ReceiverType = Ty.get(); + } return ObjCClassMessage; + } return ObjCInstanceMessage; } -- cgit v1.2.3-18-g5258