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

Tobias Gysi llvmlistbot at llvm.org
Wed Oct 18 05:38:46 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())
----------------
gysit wrote:

nice I did not realize the subprogram has a filename getter itself. The getters all return an empty string if the filename is not available.

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


More information about the Mlir-commits mailing list