summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-10-10 00:39:23 +0000
committerSean Callanan <scallanan@apple.com>2013-10-10 00:39:23 +0000
commit394e36dc810f8261bcf69d788ad412b7a1c5798f (patch)
tree68e5646c98eee20db9ff4c9ce9526c8370ae442a
parent762df1f139043263cb0c085af5b87bb90057329a (diff)
downloadbcm5719-llvm-394e36dc810f8261bcf69d788ad412b7a1c5798f.tar.gz
bcm5719-llvm-394e36dc810f8261bcf69d788ad412b7a1c5798f.zip
Fixed a leak of ASTStructExtractors and also
made sure we don't keep around no-longer-valid ASTTransformers. <rdar://problem/15182379> llvm-svn: 192333
-rw-r--r--lldb/include/lldb/Expression/ClangFunction.h2
-rw-r--r--lldb/source/Expression/ClangFunction.cpp4
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp12
3 files changed, 8 insertions, 10 deletions
diff --git a/lldb/include/lldb/Expression/ClangFunction.h b/lldb/include/lldb/Expression/ClangFunction.h
index 8225d0ad81d..8fef14c650b 100644
--- a/lldb/include/lldb/Expression/ClangFunction.h
+++ b/lldb/include/lldb/Expression/ClangFunction.h
@@ -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.
//------------------------------------------------------------------
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index 171433d945b..8d45d451f58 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -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();
}
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index 1e52ce2828c..c9196533974 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -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();
}
OpenPOWER on IntegriCloud