diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-20 00:59:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-20 00:59:43 +0000 |
commit | 2283d79155a3e82442fce124ce5fd704ca138801 (patch) | |
tree | 2bcc8745f5052aad44acdacbd1b96a7f473bc89e /tools/libclang/CIndexCodeCompletion.cpp | |
parent | 6dbce19fdae4cfae4eb5f826284978e723a04e61 (diff) |
When performing code-completion in the presence of a preamble, make
sure to (1) actually use the remapped files we were given rather
than old data, and (2) keep the remapped files alive until the
code-completion results are destroyed. Big thanks to Daniel for the
test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r-- | tools/libclang/CIndexCodeCompletion.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 53767c4467..c2febf9b72 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -624,11 +624,6 @@ void clang_codeCompleteAt_Impl(void *UserData) { // Create a code-completion consumer to capture the results. CaptureCompletionResults Capture(*Results); - // Make sure that we free the temporary buffers when the - // code-completion constructor is freed. - for (unsigned I = 0, N = RemappedFiles.size(); I != N; ++I) - Results->TemporaryBuffers.push_back(RemappedFiles[I].second); - // Perform completion. AST->CodeComplete(complete_filename, complete_line, complete_column, RemappedFiles.data(), RemappedFiles.size(), @@ -636,7 +631,8 @@ void clang_codeCompleteAt_Impl(void *UserData) { (options & CXCodeComplete_IncludeCodePatterns), Capture, *Results->Diag, Results->LangOpts, Results->SourceMgr, - Results->FileMgr, Results->Diagnostics); + Results->FileMgr, Results->Diagnostics, + Results->TemporaryBuffers); |