[llvm] r184853 - Move GetEXESuffix to the one place it is used.

Rafael Espindola rafael.espindola at gmail.com
Tue Jun 25 07:42:30 PDT 2013


Author: rafael
Date: Tue Jun 25 09:42:30 2013
New Revision: 184853

URL: http://llvm.org/viewvc/llvm-project?rev=184853&view=rev
Log:
Move GetEXESuffix to the one place it is used.

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

Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=184853&r1=184852&r2=184853&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Tue Jun 25 09:42:30 2013
@@ -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.

Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=184853&r1=184852&r2=184853&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Tue Jun 25 09:42:30 2013
@@ -81,10 +81,6 @@ inline bool lastIsSlash(const std::strin
 namespace llvm {
 using namespace sys;
 
-StringRef Path::GetEXESuffix() {
-  return StringRef();
-}
-
 Path::Path(StringRef p)
   : path(p) {}
 

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=184853&r1=184852&r2=184853&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Tue Jun 25 09:42:30 2013
@@ -42,10 +42,6 @@ static void FlipBackSlashes(std::string&
 namespace llvm {
 namespace sys {
 
-StringRef Path::GetEXESuffix() {
-  return "exe";
-}
-
 Path::Path(llvm::StringRef p)
   : path(p) {
   FlipBackSlashes(path);

Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=184853&r1=184852&r2=184853&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Tue Jun 25 09:42:30 2013
@@ -234,6 +234,12 @@ int LLI::ExecuteProgram(const std::strin
 
 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 PrependMainExecutable
   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();
   }
 





More information about the llvm-commits mailing list