diff options
author | Sean Callanan <scallanan@apple.com> | 2011-10-08 00:21:35 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2011-10-08 00:21:35 +0000 |
commit | 2590b9ac6fad32fc72a229b35c5b2b439de6e140 (patch) | |
tree | f68e5f79a9a62942c25fc6bd87c8689e963a450d /lldb/source/Expression/ClangUserExpression.cpp | |
parent | ba4a36227611e92851151e8f0e67201348cf1b14 (diff) | |
download | bcm5719-llvm-2590b9ac6fad32fc72a229b35c5b2b439de6e140.tar.gz bcm5719-llvm-2590b9ac6fad32fc72a229b35c5b2b439de6e140.zip |
Fixed a memory leak of ASTResultSynthesizers,
by attaching them to the ClangExpressionParser.
llvm-svn: 141452
Diffstat (limited to 'lldb/source/Expression/ClangUserExpression.cpp')
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index b4f4901a197..9ded61adfc7 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -72,10 +72,13 @@ ClangUserExpression::ASTTransformer (clang::ASTConsumer *passthrough) if (!clang_ast_context) return NULL; - return new ASTResultSynthesizer(passthrough, - m_desired_type, - *m_target->GetScratchClangASTContext()->getASTContext(), - m_target->GetPersistentVariables()); + if (!m_result_synthesizer.get()) + m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough, + m_desired_type, + *m_target->GetScratchClangASTContext()->getASTContext(), + m_target->GetPersistentVariables())); + + return m_result_synthesizer.get(); } void |