llvm.org GIT mirror llvm / 14d8c9e
ArgList: use MakeArgList overloads in subclasses and clean up some calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211340 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 6 years ago
2 changed file(s) with 13 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
327327 unsigned MakeIndex(StringRef String0) const;
328328 unsigned MakeIndex(StringRef String0, StringRef String1) const;
329329
330 using ArgList::MakeArgString;
330331 const char *MakeArgString(StringRef Str) const override;
331332
332333 /// @}
364365 /// (to be freed).
365366 void AddSynthesizedArg(Arg *A);
366367
368 using ArgList::MakeArgString;
367369 const char *MakeArgString(StringRef Str) const override;
368370
369371 /// AddFlagArg - Construct a new FlagArg for the given option \p Id and
349349 }
350350
351351 Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {
352 SynthesizedArgs.push_back(make_unique(
353 Opt,
354 ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
355 BaseArgs.MakeIndex(Opt.getName()), BaseArg));
352 SynthesizedArgs.push_back(
353 make_unique(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
354 BaseArgs.MakeIndex(Opt.getName()), BaseArg));
356355 return SynthesizedArgs.back().get();
357356 }
358357
359358 Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,
360359 StringRef Value) const {
361360 unsigned Index = BaseArgs.MakeIndex(Value);
362 SynthesizedArgs.push_back(make_unique(
363 Opt,
364 ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
365 Index, BaseArgs.getArgString(Index), BaseArg));
361 SynthesizedArgs.push_back(
362 make_unique(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
363 Index, BaseArgs.getArgString(Index), BaseArg));
366364 return SynthesizedArgs.back().get();
367365 }
368366
369367 Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,
370368 StringRef Value) const {
371369 unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);
372 SynthesizedArgs.push_back(make_unique(
373 Opt,
374 ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
375 Index, BaseArgs.getArgString(Index + 1), BaseArg));
370 SynthesizedArgs.push_back(
371 make_unique(Opt, MakeArgString(Opt.getPrefix() + Opt.getName()),
372 Index, BaseArgs.getArgString(Index + 1), BaseArg));
376373 return SynthesizedArgs.back().get();
377374 }
378375
380377 StringRef Value) const {
381378 unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());
382379 SynthesizedArgs.push_back(make_unique(
383 Opt,
384 ArgList::MakeArgString(Twine(Opt.getPrefix()) + Twine(Opt.getName())),
385 Index, BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
380 Opt, MakeArgString(Opt.getPrefix() + Opt.getName()), Index,
381 BaseArgs.getArgString(Index) + Opt.getName().size(), BaseArg));
386382 return SynthesizedArgs.back().get();
387383 }