Hi rnk,
This fixes http://llvm.org/PR20923.
http://reviews.llvm.org/D5334
Files:
lib/Driver/Driver.cpp
test/Driver/cl-inputs.c
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1077,7 +1077,15 @@
} else {
assert(InputTypeArg && "InputType set w/o InputTypeArg");
InputTypeArg->claim();
- Ty = InputType;
+ if (IsCLMode()) {
+ // If emulating cl.exe, make sure that -TC and -TP don't affect input
+ // object files.
+ const char *Ext = strrchr(Value, '.');
+ if (Ext && TC.LookupTypeForExtension(Ext + 1) == types::TY_Object)
+ Ty = types::TY_Object;
+ }
+ if (Ty == types::TY_INVALID)
+ Ty = InputType;
}
if (DiagnoseInputExistence(*this, Args, Value))
Index: test/Driver/cl-inputs.c
===================================================================
--- test/Driver/cl-inputs.c
+++ test/Driver/cl-inputs.c
@@ -34,6 +34,14 @@
// WARN: note: The last /TC or /TP option takes precedence over earlier instances
// WARN-NOT: note
+// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib %s -### 2>&1 | FileCheck -check-prefix=TPlib %s
+// TPlib: warning: cl-test.lib: 'linker' input unused
+// TPlib-NOT: cl-test.lib
+
+// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib %s -### 2>&1 | FileCheck -check-prefix=TClib %s
+// TClib: warning: cl-test.lib: 'linker' input unused
+// TClib-NOT: cl-test.lib
+
// RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
// STDIN: error: use /Tc or /Tp
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits