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

Avoid removal of virtual method calls from call graph when applying method overrides #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/lang/cpp/M3.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,16 @@ M3 composeCppM3(loc id, set[M3] models) {
return comp;
}

@synopsis{fills out the call graph by adding the tuples for possible actual methods and constructors, and removing the corresponding calls to virtual methods and constructors.}
@synopsis{Fills out the call graph by adding the tuples for possible actual methods and constructors.}
@pitfalls{
A previous version of this function would remove the virtual method calls from the call graph.
Virtual methods in C++ can, however, have an implementation (if they do not, they are called pure virtual functions).
As a consequence, they can also be called and must remain in the call graph.

At the moment, we overapproximate and remove no scheme, even though some might be able to be removed.
}
rel[loc caller, loc callee] closeOverriddenVirtualCalls(M3 comp) {
return comp.callGraph
+ comp.callGraph o comp.methodOverrides // add the overridden definitions
- rangeR(comp.callGraph, comp.methodOverrides<0>); // remove the virtual intermediates
return comp.callGraph
+ comp.callGraph o comp.methodOverrides; // add the overridden definitions
}

Loading