forked from OSchip/llvm-project
Revert "Fixes for Clang API changes to use std::shared_ptr"
The original Clang change caused a memory leak detected by asan. Reverting while I investigate. This reverts commit r291200. llvm-svn: 291250
This commit is contained in:
parent
81d0829438
commit
64fb405836
|
@ -64,10 +64,10 @@ private:
|
|||
class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
|
||||
public:
|
||||
ClangModulesDeclVendorImpl(
|
||||
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);
|
||||
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);
|
||||
|
||||
~ClangModulesDeclVendorImpl() override = default;
|
||||
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
bool m_enabled = false;
|
||||
|
||||
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine;
|
||||
std::shared_ptr<clang::CompilerInvocation> m_compiler_invocation;
|
||||
llvm::IntrusiveRefCntPtr<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::ClangModulesDeclVendor() {}
|
|||
ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
|
||||
|
||||
ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
|
||||
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)),
|
||||
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),
|
||||
m_compiler_instance(std::move(compiler_instance)),
|
||||
m_parser(std::move(parser)) {}
|
||||
m_parser(std::move(parser)), m_imported_modules() {}
|
||||
|
||||
void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
|
||||
std::set<ClangModulesDeclVendor::ModuleID> &exports,
|
||||
|
@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &target) {
|
|||
compiler_invocation_argument_cstrs.push_back(arg.c_str());
|
||||
}
|
||||
|
||||
std::shared_ptr<clang::CompilerInvocation> invocation =
|
||||
llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> 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);
|
||||
instance->setInvocation(invocation.get());
|
||||
|
||||
std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
|
||||
|
||||
|
@ -674,7 +674,6 @@ ClangModulesDeclVendor::Create(Target &target) {
|
|||
while (!parser->ParseTopLevelDecl(parsed))
|
||||
;
|
||||
|
||||
return new ClangModulesDeclVendorImpl(std::move(diagnostics_engine),
|
||||
std::move(invocation),
|
||||
return new ClangModulesDeclVendorImpl(diagnostics_engine, invocation,
|
||||
std::move(instance), std::move(parser));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue