[cfe-dev] Clang Python Binding get integer from CursorKind.INTEGER_LITERAL
Theodor J Johansson via cfe-dev
cfe-dev at lists.llvm.org
Wed Jul 11 09:46:06 PDT 2018
Hello,
I'm trying to convert an AST emitted by the Clang python bindings (as a TranslationUnit) to a pycparser AST (As found in Eli Bendersky's code here<https://github.com/eliben/pycparser>) to work with some existing code. Eventually, I have a recursive function that points to a cursor of kind INTEGER_LITERAL, but if the integer literal came from a preprocessed macro, the cursor.get_tokens() and cursor.spelling attributes are both empty. Is there a way to reliably retrieve an integer constant form a cursor?
Thanks for any help,
Theodor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180711/4f078684/attachment.html>
More information about the cfe-dev
mailing list