[Lldb-commits] [lldb] r372817 - [lldb] Fix undefined behavior when having fixits in undefined top level exprs
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 25 00:34:56 PDT 2019
Author: teemperor
Date: Wed Sep 25 00:34:56 2019
New Revision: 372817
URL: http://llvm.org/viewvc/llvm-project?rev=372817&view=rev
Log:
[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.
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=372817&r1=372816&r2=372817&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp Wed Sep 25 00:34:56 2019
@@ -600,7 +600,10 @@ bool ClangUserExpression::Parse(Diagnost
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);
More information about the lldb-commits
mailing list