[cfe-dev] Incomplete cursor traversal in libclang

Jeaye contact at jeaye.com
Sat Nov 22 12:43:00 PST 2014


On Wed, Nov 12, 2014 at 01:10:11PM +0800, Jeaye wrote:
> Hey folks,
> 
> I've been bashing my head over this for several days, so I'm hoping one
> of you can lend a hand. When using the C interface to clang, I am unable
> to get some nested cursors which should exist. The example I'll use is
> one particular instance described below:
> 
> ```c++
> struct foo
> {
>   int num{ 42 };
>   int age{ num };
> };
> ```
> 
> The FieldDecl for `age` should also have a nested MemberRef (or
> similar), but it doesn't. The clang ast dump, on the other hand, shows
> that this information is available. See my gist below.
> 
> 1. Is this information available, but I'm missing something?
> 2. If it's not available, should it be added to 3.6?
> 
> Note, I'm currently using: clang version 3.5.0 (tags/RELEASE_350/final)
> 
> Extended information, including a testcase (code quality is that of a
> testcase and should not be a concern):
> 
> https://gist.github.com/jeaye/243d8b992f799de6ecf0

Folks,

I have been digging around in libclang, trying to get these issues
resolved myself. I _have_ managed to fix the specific issue I mentioned
above, but there are still several incomplete cursor traversals I am
seeing in libclang.

In hopes of not only getting these fixes in, but also getting some help
with these problems, I'm linking two commits which have been proven to
solve to separate issues for me. These commits are based on and work
with the latest clang/llvm master.

Field decl init: (as shown above)
commit:
  https://github.com/jeaye/clang/commit/7fc5ad762dfc9c3da56c5a10c9c5990e4da4a254
diff:
  https://github.com/jeaye/clang/commit/7fc5ad762dfc9c3da56c5a10c9c5990e4da4a254.diff

Lambda function params:
commit:
  https://github.com/jeaye/clang/commit/d5e32aa70903556a5181f45ee6b9975864b890ba
diff:
  https://github.com/jeaye/clang/commit/d5e32aa70903556a5181f45ee6b9975864b890ba.diff

I'm keeping a list of still existing issues here:
  https://github.com/jeaye/color_coded/issues/2

I'd really love some help finding and fixing them. So far, I've asked on
two IRC networks (for over a week) and I've had this message in the
mailing list (for over a week) about these issues. Not once an acknowledgement.

Cheers,
Jeaye



More information about the cfe-dev mailing list