Finding anonymous enums with libclang
Is there a way to detect anonymous enumerations using libclang without relying on the text in the spelling name? The python bindings to libclang include functionality to detect whether C/C++ structs or unions are anonymous using clang.cindex.Cursor.is_anonymous , which ends up calling clang_Cursor_isAnonymous . The following sample demonstrates the issue. import sys from clang.cindex import * def nodeinfo(n): return (n.kind, n.is_anonymous(), n.spelling, n.type.spelling) idx = Index.create() # translation unit parsed correctly tu = idx.parse(sys.argv[1], ['-std=c++11']) assert(len(tu