Fixes for Clang API changes to use std::shared_ptr

llvm-svn: 291200
This commit is contained in:
David Blaikie 2017-01-06 00:38:12 +00:00
parent 73902cc0ac
commit e9c678cfca
1 changed files with 17 additions and 16 deletions

View File

@ -64,10 +64,10 @@ private:
class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor { class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
public: public:
ClangModulesDeclVendorImpl( ClangModulesDeclVendorImpl(
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine, llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation, std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
std::unique_ptr<clang::CompilerInstance> &&compiler_instance, std::unique_ptr<clang::CompilerInstance> compiler_instance,
std::unique_ptr<clang::Parser> &&parser); std::unique_ptr<clang::Parser> parser);
~ClangModulesDeclVendorImpl() override = default; ~ClangModulesDeclVendorImpl() override = default;
@ -96,7 +96,7 @@ private:
bool m_enabled = false; bool m_enabled = false;
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine; 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::CompilerInstance> m_compiler_instance;
std::unique_ptr<clang::Parser> m_parser; std::unique_ptr<clang::Parser> m_parser;
size_t m_source_location_index = size_t m_source_location_index =
@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDeclVendor() {}
ClangModulesDeclVendor::~ClangModulesDeclVendor() {} ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl( ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine, llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation, std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
std::unique_ptr<clang::CompilerInstance> &&compiler_instance, std::unique_ptr<clang::CompilerInstance> compiler_instance,
std::unique_ptr<clang::Parser> &&parser) std::unique_ptr<clang::Parser> parser)
: ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine), : m_diagnostics_engine(std::move(diagnostics_engine)),
m_compiler_invocation(compiler_invocation), m_compiler_invocation(std::move(compiler_invocation)),
m_compiler_instance(std::move(compiler_instance)), m_compiler_instance(std::move(compiler_instance)),
m_parser(std::move(parser)), m_imported_modules() {} m_parser(std::move(parser)) {}
void ClangModulesDeclVendorImpl::ReportModuleExportsHelper( void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
std::set<ClangModulesDeclVendor::ModuleID> &exports, std::set<ClangModulesDeclVendor::ModuleID> &exports,
@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &target) {
compiler_invocation_argument_cstrs.push_back(arg.c_str()); 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, clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs,
diagnostics_engine)); diagnostics_engine);
if (!invocation) if (!invocation)
return nullptr; return nullptr;
@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &target) {
new clang::CompilerInstance); new clang::CompilerInstance);
instance->setDiagnostics(diagnostics_engine.get()); instance->setDiagnostics(diagnostics_engine.get());
instance->setInvocation(invocation.get()); instance->setInvocation(invocation);
std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction); std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &target) {
while (!parser->ParseTopLevelDecl(parsed)) 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)); std::move(instance), std::move(parser));
} }