[cfe-dev] libclang python bindings - how to force C++ mode ?

Eli Friedman eli.friedman at gmail.com
Mon Nov 14 14:30:03 PST 2011


On Mon, Nov 14, 2011 at 1:54 PM, Stefaan Himpe <stefaan.himpe at gmail.com> wrote:
>
>> Try passing "-x c++" to the parser.
>
> Hello, and thanks for replying.
>
> Unfortunately, passing -x c++ doesn't seem to have any effect.
>
> I'm invoking cindex-dump.py as follows:
>
> python cindex-dump.py test.h -x c++
>
> i've also tried
>
> python cindex-dump.py test.h "-x c++"
>
> I've verified with print statements that
> the arguments are really passed to the parser
> as part of the following code:
>
> index = Index.create()
> tu = index.parse(None, args)
>
> where
>
> args = ['test.h', '-x', 'c++'] (first way of invoking)
>
> or
>
> args = ['test.h', '-x c++'] (second way of invoking)
>
> Any other ideas?

You want something more like "-x c++ test.h"; the order matters here.

-Eli



More information about the cfe-dev mailing list