[PATCH] Unify handling of PWD (llvm patch)
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Thu Aug 8 20:43:30 PDT 2013
Hi klimek, nicholas,
http://llvm-reviews.chandlerc.com/D1335
Files:
lib/Support/Unix/Path.inc
Index: lib/Support/Unix/Path.inc
===================================================================
--- lib/Support/Unix/Path.inc
+++ lib/Support/Unix/Path.inc
@@ -298,6 +298,18 @@
}
error_code current_path(SmallVectorImpl<char> &result) {
+ result.clear();
+
+ const char *pwd = ::getenv("PWD");
+ llvm::sys::fs::file_status PWDStatus, DotStatus;
+ if (pwd && llvm::sys::path::is_absolute(pwd) &&
+ !llvm::sys::fs::status(pwd, PWDStatus) &&
+ !llvm::sys::fs::status(".", DotStatus) &&
+ PWDStatus.getUniqueID() == DotStatus.getUniqueID()) {
+ result.append(pwd, pwd + strlen(pwd));
+ return error_code::success();
+ }
+
#ifdef MAXPATHLEN
result.reserve(MAXPATHLEN);
#else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1335.1.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130808/79efb4e7/attachment.bin>
More information about the llvm-commits
mailing list