diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 4ddf6974c728..64b303c4f735 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -64,10 +64,10 @@ private: class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor { public: ClangModulesDeclVendorImpl( - llvm::IntrusiveRefCntPtr &diagnostics_engine, - llvm::IntrusiveRefCntPtr &compiler_invocation, - std::unique_ptr &&compiler_instance, - std::unique_ptr &&parser); + llvm::IntrusiveRefCntPtr diagnostics_engine, + std::shared_ptr compiler_invocation, + std::unique_ptr compiler_instance, + std::unique_ptr parser); ~ClangModulesDeclVendorImpl() override = default; @@ -96,7 +96,7 @@ private: bool m_enabled = false; llvm::IntrusiveRefCntPtr m_diagnostics_engine; - llvm::IntrusiveRefCntPtr m_compiler_invocation; + std::shared_ptr m_compiler_invocation; std::unique_ptr m_compiler_instance; std::unique_ptr m_parser; size_t m_source_location_index = @@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDeclVendor() {} ClangModulesDeclVendor::~ClangModulesDeclVendor() {} ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl( - llvm::IntrusiveRefCntPtr &diagnostics_engine, - llvm::IntrusiveRefCntPtr &compiler_invocation, - std::unique_ptr &&compiler_instance, - std::unique_ptr &&parser) - : ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine), - m_compiler_invocation(compiler_invocation), + llvm::IntrusiveRefCntPtr diagnostics_engine, + std::shared_ptr compiler_invocation, + std::unique_ptr compiler_instance, + std::unique_ptr parser) + : m_diagnostics_engine(std::move(diagnostics_engine)), + m_compiler_invocation(std::move(compiler_invocation)), m_compiler_instance(std::move(compiler_instance)), - m_parser(std::move(parser)), m_imported_modules() {} + m_parser(std::move(parser)) {} void ClangModulesDeclVendorImpl::ReportModuleExportsHelper( std::set &exports, @@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &target) { compiler_invocation_argument_cstrs.push_back(arg.c_str()); } - llvm::IntrusiveRefCntPtr invocation( + std::shared_ptr invocation = clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs, - diagnostics_engine)); + diagnostics_engine); if (!invocation) return nullptr; @@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &target) { new clang::CompilerInstance); instance->setDiagnostics(diagnostics_engine.get()); - instance->setInvocation(invocation.get()); + instance->setInvocation(invocation); std::unique_ptr action(new clang::SyntaxOnlyAction); @@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &target) { while (!parser->ParseTopLevelDecl(parsed)) ; - return new ClangModulesDeclVendorImpl(diagnostics_engine, invocation, + return new ClangModulesDeclVendorImpl(std::move(diagnostics_engine), + std::move(invocation), std::move(instance), std::move(parser)); }