ClangFunction: Fix destruction order of parser and execution unit

Fix PR21802 by correcting the destruction order of
`ClangExpressionParser` and `IRExecutionUnit` in `ClangFunction`.  The
former has hooks into the latter -- i.e., `clang::CGDebugInfo` points at
the `LLVMContext` -- so it needs to be torn down first.

This was exposed by r223802 in LLVM, which started doing work in the
`CGDebugInfo` teardown.

llvm-svn: 223916
This commit is contained in:
Duncan P. N. Exon Smith 2014-12-10 04:59:18 +00:00
parent 89c019ecd2
commit f3079d2762
2 changed files with 4 additions and 2 deletions

View File

@ -411,8 +411,10 @@ private:
// For ClangFunction only
//------------------------------------------------------------------
std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
// Note: the parser needs to be destructed before the execution unit, so
// declare the the execution unit first.
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function.
lldb::ModuleWP m_jit_module_wp;
std::string m_name; ///< The name of this clang function - for debugging purposes.

View File

@ -57,8 +57,8 @@ ClangFunction::ClangFunction
const ValueList &arg_value_list,
const char *name
) :
m_parser(),
m_execution_unit_sp(),
m_parser(),
m_jit_module_wp(),
m_name (name ? name : "<unknown>"),
m_function_ptr (NULL),