Skip to content

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

phcerdan requested to merge github/fork/phcerdan/clang_tidy_override into master

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


-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. -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`;
    ack "override override" -l --print0 | xargs -0 -n 1 sed -i \
    's/override override/override/g'

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)

Merge request reports