Make -save-temps=obj play better with -o.
authorMikhail Glushenkov <foldr@codedgers.com>
Sat, 4 Jul 2009 14:23:32 +0000 (14:23 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Sat, 4 Jul 2009 14:23:32 +0000 (14:23 +0000)
Use only the *dirname* of the pathname given to -o, so that -o can still be used
to name the output executable. This is more like what GCC 4.5 does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74790 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CompilerDriver/Main.cpp
lib/CompilerDriver/Tool.cpp

index c9c0413028d8fb448a63cbf4affa7c005f4dd565..7d1a3d8fbc4eb43caac758fb757e8a6e4b0bca76 100644 (file)
@@ -37,6 +37,7 @@ namespace {
     }
     else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
       tempDir = OutputFilename;
+      tempDir = tempDir.getDirname();
 
       if (!tempDir.exists()) {
         std::string ErrMsg;
index 7953dd24934b7998785963ae5df55e07c9cee04c..5a32fd33c3eec86aac42e1afbb7e73eb8587302f 100644 (file)
@@ -56,7 +56,7 @@ sys::Path Tool::OutFilename(const sys::Path& In,
   sys::Path Out;
 
   if (StopCompilation) {
-    if (!OutputFilename.empty() && SaveTemps != SaveTempsEnum::Obj ) {
+    if (!OutputFilename.empty()) {
       Out.set(OutputFilename);
     }
     else if (IsJoin()) {