From: Mikhail Glushenkov Date: Tue, 2 Nov 2010 20:32:26 +0000 (+0000) Subject: Path: Add GetEXESuffix() to complement GetDLLSuffix(). X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f5a95ce0d42ddfac8a5a14701188e94ce5dc282f;p=oota-llvm.git Path: Add GetEXESuffix() to complement GetDLLSuffix(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118042 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h index ef7c087bb76..c13f2e8d6c4 100644 --- a/include/llvm/System/Path.h +++ b/include/llvm/System/Path.h @@ -154,6 +154,12 @@ namespace sys { /// @brief Returns the current working directory. static Path GetCurrentDirectory(); + /// Return the suffix commonly used on file names that contain an + /// executable. + /// @returns The executable file suffix for the current platform. + /// @brief Return the executable file suffix. + static StringRef GetEXESuffix(); + /// Return the suffix commonly used on file names that contain a shared /// object, shared archive, or dynamic link library. Such files are /// linked at runtime into a process and their code images are shared diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 4c97c4b71cc..44c81a2f3f9 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -78,6 +78,10 @@ using namespace sys; const char sys::PathSeparator = ':'; +StringRef Path::GetEXESuffix() { + return ""; +} + Path::Path(StringRef p) : path(p) {} diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 7e2275105a3..a4d55a0f048 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -45,8 +45,13 @@ static void FlipBackSlashes(std::string& s) { namespace llvm { namespace sys { + const char PathSeparator = ';'; +StringRef Path::GetEXESuffix() { + return "exe"; +} + Path::Path(llvm::StringRef p) : path(p) { FlipBackSlashes(path);