[Mlir-commits] [mlir] [mlir][LLVM] Improve function debug info import (PR #69446)

Christian Ulmann llvmlistbot at llvm.org
Wed Oct 18 05:25:00 PDT 2023


================
@@ -24,13 +24,19 @@ using namespace mlir::LLVM;
 using namespace mlir::LLVM::detail;
 
 Location DebugImporter::translateFuncLocation(llvm::Function *func) {
-  if (!func->getSubprogram())
+  llvm::DISubprogram *subprogram = func->getSubprogram();
+  if (!subprogram)
     return UnknownLoc::get(context);
 
-  // Add a fused location to link the subprogram information.
-  StringAttr name = StringAttr::get(context, func->getSubprogram()->getName());
-  return FusedLocWith<DISubprogramAttr>::get(
-      {NameLoc::get(name)}, translate(func->getSubprogram()), context);
+  SmallVector<Location, 2> funcLocs = {
+      NameLoc::get(StringAttr::get(context, subprogram->getName()))};
+  if (llvm::DIScope *scope = subprogram->getScope())
----------------
Dinistro wrote:

Is there a guarantee that the scope is always a `DIFile` or can it also be a `DINamespace` or a `DIModule`?  Maybe relying on the `file` field might be safer.

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


More information about the Mlir-commits mailing list