Hi,
I'm experimenting with the python bindings for libclang.
(I'm keeping it simple for now: I'm trying out the example
cindex-dump.py script)
I've noticed that if I pass a .h file it is parsed in C mode,
whereas if I rename it to .hpp it is parsed in C++ mode.
My question is: can I force C++ mode for a .h file (without renaming it) ? (And the follow-up question is: How?)
Thanks,
Stefaan.
Try passing “-x c++” to the parser.
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?
Stefaan.
You want something more like "-x c++ test.h"; the order matters here.
-Eli
You want something more like "-x c++ test.h"; the order matters here.
Thank you! That seems to do the trick.
Best regards,
Stefaan.