[cfe-dev] [ping] extra libclang functionality for the xdress project

Geoffrey Irving irving at naml.us
Wed Nov 13 10:54:14 PST 2013


Alp Toker recommended I cc you folk for thoughts on my patches to
libclang, since you seem to be involved in a libclang-related
discussion.  So far I haven't gotten in responses from people involved
in libclang.  Thanks Alp!

The three patches are attached.  They add additional functionality
that I needed to write a clang frontend for the xdress python wrapper
generator project.  All three patches come with passing unit tests.  I
am happy to do extra work to clean them up if requested!

If I can get these in, there will be other followup patches.  Also, my
previous email had four patches: this email removes the
clang_Cursor_getDefaultArgument patch since further work exposed a bug
(it called a C++ routine which assert()'ed various conditions).  This
is fixed, but I haven't yet extended the unit tests to detect the bug.
 I will resubmit once I do this.

Stepping back, I would greatly appreciate any advice for how to go
about patch submission for libclang in future, since I already have a
few followup patches and may generate more going forwards (though I
think I have nearly all the functionality needed by xdress).

Thanks,
Geoffrey

---------- Forwarded message ----------
From: Geoffrey Irving <irving at naml.us>
Date: Thu, Nov 7, 2013 at 11:08 AM
Subject: Re: [PATCH] extra libclang functionality for the xdress project
To: Alp Toker <alp at nuanti.com>
Cc: Anthony Scopatz <scopatz at gmail.com>, cfe-commits at cs.uiuc.edu,
Argyrios Kyrtzidis <akyrtzi at gmail.com>


On Wed, Nov 6, 2013 at 7:39 AM, Alp Toker <alp at nuanti.com> wrote:
>
> On 06/11/2013 14:55, Anthony Scopatz wrote:
>> Hello All,
>>
>> Could we please hear some response on this?  Thanks!
>
> Hello Anthony, Geoffrey,
>
> Thanks for the contribution.
>
> You'll need to rebase this work against current SVN, add at least a
> couple of standard lit tests and probably split it up into two or three
> bite-size chunks for review.
>
> Once that's done, it can also help to CC in others who've recently
> worked on the C API in order to get buy-in.
>
> As for the Geoffrey's build problem, it's best to ask that as a separate
> question, including details about the platform and configuration if
> you're still struggling.
>
> Good luck with the patch :-)
>
> Alp.
>
>
>
>>
>> Be Well
>> Anthony
>>
>>
>> On Sun, Nov 3, 2013 at 5:46 PM, Geoffrey Irving <irving at naml.us
>> <mailto:irving at naml.us>> wrote:
>>
>>     Here are four patches improving libclang in various ways for use in
>>     xdress (http://xdress.org).  In order, they add
>>
>>     1. Python support for clang_formatDiagnostic.
>>     2. Access to public / private / protected specifiers.
>>     3. Template argument access (as new cursor types).
>>     4. A clang_Cursor_getDefaultArgument function.
>>
>>     They've all been tested inside xdress, but the patches themselves do
>>     not include tests.  Since questions about this stuff to cfe-dev were
>>     ignored, I want to make sure these patches will be looked at before I
>>     do potentially unnecessary work.
>>
>>     Caveat: llvm trunk does not build for me due to these errors:
>>
>>         llvm-build: error: invalid native target: 'x86_64' (not in
>>     project)
>>
>>     Therefore, these patches were written, built, and tested again
>>     release_33 plus several cherry-picked libclang commits.  It's possible
>>     they don't compile against the trunk.
>>
>>     Any ideas what would have caused this build breakage since release_33?
>>
>>     Thanks,
>>     Geoffrey

Attached are updated versions of the four patches with both python and
c unit tests.  If anyone prefers git-svn, they are also here:

    https://github.com/girving/clang/commits/xdress
    https://github.com/girving/clang/commits/a064ac67efe8cf4cf82219e9d8988d72406d3925

Argyrios: I cc'ed you on Alp's suggestion since you touched the
libclang code recently.  Please let me know if you're up for looking
over the code, or know someone else you might be.

One change from the previous code: the new
clang_Cursor_getDefaultArgument() supports only function parameters,
since my naive method for extracting template argument defaults
(calling the getDefaultArgument() function) didn't work.  I don't
actually need template argument defaults for now, but here's the patch
that *did not* work if anyone is curious:

    https://github.com/girving/clang/commit/72879373f65e6eb08a94dcb4d74a5ff13532db2f

Thanks!
Geoffrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libclang-python-Expose-clang_formatDiagnostic-to-pyt.patch
Type: text/x-patch
Size: 2142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131113/900fd28f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-libclang-python-Expose-access-control-levels.patch
Type: text/x-patch
Size: 3990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131113/900fd28f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-libclang-Add-template-argument-support.patch
Type: text/x-patch
Size: 21530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131113/900fd28f/attachment-0002.bin>


More information about the cfe-dev mailing list