Skip to content

Commit

Permalink
refactor: IWYU fixes and some manual modifications (#2158)
Browse files Browse the repository at this point in the history
After using #2155 I applied the suggested changes and added manual fixes to make the code compile again.

Not sure how customizable IWYU is but it does not work great with Eigen and boost and ipp because it always tries to use the original declaration/definition of the symbol in use. Also it seems not to be able to discover includes necessary for implicit conversions and operator overloads.
  • Loading branch information
andiwand committed Jun 15, 2023
1 parent 8cd72f8 commit 990a060
Show file tree
Hide file tree
Showing 822 changed files with 5,961 additions and 998 deletions.
2 changes: 2 additions & 0 deletions CI/iwyu/filter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ remove_lines:
- "^(- )?#include <boost/"
# don remove ipp
- "^- #include [<\"].*\\.ipp"
# ignore pybind11
- "^(- )?#include <pybind11/"

replace_lines:
- "^#include <assert\\.h>": "#include <cassert>"
Expand Down
3 changes: 3 additions & 0 deletions CI/iwyu/mapping-pythia.imp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ include: ["@<Pythia8/.*>", "private", "<Pythia8/Pythia.h>", "public"] }
]
3 changes: 2 additions & 1 deletion CI/iwyu/mapping.imp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
{ ref: "mapping-boost.imp" },
{ ref: "mapping-eigen.imp" }
{ ref: "mapping-eigen.imp" },
{ ref: "mapping-pythia.imp" }
]
2 changes: 2 additions & 0 deletions Core/include/Acts/Definitions/Direction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "Acts/Definitions/Algebra.hpp"

#include <cassert>
#include <cstddef>
#include <iosfwd>
#include <string>

Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/Detector/CylindricalContainerBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <memory>
Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/Detector/Detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Utilities/Delegate.hpp"

#include <cstddef>
#include <memory>
#include <stdexcept>
#include <string>
Expand All @@ -23,6 +24,7 @@

namespace Acts {
namespace Experimental {
struct NavigationState;

class Detector : public std::enable_shared_from_this<Detector> {
protected:
Expand Down
6 changes: 6 additions & 0 deletions Core/include/Acts/Detector/DetectorVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Acts/Detector/PortalGenerators.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
Expand All @@ -22,14 +23,19 @@
#include "Acts/Utilities/Delegate.hpp"
#include "Acts/Utilities/Helpers.hpp"

#include <algorithm>
#include <cstddef>
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

namespace Acts {

class Surface;
class IVolumeMaterial;
class VolumeBounds;

namespace Experimental {

Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Detector/DetectorVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@

#pragma once

#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
#include "Acts/Detector/interface/IExternalStructureBuilder.hpp"
#include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <memory>
#include <string>

namespace Acts {
namespace Experimental {
class IExternalStructureBuilder;
class IInternalStructureBuilder;

/// @brief A generic detector volume builder that uses
/// an external builder for shape and portals and an internal
Expand Down
9 changes: 9 additions & 0 deletions Core/include/Acts/Detector/LayerStructureBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <array>
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <vector>

namespace Acts {
namespace Experimental {
Expand Down
5 changes: 5 additions & 0 deletions Core/include/Acts/Detector/Portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/Surface.hpp"

#include <array>
#include <map>
#include <memory>
#include <optional>
#include <vector>

namespace Acts {

class ISurfaceMaterial;
class Surface;

namespace Experimental {
class DetectorVolume;
struct NavigationState;

/// A portal description between the detector volumes
///
Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/Detector/PortalGenerators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <vector>

namespace Acts {
class VolumeBounds;

namespace Experimental {

class DetectorVolume;
Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Detector/ProtoDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningData.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <vector>

namespace Acts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Detector/DetectorComponents.hpp"
#include "Acts/Detector/Portal.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <array>
#include <limits>
#include <map>
#include <memory>
Expand Down
3 changes: 3 additions & 0 deletions Core/include/Acts/Detector/detail/PortalHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
#include <vector>

namespace Acts {
class Direction;

namespace Experimental {

class DetectorVolume;
class Portal;

/// @brief Definition of a portal replacement when building proto containers
///
Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Detector/detail/SupportHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Surfaces/Surface.hpp"

#include <array>
#include <cstddef>
#include <memory>
#include <optional>
#include <vector>

namespace Acts {
Expand Down
3 changes: 3 additions & 0 deletions Core/include/Acts/Digitization/CartesianSegmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#include "Acts/Surfaces/RectangleBounds.hpp"
#include "Acts/Utilities/BinUtility.hpp"

#include <cstddef>
#include <memory>
#include <utility>
#include <vector>

namespace Acts {

Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/Digitization/DigitizationModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#include "Acts/Digitization/Segmentation.hpp"

#include <memory>
#include <vector>

namespace Acts {

class Surface;

using SurfacePtr = std::shared_ptr<const Surface>;
using SurfacePtrVector = std::vector<SurfacePtr>;

Expand Down
2 changes: 2 additions & 0 deletions Core/include/Acts/Digitization/PlanarModuleStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
#include "Acts/Utilities/Logger.hpp"

#include <memory>
#include <utility>
#include <vector>

namespace Acts {

class DigitizationModule;
struct DigitizationStep;

/// @class PlanarModuleStepper
///
Expand Down
21 changes: 19 additions & 2 deletions Core/include/Acts/EventData/VectorMultiTrajectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,31 @@
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/MultiTrajectoryBackendConcept.hpp"
#include "Acts/EventData/SourceLink.hpp"
#include "Acts/EventData/TrackStatePropMask.hpp"
#include "Acts/EventData/detail/DynamicColumn.hpp"
#include "Acts/Utilities/Concepts.hpp"
#include "Acts/Utilities/Helpers.hpp"

#include "Acts/Utilities/HashedString.hpp"

#include <any>
#include <cassert>
#include <cstddef>
#include <iosfwd>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

#include <boost/histogram.hpp>

namespace Acts {
class Surface;
template <typename T>
struct IsReadOnlyMultiTrajectory;

namespace detail_vmt {

Expand Down Expand Up @@ -312,6 +327,7 @@ class VectorMultiTrajectoryBase {
} // namespace detail_vmt

class VectorMultiTrajectory;

template <>
struct IsReadOnlyMultiTrajectory<VectorMultiTrajectory> : std::false_type {};

Expand Down Expand Up @@ -462,6 +478,7 @@ class VectorMultiTrajectory final
ACTS_STATIC_CHECK_CONCEPT(MutableMultiTrajectoryBackend, VectorMultiTrajectory);

class ConstVectorMultiTrajectory;

template <>
struct IsReadOnlyMultiTrajectory<ConstVectorMultiTrajectory> : std::true_type {
};
Expand Down
17 changes: 16 additions & 1 deletion Core/include/Acts/EventData/VectorTrackContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,29 @@

#pragma once

#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/MultiTrajectory.hpp"
#include "Acts/EventData/TrackContainer.hpp"
#include "Acts/EventData/TrackContainerBackendConcept.hpp"
#include "Acts/EventData/detail/DynamicColumn.hpp"
#include "Acts/Utilities/Concepts.hpp"

#include "Acts/Utilities/HashedString.hpp"

#include <any>
#include <cassert>
#include <cstddef>
#include <memory>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

namespace Acts {
class Surface;
template <typename T>
struct IsReadOnlyTrackContainer;

namespace detail_vtc {

Expand Down Expand Up @@ -233,6 +247,7 @@ class VectorTrackContainer final : public detail_vtc::VectorTrackContainerBase {
ACTS_STATIC_CHECK_CONCEPT(TrackContainerBackend, VectorTrackContainer);

class ConstVectorTrackContainer;

template <>
struct IsReadOnlyTrackContainer<ConstVectorTrackContainer> : std::true_type {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Direction.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/EventData/detail/TransformationFreeToBound.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <optional>
#include <tuple>

namespace Acts {

/// @brief Free to bound transformation Correction configuration class
Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/EventData/detail/PrintParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"

#include <cstdint>
Expand Down
4 changes: 4 additions & 0 deletions Core/include/Acts/Geometry/AbstractVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
namespace Acts {

class AbstractVolume;
template <class volume_t>
class BoundarySurfaceT;

using BoundarySurfacePtr =
std::shared_ptr<const BoundarySurfaceT<AbstractVolume>>;

class VolumeBounds;

using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;

/// @class AbstractVolume
Expand Down
3 changes: 1 addition & 2 deletions Core/include/Acts/Geometry/BoundarySurfaceT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
#include "Acts/Geometry/BoundarySurfaceFace.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinnedArray.hpp"

#include <memory>

namespace Acts {

class Surface;

/// @class BoundarySurfaceT
///
/// @tparam volume_t the type of volume.
Expand Down

0 comments on commit 990a060

Please sign in to comment.