From b0a5c96379e7f6fd25fc7f8b9cdc237a6852d4e4 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 14 Jun 2013 19:38:45 +0000 Subject: Replace use of PathV1.h in Program.cpp. llvm-svn: 183996 --- llvm/lib/Support/Unix/PathV2.inc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/Support/Unix/PathV2.inc') diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index 7e0aead151b..df8841220b5 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -292,6 +292,13 @@ error_code exists(const Twine &path, bool &result) { return error_code::success(); } +bool can_execute(const Twine &Path) { + SmallString<128> PathStorage; + StringRef P = Path.toNullTerminatedStringRef(PathStorage); + + return ::access(P.begin(), X_OK) != -1; +} + bool equivalent(file_status A, file_status B) { assert(status_known(A) && status_known(B)); return A.fs_st_dev == B.fs_st_dev && -- cgit v1.2.3