I agree, however, I didn't realise there was another method for obtaining the size until Duncan, correctly, pointed one out. I have since changed my code to use the getAllocSize method.<br><br>Thanks,<br><br>Daniel<br>
<br><div class="gmail_quote">2009/10/20 Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Daniel Waterworth <<a href="mailto:da.waterworth@googlemail.com">da.waterworth@googlemail.com</a>> writes:<br>
<br>
</div><div class="im">> It may not be the best way to do what I'm trying to do, but it's not useless<br>
> and bogus. Consider the following:<br>
><br>
> %1 = alloca i32* ; %1 is of type i32**, dereferenced it becomes a type i32*<br>
> and<br>
> ; the size of that is sizeof(void *) bytes<br>
<br>
</div>What Duncan says is that any valid method for obtaining the size of a<br>
Type should work for a PointerType, which is just another kind of Type.<br>
<div><div></div><div class="h5"><br>
>>>>> if (isa<PointerType>(allocated_type)) {<br>
>>>>> size = sizeof(void*) * 8;<br>
>>>>> } else {<br>
>>>>> size = allocated_type->getPrimitiveSizeInBits();<br>
>>>>> }<br>
>>>>> // size now equals the size (in bits) of the type allocated<br>
<br>
</div></div><font color="#888888">--<br>
Óscar<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</font></blockquote></div><br>