This is an archive of the discontinued LLVM Phabricator instance.

[Flang][Debug] Modifications for getting pathname
ClosedPublic

Authored by kiranchandramohan on Jan 13 2023, 3:34 AM.

Details

Summary

-> Use file pathname from the Flang frontend. It is the frontend
that is in-charge of finding the files and is hence the canonical
source for paths.
-> Convert pathname to absolute pathname while creating the moduleOp.

Co-authored-by: Peter Klausler <pklausler@nvidia.com>

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added a subscriber: mehdi_amini. · View Herald Transcript
kiranchandramohan requested review of this revision.Jan 13 2023, 3:34 AM
flang/lib/Lower/Bridge.cpp
3830

Other options include,
-> adding a function in SourceFile to get the full path. And use this in all places while creating location info.
-> use the relative path here but convert to absolute path in the addDebugFoundation pass. Was concerned whether there might be an issue if the IR is moved to a different location.

awarzynski accepted this revision.Jan 13 2023, 6:56 AM
This revision is now accepted and ready to land.Jan 13 2023, 6:56 AM
tschuett added inline comments.
flang/lib/Lower/Bridge.cpp
3828

Please remove the .has_value().

3829

*path instead of path.value().

klausler added inline comments.Jan 13 2023, 9:17 AM
flang/lib/Lower/Bridge.cpp
3828

It's fine.

jeanPerier accepted this revision.Jan 16 2023, 12:29 AM

@PeteSteinfeld are you OK with this patch for the issue you mentioned in https://reviews.llvm.org/D137956?

PeteSteinfeld accepted this revision.Jan 17 2023, 10:33 AM

All builds and tests correctly and looks good.

Thanks for fixing this, @kiranchandramohan!

kiranchandramohan marked an inline comment as done.

Use *path instead of path.value() since the presence of the value is
already checked with path.has_value(). Address comment for @tschuett.

It is feasible to modify flang/test/Lower/module-debug-file-loc.f90 to check that at least some (build invariant) portions of the path are propagated?

Add a specific test for linux platform to ensure paths are propagated.
Address comment from @vzakhari.

vzakhari accepted this revision.Jan 19 2023, 8:34 AM

Thank you, Kiran!