This is an archive of the discontinued LLVM Phabricator instance.

[JMCInstrument] infer proper path style based on debug info
ClosedPublic

Authored by ychen on Mar 8 2022, 11:02 AM.

Details

Summary

By default, the path style is decided by the host. This patch makes JMC
uses the path style used by the SP directory. This makes JMC output
host-independent.

Fixes: https://github.com/llvm/llvm-project/issues/54219

Diff Detail

Event Timeline

ychen created this revision.Mar 8 2022, 11:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 11:02 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
ychen requested review of this revision.Mar 8 2022, 11:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2022, 11:02 AM
rnk accepted this revision.Mar 8 2022, 3:04 PM

lgtm, thanks!

llvm/lib/CodeGen/JMCInstrumenter.cpp
72

I see, I was hoping we already had an auto-detector routine. We have an existing one in the VFS code, but it's inaccessible from here, and your logic seems slightly better:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/VirtualFileSystem.cpp#L1059

llvm/test/Instrumentation/JustMyCode/jmc-instrument.ll
147

Thanks for the tests

This revision is now accepted and ready to land.Mar 8 2022, 3:04 PM
ychen updated this revision to Diff 413960.Mar 8 2022, 3:32 PM
  • search for backslash in SP filename
  • add a test case
ychen added inline comments.Mar 8 2022, 3:40 PM
llvm/lib/CodeGen/JMCInstrumenter.cpp
72

yeah, I considered hoisting it to Path.h but it does not seem suitable for all cases for JMC and I'm afraid of breaking lldb by touching path related code. We should definitely consider a common path style detection function if there are more users in the future.

This revision was landed with ongoing or failed builds.Mar 10 2022, 10:51 AM
This revision was automatically updated to reflect the committed changes.