diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-18 04:49:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-18 04:49:41 +0000 |
commit | 5b4671c32835cfe7eee13e28fe8b13d1b53c9db6 (patch) | |
tree | 1008b4b1c8df9c5193459b4261a4b908fd0af866 /clang/lib/Sema | |
parent | 23f21f7ba360ffa235f9396f127e22c99b974c88 (diff) | |
download | bcm5719-llvm-5b4671c32835cfe7eee13e28fe8b13d1b53c9db6.tar.gz bcm5719-llvm-5b4671c32835cfe7eee13e28fe8b13d1b53c9db6.zip |
Code completion after @property, providing the names of forward-declared properties
llvm-svn: 89196
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/Sema.h | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 22 |
2 files changed, 21 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 333cc00069a..e16bfaa57c8 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -4017,7 +4017,8 @@ public: virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver); virtual void CodeCompleteObjCProtocolReferences(IdentifierLocPair *Protocols, unsigned NumProtocols); - //@} + virtual void CodeCompleteObjCProtocolDecl(Scope *S); + //@} //===--------------------------------------------------------------------===// // Extra semantic analysis beyond the C type system diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index be1ddddd699..9cecdadc867 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -1830,6 +1830,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver) { /// \brief Add all of the protocol declarations that we find in the given /// (translation unit) context. static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, + bool OnlyForwardDeclarations, ResultBuilder &Results) { typedef CodeCompleteConsumer::Result Result; @@ -1838,7 +1839,8 @@ static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, D != DEnd; ++D) { // Record any protocols we find. if (ObjCProtocolDecl *Proto = dyn_cast<ObjCProtocolDecl>(*D)) - Results.MaybeAddResult(Result(Proto, 0), CurContext); + if (!OnlyForwardDeclarations || Proto->isForwardDecl()) + Results.MaybeAddResult(Result(Proto, 0), CurContext); // Record any forward-declared protocols we find. if (ObjCForwardProtocolDecl *Forward @@ -1847,7 +1849,8 @@ static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, P = Forward->protocol_begin(), PEnd = Forward->protocol_end(); P != PEnd; ++P) - Results.MaybeAddResult(Result(*P, 0), CurContext); + if (!OnlyForwardDeclarations || (*P)->isForwardDecl()) + Results.MaybeAddResult(Result(*P, 0), CurContext); } } } @@ -1864,7 +1867,20 @@ void Sema::CodeCompleteObjCProtocolReferences(IdentifierLocPair *Protocols, Results.Ignore(Protocol); // Add all protocols. - AddProtocolResults(Context.getTranslationUnitDecl(), CurContext, Results); + AddProtocolResults(Context.getTranslationUnitDecl(), CurContext, false, + Results); + + Results.ExitScope(); + HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size()); +} + +void Sema::CodeCompleteObjCProtocolDecl(Scope *) { + ResultBuilder Results(*this); + Results.EnterNewScope(); + + // Add all protocols. + AddProtocolResults(Context.getTranslationUnitDecl(), CurContext, true, + Results); Results.ExitScope(); HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size()); |