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

Add P4-14 type checker logging #343

Merged

Conversation

sethfowler
Copy link
Contributor

It would be helpful to have logging for the P4-14 type checker so we can diagnose problems more easily.

This patch adds fairly comprehensive logging.

The setType() helper methods are just there to avoid bloating the call sites with ifs and logging statements. I went with the current interface because it seemed to be the most readable tradeoff. We could just pass the result of getOriginal() in at the cost of some verbosity at the call site. We could also go the other way and not pass currentNode in, but I felt like it was clearer and less error-prone to explicitly specify the node when calling setType().

@sethfowler sethfowler self-assigned this Mar 2, 2017
@sethfowler sethfowler changed the title Seth/add p4 14 type checker logging Add P4-14 type checker logging Mar 2, 2017
"Expected to be called on the visitor's current node");
currentNode->type = type;
if (type != getOriginal<NodeType>()->type)
LOG1("Set initial type " << type << " for expression " << currentNode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be LOG2 or even LOG3

( see https://github.com/p4lang/p4c/blob/master/docs/README.md -- towards the end)

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

Successfully merging this pull request may close these issues.

2 participants