diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-21 20:38:13 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-21 20:38:13 +0000 |
commit | 1569f95831a8c99e9f664137bf8f40e47ee3d90f (patch) | |
tree | a107f83099282227ab157ee9b055da87ca8319ab /lib/Parse/ParseObjc.cpp | |
parent | b99c666a940e93bcfcaeddc01515c94472e28a20 (diff) |
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
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 56937a66cd..2a71bf024b 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1726,40 +1726,26 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() { if (Tok.is(tok::identifier)) { IdentifierInfo *Name = Tok.getIdentifierInfo(); SourceLocation NameLoc = Tok.getLocation(); + TypeTy *ReceiverType; switch (Actions.getObjCMessageKind(CurScope, Name, NameLoc, Name == Ident_super, - NextToken().is(tok::period))) { + NextToken().is(tok::period), + ReceiverType)) { case Action::ObjCSuperMessage: return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0, ExprArg(Actions)); - case Action::ObjCClassMessage: { - // Create the type that corresponds to the identifier (which - // names an Objective-C class). - TypeTy *Type = 0; - if (TypeTy *TyName = Actions.getTypeName(*Name, NameLoc, CurScope)) { - 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 = Actions.ActOnTypeName(CurScope, DeclaratorInfo); - if (!Ty.isInvalid()) - Type = Ty.get(); - } - } - - ConsumeToken(); // The identifier. - if (!Type) { + case Action::ObjCClassMessage: + if (!ReceiverType) { SkipUntil(tok::r_square); return ExprError(); } - return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), Type, + ConsumeToken(); // the type name + + return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), + ReceiverType, ExprArg(Actions)); - } case Action::ObjCInstanceMessage: // Fall through to parse an expression. |