diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-13 17:57:10 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-13 17:57:10 +0000 |
commit | 83dd21f6b4e6e109b893c0d42bc81e4883c342f7 (patch) | |
tree | 00edd9b066ea15cc52ccb46b35fa45ffd4b25197 /lib/Driver/Driver.cpp | |
parent | 209333506a935c582a7d62ad470978baec71afdc (diff) |
Driver: Fix '-x none' handling.
- Enough stuff works now we can test argument parsing & pipelining.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index b48d01c699..c6cdf6a436 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -345,11 +345,15 @@ void Driver::BuildUniversalActions(ArgList &Args, ActionList &Actions) { } void Driver::BuildActions(ArgList &Args, ActionList &Actions) { - types::ID InputType = types::TY_INVALID; - Arg *InputTypeArg = 0; - // Start by constructing the list of inputs and their types. + // Track the current user specified (-x) input. We also explicitly + // track the argument used to set the type; we only want to claim + // the type when we actually use it, so we warn about unused -x + // arguments. + types::ID InputType = types::TY_Nothing; + Arg *InputTypeArg = 0; + llvm::SmallVector<std::pair<types::ID, const Arg*>, 16> Inputs; for (ArgList::const_iterator it = Args.begin(), ie = Args.end(); it != ie; ++it) { @@ -360,7 +364,11 @@ void Driver::BuildActions(ArgList &Args, ActionList &Actions) { types::ID Ty = types::TY_INVALID; // Infer the input type if necessary. - if (InputType == types::TY_INVALID) { + if (InputType == types::TY_Nothing) { + // If there was an explicit arg for this, claim it. + if (InputTypeArg) + InputTypeArg->claim(); + // stdin must be handled specially. if (memcmp(Value, "-", 2) == 0) { // If running with -E, treat as a C input (this changes the |