-
Notifications
You must be signed in to change notification settings - Fork 277
Improve remove virtual functions #393
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
Merged
kroening
merged 5 commits into
diffblue:master
from
smowton:improve_remove_virtual_functions_master
Jan 24, 2017
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c4c649
Don't use potentially-invalid downcasts to read an object's clsid if …
smowton ef7bdfe
Include child types when creating a virtual function dispatch tree
smowton 381eec4
Call least-derived virtual function for unknown clsid
smowton 386aad1
Add test for virtual dispatch against child type
smowton 065bfb9
Style and documentation fixes
smowton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
public class A { | ||
|
||
int f() { | ||
return 1; | ||
} | ||
|
||
public void main(int unknown) { | ||
|
||
A a = new A(); | ||
B b = new B(); | ||
C c = new C(); | ||
A callee; | ||
switch(unknown) { | ||
case 1: | ||
callee = a; | ||
break; | ||
case 2: | ||
callee = b; | ||
break; | ||
default: | ||
callee = c; | ||
break; | ||
} | ||
|
||
callee.f(); | ||
|
||
} | ||
|
||
} | ||
|
||
class B extends A { | ||
|
||
int f() { | ||
return 2; | ||
} | ||
|
||
} | ||
|
||
class C extends B {} |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
A.class | ||
--function A.main --show-goto-functions | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
IF "java::C".*THEN GOTO | ||
IF "java::B".*THEN GOTO | ||
IF "java::A".*THEN GOTO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The constructor for dereference_exprt should really infer the type iff the expr has a pointer type. Would you mind adding such a commit?
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.
So the fact that it doesn't attempt this, while
address_of_exprt
does, suggests that there must be some intentional use of dereference_exprt that changes type in a surprising way. @kroening ?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.
Yes, dereference_exprt(exprt e) should infer e.subtype() as type; exceptions can be dealt with using dereference_exprt(exprt, typet). Please do a PR.