[cfe-dev] Issue with cindex parsing on python: Can't parse function that returns a std::vector<std::vector<int>>

Tarcísio Fischer via cfe-dev cfe-dev at lists.llvm.org
Sun Oct 28 13:55:17 PDT 2018


Hi, David. Thanks for the response!

As far as I understand, since I'm using `-std=c++11` option, it SHOULD be
right. Anyway, I tried your suggestion, and it did not work (Same problem)
:( I'll leave the link here just for reference:
https://pastebin.com/jvQev5eb

Good news is... After trying a bit more, I managed to make the code work.
Turns out it as a missing `#include <vector>`. I don't know why the first
example works, (Now I believe none of them should work). Here's the working
example: https://pastebin.com/Setuw9cF

Does anyone knows why the first example was working, even with the missing
include?

Em sáb, 27 de out de 2018 às 14:31, David Blaikie <dblaikie at gmail.com>
escreveu:

> Are you parsing as C++98 (the default, I think? That code is invalid
> C++98/C++03, I think (because the ">>" is interpreted as a right shift
> operator, not the end of two template argument lists). In C++11 and above,
> it should do the right thing.
>
> On Fri, Oct 26, 2018 at 2:17 PM Tarcísio Fischer via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hello. I'm new with the clang python bindings (
>> https://github.com/llvm-mirror/clang/tree/master/bindings/python), and
>> I'm mostly basing my tests on the test examples on
>> https://github.com/llvm-mirror/clang/tree/master/bindings/python/tests/cindex .
>> Feel free to suggest any better documentation.
>>
>> For the following example, I'd expect the two results to be similar, but
>> the first one isn't getting any data about the function `example`. Does
>> anyone know why?
>>
>> https://pastebin.com/TF3RLibt
>>
>> Results on my machine:
>>
>> t.cpp (TypeKind.INVALID)
>>
>> ****************************************************************************************************
>> t.cpp (TypeKind.INVALID)
>>  example() (TypeKind.FUNCTIONPROTO)
>>    (TypeKind.INVALID)
>>     (TypeKind.INVALID)
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181028/87f0b920/attachment.html>


More information about the cfe-dev mailing list