Skip to content
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

Update to clang format 19 support #5015

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Examples/IO/XML/itkParticleSwarmOptimizerSAXReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ ParticleSwarmOptimizerSAXReader::ProcessBoundAttributes(
}
}
} // end if
} // end for
} // end for
}

/** Search for and return a particular attribute from the attribute list. */
Expand Down
5 changes: 1 addition & 4 deletions Modules/Bridge/VTK/src/itkVTKImageExportBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ namespace itk
* Constructor sets up information for the image-type indepenedent
* callbacks implemented in this superclass.
*/
VTKImageExportBase::VTKImageExportBase()
{
m_LastPipelineMTime = 0;
}
VTKImageExportBase::VTKImageExportBase() { m_LastPipelineMTime = 0; }
hjmjohnson marked this conversation as resolved.
Show resolved Hide resolved

void
VTKImageExportBase::PrintSelf(std::ostream & os, Indent indent) const
Expand Down
30 changes: 15 additions & 15 deletions Modules/Bridge/VtkGlue/src/QuickView.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,27 @@ using FloatImageType = itk::Image<float, 2>;
using DoubleImageType = itk::Image<double, 2>;

template void ITKVtkGlue_EXPORT
QuickView::AddImage<CharImageType>(CharImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<CharImageType>(CharImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<UnsignedShortImageType>(UnsignedShortImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<UnsignedShortImageType>(UnsignedShortImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<ShortImageType>(ShortImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<ShortImageType>(ShortImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<UnsignedIntImageType>(UnsignedIntImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<UnsignedIntImageType>(UnsignedIntImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<IntImageType>(IntImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<IntImageType>(IntImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<UnsignedLongImageType>(UnsignedLongImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<UnsignedLongImageType>(UnsignedLongImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<LongImageType>(LongImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<LongImageType>(LongImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<FloatImageType>(FloatImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<FloatImageType>(FloatImageType * image, bool FlipVertical, std::string Description);
template void ITKVtkGlue_EXPORT
QuickView::AddImage<DoubleImageType>(DoubleImageType * image, bool FlipVertical, std::string Description);
QuickView::AddImage<DoubleImageType>(DoubleImageType * image, bool FlipVertical, std::string Description);

template <>
void ITKVtkGlue_EXPORT
QuickView::AddImage<UnsignedCharImageType>(UnsignedCharImageType * image, bool FlipVertical, std::string Description)
QuickView::AddImage<UnsignedCharImageType>(UnsignedCharImageType * image, bool FlipVertical, std::string Description)
{
if (FlipVertical)
{
Expand All @@ -101,7 +101,7 @@ void ITKVtkGlue_EXPORT

template <typename TImage>
void ITK_TEMPLATE_EXPORT
QuickView::AddImage(TImage * image, bool FlipVertical, std::string Description)
QuickView::AddImage(TImage * image, bool FlipVertical, std::string Description)
{
using rescaleFilterType = itk::RescaleIntensityImageFilter<TImage, UnsignedCharImageType>;

Expand All @@ -116,7 +116,7 @@ void ITK_TEMPLATE_EXPORT

template <>
void ITKVtkGlue_EXPORT
QuickView::AddImage<UnsignedCharRGBImageType>(UnsignedCharRGBImageType * image,
QuickView::AddImage<UnsignedCharRGBImageType>(UnsignedCharRGBImageType * image,
bool FlipVertical,
std::string Description)
{
Expand All @@ -141,7 +141,7 @@ void ITKVtkGlue_EXPORT

template <>
void ITKVtkGlue_EXPORT
QuickView::AddRGBImage<UnsignedCharRGBImageType>(UnsignedCharRGBImageType * image,
QuickView::AddRGBImage<UnsignedCharRGBImageType>(UnsignedCharRGBImageType * image,
bool FlipVertical,
std::string Description)
{
Expand All @@ -166,7 +166,7 @@ void ITKVtkGlue_EXPORT

template <>
void ITKVtkGlue_EXPORT
QuickView::AddRGBImage<FloatRGBImageType>(FloatRGBImageType * image, bool FlipVertical, std::string Description)
QuickView::AddRGBImage<FloatRGBImageType>(FloatRGBImageType * image, bool FlipVertical, std::string Description)
{
using AdaptorType = itk::RGBToVectorImageAdaptor<FloatRGBImageType>;
AdaptorType::Pointer adaptor = AdaptorType::New();
Expand All @@ -182,7 +182,7 @@ void ITKVtkGlue_EXPORT

template <>
void ITKVtkGlue_EXPORT
QuickView::AddImage<FloatRGBImageType>(FloatRGBImageType * image, bool FlipVertical, std::string Description)
QuickView::AddImage<FloatRGBImageType>(FloatRGBImageType * image, bool FlipVertical, std::string Description)
{
using AdaptorType = itk::RGBToVectorImageAdaptor<FloatRGBImageType>;
AdaptorType::Pointer adaptor = AdaptorType::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ main()

using AlignedA = A __attribute__((aligned(64)));

return OnlyTrue<__alignof__(AlignedA) == 64>::Result && OnlyTrue<__alignof__(B) == 64>::Result;
return OnlyTrue < __alignof__(AlignedA) == 64 > ::Result && OnlyTrue < __alignof__(B) == 64 > ::Result;


return 0;
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ operator<<(std::ostream & os, const Array<TValue> & arr)

// declaration of specialization
template <>
ITKCommon_EXPORT std::ostream & operator<<<double>(std::ostream & os, const Array<double> & arr);
ITKCommon_EXPORT std::ostream & operator<< <double>(std::ostream & os, const Array<double> & arr);
template <>
ITKCommon_EXPORT std::ostream & operator<<<float>(std::ostream & os, const Array<float> & arr);
ITKCommon_EXPORT std::ostream & operator<< <float>(std::ostream & os, const Array<float> & arr);


template <typename T>
Expand Down
6 changes: 5 additions & 1 deletion Modules/Core/Common/include/itkAutoPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ class AutoPointer
~AutoPointer() { this->Reset(); }

/** Overload operator ->. */
ObjectType * operator->() const { return m_Pointer; }
ObjectType *
operator->() const
{
return m_Pointer;
}
Comment on lines -76 to +80
Copy link
Contributor

Choose a reason for hiding this comment

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

Interestingly, here it goes the other way (compared to the case of the m_LastPipelineMTime = 0; statement). I like having the return m_Pointer; statement on its own line. 👍


/** Clear the AutoPointer. If it had a pointer the object
is deleted and the pointer is set to null. */
Expand Down
6 changes: 5 additions & 1 deletion Modules/Core/Common/include/itkBoolean.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ class Boolean
{}

/** Supports implicit conversion to `bool`. */
constexpr operator bool() const { return m_Value; }
constexpr
operator bool() const
{
return m_Value;
}

private:
bool m_Value = false;
Expand Down
17 changes: 11 additions & 6 deletions Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ class ITK_TEMPLATE_EXPORT CellInterface
* Array is ordered (xmin, xmax, ymin, ymax, ....). A pointer to the
* array is returned for convenience. This allows code like:
* "CoordRep* bounds = cell->GetBoundingBox(new CoordRep[6]);". */
CoordinateType * GetBoundingBox(CoordinateType[PointDimension * 2]) { return nullptr; }
CoordinateType *
GetBoundingBox(CoordinateType[PointDimension * 2])
{
return nullptr;
}

/** Compute the square of the diagonal length of the bounding box. */
CoordinateType
Expand All @@ -407,11 +411,12 @@ class ITK_TEMPLATE_EXPORT CellInterface
* (returned through "t" pointer).
*
* Returns whether an intersection exists. */
virtual bool IntersectBoundingBoxWithLine(CoordinateType[PointDimension * 2],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType *)
virtual bool
IntersectBoundingBoxWithLine(CoordinateType[PointDimension * 2],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType *)
{
return bool();
}
Expand Down
7 changes: 4 additions & 3 deletions Modules/Core/Common/include/itkCompensatedSummation.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ class ITK_TEMPLATE_EXPORT CompensatedSummation
GetSum() const;

/** explicit conversion */
explicit operator FloatType() const;
explicit
operator FloatType() const;

private:
AccumulateType m_Sum{};
Expand All @@ -130,9 +131,9 @@ class ITK_TEMPLATE_EXPORT CompensatedSummation
};

void ITKCommon_EXPORT
CompensatedSummationAddElement(float & compensation, float & sum, const float element);
CompensatedSummationAddElement(float & compensation, float & sum, const float element);
void ITKCommon_EXPORT
CompensatedSummationAddElement(double & compensation, double & sum, const double element);
CompensatedSummationAddElement(double & compensation, double & sum, const double element);

} // end namespace itk

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkCompensatedSummation.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace itk
{

void ITKCommon_EXPORT
CompensatedSummationAddElement(float & compensation, float & sum, const float element);
CompensatedSummationAddElement(float & compensation, float & sum, const float element);
void ITKCommon_EXPORT
CompensatedSummationAddElement(double & compensation, double & sum, const double element);
CompensatedSummationAddElement(double & compensation, double & sum, const double element);

#ifndef itkCompensatedSummation_cxx
// We try the looser pragma guards if we don't have an explicit instantiation.
Expand Down
11 changes: 8 additions & 3 deletions Modules/Core/Common/include/itkConceptChecking.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ struct UniqueType_bool
* warning. (BOOST)
*/
template <typename T>
inline void IgnoreUnusedVariable(T)
inline void
IgnoreUnusedVariable(T)
{}

/**
Expand Down Expand Up @@ -806,7 +807,9 @@ struct SameDimensionOrMinusOne
using Type1 = Detail::UniqueType_unsigned_int<D1>;
using Type2 = Detail::UniqueType_unsigned_int<D1 - 1>;

void f(Type1) {}
void
f(Type1)
{}
void
f(Type2, int = 0)
{}
Expand All @@ -831,7 +834,9 @@ struct SameDimensionOrMinusOneOrTwo
using Type2 = Detail::UniqueType_unsigned_int<D1 - 1>;
using Type3 = Detail::UniqueType_unsigned_int<D1 - 2>;

void f(Type1) {}
void
f(Type1)
{}
void
f(Type2, int = 0)
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ class ConnectedImageNeighborhoodShape
static constexpr uintmax_t
CalculateBinomialCoefficient(const uintmax_t n, const uintmax_t k) noexcept
{
return (k > n) ? (assert(!"Out of range!"), 0)
: (k == 0) ? 1 : Math::UnsignedProduct(n, CalculateBinomialCoefficient(n - 1, k - 1)) / k;
return (k > n) ? (assert(!"Out of range!"), 0)
: (k == 0) ? 1
: Math::UnsignedProduct(n, CalculateBinomialCoefficient(n - 1, k - 1)) / k;
}


Expand Down
12 changes: 10 additions & 2 deletions Modules/Core/Common/include/itkConstSliceIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,19 @@ class ConstSliceIterator

/** Returns the element at position n of the slice. Sets the
* iterator to point to position n. */
const TPixel & operator[](SizeValueType n) { return this->Loc(m_Pos = n); }
const TPixel &
operator[](SizeValueType n)
{
return this->Loc(m_Pos = n);
}

/** Dereferences the iterator, returning the value that it points
* to. */
const TPixel & operator*() { return Loc(m_Pos); }
const TPixel &
operator*()
{
return Loc(m_Pos);
}

/** Returns the logical && of the boolean == of two slice iterator positions,
* stride, and start locations. */
Expand Down
16 changes: 10 additions & 6 deletions Modules/Core/Common/include/itkCovariantVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,18 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, VVectorDimensio
* Performs the inner product of two covariant vectors.
* \warning This is equivalent to the scalar product only if the reference
* system has orthogonal axis and equal scales. */
ValueType operator*(const Self & other) const;
ValueType
operator*(const Self & other) const;

/** operator*. Performs the scalar product with a vector (contravariant).
* This scalar product is invariant under affine transformations */
ValueType operator*(const Vector<T, VVectorDimension> & other) const;
ValueType
operator*(const Vector<T, VVectorDimension> & other) const;

/** Scalar operator*. Scale the elements of a vector by a scalar.
* Return a new vector. */
inline Self operator*(const ValueType & val) const
inline Self
operator*(const ValueType & val) const
{
Self result;

Expand Down Expand Up @@ -259,16 +262,17 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, VVectorDimensio
/** Premultiply Operator for product of a vector and a scalar.
* CovariantVector< T, N > = T * CovariantVector< T,N > */
template <typename T, unsigned int VVectorDimension>
inline CovariantVector<T, VVectorDimension> operator*(const T & scalar, const CovariantVector<T, VVectorDimension> & v)
inline CovariantVector<T, VVectorDimension>
operator*(const T & scalar, const CovariantVector<T, VVectorDimension> & v)
{
return v.operator*(scalar);
}

/** Performs the scalar product of a covariant with a contravariant.
* This scalar product is invariant under affine transformations */
template <typename T, unsigned int VVectorDimension>
inline T operator*(const Vector<T, VVectorDimension> & contravariant,
const CovariantVector<T, VVectorDimension> & covariant)
inline T
operator*(const Vector<T, VVectorDimension> & contravariant, const CovariantVector<T, VVectorDimension> & covariant)
{
return covariant.operator*(contravariant);
}
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkCovariantVector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ CovariantVector<T, VVectorDimension>::operator-(const Self & vec) const -> Self
}

template <typename T, unsigned int VVectorDimension>
typename CovariantVector<T, VVectorDimension>::ValueType CovariantVector<T, VVectorDimension>::operator*(
const Self & other) const
typename CovariantVector<T, VVectorDimension>::ValueType
CovariantVector<T, VVectorDimension>::operator*(const Self & other) const
{
typename NumericTraits<T>::AccumulateType value = T{};
for (unsigned int i = 0; i < VVectorDimension; ++i)
Expand All @@ -110,8 +110,8 @@ typename CovariantVector<T, VVectorDimension>::ValueType CovariantVector<T, VVec
}

template <typename T, unsigned int VVectorDimension>
typename CovariantVector<T, VVectorDimension>::ValueType CovariantVector<T, VVectorDimension>::operator*(
const Vector<T, VVectorDimension> & other) const
typename CovariantVector<T, VVectorDimension>::ValueType
CovariantVector<T, VVectorDimension>::operator*(const Vector<T, VVectorDimension> & other) const
{
typename NumericTraits<T>::AccumulateType value = T{};
for (unsigned int i = 0; i < VVectorDimension; ++i)
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkEventObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ operator<<(std::ostream & os, const EventObject & e)

#define itkEventMacroDefinition(classname, super) \
classname::classname(const classname & s) \
: super(s){}; \
: super(s) {}; \
classname::~classname() {} \
const char * classname::GetEventName() const { return #classname; } \
bool classname::CheckEvent(const itk::EventObject * e) const \
Expand Down Expand Up @@ -190,7 +190,7 @@ operator<<(std::ostream & os, const EventObject & e)
return new Self; \
} \
classname(const Self & s) \
: super(s){}; \
: super(s) {}; \
\
private: \
void \
Expand Down
Loading
Loading