[Lldb-commits] [lldb] e6cbea1 - Revert "[lldb] unique_ptr-ify some GetUserExpression APIs. (#106034)"
Lang Hames via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 27 22:50:30 PDT 2024
Author: Lang Hames
Date: 2024-08-28T15:49:40+10:00
New Revision: e6cbea11578f197589801297d22b9b3bc4f1bd10
URL: https://github.com/llvm/llvm-project/commit/e6cbea11578f197589801297d22b9b3bc4f1bd10
DIFF: https://github.com/llvm/llvm-project/commit/e6cbea11578f197589801297d22b9b3bc4f1bd10.diff
LOG: Revert "[lldb] unique_ptr-ify some GetUserExpression APIs. (#106034)"
This reverts commit 3c5ab5a75a9c8fb87dcb13cdf4207aa975fd6972 while I investigate
bot failures (e.g. https://lab.llvm.org/buildbot/#/builders/163/builds/4286).
Added:
Modified:
lldb/include/lldb/Symbol/TypeSystem.h
lldb/include/lldb/Target/Target.h
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Target/Target.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index b1ed5df3013a2b..7d48f9b316138c 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -495,7 +495,7 @@ class TypeSystem : public PluginInterface,
return IsPointerOrReferenceType(type, nullptr);
}
- virtual std::unique_ptr<UserExpression> GetUserExpression(
+ virtual UserExpression *GetUserExpression(
llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions &options, ValueObject *ctx_obj) {
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 95e3aaf02b19d5..7f4d607f5427df 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1174,7 +1174,7 @@ class Target : public std::enable_shared_from_this<Target>,
// parameters have the same meaning as for the UserExpression constructor.
// Returns a new-ed object which the caller owns.
- std::unique_ptr<UserExpression>
+ UserExpression *
GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
Expression::ResultType desired_type,
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 91a36bf2bd9e08..8d7364052a006a 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -251,9 +251,9 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
if (comp_unit)
language = comp_unit->GetLanguage();
- m_user_expression_sp = GetTarget().GetUserExpressionForLanguage(
+ m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
- EvaluateExpressionOptions(), nullptr, error);
+ EvaluateExpressionOptions(), nullptr, error));
if (error.Fail()) {
LLDB_LOGF(log, "Error getting condition expression: %s.",
error.AsCString());
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp
index 577ee81d687dcb..715e83c76697b2 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -463,9 +463,9 @@ void Watchpoint::SetCondition(const char *condition) {
} else {
// Pass nullptr for expr_prefix (no translation-unit level definitions).
Status error;
- m_condition_up = m_target.GetUserExpressionForLanguage(
+ m_condition_up.reset(m_target.GetUserExpressionForLanguage(
condition, {}, {}, UserExpression::eResultTypeAny,
- EvaluateExpressionOptions(), nullptr, error);
+ EvaluateExpressionOptions(), nullptr, error));
if (error.Fail()) {
// FIXME: Log something...
m_condition_up.reset();
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2e2f4be6343791..695801da9da69a 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -9741,7 +9741,7 @@ void ScratchTypeSystemClang::Dump(llvm::raw_ostream &output) {
}
}
-std::unique_ptr<UserExpression> ScratchTypeSystemClang::GetUserExpression(
+UserExpression *ScratchTypeSystemClang::GetUserExpression(
llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions &options, ValueObject *ctx_obj) {
@@ -9749,8 +9749,8 @@ std::unique_ptr<UserExpression> ScratchTypeSystemClang::GetUserExpression(
if (!target_sp)
return nullptr;
- return std::make_unique<ClangUserExpression>(
- *target_sp.get(), expr, prefix, language, desired_type, options, ctx_obj);
+ return new ClangUserExpression(*target_sp.get(), expr, prefix, language,
+ desired_type, options, ctx_obj);
}
FunctionCaller *ScratchTypeSystemClang::GetFunctionCaller(
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index fc29a2e5eaefc7..e39aedec7e3902 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -1299,10 +1299,12 @@ class ScratchTypeSystemClang : public TypeSystemClang {
/// \see lldb_private::TypeSystem::Dump
void Dump(llvm::raw_ostream &output) override;
- std::unique_ptr<UserExpression> GetUserExpression(
- llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
- Expression::ResultType desired_type,
- const EvaluateExpressionOptions &options, ValueObject *ctx_obj) override;
+ UserExpression *GetUserExpression(llvm::StringRef expr,
+ llvm::StringRef prefix,
+ SourceLanguage language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ValueObject *ctx_obj) override;
FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
const Address &function_address,
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e0c92df0f9d7fc..fcac0a48f46e6d 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2521,7 +2521,7 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
return nullptr;
}
-std::unique_ptr<UserExpression> Target::GetUserExpressionForLanguage(
+UserExpression *Target::GetUserExpressionForLanguage(
llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions &options, ValueObject *ctx_obj,
@@ -2544,8 +2544,8 @@ std::unique_ptr<UserExpression> Target::GetUserExpressionForLanguage(
return nullptr;
}
- auto user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
- options, ctx_obj);
+ auto *user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
+ options, ctx_obj);
if (!user_expr)
error = Status::FromErrorStringWithFormat(
"Could not create an expression for language %s",
More information about the lldb-commits
mailing list