From 811db4eac4e036de3705570a46e28bf7d993dbab Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 23 Oct 2012 22:26:28 +0000 Subject: Make DiagnosticOptions intrusively reference-counted, and make sure the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508 --- clang/tools/libclang/CIndexCodeCompletion.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/tools/libclang/CIndexCodeCompletion.cpp') diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp index 2676b5346c4..46af661d0e5 100644 --- a/clang/tools/libclang/CIndexCodeCompletion.cpp +++ b/clang/tools/libclang/CIndexCodeCompletion.cpp @@ -246,6 +246,8 @@ struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { /// \brief Diagnostics produced while performing code completion. SmallVector Diagnostics; + IntrusiveRefCntPtr DiagOpts; + /// \brief Diag object IntrusiveRefCntPtr Diag; @@ -305,8 +307,10 @@ static llvm::sys::cas_flag CodeCompletionResultObjects; AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults( const FileSystemOptions& FileSystemOpts) : CXCodeCompleteResults(), + DiagOpts(new DiagnosticOptions), Diag(new DiagnosticsEngine( - IntrusiveRefCntPtr(new DiagnosticIDs))), + IntrusiveRefCntPtr(new DiagnosticIDs), + &*DiagOpts)), FileSystemOpts(FileSystemOpts), FileMgr(new FileManager(FileSystemOpts)), SourceMgr(new SourceManager(*Diag, *FileMgr)), -- cgit v1.2.3