Skip to content

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

Merged
merged 1 commit into from
Nov 30, 2018
Merged

Document remove_virtual_functions [DOC-85] #2786

merged 1 commit into from
Nov 30, 2018

Conversation

LAJW
Copy link
Contributor

@LAJW LAJW commented Aug 21, 2018

No description provided.

Copy link
Contributor

@jeannielynnmoulton jeannielynnmoulton left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

use \return

Copy link
Contributor Author

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).

Copy link
Collaborator

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.

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

@thk123 thk123 left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

\param

Copy link
Member

Choose a reason for hiding this comment

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

Self explanatory -> Symbol table

@LAJW
Copy link
Contributor Author

LAJW commented Aug 22, 2018

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.

@LAJW LAJW changed the title Document remove_virtual_functions [DOC-25] Document remove_virtual_functions Aug 22, 2018
Copy link
Contributor

@thk123 thk123 left a 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. 

@thk123
Copy link
Contributor

thk123 commented Aug 24, 2018

Unfortunately the CI is failing due to two errors in this doxygen:

remove_virtual_functions.cpp:594: warning: argument 'target' of command @param is not found in the argument list of remove_virtual_function
remove_virtual_functions.cpp:594: warning: argument 'functions' of command @param is not found in the argument list of remove_virtual_function

@peterschrammel
Copy link
Member

@LAJW, please fix @thk123's remaining comments.

@thk123 thk123 changed the title [DOC-25] Document remove_virtual_functions Document remove_virtual_functions [DOC-85] Oct 4, 2018
Copy link
Contributor

@allredj allredj left a 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

@LAJW
Copy link
Contributor Author

LAJW commented Nov 30, 2018

CI Fixed, comments addressed (separate ticket has been created)

@peterschrammel peterschrammel merged commit 1eb1df6 into diffblue:develop Nov 30, 2018
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.

6 participants