aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2011-03-16 22:45:02 +0000
committerJoerg Sonnenberger <joerg@bec.de>2011-03-16 22:45:02 +0000
commit9a2927c4e6afa56ade0e5acc654f07fc658a220e (patch)
treeb9b45c3fc1d1a3d10973f3998eeb173106a6a37e /lib/Driver/Driver.cpp
parent545aa7a0f57d2bb2fc0eef83daa499300273d983 (diff)
Use C as fallback type if in C preprocessor mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 572323a963..f713fa0b3b 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -725,14 +725,19 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args,
Diag(clang::diag::err_drv_unknown_stdin_type);
Ty = types::TY_C;
} else {
- // Otherwise lookup by extension, and fallback to ObjectType if not
- // found. We use a host hook here because Darwin at least has its own
+ // Otherwise lookup by extension.
+ // Fallback is C if invoked as C preprocessor or Object otherwise.
+ // We use a host hook here because Darwin at least has its own
// idea of what .s is.
if (const char *Ext = strrchr(Value, '.'))
Ty = TC.LookupTypeForExtension(Ext + 1);
- if (Ty == types::TY_INVALID)
- Ty = types::TY_Object;
+ if (Ty == types::TY_INVALID) {
+ if (CCCIsCPP)
+ Ty = types::TY_C;
+ else
+ Ty = types::TY_Object;
+ }
// If the driver is invoked as C++ compiler (like clang++ or c++) it
// should autodetect some input files as C++ for g++ compatibility.