[cfe-commits] [Patch] Better libclang template support (looking for someone to look over the changes)

Dmitri Gribenko gribozavr at gmail.com
Wed Sep 19 10:55:29 PDT 2012


On Wed, Sep 19, 2012 at 8:36 PM, A. Selm <and.selm+clanglist at gmail.com> wrote:
> Hello,
>
> I modified libclang to support C++ templates better.
>
> As I am a first-time contributor, it would be great if someone could look
> over the changes, propose revisions and help me create the according
> patches.
>
> The changes can be seen in this github diff:
> https://github.com/FunkMonkey/libClang/compare/master...dev_templates
>
> My changes include:
> - exposing the types TemplateTypeParm, TemplateSpecialization
> - accessing the template parameters of a cursor
> -- clang_getTemplateNumParameters and clang_getTemplateParameter
> - exposing template arguments as cursors
>
> The part about the template arguments is really debatable, as they are not
> AST nodes in Clang, but I exposed them as AST cursors in libclang (because
> it fit better to what I did).
>
> Other changes
> - exposing type Elaborated
> - getting the access specifier of a member cursor
> (clang_getCXXMemberAccessSpecifier)

A few high-level comments, but this is by no means a full review.

1. Please review http://llvm.org/docs/CodingStandards.html and correct
your code accordingly.  (Mostly things like ASCII art delimiters, use
of doxygen markers for documentation comments, 80 columns, star
placement in pointer types etc)

2. Some changes, like clang_CXXMethod_isConst, are unrelated to
template support and should be discussed and reviewed separately.
(And a smaller patch is easier to review anyway.)

3. Please add tests.  One approach is to to change c-index-test to
print additional information for templates and specializations and
then add tests to tests/Index directory.

4. Breaking binary compatibility by changing CXCursor_LastDecl is a
big issue, but it was already raised on clang lists.  Seems like it
was going to happen sooner or later, but by breaking it we should make
it more future-proof than it was.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list