Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeDecl nodes of _Atomic C11 declarations have empty coord #475

Open
ebmoll opened this issue Oct 4, 2022 · 1 comment
Open

TypeDecl nodes of _Atomic C11 declarations have empty coord #475

ebmoll opened this issue Oct 4, 2022 · 1 comment

Comments

@ebmoll
Copy link

ebmoll commented Oct 4, 2022

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.

@eliben
Copy link
Owner

eliben commented Oct 4, 2022

PRs welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants