[llvm-commits] PATCH: refactoring MCInstFragment and MCDataFragment

Eli Bendersky eliben at google.com
Fri Dec 7 10:35:23 PST 2012


On Fri, Dec 7, 2012 at 10:05 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Perhaps I'm misunderstanding something but SmallString <is> a
> SmallVector, so you can get the length-erasure just by returning
> SmallVectorImpl<char>, if that's what you're wondering about. (but,
> yes, that would still involve changing clients to use the value as a
> SmallVec not a SmallString)
>
> (& as Jim mentioned I guess - why not just return a StringRef from
> these functions?)

Yep, I know that SmallString is-a SmallVector. However, if you do the
type erasure you mention, you lose the ability to use all the extra
methods provided by SmallString in the clients, right? And then,
what's the point?

If I switch to SmallVector, however, then I can get length-erasure by
returning SmallVectorImpl<char> and the clients don't lose any
abilities.

Eli



More information about the llvm-commits mailing list