-
Notifications
You must be signed in to change notification settings - Fork 277
Document remove_virtual_functions [DOC-85] #2786
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
Document remove_virtual_functions [DOC-85] #2786
Conversation
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.
Documentation seems clear, but I think you were supposed to write a summary in the main markdown file.
/// and the instance type or if fallback_action is set to | ||
/// ASSUME_FALSE, then function is substituted with a call to ASSUME(false) | ||
/// \symbol_table: Self explanatory | ||
/// \param goto_program [in/out]: GoTo program to modify |
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.
consider consistency in capitalisation of gOTo throughout
void remove_virtual_functions(goto_modelt &goto_model) | ||
{ | ||
remove_virtual_functions( | ||
goto_model.symbol_table, goto_model.goto_functions); | ||
} | ||
|
||
/// Remove virtual function calls from the specified model |
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.
model function
@@ -479,6 +506,9 @@ exprt remove_virtual_functionst::get_method( | |||
return symbol->symbol_expr(); | |||
} | |||
|
|||
/// Remove all virtual function calls in a goto program and replace | |||
/// them with calls to their most derived implementations | |||
/// Returns true if at least one function has been replaced |
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.
use \return
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.
If I add \return
this no longer is considered as \brief
section, and linter is going to kill me.
Also I really, really don't like the pattern where a function that just returns something has to have its behaviour specified in the \return
clause only. I don't believe any commercial library does that (except Java, where everything is void-returning).
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.
If I add
\return
this no longer is considered as\brief
section, and linter is going to kill me.
Is this just because of the missing full stop after "derived implementations?" Not a doxygen expert here, but AFAIK the first "." (if any) is interpreted by doxygen.
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.
Everything before the first tag is considered as \brief
(the high-level function description, it can be as long as you like). Yes, I'm missing full stop, thanks for pointing that out 👍
/// implementation. If there's a type mismatch between implementation | ||
/// and the instance type or if fallback_action is set to | ||
/// ASSUME_FALSE, then function is substituted with a call to ASSUME(false) | ||
/// \param goto_program [in/out]: GoTo program to modify |
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.
consider consistency in capitalisation of gOTo throughout
@@ -72,6 +72,13 @@ remove_virtual_functionst::remove_virtual_functionst( | |||
{ | |||
} | |||
|
|||
/// Replace specified virtual function call with a static call to its | |||
/// last implementation | |||
/// \param goto_program [in/out]: GoTo program to modify |
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.
consider consistency in capitalisation of gOTo throughout
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.
I think it is normally capitalised as GOTO
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.
As Jeanie pointed out needs overview in goto-programs/README.md in a section called Remove Virtual Functions
@@ -72,6 +72,13 @@ remove_virtual_functionst::remove_virtual_functionst( | |||
{ | |||
} | |||
|
|||
/// Replace specified virtual function call with a static call to its | |||
/// last implementation | |||
/// \param goto_program [in/out]: GoTo program to modify |
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.
I think it is normally capitalised as GOTO
@@ -72,6 +72,13 @@ remove_virtual_functionst::remove_virtual_functionst( | |||
{ | |||
} | |||
|
|||
/// Replace specified virtual function call with a static call to its | |||
/// last implementation |
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.
What does implementation mean?
void remove_virtual_functions(goto_modelt &goto_model) | ||
{ | ||
remove_virtual_functions( | ||
goto_model.symbol_table, goto_model.goto_functions); | ||
} | ||
|
||
/// Remove virtual function calls from the specified model |
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.
You can use \copydoc remove_virtual_functions
rather than actually copy-pasting the docs
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.
I think I can't do that because the function differs a bit (it's not a method, takes in more arguments).
/// implementation. If there's a type mismatch between implementation | ||
/// and the instance type or if fallback_action is set to | ||
/// ASSUME_FALSE, then function is substituted with a call to ASSUME(false) | ||
/// \symbol_table: Self explanatory |
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.
\param
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.
Self explanatory -> Symbol table
I've applied your suggestions, with one exception. @thk123 There are no sections for any of the contents of the directory in there, unlike in java_bytecode, where yall been working. There's a really good high-level overview, and my file seems to be an implementation detail, rather than one of the entry points, so I'm not sure it should go in there. |
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.
For the overview I was imaging adding to that readme a
\section goto-programs-lowerings GOTO program lowers
_Summary of lowering as a concept_
_List of lowerings_
\subsection goto-programs-remove-virtual-function remove_virtual_functions
\ref remove_virtual_functions replaces virtual function calls with a switch on the class identifier with the possible implementations of that method. The virtual call is therefore replaced by a collection of static calls.
But no reason to hold up this PR for that.
Unfortunately the CI is failing due to two errors in this doxygen:
|
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: f14b163).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93144212
CI Fixed, comments addressed (separate ticket has been created) |
No description provided.