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 | c5a5ac5015584478ce89059757674b27661fe89c (patch) | |
tree | 4b749e50b37fe436217dfb0a553131c226c2b2cf /clang/lib/Driver/Driver.cpp | |
parent | 7326ad57a4be55baac656fe3c207239652477d03 (diff) | |
download | bcm5719-llvm-c5a5ac5015584478ce89059757674b27661fe89c.tar.gz bcm5719-llvm-c5a5ac5015584478ce89059757674b27661fe89c.zip |
Driver: Fix '-x none' handling.
- Enough stuff works now we can test argument parsing & pipelining.
llvm-svn: 66913
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index b48d01c699a..c6cdf6a4369 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/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 |