/// @name Arg Synthesis
/// @{
+ /// AddSynthesizedArg - Add a argument to the list of synthesized arguments
+ /// (to be freed).
+ void AddSynthesizedArg(Arg *A) {
+ SynthesizedArgs.push_back(A);
+ }
+
virtual const char *MakeArgString(llvm::StringRef Str) const;
/// AddFlagArg - Construct a new FlagArg for the given option \arg Id and
if (getArchName() != A->getValue(Args, 0))
continue;
- // FIXME: The arg is leaked here, and we should have a nicer
- // interface for this.
- unsigned Prev, Index = Prev = A->getIndex() + 1;
+ unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(Args, 1));
+ unsigned Prev = Index;
Arg *XarchArg = Opts.ParseOneArg(Args, Index);
// If the argument parsing failed or more than one argument was
XarchArg->setBaseArg(A);
A = XarchArg;
+
+ DAL->AddSynthesizedArg(A);
}
// Sob. These is strictly gcc compatible for the time being. Apple
else
Std->render(Args, CmdArgs);
- if (Arg *A = Args.getLastArg(options::OPT_trigraphs))
- if (A->getIndex() > Std->getIndex())
+ if (Arg *A = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,
+ options::OPT_trigraphs))
+ if (A != Std)
A->render(Args, CmdArgs);
} else {
// Honor -std-default.