diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-11 22:00:26 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-11 22:00:26 +0000 |
commit | 279c1dbebf37cd128f3c73c70741a6b8c35ad025 (patch) | |
tree | d63cc4d0a2d13ad79bb6d2beb6534be7122d53aa /lib/Driver/Driver.cpp | |
parent | 3612bc80fabcdd337f6d1df06e69b38c2c5f5a32 (diff) |
Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 7b45070912..4663fb9502 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -110,6 +110,16 @@ InputArgList *Driver::ParseArgStrings(const char **ArgBegin, return Args; } +DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { + DerivedArgList *DAL = new DerivedArgList(Args); + + for (ArgList::const_iterator it = Args.begin(), + ie = Args.end(); it != ie; ++it) + DAL->append(*it); + + return DAL; +} + Compilation *Driver::BuildCompilation(int argc, const char **argv) { llvm::PrettyStackTraceString CrashInfo("Compilation construction"); @@ -179,8 +189,12 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) { Host = GetHostInfo(HostTriple); + // Perform the default argument translations. + DerivedArgList *TranslatedArgs = TranslateInputArgs(*Args); + // The compilation takes ownership of Args. - Compilation *C = new Compilation(*this, *Host->CreateToolChain(*Args), Args); + Compilation *C = new Compilation(*this, *Host->CreateToolChain(*Args), Args, + TranslatedArgs); // FIXME: This behavior shouldn't be here. if (CCCPrintOptions) { |