[lldb] Fix undefined behavior when having fixits in undefined top level exprs

In top level expressions, we don't have a m_source_code and we don't need to change
the source bounds (as no wrapping happend there). Fixes the test on the
sanitizer bot.

llvm-svn: 372817
This commit is contained in:
Raphael Isemann 2019-09-25 07:34:56 +00:00
parent bf5e5834d9
commit 06e98a8f40
1 changed files with 4 additions and 1 deletions

View File

@ -600,7 +600,10 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
size_t fixed_end;
const std::string &fixed_expression =
diagnostic_manager.GetFixedExpression();
if (m_source_code->GetOriginalBodyBounds(fixed_expression, m_expr_lang,
// Retrieve the original expression in case we don't have a top level
// expression (which has no surrounding source code).
if (m_source_code &&
m_source_code->GetOriginalBodyBounds(fixed_expression, m_expr_lang,
fixed_start, fixed_end))
m_fixed_text =
fixed_expression.substr(fixed_start, fixed_end - fixed_start);