diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-01 02:48:27 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-01 02:48:27 +0000 |
commit | 8002500ee17730dadefa6922bb25ef7dc1d77058 (patch) | |
tree | c4250e7468f1d1c69d4e4f7bc641a36c48d201f4 /llvm/lib/Support/PathV2.cpp | |
parent | e41b1463f9924a6f3f47d1a235619cb17bb2d0b7 (diff) | |
download | bcm5719-llvm-8002500ee17730dadefa6922bb25ef7dc1d77058.tar.gz bcm5719-llvm-8002500ee17730dadefa6922bb25ef7dc1d77058.zip |
Support/PathV2: Add native implementation.
llvm-svn: 120539
Diffstat (limited to 'llvm/lib/Support/PathV2.cpp')
-rw-r--r-- | llvm/lib/Support/PathV2.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Support/PathV2.cpp b/llvm/lib/Support/PathV2.cpp index 7e49d8d446a..7bb79887a3f 100644 --- a/llvm/lib/Support/PathV2.cpp +++ b/llvm/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); +} + } } } |