diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-08-04 16:47:14 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-08-04 16:47:14 +0000 |
| commit | 8e984da800594aefdeaf33da2f75cb66782f328e (patch) | |
| tree | eacc759e6cb7e0cf847782e7e7aa2bdfbcb569ed /clang/lib/Sema/SemaCodeComplete.cpp | |
| parent | 988bfce174f5debeb5f79e5050b933a418f53477 (diff) | |
| download | bcm5719-llvm-8e984da800594aefdeaf33da2f75cb66782f328e.tar.gz bcm5719-llvm-8e984da800594aefdeaf33da2f75cb66782f328e.zip | |
Add code-completion support directly to ASTUnit, which performs code
completion within the translation unit using the same command-line
arguments for parsing the translation unit. Eventually, we'll reuse
the precompiled preamble to improve code-completion performance, and
this also gives us a place to cache results.
Expose this function via the new libclang function
clang_codeCompleteAt(), which performs the code completion within a
CXTranslationUnit. The completion occurs in-process
(clang_codeCompletion() runs code completion out-of-process).
llvm-svn: 110210
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 476c79cc37b..52ac8dd6498 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -1811,13 +1811,15 @@ static void AddFunctionTypeQualsToCompletionString(CodeCompletionString *Result, /// how to use this result, or NULL to indicate that the string or name of the /// result is all that is needed. CodeCompletionString * -CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) { +CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S, + CodeCompletionString *Result) { typedef CodeCompletionString::Chunk Chunk; if (Kind == RK_Pattern) - return Pattern->Clone(); + return Pattern->Clone(Result); - CodeCompletionString *Result = new CodeCompletionString; + if (!Result) + Result = new CodeCompletionString; if (Kind == RK_Keyword) { Result->AddTypedTextChunk(Keyword); |

