diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-20 23:39:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-20 23:39:23 +0000 |
commit | ea9f032613bceee3ac04710ee0088352cf5dbaea (patch) | |
tree | 3c7da8b785d1ac0e468100939970e50357116263 /clang/lib | |
parent | 52a47e9c7ba8fa5450c3286ddad2a08304bac36d (diff) | |
download | bcm5719-llvm-ea9f032613bceee3ac04710ee0088352cf5dbaea.tar.gz bcm5719-llvm-ea9f032613bceee3ac04710ee0088352cf5dbaea.zip |
ccc/Driver: .s defaults to 'assembler-with-cpp' on Darwin.
- <rdar://problem/6669441> ccc doesn't handle assembler-with-cpp
semantics correctly (but clang supports it)
- This is sad, because it requires a fairly useless target
hook. C'est la vie.
llvm-svn: 67418
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Driver/HostInfo.cpp | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 2c324010dac..40c6e500636 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -445,9 +445,11 @@ void Driver::BuildActions(const ArgList &Args, ActionList &Actions) const { Ty = types::TY_C; } else { // Otherwise lookup by extension, and fallback to ObjectType - // if not found. + // if not found. 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 = types::lookupTypeForExtension(Ext + 1); + Ty = Host->lookupTypeForExtension(Ext + 1); + if (Ty == types::TY_INVALID) Ty = types::TY_Object; } diff --git a/clang/lib/Driver/HostInfo.cpp b/clang/lib/Driver/HostInfo.cpp index 39a688a4f5c..8c24a3c707b 100644 --- a/clang/lib/Driver/HostInfo.cpp +++ b/clang/lib/Driver/HostInfo.cpp @@ -57,6 +57,17 @@ public: virtual bool useDriverDriver() const; + virtual types::ID lookupTypeForExtension(const char *Ext) const { + types::ID Ty = types::lookupTypeForExtension(Ext); + + // Darwin always preprocesses assembly files (unless -x is used + // explicitly). + if (Ty == types::TY_PP_Asm) + return types::TY_Asm; + + return Ty; + } + virtual ToolChain *getToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -173,6 +184,10 @@ public: virtual bool useDriverDriver() const; + virtual types::ID lookupTypeForExtension(const char *Ext) const { + return types::lookupTypeForExtension(Ext); + } + virtual ToolChain *getToolChain(const ArgList &Args, const char *ArchName) const; }; |