[cfe-commits] patch for libclang: expose additional information about complex, vector, function, typedef, and enum types; cursor spelling for AsmLabelAttr attributes

Joe Groff arcata at gmail.com
Sat Dec 3 14:14:27 PST 2011


Attached is a revised version of the patch that addresses the issues raised
by Argyrios. This version of the patch is against SVN revision 145776. How
does this version look? Is there anything I need to sign off on in order to
get this patch integrated upstream? Thanks again for the feedback.

-Joe

On Wed, Nov 30, 2011 at 4:28 PM, Argyrios Kyrtzidis <kyrtzidis at apple.com>wrote:

> Looks great!
>
> Some nitpicking:
>
> +  QualType T = GetQualType(X);
> +  if (!T.getTypePtrOrNull())
> +    return 0;
> +
>
>
> Why not "if (T.isNull())" ? This applies to the other uses as well.
>
> +CINDEX_LINKAGE CXType clang_getArgType(CXType T, long long i);
>
>
> Any reason not making this "unsigned i" ?
>
> Could you also add tests in test/Index, to make sure the new cursors are
> created correctly ?
>
> -Argyrios
>
> On Nov 20, 2011, at 12:27 PM, Joe Groff wrote:
>
> Hi everyone. Here's a patch that adds some more functionality to libclang
> to query various types. I'd like to get some feedback. The patch is against
> svn revision 145002. It adds the following features:
>
> - Exposes a CXType_Vector type kind for vector types.
> - Adds generalized versions of the clang_getArrayElementType and
> clang_getArraySize functions, named clang_getElementType and
> clang_getNumElements, which work on array, vector, or complex types. This
> was the API change recommended in an earlier thread:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110926/046899.html. I left the clang_getArray* functions for source compatibility.
> - Adds additional functions for querying function types.
> clang_isFunctionTypeVariadic returns true if a function type is variadic.
> clang_getFunctionCallingConv returns an enumeration value indicating the
> calling convention of the function type. clang_getNumArgTypes returns the
> number of static argument types, and clang_getArgType gets the type of an
> argument.
> - Adds a clang_getTypedefDeclUnderlyingType function to get the underlying
> type from a TypedefDecl cursor.
> - Adds a clang_getEnumDeclIntegerType function to get the integer type
> from an EnumDecl cursor.
> - Adds clang_getEnumConstantDeclValue and
> clang_getEnumConstantDeclUnsignedValue functions to get the value of an
> EnumConstantDecl as a signed or unsigned long long, respectively.
> - Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label")
> attributes.
> - Alters clang_getCursorSpelling to return the label value for
> AsmLabelAttr-kind cursors.
>
> Let me know if there are any API or functionality changes I should make.
> Thanks for the feedback.
>
> -Joe
> <145002-libclang-complex-vector-function-enum-type-information.diff>
> _______________________________________________
>
> 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/20111203/e32a2702/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 145776-libclang-complex-vector-function-enum-type-information.diff
Type: application/octet-stream
Size: 14738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111203/e32a2702/attachment.obj>


More information about the cfe-commits mailing list