[Lldb-commits] [lldb] r291271 - Reapply "Fixes for Clang API changes to use std::shared_ptr"
David Blaikie via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 6 11:49:05 PST 2017
Author: dblaikie
Date: Fri Jan 6 13:49:05 2017
New Revision: 291271
URL: http://llvm.org/viewvc/llvm-project?rev=291271&view=rev
Log:
Reapply "Fixes for Clang API changes to use std::shared_ptr"
Aleksey Shlyapnikov found the memory leak I introduced, recommitted the
Clang change with a fix for this.
This reapplies r291200 reverted in r291250
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=291271&r1=291270&r2=291271&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Fri Jan 6 13:49:05 2017
@@ -64,10 +64,10 @@ private:
class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
public:
ClangModulesDeclVendorImpl(
- llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
- std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
- std::unique_ptr<clang::Parser> &&parser);
+ llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+ std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+ std::unique_ptr<clang::CompilerInstance> compiler_instance,
+ std::unique_ptr<clang::Parser> parser);
~ClangModulesDeclVendorImpl() override = default;
@@ -96,7 +96,7 @@ private:
bool m_enabled = false;
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine;
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> m_compiler_invocation;
+ std::shared_ptr<clang::CompilerInvocation> m_compiler_invocation;
std::unique_ptr<clang::CompilerInstance> m_compiler_instance;
std::unique_ptr<clang::Parser> m_parser;
size_t m_source_location_index =
@@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDecl
ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
- llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
- std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
- std::unique_ptr<clang::Parser> &&parser)
- : ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine),
- m_compiler_invocation(compiler_invocation),
+ llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+ std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+ std::unique_ptr<clang::CompilerInstance> compiler_instance,
+ std::unique_ptr<clang::Parser> 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<ClangModulesDeclVendor::ModuleID> &exports,
@@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &t
compiler_invocation_argument_cstrs.push_back(arg.c_str());
}
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> invocation(
+ std::shared_ptr<clang::CompilerInvocation> invocation =
clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs,
- diagnostics_engine));
+ diagnostics_engine);
if (!invocation)
return nullptr;
@@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &t
new clang::CompilerInstance);
instance->setDiagnostics(diagnostics_engine.get());
- instance->setInvocation(invocation.get());
+ instance->setInvocation(invocation);
std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
@@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &t
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));
}
More information about the lldb-commits
mailing list