Fix default image name to 'a.exe' on Windows, instead 'a.out'.
authorYaron Keren <yaron.keren@gmail.com>
Sun, 4 Jan 2015 13:48:30 +0000 (13:48 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Sun, 4 Jan 2015 13:48:30 +0000 (13:48 +0000)
This applies to mingw as clang-cl already has its own logic for the filename.

llvm-svn: 225134

clang/include/clang/Driver/Driver.h
clang/lib/Driver/Driver.cpp
clang/test/Driver/lto.c

index 020966f..20ca5f0 100644 (file)
@@ -105,7 +105,7 @@ public:
   std::string DefaultTargetTriple;
 
   /// Default name for linked images (e.g., "a.out").
-  std::string DefaultImageName;
+  mutable std::string DefaultImageName;
 
   /// Driver title to use with help.
   std::string DriverTitle;
index 8475e20..38765f0 100644 (file)
@@ -1996,6 +1996,8 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
                                       StringRef DarwinArchName) const {
   llvm::Triple Target = computeTargetTriple(DefaultTargetTriple, Args,
                                             DarwinArchName);
+  if (Target.isOSWindows())
+    DefaultImageName = "a.exe";
 
   ToolChain *&TC = ToolChains[Target.str()];
   if (!TC) {
index ec6b3f1..62300bd 100644 (file)
@@ -16,7 +16,7 @@
 // RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
 // RUN: grep '"-o" ".*lto\.bc" .*".*lto\.i"' %t.log
 // RUN: grep '"-o" ".*lto\.o" .*".*lto\.bc"' %t.log
-// RUN: grep '".*a.out" .*".*lto\.o"' %t.log
+// RUN: grep '".*a\.\(out\|exe\)" .*".*lto\.o"' %t.log
 
 // RUN: %clang %s -flto -S -### 2> %t.log
 // RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log