diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-30 06:55:39 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-30 06:55:39 +0000 |
commit | 2c595adf2e8aa74232b5b7b6820e0f93d7353632 (patch) | |
tree | 4116d58614c5f18ca4e2ae17c3910534fed3774f /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 7e1eb935dbc3560e05761de521f379736d0a3a6f (diff) | |
download | bcm5719-llvm-2c595adf2e8aa74232b5b7b6820e0f93d7353632.tar.gz bcm5719-llvm-2c595adf2e8aa74232b5b7b6820e0f93d7353632.zip |
When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.
llvm-svn: 136559
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index f91d6907967..66ecae0b792 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5325,21 +5325,23 @@ void Sema::CodeCompleteObjCInterfaceDecl(Scope *S) { CodeCompletionContext::CCC_Other); Results.EnterNewScope(); - // Add all classes. - AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, true, - false, Results); - + if (CodeCompleter->includeGlobals()) { + // Add all classes. + AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, false, + false, Results); + } + Results.ExitScope(); - // FIXME: Use cached global completion results. + HandleCodeCompleteResults(this, CodeCompleter, - CodeCompletionContext::CCC_Other, + CodeCompletionContext::CCC_ObjCInterfaceName, Results.data(),Results.size()); } void Sema::CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc) { ResultBuilder Results(*this, CodeCompleter->getAllocator(), - CodeCompletionContext::CCC_ObjCSuperclass); + CodeCompletionContext::CCC_ObjCInterfaceName); Results.EnterNewScope(); // Make sure that we ignore the class we're currently defining. @@ -5348,14 +5350,16 @@ void Sema::CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, if (CurClass && isa<ObjCInterfaceDecl>(CurClass)) Results.Ignore(CurClass); - // Add all classes. - AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, false, - false, Results); - + if (CodeCompleter->includeGlobals()) { + // Add all classes. + AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, false, + false, Results); + } + Results.ExitScope(); - // FIXME: Use cached global completion results. + HandleCodeCompleteResults(this, CodeCompleter, - CodeCompletionContext::CCC_ObjCSuperclass, + CodeCompletionContext::CCC_ObjCInterfaceName, Results.data(),Results.size()); } @@ -5364,14 +5368,16 @@ void Sema::CodeCompleteObjCImplementationDecl(Scope *S) { CodeCompletionContext::CCC_Other); Results.EnterNewScope(); - // Add all unimplemented classes. - AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, false, - true, Results); - + if (CodeCompleter->includeGlobals()) { + // Add all unimplemented classes. + AddInterfaceResults(Context.getTranslationUnitDecl(), CurContext, false, + true, Results); + } + Results.ExitScope(); - // FIXME: Use cached global completion results. + HandleCodeCompleteResults(this, CodeCompleter, - CodeCompletionContext::CCC_Other, + CodeCompletionContext::CCC_ObjCInterfaceName, Results.data(),Results.size()); } |