Fixed a leak of ASTStructExtractors and also

made sure we don't keep around no-longer-valid
ASTTransformers.

<rdar://problem/15182379>

llvm-svn: 192333
This commit is contained in:
Sean Callanan 2013-10-10 00:39:23 +00:00
parent 762df1f139
commit 394e36dc81
3 changed files with 8 additions and 10 deletions

View File

@ -630,6 +630,8 @@ private:
std::string m_wrapper_struct_name; ///< The name of the struct that contains the target function address, arguments, and result.
std::list<lldb::addr_t> m_wrapper_args_addrs; ///< The addresses of the arguments to the wrapper function.
std::unique_ptr<ASTStructExtractor> m_struct_extractor; ///< The class that generates the argument struct below.
bool m_struct_valid; ///< True if the ASTStructExtractor has populated the variables below.
//------------------------------------------------------------------

View File

@ -628,5 +628,7 @@ ClangFunction::ExecuteFunction(
clang::ASTConsumer *
ClangFunction::ASTTransformer (clang::ASTConsumer *passthrough)
{
return new ASTStructExtractor(passthrough, m_wrapper_struct_name.c_str(), *this);
m_struct_extractor.reset(new ASTStructExtractor(passthrough, m_wrapper_struct_name.c_str(), *this));
return m_struct_extractor.get();
}

View File

@ -95,15 +95,9 @@ ClangUserExpression::~ClangUserExpression ()
clang::ASTConsumer *
ClangUserExpression::ASTTransformer (clang::ASTConsumer *passthrough)
{
ClangASTContext *clang_ast_context = m_target->GetScratchClangASTContext();
if (!clang_ast_context)
return NULL;
if (!m_result_synthesizer.get())
m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough,
*m_target));
{
m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough,
*m_target));
return m_result_synthesizer.get();
}