aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-07-03 03:59:29 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-07-03 03:59:29 +0000
commit4c215c08e3e79c5fc221dd0f6e6ce0c1624f895a (patch)
treed933496d0a35abaec3cb79af5fd3261594d1845a
parentea957f0c561384d989e0727ebad80fdf53c363ff (diff)
downloadexternal_llvm-4c215c08e3e79c5fc221dd0f6e6ce0c1624f895a.zip
external_llvm-4c215c08e3e79c5fc221dd0f6e6ce0c1624f895a.tar.gz
external_llvm-4c215c08e3e79c5fc221dd0f6e6ce0c1624f895a.tar.bz2
MCContext::GetDwarfFile(): Make FileName parsing tolerant of DOSish pathsep with PathV2.
It fixes failure in test/MC/MachO/gen-dwarf.s on Win32 w/o bash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159640 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/MCContext.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index d3c4fb1..b535b3e 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -274,11 +274,11 @@ unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,
if (Directory.empty()) {
// Separate the directory part from the basename of the FileName.
- std::pair<StringRef, StringRef> Slash = FileName.rsplit('/');
- Directory = Slash.second;
- if (!Directory.empty()) {
- Directory = Slash.first;
- FileName = Slash.second;
+ StringRef tFileName = sys::path::filename(FileName);
+ if (!tFileName.empty()) {
+ Directory = sys::path::parent_path(FileName);
+ if (!Directory.empty())
+ FileName = sys::path::filename(FileName);
}
}