summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-08-13 21:32:29 +0000
committerHans Wennborg <hans@hanshq.net>2013-08-13 21:32:29 +0000
commited1d07282cc9d8e4c25d585e03e5c8a1b6f63a74 (patch)
tree591c17d8c03489acd58555902058e13ae8befb36 /clang
parent327ccc787eb5dec947a99a99390313a9fa88f907 (diff)
downloadbcm5719-llvm-ed1d07282cc9d8e4c25d585e03e5c8a1b6f63a74.tar.gz
bcm5719-llvm-ed1d07282cc9d8e4c25d585e03e5c8a1b6f63a74.zip
Handle "--" explicitly in the driver
Anything that comes after -- is treated as an input file. This used to be handled automagically by the option parsing library, but after LLVM r188314, we should handle it ourselves. No functionality change. llvm-svn: 188316
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Driver/Options.td2
-rw-r--r--clang/lib/Driver/Driver.cpp26
2 files changed, 19 insertions, 9 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index ffe30a862b8..c72622d8425 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -179,6 +179,8 @@ def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
def _HASH_HASH_HASH : Flag<["-"], "###">, Flags<[DriverOption, CoreOption]>,
HelpText<"Print the commands to run for this compilation">;
+def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
+ Flags<[DriverOption, CoreOption]>;
def A : JoinedOrSeparate<["-"], "A">;
def B : JoinedOrSeparate<["-"], "B">;
def CC : Flag<["-"], "CC">, Flags<[CC1Option]>;
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index bbdb6fb8d17..68958047ba7 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -186,6 +186,14 @@ const {
return FinalPhase;
}
+static Arg* MakeInputArg(const DerivedArgList &Args, OptTable *Opts,
+ StringRef Value) {
+ Arg *A = new Arg(Opts->getOption(options::OPT_INPUT), Value,
+ Args.getBaseArgs().MakeIndex(Value), Value.data());
+ A->claim();
+ return A;
+}
+
DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
DerivedArgList *DAL = new DerivedArgList(Args);
@@ -251,6 +259,14 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
}
}
+ // Pick up inputs via the -- option.
+ if (A->getOption().matches(options::OPT__DASH_DASH)) {
+ A->claim();
+ for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
+ DAL->append(MakeInputArg(*DAL, Opts, A->getValue(i)));
+ continue;
+ }
+
DAL->append(*it);
}
@@ -375,7 +391,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
// Construct the list of inputs.
InputList Inputs;
- BuildInputs(C->getDefaultToolChain(), C->getArgs(), Inputs);
+ BuildInputs(C->getDefaultToolChain(), *TranslatedArgs, Inputs);
// Construct the list of abstract actions to perform for this compilation. On
// Darwin target OSes this uses the driver-driver and universal actions.
@@ -990,14 +1006,6 @@ static bool DiagnoseInputExistance(const Driver &D, const DerivedArgList &Args,
return false;
}
-static Arg* MakeInputArg(const DerivedArgList &Args, OptTable *Opts,
- StringRef Value) {
- unsigned Index = Args.getBaseArgs().MakeIndex(Value);
- Arg *A = Opts->ParseOneArg(Args, Index);
- A->claim();
- return A;
-}
-
// Construct a the list of inputs and their types.
void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
InputList &Inputs) const {
OpenPOWER on IntegriCloud