summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-04-11 18:24:03 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-04-11 18:24:03 +0000
commitcb8a666f4b1d343b7ebbc2f9864821473f4cfa1d (patch)
treedfc8f48d18a5cb503ff463ec46dfd369b558a2d7 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent8fc2b496207eb49aa0191a52d50f51e7da3fec0b (diff)
downloadbcm5719-llvm-cb8a666f4b1d343b7ebbc2f9864821473f4cfa1d.tar.gz
bcm5719-llvm-cb8a666f4b1d343b7ebbc2f9864821473f4cfa1d.zip
CodeGen: Don't try to canonicalize Unix-style paths in CodeView debug info.
Most importantly, we should not replace slashes with backslashes because that would invalidate the path. Differential Revision: https://reviews.llvm.org/D45473 llvm-svn: 329838
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index f8cd01abddd..6769ed4cff0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -114,6 +114,16 @@ StringRef CodeViewDebug::getFullFilepath(const DIFile *File) {
StringRef Dir = File->getDirectory(), Filename = File->getFilename();
+ // If this is a Unix-style path, just use it as is. Don't try to canonicalize
+ // it textually because one of the path components could be a symlink.
+ if (!Dir.empty() && Dir[0] == '/') {
+ Filepath = Dir;
+ if (Dir.back() != '/')
+ Filepath += '/';
+ Filepath += Filename;
+ return Filepath;
+ }
+
// Clang emits directory and relative filename info into the IR, but CodeView
// operates on full paths. We could change Clang to emit full paths too, but
// that would increase the IR size and probably not needed for other users.
OpenPOWER on IntegriCloud