Move GetEXESuffix to the one place it is used.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 25 Jun 2013 14:42:30 +0000 (14:42 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 25 Jun 2013 14:42:30 +0000 (14:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184853 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PathV1.h
lib/Support/Unix/Path.inc
lib/Support/Windows/Path.inc
tools/bugpoint/ToolRunner.cpp

index 32024514676ef5814662363279b36abe6c982c2b..a6d2663681c393e2d8c9c0f27dc74aa47be3bf27 100644 (file)
@@ -104,12 +104,6 @@ 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();
-
       /// GetMainExecutable - Return the path to the main executable, given the
       /// value of argv[0] from program startup and the address of main itself.
       /// In extremis, this function may fail and return an empty path.
index 8e31f4cedf4cd28df08bdd03dede6f7936be4d52..63b05193716dc3bf1eb201f957d7574e92e38c2b 100644 (file)
@@ -81,10 +81,6 @@ inline bool lastIsSlash(const std::string& path) {
 namespace llvm {
 using namespace sys;
 
-StringRef Path::GetEXESuffix() {
-  return StringRef();
-}
-
 Path::Path(StringRef p)
   : path(p) {}
 
index ba13edc7c8180a5f7120b7b7894baef3952e0ee1..53767e7a15c4d8a38da099292381ae88fb0a85ec 100644 (file)
@@ -42,10 +42,6 @@ static void FlipBackSlashes(std::string& s) {
 namespace llvm {
 namespace sys {
 
-StringRef Path::GetEXESuffix() {
-  return "exe";
-}
-
 Path::Path(llvm::StringRef p)
   : path(p) {
   FlipBackSlashes(path);
index 3f0779e2c54180926d5300fd7c22e02a68571bd1..4e6f6e27cca1ae95d1b639de4e29a93a6f225541 100644 (file)
@@ -234,6 +234,12 @@ int LLI::ExecuteProgram(const std::string &Bitcode,
 
 void AbstractInterpreter::anchor() { }
 
+#if defined(LLVM_ON_UNIX)
+const char EXESuffix[] = "";
+#elif defined (LLVM_ON_WIN32)
+const char EXESuffix[] = "exe";
+#endif
+
 /// Prepend the path to the program being executed
 /// to \p ExeName, given the value of argv[0] and the address of main()
 /// itself. This allows us to find another LLVM tool if it is built in the same
@@ -252,7 +258,7 @@ static std::string PrependMainExecutablePath(const std::string &ExeName,
   if (!Result.empty()) {
     SmallString<128> Storage = Result;
     sys::path::append(Storage, ExeName);
-    sys::path::replace_extension(Storage, sys::Path::GetEXESuffix());
+    sys::path::replace_extension(Storage, EXESuffix);
     return Storage.str();
   }