summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-07 21:53:57 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-07 21:53:57 +0000
commitc042bf1db5f6aedd4a677950f9322675cca46d66 (patch)
treea30fc3f8c352661a4c78606027e4e88f77c7dd1c /llvm/lib/System/Unix
parent3a130675572b3c51f605b17db5c2b89ee115e03a (diff)
downloadbcm5719-llvm-c042bf1db5f6aedd4a677950f9322675cca46d66.tar.gz
bcm5719-llvm-c042bf1db5f6aedd4a677950f9322675cca46d66.zip
Added method Path::getDirname().
llvm-svn: 49352
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r--llvm/lib/System/Unix/Path.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index c3d06a3fa1d..fe2e3c67778 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -277,16 +277,18 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) {
}
+std::string Path::getDirname() const { return getDirnameCharSep('/'); }
+
std::string
Path::getBasename() const {
// Find the last slash
- size_t slash = path.rfind('/');
+ std::string::size_type slash = path.rfind('/');
if (slash == std::string::npos)
slash = 0;
else
slash++;
- size_t dot = path.rfind('.');
+ std::string::size_type dot = path.rfind('.');
if (dot == std::string::npos || dot < slash)
return path.substr(slash);
else
OpenPOWER on IntegriCloud