[PATCH] [libclang] getSizeOf/getAlignOf/getOffsetOf (was [PATCH] Expose AST Record layout attributes to libclang)

Loïc Jaquemet loic.jaquemet at gmail.com
Mon Mar 25 17:24:27 PDT 2013


>> Does this handle anonymous structs/unions ? For example:
>>
>> struct Test {
>>   struct {
>>     union {
>>       int foo;
>>     };
>>   };
>> };
>>
>> If I pass "struct Test", "foo" will it work ? If yes, could you add a
>> related test ?
>>
>
> It does not work.
> I will look into that.

And now it does handle anonymous records.
I added some tests cases and changed the unit test code.

I also removed the duplicate clang_Cursor_getOffsetOf().
After consideration, it did not make sense, especially in the
anonymous record situation.

Please see attached diffs.

* Implementation of sizeof, alignof and offsetof for libclang.
* Unit Tests
* Python bindings
* Python tests





-- 
Loïc Jaquemet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sizeof-alignof-offsetof-001
Type: application/octet-stream
Size: 10502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130325/99f5b6a3/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sizeof-alignof-offsetof-002-tests
Type: application/octet-stream
Size: 16404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130325/99f5b6a3/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sizeof-alignof-offsetof-003-python-bindings
Type: application/octet-stream
Size: 1950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130325/99f5b6a3/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sizeof-alignof-offsetof-004-python-bindings-tests
Type: application/octet-stream
Size: 3468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130325/99f5b6a3/attachment-0003.obj>


More information about the cfe-commits mailing list