Skip to content

Commit 8b62429

Browse files
committed
Use StringRef instead of char* (NFC)
1 parent 5a81a60 commit 8b62429

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lldb/include/lldb/Expression/UserExpression.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,8 @@ class UserExpression : public Expression {
266266
0x1001; ///< ValueObject::GetError() returns this if there is no result
267267
/// from the expression.
268268

269-
const char *GetFixedText() {
270-
if (m_fixed_text.empty())
271-
return nullptr;
272-
return m_fixed_text.c_str();
269+
llvm::StringRef GetFixedText() {
270+
return m_fixed_text;
273271
}
274272

275273
protected:

lldb/source/Expression/UserExpression.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,7 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
254254
if (fixed_expression == nullptr)
255255
fixed_expression = &tmp_fixed_expression;
256256

257-
const char *fixed_text = user_expression_sp->GetFixedText();
258-
if (fixed_text != nullptr)
259-
fixed_expression->append(fixed_text);
257+
*fixed_expression = user_expression_sp->GetFixedText().str();
260258

261259
// If there is a fixed expression, try to parse it:
262260
if (!parse_success) {
@@ -285,8 +283,8 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
285283
} else {
286284
// The fixed expression also didn't parse. Let's check for any new
287285
// Fix-Its we could try.
288-
if (fixed_expression_sp->GetFixedText()) {
289-
*fixed_expression = fixed_expression_sp->GetFixedText();
286+
if (!fixed_expression_sp->GetFixedText().empty()) {
287+
*fixed_expression = fixed_expression_sp->GetFixedText().str();
290288
} else {
291289
// Fixed expression didn't compile without a fixit, don't retry and
292290
// don't tell the user about it.

0 commit comments

Comments
 (0)