[PATCH] D48298: [ELF] Uniquify --wrap list.

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 02:22:26 PDT 2018


bd1976llvm added a comment.

In https://reviews.llvm.org/D48298#1136343, @grimar wrote:

> In https://reviews.llvm.org/D48298#1136277, @bd1976llvm wrote:
>
> > I would propose adding the ability to retrieve a unique filtered list of arguments.
> >
> >   for (StringRef Name : Args.getAllUniqueArgValues(OPT_wrap))
> >     Symtab->addSymbolWrap<ELFT>(Name);
> >   
> >
> > Relevant for other options: --defsym, --trace-symbol, --undefined etc..
>
>
> I am not sure it is useful for other options we have, but it perhaps can be a nice refactoring for this particular case.
>
> For example, I am not sure we should use it for --defsym, as in theory it can have different values: `--defsym=foo=1 ... --defsym=foo=2`.
>  It is OK to process all of them one by one like we do now. The same applies for --trace-symbol and --undefined - there is no issue to process them one by one.
>  I would not overcomplicate the current code for these cases until it is proven to be a useful change.


For `--defsym=foo=2 --defsym=foo=1 --defsym=foo=1 --defsym=foo=3 ` getAllUniqueArgValues() result would be `foo=2`, `foo=1`, `foo=3`. We wouldn't want the result to be sorted.
However, looking at the current use cases of getAllArgValues() it doesn't seem worth adding this at the moment.

Let's go for the approach than you suggested (putting the don't wrap twice logic into addSymbolWrap).


Repository:
  rL LLVM

https://reviews.llvm.org/D48298





More information about the llvm-commits mailing list