Skip to content

Commit

Permalink
STYLE: Explicitly recognize virtual functions
Browse files Browse the repository at this point in the history
Build the latest version of llvm with clang and extra tools

The clang-modernize tool can insert missing override keyword
as a macro so that missing [optional] virtual identifiers
can be easily added.

mkdir ITK-newclang
cd ITK-newclang/
CC=/opt/llvm_trunk/bin/clang CXX=/opt/llvm_trunk/bin/clang++ CXXFLAGS="-std=c++11 -stdlib=libstdc++" ccmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON ../ITK
make -j23
clang-modernize -p ITK-newclang/ -include ITK/Modules/ -exclude ITK/Modules/ThirdParty  -add-override -override-macros

Change-Id: Ifbfb774b8b6eb489f4c0bd8955b13a9b5bce21d0
  • Loading branch information
hjmjohnson committed May 7, 2014
1 parent 1c86090 commit 1075772
Show file tree
Hide file tree
Showing 417 changed files with 1,480 additions and 1,481 deletions.
2 changes: 1 addition & 1 deletion Modules/Bridge/VTK/include/itkVTKImageExportBase.h
Expand Up @@ -117,7 +117,7 @@ class VTKImageExportBase:public ProcessObject
protected:
VTKImageExportBase();
~VTKImageExportBase() {}
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

typedef DataObject::Pointer DataObjectPointer;

Expand Down
Expand Up @@ -87,7 +87,7 @@ class AutoPointerDataObjectDecorator:public DataObject
protected:
AutoPointerDataObjectDecorator();
~AutoPointerDataObjectDecorator();
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

protected:

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkBoundingBox.h
Expand Up @@ -164,15 +164,15 @@ class BoundingBox:public Object
bool IsInside(const PointType &) const;

/** Method Compute the Modified Time based on changed to the components. */
ModifiedTimeType GetMTime(void) const;
virtual ModifiedTimeType GetMTime(void) const ITK_OVERRIDE;

/** Duplicates this bounding box */
Pointer DeepCopy() const;

protected:
BoundingBox();
virtual ~BoundingBox();
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

typedef typename PointsContainer::ConstIterator ConstIterator;

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkColorTable.h
Expand Up @@ -108,7 +108,7 @@ class ColorTable:public Object

protected:
ColorTable();
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

unsigned int m_NumberOfColors;

Expand Down
20 changes: 10 additions & 10 deletions Modules/Core/Common/include/itkCommand.h
Expand Up @@ -117,7 +117,7 @@ class MemberCommand:public Command
}

/** Invoke the member function. */
virtual void Execute(Object *caller, const EventObject & event)
virtual void Execute(Object *caller, const EventObject & event) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
Expand All @@ -126,7 +126,7 @@ class MemberCommand:public Command
}

/** Invoke the member function with a const object. */
virtual void Execute(const Object *caller, const EventObject & event)
virtual void Execute(const Object *caller, const EventObject & event) ITK_OVERRIDE
{
if ( m_ConstMemberFunction )
{
Expand Down Expand Up @@ -188,7 +188,7 @@ class ReceptorMemberCommand:public Command
}

/** Invoke the member function. */
virtual void Execute(Object *, const EventObject & event)
virtual void Execute(Object *, const EventObject & event) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
Expand All @@ -197,7 +197,7 @@ class ReceptorMemberCommand:public Command
}

/** Invoke the member function with a const object */
virtual void Execute(const Object *, const EventObject & event)
virtual void Execute(const Object *, const EventObject & event) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
Expand Down Expand Up @@ -256,15 +256,15 @@ class SimpleMemberCommand:public Command
}

/** Invoke the callback function. */
virtual void Execute(Object *, const EventObject &)
virtual void Execute(Object *, const EventObject &) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
( ( *m_This ).*( m_MemberFunction ) )( );
}
}

virtual void Execute(const Object *, const EventObject &)
virtual void Execute(const Object *, const EventObject &) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
Expand Down Expand Up @@ -323,15 +323,15 @@ class SimpleConstMemberCommand:public Command
}

/** Invoke the const member method callback. */
virtual void Execute(Object *, const EventObject &)
virtual void Execute(Object *, const EventObject &) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
( ( *m_This ).*( m_MemberFunction ) )( );
}
}

virtual void Execute(const Object *, const EventObject &)
virtual void Execute(const Object *, const EventObject &) ITK_OVERRIDE
{
if ( m_MemberFunction )
{
Expand Down Expand Up @@ -401,7 +401,7 @@ class CStyleCommand:public Command
{ m_ClientDataDeleteCallback = f; }

/** Execute the callback function. */
void Execute(Object *caller, const EventObject & event)
virtual void Execute(Object *caller, const EventObject & event) ITK_OVERRIDE
{
if ( m_Callback )
{
Expand All @@ -410,7 +410,7 @@ class CStyleCommand:public Command
}

/** Execute the callback function with a const Object */
void Execute(const Object *caller, const EventObject & event)
virtual void Execute(const Object *caller, const EventObject & event) ITK_OVERRIDE
{
if ( m_ConstCallback )
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkCreateObjectFunction.h
Expand Up @@ -67,7 +67,7 @@ class CreateObjectFunction:public CreateObjectFunctionBase

/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self);
LightObject::Pointer CreateObject() { return T::New().GetPointer(); }
virtual LightObject::Pointer CreateObject() ITK_OVERRIDE { return T::New().GetPointer(); }

protected:
CreateObjectFunction() {}
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkDataObject.h
Expand Up @@ -124,7 +124,7 @@ class ITKCommon_EXPORT InvalidRequestedRegionError:public DataObjectError
* specific exception subtypes. The default is to print out the
* location where the exception was first thrown and any description
* provided by the ``thrower''. */
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
};

/*----------------------------Data Object--------------------------------*/
Expand Down Expand Up @@ -481,7 +481,7 @@ class ITKCommon_EXPORT DataObject:public Object
protected:
DataObject();
~DataObject();
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

/** Propagate a call to ResetPipeline(). Called only from ProcessObject. */
virtual void PropagateResetPipeline();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkDataObjectDecorator.h
Expand Up @@ -91,7 +91,7 @@ class DataObjectDecorator:public DataObject
protected:
DataObjectDecorator();
~DataObjectDecorator();
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

protected:

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkDirectory.h
Expand Up @@ -66,7 +66,7 @@ class ITKCommon_EXPORT Directory:public Object
protected:
Directory();
~Directory();
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
Directory(const Self &); //purposely not implemented
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkEquivalencyTable.h
Expand Up @@ -140,7 +140,7 @@ class ITKCommon_EXPORT EquivalencyTable:public DataObject
EquivalencyTable(const Self &); // purposely not implemented
void operator=(const Self &); // purposely not implemented

void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

HashTableType m_HashMap;
};
Expand Down
13 changes: 6 additions & 7 deletions Modules/Core/Common/include/itkExceptionObject.h
Expand Up @@ -104,8 +104,7 @@ class ITKCommon_EXPORT ExceptionObject:public std::exception
virtual unsigned int GetLine() const;

/** Provide std::exception::what() implementation. */
virtual const char * what() const
throw( );
virtual const char * what() const throw( ) ITK_OVERRIDE;

private:
/** \class ReferenceCounterInterface
Expand Down Expand Up @@ -187,7 +186,7 @@ class ITKCommon_EXPORT MemoryAllocationError:public ExceptionObject
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~MemoryAllocationError() throw( );

virtual const char * GetNameOfClass() const
virtual const char * GetNameOfClass() const ITK_OVERRIDE
{ return "MemoryAllocationError"; }
};

Expand All @@ -212,7 +211,7 @@ class ITKCommon_EXPORT RangeError:public ExceptionObject
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~RangeError() throw( );

virtual const char * GetNameOfClass() const
virtual const char * GetNameOfClass() const ITK_OVERRIDE
{ return "RangeError"; }
};

Expand Down Expand Up @@ -244,7 +243,7 @@ class ITKCommon_EXPORT InvalidArgumentError:public ExceptionObject
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~InvalidArgumentError() throw( );

virtual const char * GetNameOfClass() const
virtual const char * GetNameOfClass() const ITK_OVERRIDE
{ return "InvalidArgumentError"; }
};

Expand All @@ -269,7 +268,7 @@ class ITKCommon_EXPORT IncompatibleOperandsError:public ExceptionObject
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~IncompatibleOperandsError() throw( );

virtual const char * GetNameOfClass() const
virtual const char * GetNameOfClass() const ITK_OVERRIDE
{ return "IncompatibleOperandsError"; }
};

Expand Down Expand Up @@ -303,7 +302,7 @@ class ITKCommon_EXPORT ProcessAborted:public ExceptionObject
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
virtual ~ProcessAborted() throw( );

virtual const char * GetNameOfClass() const
virtual const char * GetNameOfClass() const ITK_OVERRIDE
{ return "ProcessAborted"; }
};
} // end namespace itk
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkFastMutexLock.h
Expand Up @@ -82,7 +82,7 @@ class ITKCommon_EXPORT FastMutexLock:public Object
~FastMutexLock() {}

SimpleFastMutexLock m_SimpleFastMutexLock;
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
FastMutexLock(const Self &); //purposely not implemented
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkFileOutputWindow.h
Expand Up @@ -51,7 +51,7 @@ class ITKCommon_EXPORT FileOutputWindow:public OutputWindow
itkTypeMacro(FileOutputWindow, OutputWindow);

/** Send a string to display. */
virtual void DisplayText(const char *);
virtual void DisplayText(const char *) ITK_OVERRIDE;

/** Set the filename for the log file */
itkSetStringMacro(FileName);
Expand All @@ -75,7 +75,7 @@ class ITKCommon_EXPORT FileOutputWindow:public OutputWindow
protected:
FileOutputWindow();
virtual ~FileOutputWindow();
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

void Initialize();

Expand Down
20 changes: 10 additions & 10 deletions Modules/Core/Common/include/itkImageBase.h
Expand Up @@ -164,7 +164,7 @@ class ImageBase:public DataObject
typedef Matrix< SpacePrecisionType, VImageDimension, VImageDimension > DirectionType;

/** Restore object to initialized state. */
void Initialize();
virtual void Initialize() ITK_OVERRIDE;

/** Image dimension. The dimension of an image is fixed at construction. */
static unsigned int GetImageDimension()
Expand Down Expand Up @@ -279,7 +279,7 @@ class ImageBase:public DataObject
* the object to be modified. This method is called internally by
* the pipeline and therefore bypasses the modified time
* calculation. */
virtual void SetRequestedRegion( const DataObject *data );
virtual void SetRequestedRegion( const DataObject *data ) ITK_OVERRIDE;

/** Get the region object that defines the size and starting index
* for the region of the image requested (i.e., the region of the
Expand Down Expand Up @@ -589,7 +589,7 @@ class ImageBase:public DataObject
* ImageBase has more meta-data than its DataObject. Thus, it must
* provide its own version of CopyInformation() in order to copy the
* LargestPossibleRegion from the input parameter. */
virtual void CopyInformation(const DataObject *data);
virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE;

/** Graft the data and information from one image to another. This
* is a convenience method to setup a second image with all the meta
Expand All @@ -601,7 +601,7 @@ class ImageBase:public DataObject
* simply calls CopyInformation() and copies the region ivars.
* Subclasses of ImageBase are responsible for copying the pixel
* container. */
virtual void Graft(const DataObject *data);
virtual void Graft(const DataObject *data) ITK_OVERRIDE;

/** Update the information for this DataObject so that it can be used
* as an output of a ProcessObject. This method is used the pipeline
Expand All @@ -610,7 +610,7 @@ class ImageBase:public DataObject
* ProcessObject::UpdateOutputInformation() which determines modified
* times, LargestPossibleRegions, and any extra meta data like spacing,
* origin, etc. */
virtual void UpdateOutputInformation();
virtual void UpdateOutputInformation() ITK_OVERRIDE;

/** UpdateOutputData() is part of the pipeline infrastructure to
* communicate between ProcessObjects and DataObjects. The method of
Expand All @@ -619,12 +619,12 @@ class ImageBase:public DataObject
* input's requested region to zero, to indicate that it does not
* need to be updated or executed.
*/
virtual void UpdateOutputData();
virtual void UpdateOutputData() ITK_OVERRIDE;

/** Set the RequestedRegion to the LargestPossibleRegion. This
* forces a filter to produce all of the output in one execution
* (i.e. not streaming) on the next call to Update(). */
virtual void SetRequestedRegionToLargestPossibleRegion();
virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE;

/** Determine whether the RequestedRegion is outside of the
* BufferedRegion. This method returns true if the RequestedRegion
Expand All @@ -635,7 +635,7 @@ class ImageBase:public DataObject
* inside the BufferedRegion from the previous execution (and the
* current filter is up to date), then a given filter does not need
* to re-execute */
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE;

/** Verify that the RequestedRegion is within the
* LargestPossibleRegion. If the RequestedRegion is not within the
Expand All @@ -645,7 +645,7 @@ class ImageBase:public DataObject
* used by PropagateRequestedRegion(). PropagateRequestedRegion()
* throws a InvalidRequestedRegionError exception is the requested
* region is not within the LargestPossibleRegion. */
virtual bool VerifyRequestedRegion();
virtual bool VerifyRequestedRegion() ITK_OVERRIDE;

/** INTERNAL This method is used internally by filters to copy meta-data from
* the output to the input. Users should not have a need to use this method.
Expand All @@ -671,7 +671,7 @@ class ImageBase:public DataObject
protected:
ImageBase();
~ImageBase();
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

/** Calculate the offsets needed to move from one pixel to the next
* along a row, column, slice, volume, etc. These offsets are based
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImageDuplicator.h
Expand Up @@ -86,7 +86,7 @@ class ImageDuplicator:public Object
protected:
ImageDuplicator();
virtual ~ImageDuplicator() {}
void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
ImageDuplicator(const Self &); //purposely not implemented
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageIORegion.h
Expand Up @@ -83,7 +83,7 @@ class ITKCommon_EXPORT ImageIORegion:public Region
unsigned int GetRegionDimension() const;

/** Return the region type. Images are described with structured regions. */
virtual RegionType GetRegionType() const;
virtual RegionType GetRegionType() const ITK_OVERRIDE;

/** Constructor. ImageIORegion is a lightweight object that is not reference
* counted, so the constructor is public. */
Expand Down Expand Up @@ -152,7 +152,7 @@ class ITKCommon_EXPORT ImageIORegion:public Region
* including superclasses. Typically not called by the user (use Print()
* instead) but used in the hierarchical print process to combine the
* output of several classes. */
virtual void PrintSelf(std::ostream & os, Indent indent) const;
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

private:
unsigned int m_ImageDimension;
Expand Down

0 comments on commit 1075772

Please sign in to comment.