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

Make NToString and friends free functions #652

Merged
merged 6 commits into from
Aug 24, 2023
Merged

Conversation

fabianbs96
Copy link
Member

Currently, the printers NToString, DToString, etc. are pure virtual functions that have to be implemented by each analysis problem. However, the vast majority of all implementations of these functions is exactly the same (delegating to either llvmIRToString() or to operator<<) and independent from the analysis problem instance.

To simplify the usage of these functions as well as to simplify implementations of IDETabulationProblem, these printer functions are now free functions directly within the namespace psr. They now have a useful default implementation and can be easily extended via normal function overloading.

Note: The only painpoint currently is the Typestate Analysis -- the only analysis where LToString really depends on the analysis.
This PR, thus, slightly adapts the l_t type of the TSA to cope with this issue. A better solution is welcome and may come in its own PR.

OS << "Call string: [ ";
for (auto C : CallString) {
NP.printNode(OS, C);
OS << NToString((C));
Copy link
Member

Choose a reason for hiding this comment

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

double parentheses?

include/phasar/Utils/TypeTraits.h Outdated Show resolved Hide resolved
include/phasar/Utils/TypeTraits.h Outdated Show resolved Hide resolved
Copy link
Member

@MMory MMory left a comment

Choose a reason for hiding this comment

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

looks good, thanks! Nice cleanup!

fabianbs96 and others added 3 commits August 15, 2023 19:35
* Make IDETypeStateDescription a template to allow for type-safe type states

* Implement JoinLatticeTraits for CSTDFILEIOState

* Move TSA flow functions to source file again
@fabianbs96 fabianbs96 merged commit 4ac7e69 into development Aug 24, 2023
4 checks passed
@fabianbs96 fabianbs96 deleted the f-FreePrinters branch August 24, 2023 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants