clang-cl: Implement support for the /Fo option
This implements support for the /Fo option, which is used
to set the filename or output dir for object files.
Differential Revision: http://llvm-reviews.chandlerc.com/D1302
llvm-svn: 187820
diff --git a/clang/test/Driver/cl-Fo.c b/clang/test/Driver/cl-Fo.c
new file mode 100644
index 0000000..b820f0d
--- /dev/null
+++ b/clang/test/Driver/cl-Fo.c
@@ -0,0 +1,34 @@
+// Don't attempt slash switches on msys bash.
+// REQUIRES: shell-preserves-root
+
+// Note: %s must be preceded by --, otherwise it may be interpreted as a
+// command-line option, e.g. on Mac where %s is commonly under /Users.
+
+// RUN: %clang_cl /Foa -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-NAME %s
+// CHECK-NAME: "-o" "a.o"
+
+// RUN: %clang_cl /Foa.ext /Fob.ext -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-NAMEEXT %s
+// CHECK-NAMEEXT: warning: overriding '/Foa.ext' option with '/Fob.ext'
+// CHECK-NAMEEXT: "-o" "b.ext"
+
+// RUN: %clang_cl /Fofoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-DIR %s
+// CHECK-DIR: "-o" "foo.dir{{[/\\]+}}cl-Fo.o"
+
+// RUN: %clang_cl /Fofoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-DIRNAME %s
+// CHECK-DIRNAME: "-o" "foo.dir{{[/\\]+}}a.o"
+
+// RUN: %clang_cl /Fofoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-DIRNAMEEXT %s
+// CHECK-DIRNAMEEXT: "-o" "foo.dir{{[/\\]+}}a.ext"
+
+// RUN: %clang_cl /Fo.. -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-CRAZY %s
+// CHECK-CRAZY: "-o" "...o"
+
+
+// RUN: %clang_cl /Fo -### 2>&1 | FileCheck -check-prefix=CHECK-MISSINGARG %s
+// CHECK-MISSINGARG: error: argument to '/Fo' is missing (expected 1 value)
+
+// RUN: %clang_cl /Foa.obj -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEERROR %s
+// CHECK-MULTIPLESOURCEERROR: error: cannot specify '/Foa.obj' when compiling multiple source files
+
+// RUN: %clang_cl /Fomydir/ -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEOK %s
+// CHECK-MULTIPLESOURCEOK: "-o" "mydir{{[/\\]+}}cl-Fo.o"
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index ca286f7..ba1c1f3 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -88,7 +88,7 @@
// Unsupported but parsed options. Check that we don't error on them.
// (/Zs is for syntax-only)
-// RUN: %clang_cl /Zs /EHsc /Fdfoo /Fobar /fp:precise /Gd /GL /GL- -- %s 2>&1
+// RUN: %clang_cl /Zs /EHsc /Fdfoo /fp:precise /Gd /GL /GL- -- %s 2>&1
// RUN: %clang_cl /Zs /Gm /Gm- /GS /Gy /Gy- /GZ /MD /MT /MDd /MTd /Oi -- %s 2>&1
// RUN: %clang_cl /Zs /RTC1 /wfoo /Zc:wchar_t- -- %s 2>&1
// RUN: %clang_cl /Zs /ZI /Zi /showIncludes -- %s 2>&1