[Lldb-commits] [lldb] [lldb] Move GetTypeSystemFromCU to DILEval.cpp (NFC) (PR #193245)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 21 08:32:28 PDT 2026


https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/193245

None

>From 1c7383b6b863c0e22943b94b36847061b08d7a7f Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Sun, 19 Apr 2026 07:59:12 -0700
Subject: [PATCH] [lldb] Move GetTypeSystemFromCU to DILEval.cpp (NFC)

---
 lldb/include/lldb/ValueObject/DILParser.h |  3 ---
 lldb/source/ValueObject/DILEval.cpp       | 10 ++++++++++
 lldb/source/ValueObject/DILParser.cpp     | 10 ----------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/lldb/include/lldb/ValueObject/DILParser.h b/lldb/include/lldb/ValueObject/DILParser.h
index d3a1cf0d743fa..53e56c9e6837c 100644
--- a/lldb/include/lldb/ValueObject/DILParser.h
+++ b/lldb/include/lldb/ValueObject/DILParser.h
@@ -35,9 +35,6 @@ enum class ErrorCode : unsigned char {
   kUnknown,
 };
 
-llvm::Expected<lldb::TypeSystemSP>
-GetTypeSystemFromCU(std::shared_ptr<StackFrame> ctx);
-
 // The following is modeled on class OptionParseError.
 class DILDiagnosticError
     : public llvm::ErrorInfo<DILDiagnosticError, DiagnosticError> {
diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp
index 01e5238ddd6d0..9adbcec24463b 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -42,6 +42,16 @@ static lldb::ValueObjectSP ArrayToPointerConversion(ValueObject &valobj,
       /* do_deref */ false);
 }
 
+static llvm::Expected<lldb::TypeSystemSP>
+GetTypeSystemFromCU(std::shared_ptr<StackFrame> ctx) {
+  SymbolContext symbol_context =
+      ctx->GetSymbolContext(lldb::eSymbolContextCompUnit);
+  lldb::LanguageType language = symbol_context.comp_unit->GetLanguage();
+
+  symbol_context = ctx->GetSymbolContext(lldb::eSymbolContextModule);
+  return symbol_context.module_sp->GetTypeSystemForLanguage(language);
+}
+
 llvm::Expected<lldb::ValueObjectSP>
 Interpreter::UnaryConversion(lldb::ValueObjectSP valobj, uint32_t location) {
   if (!valobj)
diff --git a/lldb/source/ValueObject/DILParser.cpp b/lldb/source/ValueObject/DILParser.cpp
index b63dab984b533..bec0c582a038e 100644
--- a/lldb/source/ValueObject/DILParser.cpp
+++ b/lldb/source/ValueObject/DILParser.cpp
@@ -59,16 +59,6 @@ DILDiagnosticError::DILDiagnosticError(llvm::StringRef expr,
   m_detail.rendered = std::move(rendered_str);
 }
 
-llvm::Expected<lldb::TypeSystemSP>
-GetTypeSystemFromCU(std::shared_ptr<StackFrame> ctx) {
-  SymbolContext symbol_context =
-      ctx->GetSymbolContext(lldb::eSymbolContextCompUnit);
-  lldb::LanguageType language = symbol_context.comp_unit->GetLanguage();
-
-  symbol_context = ctx->GetSymbolContext(lldb::eSymbolContextModule);
-  return symbol_context.module_sp->GetTypeSystemForLanguage(language);
-}
-
 static CompilerType ResolveTypeByName(const std::string &name,
                                       ExecutionContextScope &ctx_scope) {
   // Internally types don't have global scope qualifier in their names and



More information about the lldb-commits mailing list