[PATCH] D71508: [DebugInfo] Duplicate file names in debug info
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 02:23:10 PST 2019
labath added a comment.
In D71508#1785767 <https://reviews.llvm.org/D71508#1785767>, @probinson wrote:
> Do we have a similar problem if the filespec has an embedded ./ or ../ in it? I'm thinking some broader canonicalization ought to be done here.
> $ clang ./dir1/dir2/../dir3/file.c
> should resolve to dir1/dir3/file.c shouldn't it?
I would be very careful about aggressive canonicalization. Once you throw symlinks into the mix, there's very little things you can safely do. If `dir2` is a symlink then `dir2/..` can point pretty much anywhere. And if you use something like `realpath` there's no telling whether the final result actually be the thing you actually want to put into the debug info (your whole source tree could be a "symlink farm" with individual files pointing to random unpredictable locations).
It seems to me that the underlying problem here is that there are different kinds of canonicalization applied to the "main" and other files, which is something that the comment in CDDebugInfo::CreateCompileUnit seems to acknowledge. However, I don't know anything about this code to say how/if it is possible to fix that...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71508/new/
https://reviews.llvm.org/D71508
More information about the llvm-commits
mailing list