[PATCH] D88832: [TableGen] Add new getAllDerivedDefinitionsTwo function to RecordKeeper

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 08:16:30 PDT 2020


jrtc27 added a comment.

In D88832#2316844 <https://reviews.llvm.org/D88832#2316844>, @Paul-C-Anagnostopoulos wrote:

> @jrtc27
>
> It turns out that ArrayRef has a constructor that will convert std::string to ArrayRef<std::string>, making a 1-element array. Therefore, these two overloads are ambiguous when passing a string:
>
>   std::vector<Record *>
>   getAllDerivedDefinitions(const ArrayRef<std::string> Classes) const;
>
> --versus--
>
>   std::vector<Record *>
>   getAllDerivedDefinitions(StringRef ClassName) const;  // The original definition.
>
> I can't think of a solution except to leave the first one as std::vector<std::string> or change it to SmallVectorImpl<std::string>.

Then you can just drop the single-string one and it'll automatically construct the ArrayRef for you and call the general one?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88832/new/

https://reviews.llvm.org/D88832



More information about the llvm-commits mailing list