Driver: Update ArgList::{hasArg,getLastArg} to optionally claim the
arguments if they exist.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index cbd03a3..2aa5018 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -378,7 +378,7 @@
//
// Otherwise emit an error but still use a valid type to
// avoid spurious errors (e.g., no inputs).
- if (!Args.hasArg(options::OPT_E))
+ if (!Args.hasArg(options::OPT_E, false))
Diag(clang::diag::err_drv_unknown_stdin_type);
Ty = types::TY_C;
} else {
@@ -454,9 +454,10 @@
(FinalPhaseArg = Args.getLastArg(options::OPT_MM))) {
FinalPhase = phases::Preprocess;
- // -{-analyze,fsyntax-only,S} only run up to the compiler.
- } else if ((FinalPhaseArg = Args.getLastArg(options::OPT__analyze)) ||
- (FinalPhaseArg = Args.getLastArg(options::OPT_fsyntax_only)) ||
+ // -{fsyntax-only,-analyze,emit-llvm,S} only run up to the compiler.
+ } else if ((FinalPhaseArg = Args.getLastArg(options::OPT_fsyntax_only)) ||
+ (FinalPhaseArg = Args.getLastArg(options::OPT__analyze)) ||
+ (FinalPhaseArg = Args.getLastArg(options::OPT_emit_llvm)) ||
(FinalPhaseArg = Args.getLastArg(options::OPT_S))) {
FinalPhase = phases::Compile;
@@ -468,9 +469,6 @@
} else
FinalPhase = phases::Link;
- if (FinalPhaseArg)
- FinalPhaseArg->claim();
-
// Reject -Z* at the top level, these options should never have been
// exposed by gcc.
if (Arg *A = Args.getLastArg(options::OPT_Z))