Add an "exe" suffix only if the output file has no suffix at all.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Jun 2008 15:20:16 +0000 (15:20 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 15 Jun 2008 15:20:16 +0000 (15:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52289 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-ld/llvm-ld.cpp

index 0b8269c7f245b9a42e5a7fa561914a03a9e4fade..40265628ac007335acb51ced15aab6e10d65a3d4 100644 (file)
@@ -532,15 +532,15 @@ int main(int argc, char **argv, char **envp) {
 
 #if defined(_WIN32) || defined(__CYGWIN__)
     if (!LinkAsLibrary) {
-      // Make sure the output executable has an "exe" suffix.
+      // Default to "a.exe" instead of "a.out".
+      if (OutputFilename.getNumOccurrences() == 0)
+        OutputFilename = "a.exe";
+
+      // If there is no suffix add an "exe" one.
       sys::Path ExeFile( OutputFilename );
-      if (ExeFile.getSuffix() != "exe") {
-        if (OutputFilename == "a.out") {
-          OutputFilename = "a.exe";
-        } else {
-          ExeFile.appendSuffix("exe");
-          OutputFilename = ExeFile.toString();
-        }
+      if (ExeFile.getSuffix() == "") {
+        ExeFile.appendSuffix("exe");
+        OutputFilename = ExeFile.toString();
       }
     }
 #endif