[Lldb-commits] [lldb] r192333 - Fixed a leak of ASTStructExtractors and also
Sean Callanan
scallanan at apple.com
Wed Oct 9 17:39:23 PDT 2013
Author: spyffe
Date: Wed Oct 9 19:39:23 2013
New Revision: 192333
URL: http://llvm.org/viewvc/llvm-project?rev=192333&view=rev
Log:
Fixed a leak of ASTStructExtractors and also
made sure we don't keep around no-longer-valid
ASTTransformers.
<rdar://problem/15182379>
Modified:
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=192333&r1=192332&r2=192333&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Wed Oct 9 19:39:23 2013
@@ -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.
//------------------------------------------------------------------
Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=192333&r1=192332&r2=192333&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Wed Oct 9 19:39:23 2013
@@ -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();
}
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=192333&r1=192332&r2=192333&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Oct 9 19:39:23 2013
@@ -95,15 +95,9 @@ ClangUserExpression::~ClangUserExpressio
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();
}
More information about the lldb-commits
mailing list