summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 04d4d44d2ea..e448eb153a8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1076,8 +1076,17 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
}
} else {
assert(InputTypeArg && "InputType set w/o InputTypeArg");
- InputTypeArg->claim();
- Ty = InputType;
+ if (!InputTypeArg->getOption().matches(options::OPT_x)) {
+ // 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;
+ InputTypeArg->claim();
+ }
}
if (DiagnoseInputExistence(*this, Args, Value))
OpenPOWER on IntegriCloud