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 | 060d53f1559d08a6923e45bdeffe8f22ca663049 (patch) | |
tree | b3767e88ce00651c025642aa3114fb8dc69e7972 /source | |
parent | f28d134fe5696cf7a5f4a0c143b0492ab09f5ff3 (diff) | |
download | lldb-060d53f1559d08a6923e45bdeffe8f22ca663049.tar.gz |
Fixed a memory leak of ASTResultSynthesizers,
by attaching them to the ClangExpressionParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source')
-rw-r--r-- | source/Expression/ClangUserExpression.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp index b4f4901a1..9ded61adf 100644 --- a/source/Expression/ClangUserExpression.cpp +++ b/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 |