Nodes of type TypeDecl created by _Atomic() don't seem to have a correct coord attribute:
file atomic.c:
typedef _Atomic(char) atomic_char;
from pycparser import parse_file
from pycparser.c_ast import NodeVisitor
class TypedefVisitor(NodeVisitor):
def visit_TypeDecl(self, node):
print(node.coord) # prints None
print(node.type.coord) # prints the correct location
ast = parse_file('atomic.c')
TypedefVisitor().visit(ast)
I don't know if this behavior is correct, but it seems inconsistent to me. It's a bit annoying since I use it to filter out ast nodes from included files when generating wrapper code.
Nodes of type TypeDecl created by _Atomic() don't seem to have a correct coord attribute:
file atomic.c:
I don't know if this behavior is correct, but it seems inconsistent to me. It's a bit annoying since I use it to filter out ast nodes from included files when generating wrapper code.