diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-21 18:40:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-21 18:40:17 +0000 |
commit | 4f32786ac45210143654390177105eb749b614e9 (patch) | |
tree | 289b0c67da849bf045e5c03605f9fbfc80c23d01 /tools/libclang/CIndexCodeCompletion.cpp | |
parent | cd1eecfe4f43a542c8f9a6e7d12fa69b28c23a67 (diff) |
Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance
object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexCodeCompletion.cpp')
-rw-r--r-- | tools/libclang/CIndexCodeCompletion.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index 2b4a791b50..e85e80246f 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -216,10 +216,10 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { FileSystemOptions FileSystemOpts; /// \brief File manager, used for diagnostics. - FileManager FileMgr; + llvm::IntrusiveRefCntPtr<FileManager> FileMgr; /// \brief Source manager, used for diagnostics. - SourceManager SourceMgr; + llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr; /// \brief Temporary files that should be removed once we have finished /// with the code-completion results. @@ -249,8 +249,8 @@ AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults( Diag(new Diagnostic( llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs))), FileSystemOpts(FileSystemOpts), - FileMgr(FileSystemOpts), - SourceMgr(*Diag, FileMgr) { + FileMgr(new FileManager(FileSystemOpts)), + SourceMgr(new SourceManager(*Diag, *FileMgr)) { if (getenv("LIBCLANG_OBJTRACKING")) { llvm::sys::AtomicIncrement(&CodeCompletionResultObjects); fprintf(stderr, "+++ %d completion results\n", CodeCompletionResultObjects); @@ -396,8 +396,8 @@ void clang_codeCompleteAt_Impl(void *UserData) { (options & CXCodeComplete_IncludeMacros), (options & CXCodeComplete_IncludeCodePatterns), Capture, - *Results->Diag, Results->LangOpts, Results->SourceMgr, - Results->FileMgr, Results->Diagnostics, + *Results->Diag, Results->LangOpts, *Results->SourceMgr, + *Results->FileMgr, Results->Diagnostics, Results->TemporaryBuffers); // Keep a reference to the allocator used for cached global completions, so |