summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-11-04 12:35:47 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-11-04 12:35:47 +0000
commitc1f30877e0357a2513fdf4f99a90cfc35be6572e (patch)
tree5dc988323bd6c23270d7027b61172014a37c4201 /llvm/lib/Support/Unix/Program.inc
parent5a899e332b5d8eb10fd11b88901f09a55b7e6ac4 (diff)
downloadbcm5719-llvm-c1f30877e0357a2513fdf4f99a90cfc35be6572e.tar.gz
bcm5719-llvm-c1f30877e0357a2513fdf4f99a90cfc35be6572e.zip
Remove FindProgramByName. NFC.
llvm-svn: 221258
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r--llvm/lib/Support/Unix/Program.inc46
1 files changed, 0 insertions, 46 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 4124340dfed..0670ad39c9a 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -55,52 +55,6 @@ using namespace sys;
ProcessInfo::ProcessInfo() : Pid(0), ReturnCode(0) {}
-// This function just uses the PATH environment variable to find the program.
-std::string
-sys::FindProgramByName(const std::string& progName) {
-
- // Check some degenerate cases
- if (progName.length() == 0) // no program
- return "";
- std::string temp = progName;
- // Use the given path verbatim if it contains any slashes; this matches
- // the behavior of sh(1) and friends.
- if (progName.find('/') != std::string::npos)
- return temp;
-
- // At this point, the file name is valid and does not contain slashes. Search
- // for it through the directories specified in the PATH environment variable.
-
- // Get the path. If its empty, we can't do anything to find it.
- const char *PathStr = getenv("PATH");
- if (!PathStr)
- return "";
-
- // Now we have a colon separated list of directories to search; try them.
- size_t PathLen = strlen(PathStr);
- while (PathLen) {
- // Find the first colon...
- const char *Colon = std::find(PathStr, PathStr+PathLen, ':');
-
- // Check to see if this first directory contains the executable...
- SmallString<128> FilePath(PathStr,Colon);
- sys::path::append(FilePath, progName);
- if (sys::fs::can_execute(Twine(FilePath)))
- return FilePath.str(); // Found the executable!
-
- // Nope it wasn't in this directory, check the next path in the list!
- PathLen -= Colon-PathStr;
- PathStr = Colon;
-
- // Advance past duplicate colons
- while (*PathStr == ':') {
- PathStr++;
- PathLen--;
- }
- }
- return "";
-}
-
ErrorOr<std::string> sys::findProgramByName(StringRef Name,
ArrayRef<StringRef> Paths) {
assert(!Name.empty() && "Must have a name!");
OpenPOWER on IntegriCloud