From 5e14d39a8808d87b4ce4706b5944baa26bb4868c Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 21 Mar 2011 18:40:17 +0000 Subject: 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. llvm-svn: 128011 --- clang/tools/libclang/CIndexCodeCompletion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/tools/libclang/CIndexCodeCompletion.cpp') diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp index 2b4a791b50e..e85e80246f9 100644 --- a/clang/tools/libclang/CIndexCodeCompletion.cpp +++ b/clang/tools/libclang/CIndexCodeCompletion.cpp @@ -216,10 +216,10 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { FileSystemOptions FileSystemOpts; /// \brief File manager, used for diagnostics. - FileManager FileMgr; + llvm::IntrusiveRefCntPtr FileMgr; /// \brief Source manager, used for diagnostics. - SourceManager SourceMgr; + llvm::IntrusiveRefCntPtr 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(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 -- cgit v1.2.3