summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/PathV2.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 02:48:27 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 02:48:27 +0000
commit8002500ee17730dadefa6922bb25ef7dc1d77058 (patch)
treec4250e7468f1d1c69d4e4f7bc641a36c48d201f4 /llvm/lib/Support/PathV2.cpp
parente41b1463f9924a6f3f47d1a235619cb17bb2d0b7 (diff)
downloadbcm5719-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.cpp22
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);
+}
+
}
}
}
OpenPOWER on IntegriCloud