summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-14 21:41:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-14 21:41:33 +0000
commit158d537c5a0ae834a2899121d1da693af8f78859 (patch)
treed4cd024736c813f4f22cfd0ab7263ecf1efd6f7f /llvm/lib/Support/Unix
parent4e69d01b678a85b45245ecb4724177082013d236 (diff)
downloadbcm5719-llvm-158d537c5a0ae834a2899121d1da693af8f78859.tar.gz
bcm5719-llvm-158d537c5a0ae834a2899121d1da693af8f78859.zip
Add GetCurrentDirectory back.
It looks like clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp depends on the behaviour of the old one on Windows. Maybe a difference between GetCurrentDirectoryA and GetCurrentDirectoryW? llvm-svn: 184009
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 06b18bec8b6..57f02be1094 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -185,6 +185,17 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
#endif
}
+Path
+Path::GetCurrentDirectory() {
+ char pathname[MAXPATHLEN];
+ if (!getcwd(pathname, MAXPATHLEN)) {
+ assert(false && "Could not query current working directory.");
+ return Path();
+ }
+
+ return Path(pathname);
+}
+
#if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \
defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) || \
defined(__linux__) || defined(__CYGWIN__)
OpenPOWER on IntegriCloud