Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S Slicer
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 40
    • Merge requests 40
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Sam Horvath
  • Slicer
  • Merge requests
  • !1111

ENH: Modernize: add override in virtual functions of derived classes

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open phcerdan requested to merge github/fork/phcerdan/clang_tidy_override into master Mar 13, 2019
  • Overview 0
  • Commits 4
  • Changes 809

After ITK_OVERRIDE and VTK_OVERRIDE have been replaced for override we run clang-tidy to add overrides on virtual functions of derived classes.

Example:

-virtual void ShowProgress()
+void ShowProgress() override

This allows compiler warnings and errors if the method does not override the base class after a change in the base class.

Check the Slicer Wiki for an updated version of the documentation on how to run clang-tidy. https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide#C.2B.2B11:_Update_source_code_to_use_override

run-clang-tidy.py -checks=-*,modernize-use-override  -header-filter=.* -fix

Multiple override are added to the same method.

void PrintSelf(ostream& os, vtkIndent indent) override override override;

Clean them with (15 here is just a high enough number):

for n in `seq 1 15`;
do
    ack "override override" -l --print0 | xargs -0 -n 1 sed -i \
    's/override override/override/g'
done

When all of them are fixed, you should see in the terminal:

sed: no input files

This branch includes #1109 and #1107 (VTK_OVERRIDE and ITK_OVERRIDE)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/phcerdan/clang_tidy_override