[LLVMdev] Recursive Types using the llvm support library

Vladimir Merzliakov wanderer at rsu.ru
Wed Mar 9 05:05:32 PST 2005


----- Original Message ----- 
From: "Chris Lattner" <sabre at nondot.org>
To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
Sent: Tuesday, March 08, 2005 6:31 PM
Subject: Re: [LLVMdev] Recursive Types using the llvm support library


> On Tue, 8 Mar 2005, Vladimir Merzliakov wrote:
>
>>>> An example where something really simple like the line below was output
>>>> would be perfect.
>>>>
>>>> %struct.linked_list = type { %struct.linked_list*, %sbyte* }
>>>
>>> Use something like this:
>>>
>>>   PATypeHolder StructTy = OpaqueType::get();
>>>   std::vector<const Type*> Elts;
>>>   Elts.push_back(PointerType::get(StructTy));
>>>   Elts.push_back(PointerType::get(Type::SByteTy));
>>>   StructType *NewSTy = StructType::get(Elts);
>>>
>>>   // At this point, NewSTy = "{ opaque*, sbyte* }", tell VMCore that
>>>   // the struct and the opaque type are actually the same.
>>>   cast<OpaqueType>(StructTy.get())->refineAbstractTypeTo(NewSTy);
>>>
>>>   // NewSTy is potentially invalidated, but StructTy (a PATypeHolder) is
>>>   // kept up-to-date.
>>>   NewSTy = StructTy.get();
>>>
>> Is assert(!NewSTy->isAbstract()) must pass  after this line?
>
> In this case, yup.
>
I create test program and assert failed in it:

{ \2 *, sbyte * }
Assertion failed: (!NewSTy->isAbstract()), function main, file 
/usr/home/wanderer/work/LLVMTest/obj/../src/tools/tool/Test.cc, line 28.

Testcase source attached.

Vladimir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.cc
Type: application/octet-stream
Size: 796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050309/f9463a01/attachment.obj>


More information about the llvm-dev mailing list