diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-18 21:05:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-18 21:05:04 +0000 |
commit | c7b7b7a8eda7a5316ad1062b7f81a339f5550bca (patch) | |
tree | 0096df28153184277a415c3f42fa22e78193e2e4 /lib/Sema/SemaCodeComplete.cpp | |
parent | 4eb9fc0449ddbd5239ddc3ae6b6e52880f47dcf7 (diff) |
Introduce code completion results for Objective-C methods, both when
declaring methods and when sending messages to them, by bringing all
of the selector into TypedCheck chunks in the completion result. This
way, we can improve the sorting of these results to account for the
full selector name rather than just the first chunk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 13bcfea0d8..5b340d2e7b 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -2306,10 +2306,8 @@ CodeCompletionResult::CreateCodeCompletionString(Sema &S, Keyword += ":"; if (Idx < StartParameter || AllParametersAreInformative) Result->AddInformativeChunk(Keyword); - else if (Idx == StartParameter) + else Result->AddTypedTextChunk(Keyword); - else - Result->AddTextChunk(Keyword); } // If we're before the starting parameter, skip the placeholder. @@ -2523,6 +2521,7 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, typedef CodeCompletionResult Result; Results.EnterNewScope(); + for (Preprocessor::macro_iterator M = PP.macro_begin(), MEnd = PP.macro_end(); M != MEnd; ++M) { @@ -2531,7 +2530,9 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, PP.getLangOptions(), TargetTypeIsPointer))); } + Results.ExitScope(); + } static void AddPrettyFunctionResults(const LangOptions &LangOpts, @@ -2539,6 +2540,7 @@ static void AddPrettyFunctionResults(const LangOptions &LangOpts, typedef CodeCompletionResult Result; Results.EnterNewScope(); + Results.AddResult(Result("__PRETTY_FUNCTION__", CCP_Constant)); Results.AddResult(Result("__FUNCTION__", CCP_Constant)); if (LangOpts.C99 || LangOpts.CPlusPlus0x) @@ -5300,11 +5302,11 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, P != PEnd; (void)++P, ++I) { // Add the part of the selector name. if (I == 0) - Pattern->AddChunk(CodeCompletionString::CK_Colon); + Pattern->AddTypedTextChunk(":"); else if (I < Sel.getNumArgs()) { Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); - Pattern->AddTextChunk(Sel.getIdentifierInfoForSlot(I)->getName()); - Pattern->AddChunk(CodeCompletionString::CK_Colon); + Pattern->AddTypedTextChunk((Sel.getIdentifierInfoForSlot(I)->getName() + + ":").str()); } else break; |