[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 26 02:22:05 PST 2024
================
@@ -0,0 +1,117 @@
+//===-- DILEval.cpp -------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/ValueObject/DILEval.h"
+
+#include <memory>
+
+#include "lldb/ValueObject/DILAST.h"
+#include "lldb/ValueObject/ValueObject.h"
+#include "llvm/Support/FormatAdapters.h"
+
+namespace lldb_private {
+
+namespace dil {
+
+DILInterpreter::DILInterpreter(lldb::TargetSP target,
+ std::shared_ptr<std::string> sm)
+ : m_target(std::move(target)), m_sm(std::move(sm)) {
+ m_default_dynamic = lldb::eNoDynamicValues;
+}
+
+DILInterpreter::DILInterpreter(lldb::TargetSP target,
+ std::shared_ptr<std::string> sm,
+ lldb::DynamicValueType use_dynamic)
+ : m_target(std::move(target)), m_sm(std::move(sm)),
+ m_default_dynamic(use_dynamic) {}
+
+DILInterpreter::DILInterpreter(lldb::TargetSP target,
+ std::shared_ptr<std::string> sm,
+ lldb::ValueObjectSP scope)
+ : m_target(std::move(target)), m_sm(std::move(sm)),
+ m_scope(std::move(scope)) {
+ m_default_dynamic = lldb::eNoDynamicValues;
+ // If `m_scope` is a reference, dereference it. All operations on a reference
+ // should be operations on the referent.
+ if (m_scope->GetCompilerType().IsValid() &&
+ m_scope->GetCompilerType().IsReferenceType()) {
+ Status error;
+ m_scope = m_scope->Dereference(error);
----------------
labath wrote:
What if dereferencing fails (maybe because it's a null/dangling reference)?
https://github.com/llvm/llvm-project/pull/120971
More information about the lldb-commits
mailing list