[Lldb-commits] [lldb] [LLDB] Add `ScalarLiteralNode` and literal parsing in DIL (PR #152308)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 15 02:40:46 PDT 2025


================
@@ -402,4 +404,125 @@ Interpreter::Visit(const BitFieldExtractionNode *node) {
   return child_valobj_sp;
 }
 
+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);
+}
+
+static CompilerType GetBasicType(lldb::TypeSystemSP type_system,
+                                 lldb::BasicType basic_type) {
+  if (type_system)
+    if (auto compiler_type = type_system.get()->GetBasicTypeFromAST(basic_type))
+      return compiler_type;
+
+  CompilerType empty_type;
+  return empty_type;
----------------
labath wrote:

I think this boils down to 
```
if (type_system)
  return type_system->GetBasicTypeFromAST(basic_type);
return {};
```
At which point, the only purpose of this function is to check for nullness of the type system. But I don't think you need that as you could check for its validity in the caller early on. After all, without a type system, you're not going to be able to create /any/ constant.

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


More information about the lldb-commits mailing list