This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix absolute file paths with -fdebug-prefix-map
ClosedPublic

Authored by keith on Oct 7 2021, 1:28 PM.

Details

Summary

Previously if you passed an absolute path to clang, where only part of
the path to the file was remapped, it would result in the file's DIFile
being stored with a duplicate path, for example:

!DIFile(filename: "./ios/Sources/bar.c", directory: "./ios/Sources")

This change handles absolute paths, specifically in the case they are
remapped to something relative, and uses the dirname for the directory,
and basename for the filename.

This also adds a test verifying this behavior for more standard uses as
well.

Diff Detail

Event Timeline

keith requested review of this revision.Oct 7 2021, 1:28 PM
keith created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2021, 1:28 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
qyang added a subscriber: qyang.Oct 7 2021, 3:44 PM
probinson accepted this revision.Oct 8 2021, 7:12 AM
probinson added a subscriber: probinson.

I suspect this is not the only way for directories and filenames to become confused, but it certainly helps. LGTM.

This revision is now accepted and ready to land.Oct 8 2021, 7:12 AM
This revision was landed with ongoing or failed builds.Oct 8 2021, 10:35 AM
This revision was automatically updated to reflect the committed changes.