[llvm-commits] Move Module::getTypeByName to LLVMContext::getTypeByName

Maël Nison nison.mael at gmail.com
Sun Aug 5 11:44:52 PDT 2012


As a workaround, creating a temporary stack-alloced Module to use its
getTypeByName() method works.

But that's a workaround, it requires useless additional instructions. : /

On 2 August 2012 18:40, Maël Nison <nison.mael at gmail.com> wrote:

> Hi,
>
> This very short patch moves Module's getTypeByName into LLVMContext,
> because :
>
> - Every types are linked to a Context, so it makes sense to get types from
> the context and not from a module
> - The Module::getTypeByName function doesn't actually use anything owned
> by the Module class
> - It is not possible to specialize the TypeBuilder to return a named
> structure (we can only returns literal structures). By moving getTypeByName
> into the LLVMContext class, we are able to do it (TypeBuilder's
> specializations are called with a LLVMContext reference as parameter).
>
> In order to keep backward compatibility, Module::getTypeByName now
> forwards to the new method.
>
> It's my first patch so .. am I doing it wrong ?
>
> --
> Maël Nison
> Epitech 2014, Paris - Astek
>
>


-- 
Maël Nison
Epitech 2014, Paris - Astek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120805/3dde7e3a/attachment.html>


More information about the llvm-commits mailing list