[Lldb-commits] [lldb] [LLDB] Modify CreateValueObjectFrom* to take an ExecutionContext (PR #185547)

Ilia Kuklin via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 10 05:39:35 PDT 2026


================
@@ -3605,52 +3605,63 @@ ValueObject::CreateValueObjectFromAPInt(lldb::TargetSP target,
 }
 
 lldb::ValueObjectSP ValueObject::CreateValueObjectFromAPFloat(
-    lldb::TargetSP target, const llvm::APFloat &v, CompilerType type,
+    const ExecutionContext &exe_ctx, const llvm::APFloat &v, CompilerType type,
     llvm::StringRef name) {
-  return CreateValueObjectFromAPInt(target, v.bitcastToAPInt(), type, name);
+  return CreateValueObjectFromAPInt(exe_ctx, v.bitcastToAPInt(), type, name);
 }
 
-lldb::ValueObjectSP ValueObject::CreateValueObjectFromScalar(
-    lldb::TargetSP target, Scalar &s, CompilerType type, llvm::StringRef name) {
-  ExecutionContext exe_ctx(target.get(), false);
+lldb::ValueObjectSP
+ValueObject::CreateValueObjectFromScalar(const ExecutionContext &exe_ctx,
+                                         Scalar &s, CompilerType type,
+                                         llvm::StringRef name) {
   return ValueObjectConstResult::Create(exe_ctx.GetBestExecutionContextScope(),
                                         type, s, ConstString(name));
 }
 
-lldb::ValueObjectSP
-ValueObject::CreateValueObjectFromBool(lldb::TargetSP target, bool value,
-                                       llvm::StringRef name) {
-  CompilerType target_type;
-  if (target) {
-    for (auto type_system_sp : target->GetScratchTypeSystems())
-      if (auto compiler_type =
-              type_system_sp->GetBasicTypeFromAST(lldb::eBasicTypeBool)) {
-        target_type = compiler_type;
-        break;
-      }
+static TypeSystemSP
+GetTypeSystemForExecutionContext(const ExecutionContext &exe_ctx) {
+  Target *target = exe_ctx.GetTargetPtr();
+  if (!target)
+    return {};
+  lldb::LanguageType language = lldb::eLanguageTypeC;
+  if (StackFrame *frame = exe_ctx.GetFramePtr())
+    language = frame->GetLanguage().AsLanguageType();
----------------
kuilpd wrote:

Does this mean that if there is no frame, the language defaults to C? Should it fall back to getting a type system from the target, like it was before?

https://github.com/llvm/llvm-project/pull/185547


More information about the lldb-commits mailing list