From a518bb79b1854ad624e5223508813f9aaa77a547 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 7 Apr 2008 22:01:32 +0000 Subject: [PATCH] Make getDirnameSep a static method (not part of Path's interface). llvm-svn: 49354 --- llvm/include/llvm/System/Path.h | 7 ------- llvm/lib/System/Path.cpp | 2 +- llvm/lib/System/Unix/Path.inc | 4 +++- llvm/lib/System/Win32/Path.inc | 4 +++- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/llvm/include/llvm/System/Path.h b/llvm/include/llvm/System/Path.h index 5846fa92537f..36b48e7cc631 100644 --- a/llvm/include/llvm/System/Path.h +++ b/llvm/include/llvm/System/Path.h @@ -571,13 +571,6 @@ namespace sys { /// MemoryBuffer::getFile instead. static void UnMapFilePages(const char *Base, uint64_t FileSize); - - /// @} - /// @name Internal methods. - /// @{ - protected: - std::string getDirnameCharSep(char Sep) const; - /// @} /// @name Data /// @{ diff --git a/llvm/lib/System/Path.cpp b/llvm/lib/System/Path.cpp index 43c36d5e09b9..e8fd5f29634c 100644 --- a/llvm/lib/System/Path.cpp +++ b/llvm/lib/System/Path.cpp @@ -196,7 +196,7 @@ static void getPathList(const char*path, std::vector& Paths) { Paths.push_back(tmpPath); } -std::string Path::getDirnameCharSep(char Sep) const { +static std::string getDirnameCharSep(const std::string& path, char Sep) { if (path.empty()) return "."; diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index fe2e3c677781..aca4b936e872 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -277,7 +277,9 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { } -std::string Path::getDirname() const { return getDirnameCharSep('/'); } +std::string Path::getDirname() const { + return getDirnameCharSep(path, '/'); +} std::string Path::getBasename() const { diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index 35bae337da7f..357cb2f27eea 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -229,7 +229,9 @@ Path::isRootDirectory() const { return len > 0 && path[len-1] == '/'; } -std::string Path::getDirname() const { return getDirnameCharSep('\\'); } +std::string Path::getDirname() const { + return getDirnameCharSep(path, '\\'); +} std::string Path::getBasename() const {