[LLVMdev] Problems with void*

Reid Spencer reid at x10sys.com
Fri Jun 10 16:40:52 PDT 2005


No value can be stored in a void and a function returning void* points
to nowhere in particular. I think what you are really wanting to do here
is use an opaque type. The other alternative is to simply use sbyte*. 

Remember, this isn't C even though some of the names/ideas look
familiar.

Reid.

On Fri, 2005-06-10 at 15:32 -0700, Ricardo wrote:
> Hello,
> 
> I am trying to use the LLVM classes (with Modules in memory) to represent some programs that use
> the void* type but I am having some problems handling that type. 
> If I use WriteBytecodeToFile, I receive this error:
> 
> Assertion `slot != -1 && "Module broken!"`
> 
> If I save the module directly with PrintModulePass, it generates the .ll file fine, but if I try
> to compile it with llvm-as, as soon as it finds 'void *' it complains that it was expecting an "("
> instead of an "*". I suppose that the correct syntax is something like this:  'void (sbyte *)*'
> 
> For example, these lines can cause the error:
> 
> 	%castinst1 = cast typeXYZ* %var to void*		; <void*> [#uses=1]
> 
> or
> 
> 	%astruct = type { %int*, %void*, *astruct }
> 
> My question is, how can I generate 'void (sbyte*)*' using the LLVM classes?
> 
> Thanks!
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050610/e2498990/attachment.sig>


More information about the llvm-dev mailing list