aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Expression/UserExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Expression/UserExpression.cpp')
-rw-r--r--lldb/source/Expression/UserExpression.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index 8e1cac7099dc..c181712a2f0b 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -14,7 +14,6 @@
#include <string>
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/ExpressionVariable.h"
@@ -36,7 +35,6 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallUserExpression.h"
-#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
@@ -100,13 +98,12 @@ bool UserExpression::MatchesContext(ExecutionContext &exe_ctx) {
}
lldb::ValueObjectSP UserExpression::GetObjectPointerValueObject(
- lldb::StackFrameSP frame_sp, ConstString const &object_name, Status &err) {
+ lldb::StackFrameSP frame_sp, llvm::StringRef object_name, Status &err) {
err.Clear();
if (!frame_sp) {
- err.SetErrorStringWithFormat(
- "Couldn't load '%s' because the context is incomplete",
- object_name.AsCString());
+ err.SetErrorStringWithFormatv(
+ "Couldn't load '{0}' because the context is incomplete", object_name);
return {};
}
@@ -114,7 +111,7 @@ lldb::ValueObjectSP UserExpression::GetObjectPointerValueObject(
lldb::ValueObjectSP valobj_sp;
return frame_sp->GetValueForVariableExpressionPath(
- object_name.GetStringRef(), lldb::eNoDynamicValues,
+ object_name, lldb::eNoDynamicValues,
StackFrame::eExpressionPathOptionCheckPtrVsMember |
StackFrame::eExpressionPathOptionsNoFragileObjcIvar |
StackFrame::eExpressionPathOptionsNoSyntheticChildren |
@@ -123,7 +120,7 @@ lldb::ValueObjectSP UserExpression::GetObjectPointerValueObject(
}
lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
- ConstString &object_name,
+ llvm::StringRef object_name,
Status &err) {
auto valobj_sp =
GetObjectPointerValueObject(std::move(frame_sp), object_name, err);
@@ -134,9 +131,9 @@ lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
lldb::addr_t ret = valobj_sp->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
if (ret == LLDB_INVALID_ADDRESS) {
- err.SetErrorStringWithFormat(
- "Couldn't load '%s' because its value couldn't be evaluated",
- object_name.AsCString());
+ err.SetErrorStringWithFormatv(
+ "Couldn't load '{0}' because its value couldn't be evaluated",
+ object_name);
return LLDB_INVALID_ADDRESS;
}
@@ -256,7 +253,7 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
target->GetUserExpressionForLanguage(expr, full_prefix, language,
desired_type, options, ctx_obj,
error));
- if (error.Fail()) {
+ if (error.Fail() || !user_expression_sp) {
LLDB_LOG(log, "== [UserExpression::Evaluate] Getting expression: {0} ==",
error.AsCString());
return lldb::eExpressionSetupError;