[LLVMdev] ConstantBuilder proposal

Talin viridia at gmail.com
Mon Feb 7 12:52:18 PST 2011


On Fri, Feb 4, 2011 at 2:12 PM, Frits van Bommel <fvbommel at gmail.com> wrote:

> If you remove all the 'static's from the member functions, it'd work
> more like IRBuilder.
> It would also allow you to take the LLVMContext& as a constructor
> parameter, so that methods like this:
>
> On Fri, Feb 4, 2011 at 6:57 PM, Talin <viridia at gmail.com> wrote:
> >   /// GetStruct - return a constant struct given a context and a vector
> >   /// of elements.
> >   static Constant *GetStruct(
> >     LLVMContext &Context,
> >     const std::vector<Constant*> &V,
> >     bool Packed = false) {
> >     return ConstantStruct::get(Context, V, Packed);
> >   }
>
> can remove it from their parameter list. It's probably pretty unlikely
> a given ConstantBuilder instance would be used with multiple
> LLVMContexts.
>
> Making this a class you need an instance of would likely also allow
> typing to be reduced a bit because said instance can be given a
> shorter name than 'ConstantBuilder'. For example: 'cb.GetStruct(...)'
> instead of 'ConstantBuilder::GetStruct(MyContext, ...)'.
>

Actually, my main question is whether there is even interest in this - I'm
happy to write all the docs and unit tests, but only if this is something
that people want. I know that it makes my life a lot easier to be able to
create constant structs and arrays like this, but I can do that just as
easily in my own project.

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110207/3194ceb8/attachment.html>


More information about the llvm-dev mailing list