[flang-commits] [flang] [flang] Remove hardcoded bits from AddDebugInfo. (PR #89231)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Apr 22 08:19:28 PDT 2024


================
@@ -52,21 +55,40 @@ void AddDebugInfoPass::runOnOperation() {
   mlir::ModuleOp module = getOperation();
   mlir::MLIRContext *context = &getContext();
   mlir::OpBuilder builder(context);
-  std::string inputFilePath("-");
-  if (auto fileLoc = module.getLoc().dyn_cast<mlir::FileLineColLoc>())
-    inputFilePath = fileLoc.getFilename().getValue();
+  llvm::StringRef fileName;
+  std::string filePath;
----------------
tblah wrote:

I see that some of the functions in `llvm::sys::fs` represent paths as `Twine`s so I guess a `std::string` should be good enough for now. Off the top of my head, I can't think of a reason why a `std::string` can't store a UTF8 string (::size() might be confusing, but that shouldn't matter here). 

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


More information about the flang-commits mailing list