From 979f74d1ddcff4c406668912ec6568bb69e4f222 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 3 Dec 2010 01:38:59 +0000 Subject: Fixed object lifetimes in ClangExpressionDeclMap so that it is not referring to potentially stale state during IR execution. This was done by introducing modular state (like ClangExpressionVariable) where groups of state variables have well-defined lifetimes: - m_parser_vars are specific to parsing, and only exist between calls to WillParse() and DidParse(). - m_struct_vars survive for the entire execution of the ClangExpressionDeclMap because they provide the template for a materialized set of expression variables. - m_material_vars are specific to a single instance of materialization, and only exist between calls to Materialize() and Dematerialize(). I also removed unnecessary references to long- lived state that really didn't need to be referred to at all, and also introduced several assert()s that helped me diagnose a few bugs (fixed too). llvm-svn: 120778 --- lldb/source/Expression/ClangUtilityFunction.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lldb/source/Expression/ClangUtilityFunction.cpp') diff --git a/lldb/source/Expression/ClangUtilityFunction.cpp b/lldb/source/Expression/ClangUtilityFunction.cpp index 0080347543b..0c9d90a2b57 100644 --- a/lldb/source/Expression/ClangUtilityFunction.cpp +++ b/lldb/source/Expression/ClangUtilityFunction.cpp @@ -99,7 +99,9 @@ ClangUtilityFunction::Install (Stream &error_stream, // Parse the expression // - m_expr_decl_map.reset(new ClangExpressionDeclMap(&exe_ctx)); + m_expr_decl_map.reset(new ClangExpressionDeclMap()); + + m_expr_decl_map->WillParse(exe_ctx); ClangExpressionParser parser(target_triple.GetCString(), *this); @@ -120,6 +122,8 @@ ClangUtilityFunction::Install (Stream &error_stream, Error jit_error = parser.MakeJIT (m_jit_begin, m_jit_end, exe_ctx); + m_expr_decl_map->DidParse(); + m_expr_decl_map.reset(); if (jit_error.Success()) -- cgit v1.2.3