aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/PathV2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/PathV2.cpp')
-rw-r--r--lib/Support/PathV2.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Support/PathV2.cpp b/lib/Support/PathV2.cpp
index 7e49d8d446..7bb79887a3 100644
--- a/lib/Support/PathV2.cpp
+++ b/lib/Support/PathV2.cpp
@@ -531,6 +531,28 @@ error_code replace_extension(SmallVectorImpl<char> &path,
return make_error_code(errc::success);
}
+error_code native(const Twine &path, SmallVectorImpl<char> &result) {
+ // Clear result.
+ result.set_size(0);
+#ifdef LLVM_ON_WIN32
+ SmallString<128> path_storage;
+ StringRef p = path.toStringRef(path_storage);
+ result.reserve(p.size());
+ for (StringRef::const_iterator i = p.begin(),
+ e = p.end();
+ i != e;
+ ++i) {
+ if (*i == '/')
+ result.push_back('\\');
+ else
+ result.push_back(*i);
+ }
+#else
+ path.toVector(result);
+#endif
+ return make_error_code(errc::success);
+}
+
}
}
}