[PATCH] Request for approval to commit: [libclang/python]: Add support for decayed type
Reid Kleckner
rnk at google.com
Thu Sep 12 10:30:26 PDT 2013
LGTM
On Thu, Sep 12, 2013 at 8:12 AM, Anders Waldenborg <anders at 0x63.nu> wrote:
> http://llvm-reviews.chandlerc.com/D1658
>
> Files:
> bindings/python/clang/cindex.py
> bindings/python/tests/cindex/test_type.py
>
> Index: bindings/python/clang/cindex.py
> ===================================================================
> --- bindings/python/clang/cindex.py
> +++ bindings/python/clang/cindex.py
> @@ -1486,6 +1486,7 @@
> TypeKind.INCOMPLETEARRAY = TypeKind(114)
> TypeKind.VARIABLEARRAY = TypeKind(115)
> TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116)
> +TypeKind.DECAYED = TypeKind(117)
>
> class Type(Structure):
> """
> @@ -1661,6 +1662,18 @@
> """
> return conf.lib.clang_getArraySize(self)
>
> + def get_decayed_original_type(self):
> + """
> + Retrieve the original type of a decayed type.
> + """
> + return conf.lib.clang_getDecayedOriginalType(self)
> +
> + def get_decayed_decayed_type(self):
> + """
> + Retrieve the decayed type of a decayed type.
> + """
> + return conf.lib.clang_getDecayedDecayedType(self)
> +
> def get_align(self):
> """
> Retrieve the alignment of the record.
> @@ -2693,6 +2706,16 @@
> [Type],
> c_longlong),
>
> + ("clang_getDecayedOriginalType",
> + [Type],
> + Type,
> + Type.from_result),
> +
> + ("clang_getDecayedDecayedType",
> + [Type],
> + Type,
> + Type.from_result),
> +
> ("clang_getFieldDeclBitWidth",
> [Cursor],
> c_int),
> Index: bindings/python/tests/cindex/test_type.py
> ===================================================================
> --- bindings/python/tests/cindex/test_type.py
> +++ bindings/python/tests/cindex/test_type.py
> @@ -369,3 +369,14 @@
> assert teststruct.type.get_offset("bar") == bar
>
>
> +def test_decay():
> + """Ensure decayed types are exposed"""
> +
> + tu = get_tu("void foo(int a[]);")
> + foo = get_cursor(tu, 'foo')
> + a = foo.type.argument_types()[0]
> +
> + assert a.kind == TypeKind.DECAYED
> + assert a.get_decayed_original_type().kind == TypeKind.INCOMPLETEARRAY
> + assert a.get_decayed_decayed_type().kind == TypeKind.POINTER
> +
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130912/fa36d4c9/attachment.html>
More information about the cfe-commits
mailing list