[llvm-branch-commits] [lldb] [lldb][Fortran] Added support for functions to DWARFASTParserFortran (PR #234312)

David Spickett via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 23 06:56:11 PDT 2026


================
@@ -63,6 +63,37 @@ TypeSP DWARFASTParserFortran::UpdateSymbolContextScopeForType(
   return type_sp;
 }
 
+void DWARFASTParserFortran::ParseChildParameters(
+    const DWARFDIE &parent_die,
+    llvm::SmallVectorImpl<CompilerType> &function_param_types,
+    llvm::SmallVectorImpl<llvm::StringRef> &function_param_names) {
+  if (!parent_die)
+    return;
+
+  for (DWARFDIE die : parent_die.children()) {
+    const dw_tag_t tag = die.Tag();
+    switch (tag) {
+    case DW_TAG_formal_parameter: {
+      if (die.GetAttributeValueAsUnsigned(DW_AT_artificial, 0))
+        continue;
+
+      DWARFDIE param_type_die = die.GetAttributeValueAsReferenceDIE(DW_AT_type);
+
+      Type *type = die.ResolveTypeUID(param_type_die);
+      if (!type)
+        break;
+
+      function_param_names.emplace_back(die.GetName());
+      function_param_types.push_back(type->GetForwardCompilerType());
+    } break;
+    default:
+      break;
+    }
+  }
+
+  assert(function_param_names.size() == function_param_types.size());
----------------
DavidSpickett wrote:

In theory we should not crash on malformed DWARF, and it was asked about on the other PR in this stack what happens if the two are mismatched.

Do you know if the C/C++ side does any better of a job here?

One way is to clear all the vectors and return. With a log message if we're able to do that here.

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


More information about the llvm-branch-commits mailing list