Hi Gordon and Matthjis,<br><br>I got the return type of the function in success with the way Gordon explained.<br><br>RetTy = LLVMGetReturnType(LLVMGetElementType(LLVMTypeOf(F)))
<div><br>Thanks a lot!<br><br>--<br>Syoyo<br></div>
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">On Thu, May 22, 2008 at 11:33 PM, Gordon Henriksen <<a href="mailto:gordonhenriksen@mac.com">gordonhenriksen@mac.com</a>> wrote:<br>
<div>You're trying to apply an operation on a Type to a Value; that's no good, as you say. So you want the return type of the <i>type of the function</i>. But the function value itself is of type %function*, so you have to 'dereference' the type first:</div>
<div><br></div><div>LLVMGetReturnType(LLVMGetElementType(LLVMTypeOf(F)))</div><div><br></div><div>This may help to clarify: <a href="http://llvm.org/docs/ProgrammersManual.html#coreclasses" target="_blank">http://llvm.org/docs/ProgrammersManual.html#coreclasses</a></div>
</blockquote><br><br><br><br><br><div class="gmail_quote">On Fri, May 23, 2008 at 12:02 AM, Matthijs Kooijman <<a href="mailto:matthijs@stdin.nl">matthijs@stdin.nl</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Syoyo,<br>
<div class="Ih2E3d"><br>
> I am trying to get a return type of a function(from bitcode file) with<br>
> LLVM-C API, but there seems no appropriate API to do that.<br>
</div>From my memory, this info is stored in the function type, so you could look at<br>
the function's type and get the info there.<br>
<br>
Looking the the API docs [1], I find that there is a simple method on Function<br>
called getReturnType(). You should thus be able to do:<br>
        Type* rt = F->getReturnType();<br>
<br>
Good luck,<br>
<br>
Matthijs<br>
<br>
[1]: <a href="http://llvm.org/doxygen/classllvm_1_1Function.html" target="_blank">http://llvm.org/doxygen/classllvm_1_1Function.html</a><br></blockquote></div><br>