-
Notifications
You must be signed in to change notification settings - Fork 437
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
enhanced the registry module to support pretty printing and string co… #877
Conversation
…nversion which will help with debugging
Hi @esohel30! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the idea :)
Could we define this directly in source/interprocedural/fixpoint.ml, in the Registry module? That file defines a generic "interprocedural fixpoint", and the taint analysis is just an instantiation. Since your pp/show functions are generic, they can go there directly :)
Also please demonstrate that it works by pretty-printing a registry. You should be able do to that within a test. To clarify: you don't have to make it a test, just please demonstrate that it worked once, by showing some logs/stderr output.
let pp pp_value formatter map = | ||
let pp_pairs formatter pairs = | ||
let pp_pair formatter (key, value) = | ||
Format.fprintf formatter "@[<hv 2>%a -> %a@]" Target.pp key pp_value value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to use Model.pp
here instead of pp_value
let show pp_value map = | ||
Format.asprintf "%a" (pp pp_value) map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this a bit more concise
let show pp_value map = | |
Format.asprintf "%a" (pp pp_value) map | |
let show = | |
Format.asprintf "%a" pp |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
#869
This pull request adds pp and show functions to the Registry module to enable pretty-printing of the map contents for easier debugging and logging.
Changes:
Added pp Function:
The pp function formats the map's key-value pairs for pretty-printing.
Utilizes Format.fprintf for formatting and printing the map contents in a readable format.
Added show Function:
The show function converts the map to a string representation using the pp function.
Uses Format.asprintf to generate the string representation of the map.
Modified File:
registry.ml
The pull request is not fully done. Please provide any feedback on if I have the general understanding of the Issue. I will then implement the feedback and attempt to tackle the entire issue.