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 | e5798dcb413e2cacfcf00452fb7fe14ba51bef6d (patch) | |
tree | 968f2a94c123630704b7b3c4a882906bc58632b4 /clang/lib/Parse/MinimalAction.cpp | |
parent | 4bb6e929027fff9fcf8d5a09770b19b1e7aa972b (diff) | |
download | bcm5719-llvm-e5798dcb413e2cacfcf00452fb7fe14ba51bef6d.tar.gz bcm5719-llvm-e5798dcb413e2cacfcf00452fb7fe14ba51bef6d.zip |
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.
llvm-svn: 102026
Diffstat (limited to 'clang/lib/Parse/MinimalAction.cpp')
-rw-r--r-- | clang/lib/Parse/MinimalAction.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/Parse/MinimalAction.cpp b/clang/lib/Parse/MinimalAction.cpp index fc06a0d6a52..5a037678117 100644 --- a/clang/lib/Parse/MinimalAction.cpp +++ b/clang/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; } |