diff options
| author | Raphael Isemann <teemperor@gmail.com> | 2019-09-25 07:34:56 +0000 |
|---|---|---|
| committer | Raphael Isemann <teemperor@gmail.com> | 2019-09-25 07:34:56 +0000 |
| commit | 06e98a8f4098a0ac702143fa52d8ab5e9b01803e (patch) | |
| tree | 2c18b6e42a0a50d91eaa09bbb41eca7e2bcbdf68 /lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp | |
| parent | bf5e5834d91ff89f77a53c96cb468600c33cb111 (diff) | |
| download | bcm5719-llvm-06e98a8f4098a0ac702143fa52d8ab5e9b01803e.tar.gz bcm5719-llvm-06e98a8f4098a0ac702143fa52d8ab5e9b01803e.zip | |
[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
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp')
| -rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 813d03c7194..31c85d20874 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -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); |

