X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FPath.cpp;h=4d179218f78c7781d7b5cfc0a4be6abb306ff283;hb=285133714f0d995e0e14a77e23a0abe5dfc32d17;hp=2dd6741c73508b93c22029b03fd4f9930c580bbb;hpb=981eb59138eea543af5fc628399480eb11d27016;p=oota-llvm.git diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index 2dd6741c735..4d179218f78 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -540,9 +540,19 @@ void native(const Twine &path, SmallVectorImpl &result) { native(result); } -void native(SmallVectorImpl &path) { +void native(SmallVectorImpl &Path) { #ifdef LLVM_ON_WIN32 - std::replace(path.begin(), path.end(), '/', '\\'); + std::replace(Path.begin(), Path.end(), '/', '\\'); +#else + for (auto PI = Path.begin(), PE = Path.end(); PI < PE; ++PI) { + if (*PI == '\\') { + auto PN = PI + 1; + if (PN < PE && *PN == '\\') + ++PI; // increment once, the for loop will move over the escaped slash + else + *PI = '/'; + } + } #endif }