[llvm-dev] transfer type to 'local' context

alex via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 15 05:48:07 PDT 2017


Hi all,

is there an easy way to get a 'copy' of a type living in another context
into the local context?

Background:
when calling a function residing in a different module (context2) from a
module (context1), we first need to introduce a function declaration of
the function with empty body.

However, in order to do so, we need the function type.
pFuncInContext2->getType gives us the type in context2.
The returnType or argument type might refer to some types yet only
defined in context2 (e.g. special structs).

In order to get the functin declaration right, I would need to find out
if we have in context 1every necessary type referred to by the function
(in context2) and introduce it if not.

Is there an elegant way wrapping all this?
E.G. getTypeinLocalcontext(context1, pFuncTypeInContext2)?

Thx
Alex



More information about the llvm-dev mailing list