From 5a9fa83878e1d1e4bdd34c6fa1d9f1f1474efbee Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Tue, 3 Dec 2024 20:34:15 -0800 Subject: [PATCH 01/12] tidy headers --- .clang-tidy | 6 +++- app/celer-g4/ActionInitialization.cc | 2 +- app/celer-g4/ActionInitialization.hh | 2 +- app/celer-g4/RootIO.hh | 7 ----- app/celer-g4/SensitiveDetector.cc | 2 +- app/celer-g4/SensitiveDetector.hh | 4 +-- src/accel/HepMC3PrimaryGenerator.hh | 1 + src/accel/RZMapMagneticField.hh | 3 +- src/accel/SetupOptionsMessenger.hh | 2 +- src/accel/detail/HitProcessor.hh | 2 ++ src/accel/detail/LevelTouchableUpdater.hh | 2 +- src/accel/detail/NaviTouchableUpdater.hh | 2 +- src/celeritas/Types.hh | 2 +- .../alongstep/AlongStepGeneralLinearAction.hh | 2 +- .../alongstep/AlongStepUniformMscAction.hh | 2 +- src/celeritas/em/data/AtomicRelaxationData.hh | 1 + src/celeritas/em/xs/RBDiffXsCalculator.hh | 2 +- src/celeritas/ext/GeantImporter.hh | 2 +- src/celeritas/ext/RootImporter.hh | 2 +- src/celeritas/ext/detail/AllElementReader.hh | 1 + .../ext/detail/GeantBremsstrahlungProcess.cc | 4 +-- .../ext/detail/GeantBremsstrahlungProcess.hh | 2 +- src/celeritas/field/MakeMagFieldPropagator.hh | 5 ++++ src/celeritas/global/ActionLauncher.hh | 9 +++--- src/celeritas/global/CoreState.hh | 2 +- src/celeritas/global/CoreTrackData.hh | 1 + src/celeritas/global/Stepper.hh | 2 +- src/celeritas/global/TrackExecutor.hh | 28 +++++++++---------- src/celeritas/grid/GridIdFinder.hh | 10 ++----- src/celeritas/io/EventReader.hh | 2 ++ src/celeritas/io/EventWriter.hh | 2 ++ src/celeritas/io/ImporterInterface.hh | 1 + src/celeritas/io/RootEventReader.hh | 3 +- src/celeritas/io/RootEventWriter.hh | 3 +- src/celeritas/mat/ElementSelector.hh | 13 ++++----- src/celeritas/mat/MaterialData.hh | 1 + src/celeritas/optical/CoreState.hh | 2 +- src/celeritas/optical/CoreTrackData.hh | 2 ++ src/celeritas/optical/Model.hh | 5 +--- src/celeritas/optical/OffloadData.hh | 1 + src/celeritas/optical/ParticleData.hh | 1 + src/celeritas/optical/SimData.hh | 1 + src/celeritas/optical/TrackInitData.hh | 1 + src/celeritas/optical/Types.hh | 2 +- .../optical/action/ActionLauncher.hh | 1 + .../optical/action/TrackSlotExecutor.hh | 18 ++++++------ src/celeritas/phys/ParticleData.hh | 1 + src/celeritas/phys/PhysicsData.hh | 1 + src/celeritas/phys/PrimaryGenerator.hh | 3 +- src/celeritas/random/Selector.hh | 1 + src/celeritas/random/XorwowRngData.hh | 1 + .../random/distribution/NormalDistribution.hh | 12 ++++---- src/celeritas/track/SimData.hh | 1 + src/celeritas/track/SortTracksAction.hh | 2 +- src/celeritas/track/StatusCheckData.hh | 1 + src/celeritas/track/TrackInitData.hh | 1 + src/celeritas/user/ActionDiagnostic.hh | 2 +- src/celeritas/user/ParticleTallyData.hh | 1 + src/celeritas/user/SimpleCaloData.hh | 2 ++ src/celeritas/user/StepData.hh | 3 ++ src/celeritas/user/StepDiagnostic.hh | 2 +- src/corecel/Assert.hh | 4 +-- src/corecel/DeviceRuntimeApi.hh | 2 +- src/corecel/Macros.hh | 5 +++- src/corecel/cont/InitializedValue.hh | 2 ++ src/corecel/cont/MiniStack.hh | 4 +-- src/corecel/cont/Span.hh | 9 +++--- src/corecel/cont/detail/RangeImpl.hh | 1 + src/corecel/data/AuxStateVec.hh | 2 ++ src/corecel/data/Collection.hh | 4 +++ src/corecel/data/CollectionAlgorithms.hh | 2 +- src/corecel/data/CollectionStateStore.hh | 1 + src/corecel/data/DeviceVector.hh | 4 +++ src/corecel/data/LdgIterator.hh | 2 -- src/corecel/data/StackAllocatorData.hh | 1 + src/corecel/data/StreamStore.hh | 4 +++ src/corecel/data/detail/FillInvalid.hh | 1 + src/corecel/io/Label.hh | 5 +++- src/corecel/io/StreamableVariant.hh | 3 +- src/corecel/io/StringEnumMapper.hh | 2 ++ src/corecel/math/Algorithms.hh | 5 +++- src/corecel/math/HashUtils.hh | 1 + src/corecel/math/detail/AlgorithmsImpl.hh | 1 + src/corecel/sys/ActionInterface.hh | 4 +-- src/corecel/sys/KernelLauncher.hh | 1 + src/corecel/sys/MultiExceptionHandler.hh | 6 ++-- src/corecel/sys/Stream.hh | 3 ++ src/corecel/sys/TypeDemangler.hh | 1 + src/geocel/g4/GeantGeoData.hh | 2 ++ src/geocel/g4/GeantGeoParams.hh | 5 +++- src/geocel/g4/GeantGeoTrackView.hh | 6 ++-- src/geocel/g4/VisitGeantVolumes.hh | 2 ++ src/geocel/g4/detail/GeantGeoNavCollection.hh | 4 +-- src/geocel/rasterize/ImageData.hh | 1 + src/geocel/rasterize/RaytraceImager.hh | 1 + src/orange/OrangeData.hh | 1 + src/orange/OrangeParams.cc | 1 - src/orange/detail/BIHEnclosingVolFinder.hh | 6 +++- src/orange/detail/LevelStateAccessor.hh | 8 ++++++ src/orange/orangeinp/CsgTypes.hh | 5 +++- src/orange/orangeinp/IntersectRegion.hh | 3 +- src/orange/orangeinp/PolySolid.hh | 2 +- src/orange/orangeinp/ProtoInterface.hh | 2 +- src/orange/orangeinp/Shape.hh | 3 +- src/orange/orangeinp/Solid.hh | 3 +- src/orange/orangeinp/UnitProto.hh | 2 ++ src/orange/orangeinp/detail/VolumeBuilder.hh | 13 +++++++-- src/orange/surf/LocalSurfaceVisitor.hh | 1 + src/orange/surf/SurfaceTypeTraits.hh | 1 + src/orange/transform/TransformTypeTraits.hh | 1 + src/orange/transform/TransformVisitor.hh | 1 + src/orange/univ/SimpleUnitTracker.hh | 8 ++++-- src/orange/univ/TrackerVisitor.hh | 1 + src/orange/univ/UniverseTypeTraits.hh | 1 + src/orange/univ/detail/InfixEvaluator.hh | 1 + 115 files changed, 241 insertions(+), 129 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 44d03f0fc5..edcd3ae879 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,6 +9,7 @@ Checks: | -performance-avoid-endl -performance-unnecessary-value-param -performance-enum-size + -performance-noexcept-destructor cppcoreguidelines-* -cppcoreguidelines-owning-memory -cppcoreguidelines-narrowing-conversions @@ -25,6 +26,7 @@ Checks: | -cppcoreguidelines-noexcept-swap -cppcoreguidelines-noexcept-move-operations -cppcoreguidelines-noexcept-destructor + -cppcoreguidelines-virtual-class-destructor bugprone-* -bugprone-sizeof-expression -bugprone-narrowing-conversions @@ -37,9 +39,11 @@ CheckOptions: cppcoreguidelines-avoid-do-while.IgnoreMacros: true cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreNonDeducedTemplateTypes: true cppcoreguidelines-rvalue-reference-param-not-moved.AllowPartialMove: true + cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: true cppcoreguidelines-avoid-non-const-global-variables.AllowInternalLinkage: true performance-move-const-arg.CheckTriviallyCopyableMove: false performance-move-const-arg.CheckMoveToConstRef: false -HeaderFilterRegex: '' + +HeaderFilterRegex: '(example|app|src/(accel|celeritas|corecel|orange|geocel))/.*\.hh$' FormatStyle: file ... diff --git a/app/celer-g4/ActionInitialization.cc b/app/celer-g4/ActionInitialization.cc index c3dfeb1f5d..31b3f52761 100644 --- a/app/celer-g4/ActionInitialization.cc +++ b/app/celer-g4/ActionInitialization.cc @@ -29,7 +29,7 @@ namespace app * The parameters will be distributed to worker threads and all the actions. */ ActionInitialization::ActionInitialization(SPParams params) - : params_{std::move(params)}, init_shared_{true} + : params_{std::move(params)} { CELER_EXPECT(params_); diff --git a/app/celer-g4/ActionInitialization.hh b/app/celer-g4/ActionInitialization.hh index 2d43368e1a..4d83dcb4e8 100644 --- a/app/celer-g4/ActionInitialization.hh +++ b/app/celer-g4/ActionInitialization.hh @@ -43,7 +43,7 @@ class ActionInitialization final : public G4VUserActionInitialization SPParams params_; SPDiagnostics diagnostics_; int num_events_{0}; - mutable bool init_shared_; + mutable bool init_shared_{true}; }; //---------------------------------------------------------------------------// diff --git a/app/celer-g4/RootIO.hh b/app/celer-g4/RootIO.hh index f8a1b1b436..48d717d4ec 100644 --- a/app/celer-g4/RootIO.hh +++ b/app/celer-g4/RootIO.hh @@ -51,13 +51,6 @@ class RootIO private: // Construct by initializing TFile and TTree on each worker thread RootIO(); - RootIO(RootIO&&) = default; - - // Assignment operator - RootIO& operator=(RootIO&&) = default; - - // Default destructor - ~RootIO() = default; //// HELPER FUNCTIONS //// diff --git a/app/celer-g4/SensitiveDetector.cc b/app/celer-g4/SensitiveDetector.cc index cf0cd6767b..b1eb7714a6 100644 --- a/app/celer-g4/SensitiveDetector.cc +++ b/app/celer-g4/SensitiveDetector.cc @@ -30,7 +30,7 @@ namespace app * Construct with sensitive detector name. */ SensitiveDetector::SensitiveDetector(std::string name) - : G4VSensitiveDetector(name), hcid_{-1}, collection_{nullptr} + : G4VSensitiveDetector(name) { this->collectionName.insert(name); } diff --git a/app/celer-g4/SensitiveDetector.hh b/app/celer-g4/SensitiveDetector.hh index 9d8c181fbd..bc2b4761a9 100644 --- a/app/celer-g4/SensitiveDetector.hh +++ b/app/celer-g4/SensitiveDetector.hh @@ -41,8 +41,8 @@ class SensitiveDetector final : public G4VSensitiveDetector bool ProcessHits(G4Step*, G4TouchableHistory*) final; private: - int hcid_; - SensitiveHitsCollection* collection_; + int hcid_{-1}; + SensitiveHitsCollection* collection_{nullptr}; }; //---------------------------------------------------------------------------// diff --git a/src/accel/HepMC3PrimaryGenerator.hh b/src/accel/HepMC3PrimaryGenerator.hh index cd20f23d61..eb44fc3e35 100644 --- a/src/accel/HepMC3PrimaryGenerator.hh +++ b/src/accel/HepMC3PrimaryGenerator.hh @@ -51,6 +51,7 @@ class HepMC3PrimaryGenerator final : public G4VPrimaryGenerator explicit HepMC3PrimaryGenerator(std::string const& filename); CELER_DELETE_COPY_MOVE(HepMC3PrimaryGenerator); + ~HepMC3PrimaryGenerator() override = default; //! Add primaries to Geant4 event void GeneratePrimaryVertex(G4Event* g4_event) final; diff --git a/src/accel/RZMapMagneticField.hh b/src/accel/RZMapMagneticField.hh index 3b88fa62bc..b808789604 100644 --- a/src/accel/RZMapMagneticField.hh +++ b/src/accel/RZMapMagneticField.hh @@ -38,7 +38,8 @@ class RZMapMagneticField : public G4MagneticField inline explicit RZMapMagneticField(SPConstFieldParams field_params); // Calculate values of the magnetic field vector - inline void GetFieldValue(double const point[3], double* field) const; + inline void + GetFieldValue(double const point[3], double* field) const override; private: SPConstFieldParams params_; diff --git a/src/accel/SetupOptionsMessenger.hh b/src/accel/SetupOptionsMessenger.hh index e6e40e0645..79931b0c05 100644 --- a/src/accel/SetupOptionsMessenger.hh +++ b/src/accel/SetupOptionsMessenger.hh @@ -64,7 +64,7 @@ class SetupOptionsMessenger : public G4UImessenger explicit SetupOptionsMessenger(SetupOptions* options); // Default destructor - ~SetupOptionsMessenger(); + ~SetupOptionsMessenger() override; protected: void SetNewValue(G4UIcommand* command, G4String newValue) override; diff --git a/src/accel/detail/HitProcessor.hh b/src/accel/detail/HitProcessor.hh index f5957ded46..8a4be8c8a8 100644 --- a/src/accel/detail/HitProcessor.hh +++ b/src/accel/detail/HitProcessor.hh @@ -12,6 +12,7 @@ #include #include +#include "corecel/Macros.hh" #include "celeritas/Types.hh" #include "celeritas/geo/GeoFwd.hh" #include "celeritas/user/DetectorSteps.hh" @@ -81,6 +82,7 @@ class HitProcessor // Log on destruction ~HitProcessor(); + CELER_DEFAULT_MOVE_DELETE_COPY(HitProcessor); // Process CPU-generated hits void operator()(StepStateHostRef const&); diff --git a/src/accel/detail/LevelTouchableUpdater.hh b/src/accel/detail/LevelTouchableUpdater.hh index 10449962e4..5ce3f79a2b 100644 --- a/src/accel/detail/LevelTouchableUpdater.hh +++ b/src/accel/detail/LevelTouchableUpdater.hh @@ -47,7 +47,7 @@ class LevelTouchableUpdater final : public TouchableUpdaterInterface explicit LevelTouchableUpdater(SPConstGeo); // Destroy pointers - ~LevelTouchableUpdater(); + ~LevelTouchableUpdater() final; // Update from a particular detector step bool operator()(DetectorStepOutput const& out, diff --git a/src/accel/detail/NaviTouchableUpdater.hh b/src/accel/detail/NaviTouchableUpdater.hh index b830d05984..058ea96c1a 100644 --- a/src/accel/detail/NaviTouchableUpdater.hh +++ b/src/accel/detail/NaviTouchableUpdater.hh @@ -56,7 +56,7 @@ class NaviTouchableUpdater final : public TouchableUpdaterInterface G4VPhysicalVolume const* world); // Default external deleter - ~NaviTouchableUpdater(); + ~NaviTouchableUpdater() final; // Update from a particular detector step bool operator()(DetectorStepOutput const& out, diff --git a/src/celeritas/Types.hh b/src/celeritas/Types.hh index f73bb5d950..a25d1043ba 100644 --- a/src/celeritas/Types.hh +++ b/src/celeritas/Types.hh @@ -43,7 +43,7 @@ using IsotopeId = OpaqueId; using MaterialId = OpaqueId; //! Opaque index of model in the list of physics processes -using ModelId = OpaqueId; +using ModelId = OpaqueId; //! Opaque index to a material with optical properties using OpticalMaterialId = OpaqueId; diff --git a/src/celeritas/alongstep/AlongStepGeneralLinearAction.hh b/src/celeritas/alongstep/AlongStepGeneralLinearAction.hh index 54b9e27366..3bc0f3234c 100644 --- a/src/celeritas/alongstep/AlongStepGeneralLinearAction.hh +++ b/src/celeritas/alongstep/AlongStepGeneralLinearAction.hh @@ -56,7 +56,7 @@ class AlongStepGeneralLinearAction final : public CoreStepActionInterface SPConstMsc msc); // Default destructor - ~AlongStepGeneralLinearAction(); + ~AlongStepGeneralLinearAction() final; // Launch kernel with host data void step(CoreParams const&, CoreStateHost&) const final; diff --git a/src/celeritas/alongstep/AlongStepUniformMscAction.hh b/src/celeritas/alongstep/AlongStepUniformMscAction.hh index 6ce1f097e3..1b272276e8 100644 --- a/src/celeritas/alongstep/AlongStepUniformMscAction.hh +++ b/src/celeritas/alongstep/AlongStepUniformMscAction.hh @@ -55,7 +55,7 @@ class AlongStepUniformMscAction final : public CoreStepActionInterface SPConstMsc msc); // Default destructor - ~AlongStepUniformMscAction(); + ~AlongStepUniformMscAction() final; // Launch kernel with host data void step(CoreParams const&, CoreStateHost&) const final; diff --git a/src/celeritas/em/data/AtomicRelaxationData.hh b/src/celeritas/em/data/AtomicRelaxationData.hh index 877b14ac43..a86fbd9a95 100644 --- a/src/celeritas/em/data/AtomicRelaxationData.hh +++ b/src/celeritas/em/data/AtomicRelaxationData.hh @@ -133,6 +133,7 @@ struct AtomicRelaxStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) AtomicRelaxStateData& operator=(AtomicRelaxStateData& other) { scratch = other.scratch; diff --git a/src/celeritas/em/xs/RBDiffXsCalculator.hh b/src/celeritas/em/xs/RBDiffXsCalculator.hh index 18a19ebda9..3d5c0a1725 100644 --- a/src/celeritas/em/xs/RBDiffXsCalculator.hh +++ b/src/celeritas/em/xs/RBDiffXsCalculator.hh @@ -123,6 +123,7 @@ RBDiffXsCalculator::RBDiffXsCalculator(RelativisticBremRef const& shared, , material_(material) , element_(material.make_element_view(elcomp_id)) , total_energy_(value_as(particle.total_energy())) + , dielectric_suppression_(shared.dielectric_suppression()) { real_type density_factor = material.electron_density() * detail::migdal_constant(); @@ -133,7 +134,6 @@ RBDiffXsCalculator::RBDiffXsCalculator(RelativisticBremRef const& shared, * value_as(detail::lpm_constant()); real_type lpm_threshold = lpm_energy * std::sqrt(density_factor); enable_lpm_ = (shared.enable_lpm && (total_energy_ > lpm_threshold)); - dielectric_suppression_ = shared.dielectric_suppression(); } //---------------------------------------------------------------------------// diff --git a/src/celeritas/ext/GeantImporter.hh b/src/celeritas/ext/GeantImporter.hh index 173833e663..f9af815063 100644 --- a/src/celeritas/ext/GeantImporter.hh +++ b/src/celeritas/ext/GeantImporter.hh @@ -90,7 +90,7 @@ class GeantImporter final : public ImporterInterface ImportData operator()(DataSelection const& selection); //! Fill all available data from Geant4 - ImportData operator()() { return (*this)(DataSelection{}); } + ImportData operator()() final { return (*this)(DataSelection{}); } private: // Optional setup if celeritas handles initialization diff --git a/src/celeritas/ext/RootImporter.hh b/src/celeritas/ext/RootImporter.hh index 8611d0c34f..f3f355d917 100644 --- a/src/celeritas/ext/RootImporter.hh +++ b/src/celeritas/ext/RootImporter.hh @@ -58,7 +58,7 @@ class RootImporter final : public ImporterInterface } // Load data from the ROOT files - ImportData operator()(); + ImportData operator()() final; private: // ROOT file diff --git a/src/celeritas/ext/detail/AllElementReader.hh b/src/celeritas/ext/detail/AllElementReader.hh index 592a292347..63c2183930 100644 --- a/src/celeritas/ext/detail/AllElementReader.hh +++ b/src/celeritas/ext/detail/AllElementReader.hh @@ -42,6 +42,7 @@ class AllElementReader //! Load a map of data for all stored elements template + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) auto operator()(ReadOneElement&& read_el) const -> decltype(auto) { using result_type = typename ReadOneElement::result_type; diff --git a/src/celeritas/ext/detail/GeantBremsstrahlungProcess.cc b/src/celeritas/ext/detail/GeantBremsstrahlungProcess.cc index a2aa2708b4..52162d8021 100644 --- a/src/celeritas/ext/detail/GeantBremsstrahlungProcess.cc +++ b/src/celeritas/ext/detail/GeantBremsstrahlungProcess.cc @@ -39,9 +39,7 @@ namespace detail * Construct with model selection. */ GeantBremsstrahlungProcess::GeantBremsstrahlungProcess(ModelSelection selection) - : G4VEnergyLossProcess("eBrem") - , is_initialized_(false) - , model_selection_(selection) + : G4VEnergyLossProcess("eBrem"), model_selection_(selection) { CELER_VALIDATE(selection != ModelSelection::none, << "Cannot initialize GeantBremsstrahlungProcess with " diff --git a/src/celeritas/ext/detail/GeantBremsstrahlungProcess.hh b/src/celeritas/ext/detail/GeantBremsstrahlungProcess.hh index f0ca680d35..9cfdceb3f4 100644 --- a/src/celeritas/ext/detail/GeantBremsstrahlungProcess.hh +++ b/src/celeritas/ext/detail/GeantBremsstrahlungProcess.hh @@ -51,7 +51,7 @@ class GeantBremsstrahlungProcess : public G4VEnergyLossProcess void StreamProcessInfo(std::ostream& output) const override; private: - bool is_initialized_; + bool is_initialized_{false}; ModelSelection model_selection_; }; diff --git a/src/celeritas/field/MakeMagFieldPropagator.hh b/src/celeritas/field/MakeMagFieldPropagator.hh index 07006656e8..08b383d211 100644 --- a/src/celeritas/field/MakeMagFieldPropagator.hh +++ b/src/celeritas/field/MakeMagFieldPropagator.hh @@ -34,6 +34,7 @@ namespace celeritas */ template class StepperT, class FieldT> CELER_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) make_mag_field_stepper(FieldT&& field, units::ElementaryCharge charge) { using Equation_t = MagFieldEquation; @@ -58,10 +59,12 @@ make_mag_field_stepper(FieldT&& field, units::ElementaryCharge charge) */ template CELER_FUNCTION decltype(auto) +// NOLINTBEGIN(cppcoreguidelines-missing-std-forward) make_field_propagator(StepperT&& stepper, FieldDriverOptions const& options, ParticleTrackView const& particle, GTV&& geometry) +// NOLINTEND(cppcoreguidelines-missing-std-forward) { return FieldPropagator{ FieldDriver{options, ::celeritas::forward(stepper)}, @@ -84,12 +87,14 @@ make_field_propagator(StepperT&& stepper, * propagate(0.123); * \endcode */ +// NOLINTBEGIN(cppcoreguidelines-missing-std-forward) template class StepperT, class FieldT, class GTV> CELER_FUNCTION decltype(auto) make_mag_field_propagator(FieldT&& field, FieldDriverOptions const& options, ParticleTrackView const& particle, GTV&& geometry) +// NOLINTEND(cppcoreguidelines-missing-std-forward) { return make_field_propagator( make_mag_field_stepper(::celeritas::forward(field), diff --git a/src/celeritas/global/ActionLauncher.hh b/src/celeritas/global/ActionLauncher.hh index b1185f5d23..ae32468c6c 100644 --- a/src/celeritas/global/ActionLauncher.hh +++ b/src/celeritas/global/ActionLauncher.hh @@ -37,10 +37,11 @@ namespace celeritas * \endcode */ template -void launch_core(std::string_view label, - celeritas::CoreParams const& params, - celeritas::CoreState& state, - F&& execute_thread) +void launch_core( + std::string_view label, + celeritas::CoreParams const& params, + celeritas::CoreState& state, + F&& execute_thread) // NOLINT(cppcoreguidelines-missing-std-forward) { MultiExceptionHandler capture_exception; size_type const size = state.size(); diff --git a/src/celeritas/global/CoreState.hh b/src/celeritas/global/CoreState.hh index 7dd9224aac..e55673be3c 100644 --- a/src/celeritas/global/CoreState.hh +++ b/src/celeritas/global/CoreState.hh @@ -90,7 +90,7 @@ class CoreState final : public CoreStateInterface size_type num_track_slots); // Default destructor - ~CoreState(); + ~CoreState() final; // Prevent move/copy CELER_DELETE_COPY_MOVE(CoreState); diff --git a/src/celeritas/global/CoreTrackData.hh b/src/celeritas/global/CoreTrackData.hh index 04a0212912..be3e90a3f7 100644 --- a/src/celeritas/global/CoreTrackData.hh +++ b/src/celeritas/global/CoreTrackData.hh @@ -143,6 +143,7 @@ struct CoreStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CoreStateData& operator=(CoreStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/global/Stepper.hh b/src/celeritas/global/Stepper.hh index 8760773aab..502c7e71c3 100644 --- a/src/celeritas/global/Stepper.hh +++ b/src/celeritas/global/Stepper.hh @@ -157,7 +157,7 @@ class Stepper final : public StepperInterface explicit Stepper(Input input); // Default destructor - ~Stepper(); + ~Stepper() final; // Warm up before stepping void warm_up() final; diff --git a/src/celeritas/global/TrackExecutor.hh b/src/celeritas/global/TrackExecutor.hh index 298531ae58..d2dea88b6a 100644 --- a/src/celeritas/global/TrackExecutor.hh +++ b/src/celeritas/global/TrackExecutor.hh @@ -159,10 +159,10 @@ CELER_FUNCTION ConditionalTrackExecutor(CoreParamsPtr, * Return a track executor that only applies to active, non-errored tracks. */ template -inline CELER_FUNCTION decltype(auto) -make_active_track_executor(CoreParamsPtr params, - CoreStatePtr const& state, - T&& apply_track) +inline CELER_FUNCTION decltype(auto) make_active_track_executor( + CoreParamsPtr params, + CoreStatePtr const& state, + T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) { return ConditionalTrackExecutor{ params, state, AppliesValid{}, celeritas::forward(apply_track)}; @@ -177,11 +177,11 @@ make_active_track_executor(CoreParamsPtr params, * threads, active or not. */ template -inline CELER_FUNCTION decltype(auto) -make_action_track_executor(CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) +inline CELER_FUNCTION decltype(auto) make_action_track_executor( + CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) { CELER_EXPECT(action); return ConditionalTrackExecutor{params, @@ -195,11 +195,11 @@ make_action_track_executor(CoreParamsPtr params, * Return a track executor that only applies for the given along-step action. */ template -inline CELER_FUNCTION decltype(auto) -make_along_step_track_executor(CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) +inline CELER_FUNCTION decltype(auto) make_along_step_track_executor( + CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) { CELER_EXPECT(action); return ConditionalTrackExecutor{params, diff --git a/src/celeritas/grid/GridIdFinder.hh b/src/celeritas/grid/GridIdFinder.hh index 275fb42a99..e4b8b757dd 100644 --- a/src/celeritas/grid/GridIdFinder.hh +++ b/src/celeritas/grid/GridIdFinder.hh @@ -86,14 +86,10 @@ GridIdFinder::operator()(argument_type quant) const -> result_type { auto iter = celeritas::lower_bound(grid_.begin(), grid_.end(), quant.value()); - if (iter == grid_.end()) + if (iter == grid_.end() // Higher than end point + // Below first point + || (iter == grid_.begin() && quant.value() != *iter)) { - // Higher than end point - return {}; - } - else if (iter == grid_.begin() && quant.value() != *iter) - { - // Below first point return {}; } else if (iter + 1 == grid_.end() || quant.value() != *iter) diff --git a/src/celeritas/io/EventReader.hh b/src/celeritas/io/EventReader.hh index 77a4b2cc9f..e7a5ef0088 100644 --- a/src/celeritas/io/EventReader.hh +++ b/src/celeritas/io/EventReader.hh @@ -56,6 +56,8 @@ class EventReader : public EventReaderInterface //! Prevent copying and moving CELER_DELETE_COPY_MOVE(EventReader); + ~EventReader() override = default; + // Read a single event from the event record result_type operator()() final; diff --git a/src/celeritas/io/EventWriter.hh b/src/celeritas/io/EventWriter.hh index b17b36e56f..caab5d65f6 100644 --- a/src/celeritas/io/EventWriter.hh +++ b/src/celeritas/io/EventWriter.hh @@ -61,6 +61,8 @@ class EventWriter : public EventWriterInterface //! Prevent copying and moving due to file ownership CELER_DELETE_COPY_MOVE(EventWriter); + ~EventWriter() override = default; + // Write all the primaries from a single event void operator()(VecPrimary const& primaries) final; diff --git a/src/celeritas/io/ImporterInterface.hh b/src/celeritas/io/ImporterInterface.hh index bb17d683df..5f5aed92c5 100644 --- a/src/celeritas/io/ImporterInterface.hh +++ b/src/celeritas/io/ImporterInterface.hh @@ -24,6 +24,7 @@ class ImporterInterface protected: ImporterInterface() = default; CELER_DEFAULT_COPY_MOVE(ImporterInterface); + ~ImporterInterface() = default; }; //---------------------------------------------------------------------------// diff --git a/src/celeritas/io/RootEventReader.hh b/src/celeritas/io/RootEventReader.hh index 9c4bd31d96..4b530a2a38 100644 --- a/src/celeritas/io/RootEventReader.hh +++ b/src/celeritas/io/RootEventReader.hh @@ -47,6 +47,7 @@ class RootEventReader : public EventReaderInterface //! Prevent copying and moving CELER_DELETE_COPY_MOVE(RootEventReader); + ~RootEventReader() override = default; // Read a user-defined event from the ROOT file result_type operator()(EventId event_id); @@ -86,7 +87,7 @@ inline RootEventReader::RootEventReader(std::string const&, SPConstParticles) CELER_DISCARD(num_events_); CELER_DISCARD(entry_count_); CELER_DISCARD(expected_event_id_); - CELER_DISCARD(event_to_entry_); + CELER_DISCARD(event_to_entry_); // NOLINT(bugprone-sizeof-container) CELER_NOT_CONFIGURED("ROOT"); } diff --git a/src/celeritas/io/RootEventWriter.hh b/src/celeritas/io/RootEventWriter.hh index 30e4690ff2..2e9f7ce892 100644 --- a/src/celeritas/io/RootEventWriter.hh +++ b/src/celeritas/io/RootEventWriter.hh @@ -40,9 +40,10 @@ class RootEventWriter : public EventWriterInterface //! Prevent copying and moving CELER_DELETE_COPY_MOVE(RootEventWriter); + ~RootEventWriter() override = default; // Export primaries to ROOT - void operator()(VecPrimary const& primaries); + void operator()(VecPrimary const& primaries) override; private: //// DATA //// diff --git a/src/celeritas/mat/ElementSelector.hh b/src/celeritas/mat/ElementSelector.hh index e8ebf527d7..6e3e48786c 100644 --- a/src/celeritas/mat/ElementSelector.hh +++ b/src/celeritas/mat/ElementSelector.hh @@ -82,7 +82,7 @@ class ElementSelector private: Span elements_; - real_type material_xs_; + real_type material_xs_{0}; real_type* elemental_xs_; }; @@ -93,12 +93,11 @@ class ElementSelector * Construct with material, xs calculator, and storage. */ template -CELER_FUNCTION ElementSelector::ElementSelector(MaterialView const& material, - MicroXsCalc&& calc_micro_xs, - SpanReal storage) - : elements_(material.elements()) - , material_xs_(0) - , elemental_xs_(storage.data()) +CELER_FUNCTION ElementSelector::ElementSelector( + MaterialView const& material, + MicroXsCalc&& calc_micro_xs, // NOLINT(cppcoreguidelines-missing-std-forward) + SpanReal storage) + : elements_(material.elements()), elemental_xs_(storage.data()) { CELER_EXPECT(!elements_.empty()); CELER_EXPECT(storage.size() >= material.num_elements()); diff --git a/src/celeritas/mat/MaterialData.hh b/src/celeritas/mat/MaterialData.hh index b61934a428..5f53fd6600 100644 --- a/src/celeritas/mat/MaterialData.hh +++ b/src/celeritas/mat/MaterialData.hh @@ -216,6 +216,7 @@ struct MaterialStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) MaterialStateData& operator=(MaterialStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/CoreState.hh b/src/celeritas/optical/CoreState.hh index 862f41921d..6d7b956601 100644 --- a/src/celeritas/optical/CoreState.hh +++ b/src/celeritas/optical/CoreState.hh @@ -40,7 +40,7 @@ class CoreStateInterface : public AuxStateInterface public: // Support polymorphic deletion - virtual ~CoreStateInterface(); + ~CoreStateInterface() override; //! Thread/stream ID virtual StreamId stream_id() const = 0; diff --git a/src/celeritas/optical/CoreTrackData.hh b/src/celeritas/optical/CoreTrackData.hh index 0a70d8b9e2..a9b39147d6 100644 --- a/src/celeritas/optical/CoreTrackData.hh +++ b/src/celeritas/optical/CoreTrackData.hh @@ -40,6 +40,7 @@ struct PhysicsStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) PhysicsStateData& operator=(PhysicsStateData&) { return *this; @@ -142,6 +143,7 @@ struct CoreStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CoreStateData& operator=(CoreStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/Model.hh b/src/celeritas/optical/Model.hh index d084dd2300..369431ed2e 100644 --- a/src/celeritas/optical/Model.hh +++ b/src/celeritas/optical/Model.hh @@ -32,10 +32,7 @@ class Model : public OpticalStepActionInterface, public ConcreteAction using ConcreteAction::ConcreteAction; //! Action order for optical models is always post-step - StepActionOrder order() const override final - { - return StepActionOrder::post; - } + StepActionOrder order() const override { return StepActionOrder::post; } //! Build mean free path grids for all optical materials virtual void build_mfps(OpticalMaterialId mat, MfpBuilder& build) const = 0; diff --git a/src/celeritas/optical/OffloadData.hh b/src/celeritas/optical/OffloadData.hh index 5d806ea872..01d7841067 100644 --- a/src/celeritas/optical/OffloadData.hh +++ b/src/celeritas/optical/OffloadData.hh @@ -146,6 +146,7 @@ struct OffloadStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) OffloadStateData& operator=(OffloadStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/ParticleData.hh b/src/celeritas/optical/ParticleData.hh index ca435839fa..ab13d7c217 100644 --- a/src/celeritas/optical/ParticleData.hh +++ b/src/celeritas/optical/ParticleData.hh @@ -49,6 +49,7 @@ struct ParticleStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleStateData& operator=(ParticleStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/SimData.hh b/src/celeritas/optical/SimData.hh index bb454a634f..8a393beaa8 100644 --- a/src/celeritas/optical/SimData.hh +++ b/src/celeritas/optical/SimData.hh @@ -54,6 +54,7 @@ struct SimStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimStateData& operator=(SimStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/TrackInitData.hh b/src/celeritas/optical/TrackInitData.hh index ef4ae7791a..210c277c5a 100644 --- a/src/celeritas/optical/TrackInitData.hh +++ b/src/celeritas/optical/TrackInitData.hh @@ -80,6 +80,7 @@ struct TrackInitStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) TrackInitStateData& operator=(TrackInitStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/Types.hh b/src/celeritas/optical/Types.hh index 1ce15dc7a9..197b48a687 100644 --- a/src/celeritas/optical/Types.hh +++ b/src/celeritas/optical/Types.hh @@ -19,7 +19,7 @@ namespace celeritas using ScintillationParticleId = OpaqueId; //! Opaque index to a scintillation spectrum -using ParticleScintSpectrumId = OpaqueId; +using ParticleScintSpectrumId = OpaqueId; //---------------------------------------------------------------------------// /*! diff --git a/src/celeritas/optical/action/ActionLauncher.hh b/src/celeritas/optical/action/ActionLauncher.hh index 15d24c63e4..f307e576aa 100644 --- a/src/celeritas/optical/action/ActionLauncher.hh +++ b/src/celeritas/optical/action/ActionLauncher.hh @@ -35,6 +35,7 @@ namespace optical * \endcode */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void launch_action(CoreState& state, F&& execute_thread) { MultiExceptionHandler capture_exception; diff --git a/src/celeritas/optical/action/TrackSlotExecutor.hh b/src/celeritas/optical/action/TrackSlotExecutor.hh index 07d4fc397e..773e0a247e 100644 --- a/src/celeritas/optical/action/TrackSlotExecutor.hh +++ b/src/celeritas/optical/action/TrackSlotExecutor.hh @@ -158,10 +158,10 @@ ConditionalTrackSlotExecutor(CoreParamsPtr, * Return a track executor that only applies to active, non-errored tracks. */ template -inline CELER_FUNCTION decltype(auto) -make_active_thread_executor(CoreParamsPtr params, - CoreStatePtr const& state, - T&& apply_track) +inline CELER_FUNCTION decltype(auto) make_active_thread_executor( + CoreParamsPtr params, + CoreStatePtr const& state, + T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) { return ConditionalTrackSlotExecutor{ params, state, AppliesValid{}, celeritas::forward(apply_track)}; @@ -176,11 +176,11 @@ make_active_thread_executor(CoreParamsPtr params, * all threads, active or not. */ template -inline CELER_FUNCTION decltype(auto) -make_action_thread_executor(CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) +inline CELER_FUNCTION decltype(auto) make_action_thread_executor( + CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) { CELER_EXPECT(action); return ConditionalTrackSlotExecutor{params, diff --git a/src/celeritas/phys/ParticleData.hh b/src/celeritas/phys/ParticleData.hh index 3160431131..ba4d18fc23 100644 --- a/src/celeritas/phys/ParticleData.hh +++ b/src/celeritas/phys/ParticleData.hh @@ -145,6 +145,7 @@ struct ParticleStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleStateData& operator=(ParticleStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/phys/PhysicsData.hh b/src/celeritas/phys/PhysicsData.hh index d81d482927..ac0cdaa701 100644 --- a/src/celeritas/phys/PhysicsData.hh +++ b/src/celeritas/phys/PhysicsData.hh @@ -466,6 +466,7 @@ struct PhysicsStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) PhysicsStateData& operator=(PhysicsStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/phys/PrimaryGenerator.hh b/src/celeritas/phys/PrimaryGenerator.hh index 1710b6cc0c..43c07bf282 100644 --- a/src/celeritas/phys/PrimaryGenerator.hh +++ b/src/celeritas/phys/PrimaryGenerator.hh @@ -66,12 +66,13 @@ class PrimaryGenerator : public EventReaderInterface //! Prevent copying and moving CELER_DELETE_COPY_MOVE(PrimaryGenerator); + ~PrimaryGenerator() override = default; // Generate primary particles from a single event result_type operator()() final; //! Get total number of events - size_type num_events() const { return num_events_; } + size_type num_events() const override { return num_events_; } private: size_type num_events_{}; diff --git a/src/celeritas/random/Selector.hh b/src/celeritas/random/Selector.hh index 2e154dd430..0eca33d0f0 100644 --- a/src/celeritas/random/Selector.hh +++ b/src/celeritas/random/Selector.hh @@ -80,6 +80,7 @@ class Selector */ template CELER_FUNCTION Selector +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) make_selector(F&& func, T size, decltype(func(size)) total = 1) { return {celeritas::forward(func), size, total}; diff --git a/src/celeritas/random/XorwowRngData.hh b/src/celeritas/random/XorwowRngData.hh index fb2ff4a048..59c19da371 100644 --- a/src/celeritas/random/XorwowRngData.hh +++ b/src/celeritas/random/XorwowRngData.hh @@ -119,6 +119,7 @@ struct XorwowRngStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) XorwowRngStateData& operator=(XorwowRngStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/random/distribution/NormalDistribution.hh b/src/celeritas/random/distribution/NormalDistribution.hh index 0b345e9ed4..1e826ecda3 100644 --- a/src/celeritas/random/distribution/NormalDistribution.hh +++ b/src/celeritas/random/distribution/NormalDistribution.hh @@ -62,14 +62,16 @@ class NormalDistribution inline CELER_FUNCTION NormalDistribution(NormalDistribution const& other); // Reset spare value of other distribution - inline CELER_FUNCTION NormalDistribution(NormalDistribution&& other); + inline CELER_FUNCTION + NormalDistribution(NormalDistribution&& other) noexcept; // Keep spare value but change distribution inline CELER_FUNCTION NormalDistribution& operator=(NormalDistribution const&); // Possibly use spare value, change distribution - inline CELER_FUNCTION NormalDistribution& operator=(NormalDistribution&&); + inline CELER_FUNCTION NormalDistribution& + operator=(NormalDistribution&&) noexcept; // Default destructor (rule of 5) ~NormalDistribution() = default; @@ -119,8 +121,8 @@ NormalDistribution::NormalDistribution(NormalDistribution const& other * Reset spare value of other distribution. */ template -CELER_FUNCTION -NormalDistribution::NormalDistribution(NormalDistribution&& other) +CELER_FUNCTION NormalDistribution::NormalDistribution( + NormalDistribution&& other) noexcept : mean_{other.mean_} , stddev_{other.stddev_} , spare_{other.spare_} @@ -148,7 +150,7 @@ NormalDistribution::operator=(NormalDistribution const& other) */ template CELER_FUNCTION NormalDistribution& -NormalDistribution::operator=(NormalDistribution&& other) +NormalDistribution::operator=(NormalDistribution&& other) noexcept { mean_ = other.mean_; stddev_ = other.stddev_; diff --git a/src/celeritas/track/SimData.hh b/src/celeritas/track/SimData.hh index f1b40323ee..82fd69ec9f 100644 --- a/src/celeritas/track/SimData.hh +++ b/src/celeritas/track/SimData.hh @@ -166,6 +166,7 @@ struct SimStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimStateData& operator=(SimStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/track/SortTracksAction.hh b/src/celeritas/track/SortTracksAction.hh index 5f62a21bae..e6140ee60d 100644 --- a/src/celeritas/track/SortTracksAction.hh +++ b/src/celeritas/track/SortTracksAction.hh @@ -29,7 +29,7 @@ class SortTracksAction final : public CoreStepActionInterface, SortTracksAction(ActionId id, TrackOrder track_order); //! Default destructor - ~SortTracksAction() = default; + ~SortTracksAction() final = default; //! Execute the action with host data void step(CoreParams const& params, CoreStateHost& state) const final; diff --git a/src/celeritas/track/StatusCheckData.hh b/src/celeritas/track/StatusCheckData.hh index c91dab16e0..6452811767 100644 --- a/src/celeritas/track/StatusCheckData.hh +++ b/src/celeritas/track/StatusCheckData.hh @@ -81,6 +81,7 @@ struct StatusCheckStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StatusCheckStateData& operator=(StatusCheckStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/track/TrackInitData.hh b/src/celeritas/track/TrackInitData.hh index daeaf1fe6f..13b48cc927 100644 --- a/src/celeritas/track/TrackInitData.hh +++ b/src/celeritas/track/TrackInitData.hh @@ -133,6 +133,7 @@ struct TrackInitStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) TrackInitStateData& operator=(TrackInitStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/user/ActionDiagnostic.hh b/src/celeritas/user/ActionDiagnostic.hh index a3c0996bb6..6c83cf6b05 100644 --- a/src/celeritas/user/ActionDiagnostic.hh +++ b/src/celeritas/user/ActionDiagnostic.hh @@ -63,7 +63,7 @@ class ActionDiagnostic final : public CoreStepActionInterface, explicit ActionDiagnostic(ActionId id); // Default destructor - ~ActionDiagnostic(); + ~ActionDiagnostic() final; //!@{ //! \name Action interface diff --git a/src/celeritas/user/ParticleTallyData.hh b/src/celeritas/user/ParticleTallyData.hh index 42c1d1d170..9c8117f8e3 100644 --- a/src/celeritas/user/ParticleTallyData.hh +++ b/src/celeritas/user/ParticleTallyData.hh @@ -74,6 +74,7 @@ struct ParticleTallyStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleTallyStateData& operator=(ParticleTallyStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/user/SimpleCaloData.hh b/src/celeritas/user/SimpleCaloData.hh index 2f0fffd575..a4bc15d939 100644 --- a/src/celeritas/user/SimpleCaloData.hh +++ b/src/celeritas/user/SimpleCaloData.hh @@ -26,6 +26,7 @@ struct SimpleCaloParamsData explicit CELER_FUNCTION operator bool() const { return num_detectors > 0; } template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimpleCaloParamsData& operator=(SimpleCaloParamsData& other) { CELER_EXPECT(other); @@ -74,6 +75,7 @@ struct SimpleCaloStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimpleCaloStateData& operator=(SimpleCaloStateData& other) { energy_deposition = other.energy_deposition; diff --git a/src/celeritas/user/StepData.hh b/src/celeritas/user/StepData.hh index 03d57263c5..33da8506ba 100644 --- a/src/celeritas/user/StepData.hh +++ b/src/celeritas/user/StepData.hh @@ -207,6 +207,7 @@ struct StepPointStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepPointStateData& operator=(StepPointStateData& other) { CELER_EXPECT(other); @@ -289,6 +290,7 @@ struct StepStateDataImpl //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepStateDataImpl& operator=(StepStateDataImpl& other) { // The extra storage used to gather the step data is only required on @@ -370,6 +372,7 @@ struct StepStateData //! Assign from another set of states template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepStateData& operator=(StepStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/user/StepDiagnostic.hh b/src/celeritas/user/StepDiagnostic.hh index 505bedf827..a9650178bc 100644 --- a/src/celeritas/user/StepDiagnostic.hh +++ b/src/celeritas/user/StepDiagnostic.hh @@ -52,7 +52,7 @@ class StepDiagnostic final : public CoreStepActionInterface, size_type num_streams); //! Default destructor - ~StepDiagnostic(); + ~StepDiagnostic() final; //!@{ //! \name ExplicitAction interface diff --git a/src/corecel/Assert.hh b/src/corecel/Assert.hh index 565cc4a825..37b4688743 100644 --- a/src/corecel/Assert.hh +++ b/src/corecel/Assert.hh @@ -464,7 +464,7 @@ class DebugError : public std::logic_error CELER_DEFAULT_COPY_MOVE(DebugError); // Default destructor to anchor vtable - ~DebugError(); + ~DebugError() override; //! Access the debug data DebugErrorDetails const& details() const { return details_; } @@ -485,7 +485,7 @@ class RuntimeError : public std::runtime_error CELER_DEFAULT_COPY_MOVE(RuntimeError); // Default destructor to anchor vtable - ~RuntimeError(); + ~RuntimeError() override; //! Access detailed information RuntimeErrorDetails const& details() const { return details_; } diff --git a/src/corecel/DeviceRuntimeApi.hh b/src/corecel/DeviceRuntimeApi.hh index 27a2b68c00..2186e136ff 100644 --- a/src/corecel/DeviceRuntimeApi.hh +++ b/src/corecel/DeviceRuntimeApi.hh @@ -61,4 +61,4 @@ * (Unfortunately, since the use of this symbol is embedded in a macro, IWYU * won't include this file automatically.) */ -extern int CorecelDeviceRuntimeApiHh; +extern int const CorecelDeviceRuntimeApiHh; diff --git a/src/corecel/Macros.hh b/src/corecel/Macros.hh index c720b06ef4..872e230727 100644 --- a/src/corecel/Macros.hh +++ b/src/corecel/Macros.hh @@ -42,11 +42,12 @@ # define CELER_FORCEINLINE inline #endif +// NOLINTBEGIN(cppcoreguidelines-macro-to-enum) //! Detection for the current compiler isn't supported yet #define CELER_COMPILER_UNKNOWN 0 //! Compiling with clang, or a clang-based compiler defining __clang__ (hipcc) #define CELER_COMPILER_CLANG 1 - +// NOLINTEND(cppcoreguidelines-macro-to-enum) /*! * \def CELER_COMPILER * @@ -125,6 +126,7 @@ # define CELER_UNREACHABLE #endif +// NOLINTBEGIN(cppcoreguidelines-macro-to-enum) /*! * \def CELER_USE_DEVICE * @@ -135,6 +137,7 @@ #else # define CELER_USE_DEVICE 0 #endif +// NOLINTEND(cppcoreguidelines-macro-to-enum) /*! * \def CELER_DEVICE_SOURCE diff --git a/src/corecel/cont/InitializedValue.hh b/src/corecel/cont/InitializedValue.hh index 8e6cd9ce5c..da14a624db 100644 --- a/src/corecel/cont/InitializedValue.hh +++ b/src/corecel/cont/InitializedValue.hh @@ -74,6 +74,8 @@ class InitializedValue { } + ~InitializedValue() = default; + //!@} //!@{ //! \name Assignment diff --git a/src/corecel/cont/MiniStack.hh b/src/corecel/cont/MiniStack.hh index e7e238db64..21f69b7d74 100644 --- a/src/corecel/cont/MiniStack.hh +++ b/src/corecel/cont/MiniStack.hh @@ -29,7 +29,7 @@ class MiniStack public: //! Construct with underlying storage. CELER_FUNCTION explicit MiniStack(Span storage) - : data_(storage.data()), size_(0), capacity_(storage.size()) + : data_(storage.data()), capacity_(storage.size()) { } @@ -58,7 +58,7 @@ class MiniStack private: T* data_; - size_type size_; + size_type size_{0}; size_type capacity_; }; diff --git a/src/corecel/cont/Span.hh b/src/corecel/cont/Span.hh index eec4512fc6..59f7e65d2c 100644 --- a/src/corecel/cont/Span.hh +++ b/src/corecel/cont/Span.hh @@ -10,6 +10,8 @@ #include #include +#include "corecel/Macros.hh" + #include "Array.hh" #include "detail/SpanImpl.hh" @@ -96,11 +98,8 @@ class Span { } - //! Copy constructor (same template parameters) - Span(Span const&) noexcept = default; - - //! Assignment (same template parameters) - Span& operator=(Span const&) noexcept = default; + CELER_DEFAULT_COPY_MOVE(Span); + ~Span() = default; //// ACCESS //// diff --git a/src/corecel/cont/detail/RangeImpl.hh b/src/corecel/cont/detail/RangeImpl.hh index a96ba063e7..c1ac633fa9 100644 --- a/src/corecel/cont/detail/RangeImpl.hh +++ b/src/corecel/cont/detail/RangeImpl.hh @@ -240,6 +240,7 @@ class range_iter CELER_CONSTEXPR_FUNCTION value_type value() const { return value_; } protected: + // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes) value_type value_; }; diff --git a/src/corecel/data/AuxStateVec.hh b/src/corecel/data/AuxStateVec.hh index 8dd290b82c..96af12ac1a 100644 --- a/src/corecel/data/AuxStateVec.hh +++ b/src/corecel/data/AuxStateVec.hh @@ -55,6 +55,8 @@ class AuxStateVec // Allow moving; copying is prohibited due to unique pointers CELER_DEFAULT_MOVE_DELETE_COPY(AuxStateVec); + ~AuxStateVec() = default; + // Access auxiliary state interfaces inline AuxStateInterface& at(AuxId); inline AuxStateInterface const& at(AuxId) const; diff --git a/src/corecel/data/Collection.hh b/src/corecel/data/Collection.hh index 4da2aa758b..33822ca5f3 100644 --- a/src/corecel/data/Collection.hh +++ b/src/corecel/data/Collection.hh @@ -280,6 +280,8 @@ class Collection Collection(Collection&&) = default; //!@} + ~Collection() = default; + // Construct from another collection template explicit inline Collection(Collection const& other); @@ -300,6 +302,7 @@ class Collection // Assign (mutable!) from another collection template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) inline Collection& operator=(Collection& other); //// ACCESS //// @@ -414,6 +417,7 @@ Collection::operator=(Collection const& other) template template +// NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) Collection& Collection::operator=(Collection& other) { diff --git a/src/corecel/data/CollectionAlgorithms.hh b/src/corecel/data/CollectionAlgorithms.hh index 2b740a6b91..8f57dd8ecf 100644 --- a/src/corecel/data/CollectionAlgorithms.hh +++ b/src/corecel/data/CollectionAlgorithms.hh @@ -29,7 +29,7 @@ void fill(T&& value, Collection* col) static_assert(W != Ownership::const_reference, "const references cannot be filled"); CELER_EXPECT(col); - Filler fill_impl{value}; + Filler fill_impl{std::forward(value)}; fill_impl((*col)[AllItems{}]); } diff --git a/src/corecel/data/CollectionStateStore.hh b/src/corecel/data/CollectionStateStore.hh index c9ec5189a9..6b258efbe7 100644 --- a/src/corecel/data/CollectionStateStore.hh +++ b/src/corecel/data/CollectionStateStore.hh @@ -51,6 +51,7 @@ class CollectionStateStore public: CollectionStateStore() = default; + ~CollectionStateStore() = default; // Construct from parameters and stream ID template class P> diff --git a/src/corecel/data/DeviceVector.hh b/src/corecel/data/DeviceVector.hh index dc700c50af..ea67a9e17a 100644 --- a/src/corecel/data/DeviceVector.hh +++ b/src/corecel/data/DeviceVector.hh @@ -194,6 +194,7 @@ template void DeviceVector::copy_to_device(SpanConstT data) { CELER_EXPECT(data.size() == this->size()); + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) allocation_.copy_to_device({reinterpret_cast(data.data()), data.size() * sizeof(T)}); } @@ -207,6 +208,7 @@ void DeviceVector::copy_to_host(SpanT data) const { CELER_EXPECT(data.size() == this->size()); allocation_.copy_to_host( + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) {reinterpret_cast(data.data()), data.size() * sizeof(T)}); } @@ -217,6 +219,7 @@ void DeviceVector::copy_to_host(SpanT data) const template T* DeviceVector::data() { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) return reinterpret_cast(allocation_.device_ref().data()); } @@ -227,6 +230,7 @@ T* DeviceVector::data() template T const* DeviceVector::data() const { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) return reinterpret_cast(allocation_.device_ref().data()); } diff --git a/src/corecel/data/LdgIterator.hh b/src/corecel/data/LdgIterator.hh index 4ee0de26fe..daee3af129 100644 --- a/src/corecel/data/LdgIterator.hh +++ b/src/corecel/data/LdgIterator.hh @@ -51,7 +51,6 @@ class LdgIterator //!@{ //! Construct a pointer constexpr LdgIterator() noexcept = default; - constexpr LdgIterator(LdgIterator const&) noexcept = default; CELER_CONSTEXPR_FUNCTION LdgIterator(std::nullptr_t) noexcept {} CELER_CONSTEXPR_FUNCTION explicit LdgIterator(pointer ptr) noexcept : ptr_{ptr} @@ -109,7 +108,6 @@ class LdgIterator { return LoadPolicyT::read(ptr_ + n); } - LdgIterator& operator=(LdgIterator const&) = default; //!@} //!@{ diff --git a/src/corecel/data/StackAllocatorData.hh b/src/corecel/data/StackAllocatorData.hh index 5ffa0a48d6..1747537839 100644 --- a/src/corecel/data/StackAllocatorData.hh +++ b/src/corecel/data/StackAllocatorData.hh @@ -37,6 +37,7 @@ struct StackAllocatorData //! Assign from another stack template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StackAllocatorData& operator=(StackAllocatorData& other) { CELER_EXPECT(other); diff --git a/src/corecel/data/StreamStore.hh b/src/corecel/data/StreamStore.hh index 64df23ad0b..2299d87904 100644 --- a/src/corecel/data/StreamStore.hh +++ b/src/corecel/data/StreamStore.hh @@ -113,6 +113,7 @@ class StreamStore //// FUNCTIONS //// template + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) static constexpr decltype(auto) states_impl(Self&& self) { if constexpr (M == MemSpace::host) @@ -130,6 +131,7 @@ class StreamStore } template + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) static decltype(auto) stateptr_impl(Self&& self, StreamId stream_id) { CELER_EXPECT(stream_id < self.num_streams_ || !self); @@ -217,6 +219,7 @@ StreamStore::state(StreamId stream_id, size_type size) * Apply a function to all streams. */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void apply_to_all_streams(S&& store, F&& func) { // Apply on host @@ -243,6 +246,7 @@ void apply_to_all_streams(S&& store, F&& func) * Accumulate data over all streams. */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void accumulate_over_streams(S&& store, F&& func, std::vector* result) { std::vector temp_host; diff --git a/src/corecel/data/detail/FillInvalid.hh b/src/corecel/data/detail/FillInvalid.hh index cc50d93edf..19dd247a47 100644 --- a/src/corecel/data/detail/FillInvalid.hh +++ b/src/corecel/data/detail/FillInvalid.hh @@ -85,6 +85,7 @@ struct InvalidValueTraits // all our datatypes. Reinterpret the data as bytes and assign garbage // values. T result; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) std::memset(reinterpret_cast(&result), 0xd0, sizeof(T)); return result; } diff --git a/src/corecel/io/Label.hh b/src/corecel/io/Label.hh index 1fcbbb8989..c9adb149b6 100644 --- a/src/corecel/io/Label.hh +++ b/src/corecel/io/Label.hh @@ -13,6 +13,8 @@ #include #include +#include "corecel/Config.hh" + #include "corecel/math/HashUtils.hh" namespace celeritas @@ -120,7 +122,8 @@ struct hash { using argument_type = celeritas::Label; using result_type = std::size_t; - result_type operator()(argument_type const& label) const noexcept + result_type operator()(argument_type const& label) const + noexcept(!CELERITAS_DEBUG) { return celeritas::hash_combine(label.name, label.ext); } diff --git a/src/corecel/io/StreamableVariant.hh b/src/corecel/io/StreamableVariant.hh index c8fa30a225..50dd42ba04 100644 --- a/src/corecel/io/StreamableVariant.hh +++ b/src/corecel/io/StreamableVariant.hh @@ -9,6 +9,7 @@ #include #include +#include #include #include "corecel/Assert.hh" @@ -47,7 +48,7 @@ struct GenericToStream template void operator()(T&& obj) const { - this->os << obj; + this->os << std::forward(obj); } }; } // namespace detail diff --git a/src/corecel/io/StringEnumMapper.hh b/src/corecel/io/StringEnumMapper.hh index 870b5e6881..83cbdd610b 100644 --- a/src/corecel/io/StringEnumMapper.hh +++ b/src/corecel/io/StringEnumMapper.hh @@ -57,6 +57,7 @@ class StringEnumMapper // Construct with a function that takes an enum and returns a stringlike template + // NOLINTNEXTLINE(bugprone-forwarding-reference-overload) explicit inline StringEnumMapper(U&& enum_to_string, char const* desc = nullptr); @@ -90,6 +91,7 @@ StringEnumMapper::from_cstring_func(EnumCStringFuncPtr fp, char const* desc) */ template template +// NOLINTNEXTLINE(bugprone-forwarding-reference-overload,cppcoreguidelines-missing-std-forward) StringEnumMapper::StringEnumMapper(U&& enum_to_string, char const* desc) : description_(desc) { diff --git a/src/corecel/math/Algorithms.hh b/src/corecel/math/Algorithms.hh index 0f7edc6e97..973949b9f7 100644 --- a/src/corecel/math/Algorithms.hh +++ b/src/corecel/math/Algorithms.hh @@ -39,6 +39,7 @@ forward(typename std::remove_reference::type& v) noexcept //! \cond (CELERITAS_DOC_DEV) template CELER_CONSTEXPR_FUNCTION T&& +// NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved) forward(typename std::remove_reference::type&& v) noexcept { return static_cast(v); @@ -50,6 +51,7 @@ forward(typename std::remove_reference::type&& v) noexcept * Cast a value as an rvalue reference to allow move construction. */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_CONSTEXPR_FUNCTION auto move(T&& v) noexcept -> typename std::remove_reference::type&& { @@ -108,7 +110,8 @@ struct Less { template CELER_CONSTEXPR_FUNCTION auto - operator()(T&& lhs, U&& rhs) const -> decltype(auto) + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) + operator()(T && lhs, U && rhs) const -> decltype(auto) { return ::celeritas::forward(lhs) < ::celeritas::forward(rhs); } diff --git a/src/corecel/math/HashUtils.hh b/src/corecel/math/HashUtils.hh index 2bbfe26239..cc4957bf81 100644 --- a/src/corecel/math/HashUtils.hh +++ b/src/corecel/math/HashUtils.hh @@ -38,6 +38,7 @@ std::size_t hash_as_bytes(Span s) { std::size_t result{}; Hasher hash{&result}; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) hash(Span{reinterpret_cast(s.data()), s.size() * sizeof(T)}); return result; diff --git a/src/corecel/math/detail/AlgorithmsImpl.hh b/src/corecel/math/detail/AlgorithmsImpl.hh index 4a6133e6e8..8837e41851 100644 --- a/src/corecel/math/detail/AlgorithmsImpl.hh +++ b/src/corecel/math/detail/AlgorithmsImpl.hh @@ -175,6 +175,7 @@ CELER_FUNCTION BidirectionalIterator partition_impl(BidirectionalIterator first, * Cast a value to an rvalue reference. */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_CONSTEXPR_FUNCTION auto trivial_move(T&& v) noexcept -> typename std::remove_reference::type&& { diff --git a/src/corecel/sys/ActionInterface.hh b/src/corecel/sys/ActionInterface.hh index 03c4cc5a27..aace53de03 100644 --- a/src/corecel/sys/ActionInterface.hh +++ b/src/corecel/sys/ActionInterface.hh @@ -230,7 +230,7 @@ class ConcreteAction : virtual public ActionInterface std::string description) noexcept(!CELERITAS_DEBUG); // Default destructor - ~ConcreteAction() noexcept; + ~ConcreteAction() noexcept override; CELER_DELETE_COPY_MOVE(ConcreteAction); //! ID of this action for verification @@ -308,7 +308,7 @@ class StaticConcreteAction : virtual public ActionInterface std::string_view description) noexcept(!CELERITAS_DEBUG); // Default destructor - ~StaticConcreteAction() = default; + ~StaticConcreteAction() override = default; CELER_DELETE_COPY_MOVE(StaticConcreteAction); //! ID of this action for verification diff --git a/src/corecel/sys/KernelLauncher.hh b/src/corecel/sys/KernelLauncher.hh index e08a1c6826..c2279d4d5c 100644 --- a/src/corecel/sys/KernelLauncher.hh +++ b/src/corecel/sys/KernelLauncher.hh @@ -32,6 +32,7 @@ namespace celeritas * \endcode */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void launch_kernel(size_type num_threads, F&& execute_thread) { MultiExceptionHandler capture_exception; diff --git a/src/corecel/sys/MultiExceptionHandler.hh b/src/corecel/sys/MultiExceptionHandler.hh index 96202455e2..a98aed04de 100644 --- a/src/corecel/sys/MultiExceptionHandler.hh +++ b/src/corecel/sys/MultiExceptionHandler.hh @@ -11,6 +11,8 @@ #include #include +#include "corecel/Config.hh" + #include "corecel/Macros.hh" namespace celeritas @@ -53,7 +55,7 @@ class MultiExceptionHandler CELER_DEFAULT_COPY_MOVE(MultiExceptionHandler); // Terminate if destroyed without handling exceptions - inline ~MultiExceptionHandler(); + inline ~MultiExceptionHandler() noexcept(!CELERITAS_DEBUG); // Thread-safe capture of the given exception void operator()(std::exception_ptr p); @@ -99,7 +101,7 @@ inline void log_and_rethrow(MultiExceptionHandler&& exceptions) /*! * Terminate if destroyed without handling exceptions. */ -MultiExceptionHandler::~MultiExceptionHandler() +MultiExceptionHandler::~MultiExceptionHandler() noexcept(!CELERITAS_DEBUG) { if (CELER_UNLIKELY(!exceptions_.empty())) { diff --git a/src/corecel/sys/Stream.hh b/src/corecel/sys/Stream.hh index b9f30047e2..4334eea533 100644 --- a/src/corecel/sys/Stream.hh +++ b/src/corecel/sys/Stream.hh @@ -24,6 +24,9 @@ struct MockMemoryResource virtual Pointer do_allocate(std::size_t, std::size_t) = 0; virtual void do_deallocate(Pointer, std::size_t, std::size_t) = 0; + + protected: + ~MockMemoryResource() = default; }; #endif diff --git a/src/corecel/sys/TypeDemangler.hh b/src/corecel/sys/TypeDemangler.hh index 5452194165..400bc1ef51 100644 --- a/src/corecel/sys/TypeDemangler.hh +++ b/src/corecel/sys/TypeDemangler.hh @@ -45,6 +45,7 @@ std::string demangled_typeid_name(char const* typeid_name); //---------------------------------------------------------------------------// //! Demangle the type name of any variable template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) std::string demangled_type(T&&) { return demangled_typeid_name(typeid(T).name()); diff --git a/src/geocel/g4/GeantGeoData.hh b/src/geocel/g4/GeantGeoData.hh index 95eef193fe..0d6648e97f 100644 --- a/src/geocel/g4/GeantGeoData.hh +++ b/src/geocel/g4/GeantGeoData.hh @@ -36,6 +36,7 @@ struct GeantGeoParamsData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) GeantGeoParamsData& operator=(GeantGeoParamsData& other) { world = other.world; @@ -86,6 +87,7 @@ struct GeantGeoStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) GeantGeoStateData& operator=(GeantGeoStateData& other) { static_assert(M2 == M && W == Ownership::reference, diff --git a/src/geocel/g4/GeantGeoParams.hh b/src/geocel/g4/GeantGeoParams.hh index a551d2cd11..dbd7308662 100644 --- a/src/geocel/g4/GeantGeoParams.hh +++ b/src/geocel/g4/GeantGeoParams.hh @@ -9,6 +9,7 @@ #include +#include "corecel/Macros.hh" #include "corecel/Types.hh" #include "corecel/cont/LabelIdMultiMap.hh" #include "corecel/data/ParamsDataInterface.hh" @@ -45,8 +46,10 @@ class GeantGeoParams final : public GeoParamsInterface, // Create a VecGeom model from a pre-existing Geant4 geometry explicit GeantGeoParams(G4VPhysicalVolume const* world); + CELER_DEFAULT_MOVE_DELETE_COPY(GeantGeoParams); + // Clean up on destruction - ~GeantGeoParams(); + ~GeantGeoParams() final; //! Access the world volume G4VPhysicalVolume const* world() const { return host_ref_.world; } diff --git a/src/geocel/g4/GeantGeoTrackView.hh b/src/geocel/g4/GeantGeoTrackView.hh index 1ce5dc23d3..64cee1abb9 100644 --- a/src/geocel/g4/GeantGeoTrackView.hh +++ b/src/geocel/g4/GeantGeoTrackView.hh @@ -178,10 +178,10 @@ GeantGeoTrackView::GeantGeoTrackView(ParamsRef const&, , safety_radius_(states.safety_radius[tid]) , touch_handle_(states.nav_state.touch_handle(tid)) , navi_(states.nav_state.navigator(tid)) + , g4pos_(convert_to_geant(pos_, clhep_length)) + , g4dir_(convert_to_geant(dir_, 1)) + , g4safety_(convert_to_geant(safety_radius_, clhep_length)) { - g4pos_ = convert_to_geant(pos_, clhep_length); - g4dir_ = convert_to_geant(dir_, 1); - g4safety_ = convert_to_geant(safety_radius_, clhep_length); } //---------------------------------------------------------------------------// diff --git a/src/geocel/g4/VisitGeantVolumes.hh b/src/geocel/g4/VisitGeantVolumes.hh index 5007edd468..2ddd12edea 100644 --- a/src/geocel/g4/VisitGeantVolumes.hh +++ b/src/geocel/g4/VisitGeantVolumes.hh @@ -31,6 +31,7 @@ namespace celeritas * as visited using a set. */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void visit_geant_volume_instances(F&& visit, G4VPhysicalVolume const& world) { struct QueuedVolume @@ -77,6 +78,7 @@ void visit_geant_volume_instances(F&& visit, G4VPhysicalVolume const& world) * \code void(*)(G4LogicalVolume const&) \endcode . */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void visit_geant_volumes(F&& vis, G4VPhysicalVolume const& parent_vol) { std::unordered_set visited; diff --git a/src/geocel/g4/detail/GeantGeoNavCollection.hh b/src/geocel/g4/detail/GeantGeoNavCollection.hh index 5f233f2a0c..bca00f8dfb 100644 --- a/src/geocel/g4/detail/GeantGeoNavCollection.hh +++ b/src/geocel/g4/detail/GeantGeoNavCollection.hh @@ -35,6 +35,7 @@ struct GeantGeoNavCollection explicit CELER_FUNCTION operator bool() const { return false; } CELER_FUNCTION TrackSlotId::size_type size() const { return 0; } template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CELER_FUNCTION GeantGeoNavCollection& operator=(GeantGeoNavCollection&) { @@ -102,13 +103,10 @@ struct GeantGeoNavCollection // Default constructors GeantGeoNavCollection() = default; - GeantGeoNavCollection(GeantGeoNavCollection const&) = default; // Obtain reference from host memory GeantGeoNavCollection& operator=(GeantGeoNavCollection& other); - // Default assignment - GeantGeoNavCollection& operator=(GeantGeoNavCollection const&) = default; // Get the navigation state for a given track slot GeantTouchableHandle& touch_handle(TrackSlotId tid) const; diff --git a/src/geocel/rasterize/ImageData.hh b/src/geocel/rasterize/ImageData.hh index 73f17aba1a..202165b1a5 100644 --- a/src/geocel/rasterize/ImageData.hh +++ b/src/geocel/rasterize/ImageData.hh @@ -106,6 +106,7 @@ struct ImageStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ImageStateData& operator=(ImageStateData& other) { CELER_EXPECT(other); diff --git a/src/geocel/rasterize/RaytraceImager.hh b/src/geocel/rasterize/RaytraceImager.hh index 61df6700e0..92b7a28980 100644 --- a/src/geocel/rasterize/RaytraceImager.hh +++ b/src/geocel/rasterize/RaytraceImager.hh @@ -37,6 +37,7 @@ class RaytraceImager final : public ImagerInterface public: // Construct with geometry explicit RaytraceImager(SPGeometry geo); + ~RaytraceImager() override = default; // Raytrace an image on host or device void operator()(Image* image) final; diff --git a/src/orange/OrangeData.hh b/src/orange/OrangeData.hh index ffd2444547..8a239938e1 100644 --- a/src/orange/OrangeData.hh +++ b/src/orange/OrangeData.hh @@ -511,6 +511,7 @@ struct OrangeStateData //! Assign from another set of data template + // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) OrangeStateData& operator=(OrangeStateData& other) { CELER_EXPECT(other); diff --git a/src/orange/OrangeParams.cc b/src/orange/OrangeParams.cc index 550a1e60b9..5353b18115 100644 --- a/src/orange/OrangeParams.cc +++ b/src/orange/OrangeParams.cc @@ -219,7 +219,6 @@ OrangeParams::OrangeParams(OrangeInput&& input) */ OrangeParams::~OrangeParams() = default; -// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor) template class CollectionMirror; template class ParamsDataInterface; diff --git a/src/orange/detail/BIHEnclosingVolFinder.hh b/src/orange/detail/BIHEnclosingVolFinder.hh index 7f467d8ebe..4c644cd9c6 100644 --- a/src/orange/detail/BIHEnclosingVolFinder.hh +++ b/src/orange/detail/BIHEnclosingVolFinder.hh @@ -95,6 +95,7 @@ BIHEnclosingVolFinder::BIHEnclosingVolFinder(BIHTree const& tree, */ template CELER_FUNCTION LocalVolumeId +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) BIHEnclosingVolFinder::operator()(Real3 const& pos, F&& is_inside) const { BIHNodeId previous_node; @@ -207,7 +208,9 @@ bool BIHEnclosingVolFinder::visit_edge(BIHInnerNode const& node, */ template CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_leaf( - BIHLeafNode const& leaf_node, Real3 const& pos, F&& is_inside) const + BIHLeafNode const& leaf_node, + Real3 const& pos, + F&& is_inside) const // NOLINT(cppcoreguidelines-missing-std-forward) { for (auto id : view_.leaf_volids(leaf_node)) { @@ -225,6 +228,7 @@ CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_leaf( */ template CELER_FUNCTION LocalVolumeId +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) BIHEnclosingVolFinder::visit_inf_vols(F&& is_inside) const { for (auto id : view_.inf_volids()) diff --git a/src/orange/detail/LevelStateAccessor.hh b/src/orange/detail/LevelStateAccessor.hh index 15788efacd..13648b1475 100644 --- a/src/orange/detail/LevelStateAccessor.hh +++ b/src/orange/detail/LevelStateAccessor.hh @@ -20,6 +20,7 @@ namespace detail /*! * Accesss the 2D fields (i.e., {thread, level}) of OrangeStateData */ +// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class LevelStateAccessor { public: @@ -34,9 +35,12 @@ class LevelStateAccessor TrackSlotId tid, LevelId level_id); + LevelStateAccessor(LevelStateAccessor const&) = default; + LevelStateAccessor(LevelStateAccessor&&) = default; // Copy data from another LSA inline CELER_FUNCTION LevelStateAccessor& operator=(LevelStateAccessor const& other); + ~LevelStateAccessor() = default; //// ACCESSORS //// @@ -109,6 +113,10 @@ LevelStateAccessor::LevelStateAccessor(StateRef const* states, CELER_FUNCTION LevelStateAccessor& LevelStateAccessor::operator=(LevelStateAccessor const& other) { + if (this == &other) + { + return *this; + } this->vol() = other.vol(); this->pos() = other.pos(); this->dir() = other.dir(); diff --git a/src/orange/orangeinp/CsgTypes.hh b/src/orange/orangeinp/CsgTypes.hh index 98a1497d29..e42785af19 100644 --- a/src/orange/orangeinp/CsgTypes.hh +++ b/src/orange/orangeinp/CsgTypes.hh @@ -13,6 +13,8 @@ #include #include +#include "corecel/Config.hh" + #include "corecel/OpaqueId.hh" #include "corecel/math/HashUtils.hh" #include "orange/OrangeTypes.hh" @@ -205,7 +207,8 @@ struct hash { using argument_type = celeritas::orangeinp::Joined; using result_type = std::size_t; - result_type operator()(argument_type const& val) const noexcept + result_type operator()(argument_type const& val) const + noexcept(!CELERITAS_DEBUG) { result_type result; celeritas::Hasher hash{&result}; diff --git a/src/orange/orangeinp/IntersectRegion.hh b/src/orange/orangeinp/IntersectRegion.hh index a72106d914..7f8bed3bb8 100644 --- a/src/orange/orangeinp/IntersectRegion.hh +++ b/src/orange/orangeinp/IntersectRegion.hh @@ -50,11 +50,12 @@ class IntersectRegionInterface //! Write the region to a JSON object virtual void output(JsonPimpl*) const = 0; + virtual ~IntersectRegionInterface() = default; + protected: //!@{ //! Allow construction and assignment only through daughter classes IntersectRegionInterface() = default; - virtual ~IntersectRegionInterface() = default; CELER_DEFAULT_COPY_MOVE(IntersectRegionInterface); //!@} }; diff --git a/src/orange/orangeinp/PolySolid.hh b/src/orange/orangeinp/PolySolid.hh index 781d0c0305..55434cfa1a 100644 --- a/src/orange/orangeinp/PolySolid.hh +++ b/src/orange/orangeinp/PolySolid.hh @@ -120,7 +120,7 @@ class PolySolidBase : public ObjectInterface { public: // Anchored default virtual destructor - virtual ~PolySolidBase(); + ~PolySolidBase() override; //! Get the user-provided label std::string_view label() const final { return label_; } diff --git a/src/orange/orangeinp/ProtoInterface.hh b/src/orange/orangeinp/ProtoInterface.hh index e4fba6f97a..506926f593 100644 --- a/src/orange/orangeinp/ProtoInterface.hh +++ b/src/orange/orangeinp/ProtoInterface.hh @@ -71,7 +71,7 @@ class ProtoInterface //!@{ //! Allow construction and assignment only through subclasses ProtoInterface() = default; - virtual ~ProtoInterface() = default; + ~ProtoInterface() = default; CELER_DEFAULT_COPY_MOVE(ProtoInterface); //!@} }; diff --git a/src/orange/orangeinp/Shape.hh b/src/orange/orangeinp/Shape.hh index 0661104942..aa024008d4 100644 --- a/src/orange/orangeinp/Shape.hh +++ b/src/orange/orangeinp/Shape.hh @@ -47,11 +47,12 @@ class ShapeBase : public ObjectInterface //! Interior intersect region interface for construction and access virtual IntersectRegionInterface const& interior() const = 0; + ~ShapeBase() override = default; + protected: //!@{ //! Allow construction and assignment only through daughter classes ShapeBase() = default; - virtual ~ShapeBase() = default; CELER_DEFAULT_COPY_MOVE(ShapeBase); //!@} }; diff --git a/src/orange/orangeinp/Solid.hh b/src/orange/orangeinp/Solid.hh index 9038d243b1..9bf60dda45 100644 --- a/src/orange/orangeinp/Solid.hh +++ b/src/orange/orangeinp/Solid.hh @@ -96,11 +96,12 @@ class SolidBase : public ObjectInterface //! Optional azimuthal angular restriction virtual SolidEnclosedAngle enclosed_angle() const = 0; + ~SolidBase() override = default; + protected: //!@{ //! Allow construction and assignment only through daughter classes SolidBase() = default; - virtual ~SolidBase() = default; CELER_DEFAULT_COPY_MOVE(SolidBase); //!@} }; diff --git a/src/orange/orangeinp/UnitProto.hh b/src/orange/orangeinp/UnitProto.hh index 9e80ef870b..b7a09dd453 100644 --- a/src/orange/orangeinp/UnitProto.hh +++ b/src/orange/orangeinp/UnitProto.hh @@ -140,6 +140,8 @@ class UnitProto : public ProtoInterface // Construct with required input data explicit UnitProto(Input&& inp); + virtual ~UnitProto() = default; + // Short unique name of this object std::string_view label() const final; diff --git a/src/orange/orangeinp/detail/VolumeBuilder.hh b/src/orange/orangeinp/detail/VolumeBuilder.hh index 6a5696f186..74f1556631 100644 --- a/src/orange/orangeinp/detail/VolumeBuilder.hh +++ b/src/orange/orangeinp/detail/VolumeBuilder.hh @@ -7,6 +7,8 @@ //---------------------------------------------------------------------------// #pragma once +#include "corecel/Config.hh" + #include "corecel/io/Label.hh" #include "orange/transform/VariantTransform.hh" @@ -109,20 +111,25 @@ class PopVBTransformOnDestruct public: //! Capture the pointer when move constructed - PopVBTransformOnDestruct(PopVBTransformOnDestruct&& other) + PopVBTransformOnDestruct(PopVBTransformOnDestruct&& other) noexcept : vb_(std::exchange(other.vb_, nullptr)) { } //! Capture the pointer when move assigned - PopVBTransformOnDestruct& operator=(PopVBTransformOnDestruct&& other) + PopVBTransformOnDestruct& + operator=(PopVBTransformOnDestruct&& other) noexcept { vb_ = std::exchange(other.vb_, nullptr); return *this; } + PopVBTransformOnDestruct(PopVBTransformOnDestruct const&) = default; + PopVBTransformOnDestruct& operator=(PopVBTransformOnDestruct const&) + = default; + //! Call pop when we own the pointer and go out of scope - ~PopVBTransformOnDestruct() + ~PopVBTransformOnDestruct() noexcept(!CELERITAS_DEBUG) { if (vb_) { diff --git a/src/orange/surf/LocalSurfaceVisitor.hh b/src/orange/surf/LocalSurfaceVisitor.hh index 00d4bca253..708b60c869 100644 --- a/src/orange/surf/LocalSurfaceVisitor.hh +++ b/src/orange/surf/LocalSurfaceVisitor.hh @@ -110,6 +110,7 @@ LocalSurfaceVisitor::LocalSurfaceVisitor(ParamsRef const& params, */ template CELER_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) LocalSurfaceVisitor::operator()(F&& func, LocalSurfaceId id) { CELER_EXPECT(id < surfaces_.size()); diff --git a/src/orange/surf/SurfaceTypeTraits.hh b/src/orange/surf/SurfaceTypeTraits.hh index 9c44568be8..75174811b2 100644 --- a/src/orange/surf/SurfaceTypeTraits.hh +++ b/src/orange/surf/SurfaceTypeTraits.hh @@ -65,6 +65,7 @@ ORANGE_SURFACE_TRAITS(inv, Involute); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_surface_type(F&& func, SurfaceType st) { #define ORANGE_ST_VISIT_CASE(TYPE) \ diff --git a/src/orange/transform/TransformTypeTraits.hh b/src/orange/transform/TransformTypeTraits.hh index 64525fcb64..813719e8b3 100644 --- a/src/orange/transform/TransformTypeTraits.hh +++ b/src/orange/transform/TransformTypeTraits.hh @@ -47,6 +47,7 @@ ORANGE_TRANSFORM_TRAITS(transformation, Transformation); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_transform_type(F&& func, TransformType st) { #define ORANGE_TT_VISIT_CASE(TYPE) \ diff --git a/src/orange/transform/TransformVisitor.hh b/src/orange/transform/TransformVisitor.hh index 87cd498030..7148a4b625 100644 --- a/src/orange/transform/TransformVisitor.hh +++ b/src/orange/transform/TransformVisitor.hh @@ -95,6 +95,7 @@ CELER_FUNCTION TransformVisitor::TransformVisitor(ParamsRef const& params) */ template CELER_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) TransformVisitor::operator()(F&& func, TransformId id) { CELER_EXPECT(id < transforms_.size()); diff --git a/src/orange/univ/SimpleUnitTracker.hh b/src/orange/univ/SimpleUnitTracker.hh index b1ae943666..b1a0023774 100644 --- a/src/orange/univ/SimpleUnitTracker.hh +++ b/src/orange/univ/SimpleUnitTracker.hh @@ -358,6 +358,7 @@ CELER_FUNCTION auto SimpleUnitTracker::get_neighbors(LocalSurfaceId surf) const */ template CELER_FUNCTION LocalVolumeId +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) SimpleUnitTracker::find_volume_where(Real3 const& pos, F&& predicate) const { detail::BIHEnclosingVolFinder find_volume{unit_record_.bih_tree, @@ -388,9 +389,10 @@ SimpleUnitTracker::find_volume_where(Real3 const& pos, F&& predicate) const * Geant4) */ template -CELER_FUNCTION auto -SimpleUnitTracker::intersect_impl(LocalState const& state, - F&& is_valid) const -> Intersection +CELER_FUNCTION auto SimpleUnitTracker::intersect_impl( + LocalState const& state, + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) + F&& is_valid) const -> Intersection { CELER_EXPECT(state.volume && !state.temp_sense.empty()); diff --git a/src/orange/univ/TrackerVisitor.hh b/src/orange/univ/TrackerVisitor.hh index 46dda24873..6e7979b4c6 100644 --- a/src/orange/univ/TrackerVisitor.hh +++ b/src/orange/univ/TrackerVisitor.hh @@ -68,6 +68,7 @@ CELER_FUNCTION TrackerVisitor::TrackerVisitor(ParamsRef const& params) */ template CELER_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) TrackerVisitor::operator()(F&& func, UniverseId id) { CELER_EXPECT(id < params_.universe_types.size()); diff --git a/src/orange/univ/UniverseTypeTraits.hh b/src/orange/univ/UniverseTypeTraits.hh index 8783cf488e..0a5035af44 100644 --- a/src/orange/univ/UniverseTypeTraits.hh +++ b/src/orange/univ/UniverseTypeTraits.hh @@ -46,6 +46,7 @@ ORANGE_UNIV_TRAITS(rect_array, RectArray); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_universe_type(F&& func, UniverseType ut) { #define ORANGE_UT_VISIT_CASE(TYPE) \ diff --git a/src/orange/univ/detail/InfixEvaluator.hh b/src/orange/univ/detail/InfixEvaluator.hh index 30e39e3b87..11641d41a5 100644 --- a/src/orange/univ/detail/InfixEvaluator.hh +++ b/src/orange/univ/detail/InfixEvaluator.hh @@ -71,6 +71,7 @@ CELER_FUNCTION InfixEvaluator::InfixEvaluator(SpanConstLogic logic) * matching \c celeritas::Sense */ template +// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_FUNCTION bool InfixEvaluator::operator()(F&& eval_sense) const { bool result{true}; From 0e2ffd4a746925278d7af49ba3e40b778484d969 Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 09:11:27 -0800 Subject: [PATCH 02/12] fix for clang-tidy 15 --- .clang-tidy | 1 + src/corecel/cont/Span.hh | 3 ++- src/corecel/io/ExceptionOutput.hh | 2 ++ src/corecel/sys/ScopedMpiInit.cc | 2 +- src/corecel/sys/ScopedMpiInit.hh | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index edcd3ae879..72eebc3646 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -33,6 +33,7 @@ Checks: | -bugprone-macro-parentheses -bugprone-easily-swappable-parameters -bugprone-implicit-widening-of-multiplication-result + -bugprone-exception-escape WarningsAsErrors: '*' CheckOptions: cppcoreguidelines-macro-usage.CheckCapsOnly: true diff --git a/src/corecel/cont/Span.hh b/src/corecel/cont/Span.hh index 59f7e65d2c..b9a06dd393 100644 --- a/src/corecel/cont/Span.hh +++ b/src/corecel/cont/Span.hh @@ -97,7 +97,8 @@ class Span : s_(other.data(), other.size()) { } - + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) CELER_DEFAULT_COPY_MOVE(Span); ~Span() = default; diff --git a/src/corecel/io/ExceptionOutput.hh b/src/corecel/io/ExceptionOutput.hh index 7f27ed0448..6ef2e5a94a 100644 --- a/src/corecel/io/ExceptionOutput.hh +++ b/src/corecel/io/ExceptionOutput.hh @@ -40,6 +40,8 @@ class ExceptionOutput final : public OutputInterface explicit ExceptionOutput(std::exception_ptr e); // Protected destructor + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) ~ExceptionOutput(); // Category of data to write diff --git a/src/corecel/sys/ScopedMpiInit.cc b/src/corecel/sys/ScopedMpiInit.cc index 1f139d95ea..29b75d2e74 100644 --- a/src/corecel/sys/ScopedMpiInit.cc +++ b/src/corecel/sys/ScopedMpiInit.cc @@ -26,7 +26,7 @@ namespace celeritas { //---------------------------------------------------------------------------// -// False positive with clang-tidy-15, need cleanup +// TODO Remove in clang-tidy-18 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) ScopedMpiInit::Status ScopedMpiInit::status_ = ScopedMpiInit::Status::uninitialized; diff --git a/src/corecel/sys/ScopedMpiInit.hh b/src/corecel/sys/ScopedMpiInit.hh index c9d495d769..e561271739 100644 --- a/src/corecel/sys/ScopedMpiInit.hh +++ b/src/corecel/sys/ScopedMpiInit.hh @@ -52,6 +52,8 @@ class ScopedMpiInit private: bool do_finalize_{false}; + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) static Status status_; }; From 4051c5565298acd5104c65b655ca2b0021075f5e Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 09:53:10 -0800 Subject: [PATCH 03/12] turn off operator= check --- .clang-tidy | 1 + src/celeritas/em/data/AtomicRelaxationData.hh | 1 - src/celeritas/global/CoreTrackData.hh | 1 - src/celeritas/mat/MaterialData.hh | 1 - src/celeritas/optical/CoreTrackData.hh | 2 -- src/celeritas/optical/OffloadData.hh | 1 - src/celeritas/optical/ParticleData.hh | 1 - src/celeritas/optical/SimData.hh | 1 - src/celeritas/optical/TrackInitData.hh | 1 - src/celeritas/phys/ParticleData.hh | 1 - src/celeritas/phys/PhysicsData.hh | 1 - src/celeritas/random/XorwowRngData.hh | 1 - src/celeritas/track/SimData.hh | 1 - src/celeritas/track/StatusCheckData.hh | 1 - src/celeritas/track/TrackInitData.hh | 1 - src/celeritas/user/ParticleTallyData.hh | 1 - src/celeritas/user/SimpleCaloData.hh | 2 -- src/celeritas/user/StepData.hh | 3 --- src/corecel/data/Collection.hh | 2 -- src/corecel/data/StackAllocatorData.hh | 1 - src/geocel/g4/GeantGeoData.hh | 2 -- src/geocel/g4/detail/GeantGeoNavCollection.hh | 1 - src/geocel/rasterize/ImageData.hh | 1 - src/orange/OrangeData.hh | 1 - 24 files changed, 1 insertion(+), 29 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 72eebc3646..76ca3aba7c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -27,6 +27,7 @@ Checks: | -cppcoreguidelines-noexcept-move-operations -cppcoreguidelines-noexcept-destructor -cppcoreguidelines-virtual-class-destructor + -cppcoreguidelines-c-copy-assignment-signature bugprone-* -bugprone-sizeof-expression -bugprone-narrowing-conversions diff --git a/src/celeritas/em/data/AtomicRelaxationData.hh b/src/celeritas/em/data/AtomicRelaxationData.hh index a86fbd9a95..877b14ac43 100644 --- a/src/celeritas/em/data/AtomicRelaxationData.hh +++ b/src/celeritas/em/data/AtomicRelaxationData.hh @@ -133,7 +133,6 @@ struct AtomicRelaxStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) AtomicRelaxStateData& operator=(AtomicRelaxStateData& other) { scratch = other.scratch; diff --git a/src/celeritas/global/CoreTrackData.hh b/src/celeritas/global/CoreTrackData.hh index be3e90a3f7..04a0212912 100644 --- a/src/celeritas/global/CoreTrackData.hh +++ b/src/celeritas/global/CoreTrackData.hh @@ -143,7 +143,6 @@ struct CoreStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CoreStateData& operator=(CoreStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/mat/MaterialData.hh b/src/celeritas/mat/MaterialData.hh index 5f53fd6600..b61934a428 100644 --- a/src/celeritas/mat/MaterialData.hh +++ b/src/celeritas/mat/MaterialData.hh @@ -216,7 +216,6 @@ struct MaterialStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) MaterialStateData& operator=(MaterialStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/CoreTrackData.hh b/src/celeritas/optical/CoreTrackData.hh index a9b39147d6..0a70d8b9e2 100644 --- a/src/celeritas/optical/CoreTrackData.hh +++ b/src/celeritas/optical/CoreTrackData.hh @@ -40,7 +40,6 @@ struct PhysicsStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) PhysicsStateData& operator=(PhysicsStateData&) { return *this; @@ -143,7 +142,6 @@ struct CoreStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CoreStateData& operator=(CoreStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/OffloadData.hh b/src/celeritas/optical/OffloadData.hh index 01d7841067..5d806ea872 100644 --- a/src/celeritas/optical/OffloadData.hh +++ b/src/celeritas/optical/OffloadData.hh @@ -146,7 +146,6 @@ struct OffloadStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) OffloadStateData& operator=(OffloadStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/ParticleData.hh b/src/celeritas/optical/ParticleData.hh index ab13d7c217..ca435839fa 100644 --- a/src/celeritas/optical/ParticleData.hh +++ b/src/celeritas/optical/ParticleData.hh @@ -49,7 +49,6 @@ struct ParticleStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleStateData& operator=(ParticleStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/SimData.hh b/src/celeritas/optical/SimData.hh index 8a393beaa8..bb454a634f 100644 --- a/src/celeritas/optical/SimData.hh +++ b/src/celeritas/optical/SimData.hh @@ -54,7 +54,6 @@ struct SimStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimStateData& operator=(SimStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/optical/TrackInitData.hh b/src/celeritas/optical/TrackInitData.hh index 210c277c5a..ef4ae7791a 100644 --- a/src/celeritas/optical/TrackInitData.hh +++ b/src/celeritas/optical/TrackInitData.hh @@ -80,7 +80,6 @@ struct TrackInitStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) TrackInitStateData& operator=(TrackInitStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/phys/ParticleData.hh b/src/celeritas/phys/ParticleData.hh index ba4d18fc23..3160431131 100644 --- a/src/celeritas/phys/ParticleData.hh +++ b/src/celeritas/phys/ParticleData.hh @@ -145,7 +145,6 @@ struct ParticleStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleStateData& operator=(ParticleStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/phys/PhysicsData.hh b/src/celeritas/phys/PhysicsData.hh index ac0cdaa701..d81d482927 100644 --- a/src/celeritas/phys/PhysicsData.hh +++ b/src/celeritas/phys/PhysicsData.hh @@ -466,7 +466,6 @@ struct PhysicsStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) PhysicsStateData& operator=(PhysicsStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/random/XorwowRngData.hh b/src/celeritas/random/XorwowRngData.hh index 59c19da371..fb2ff4a048 100644 --- a/src/celeritas/random/XorwowRngData.hh +++ b/src/celeritas/random/XorwowRngData.hh @@ -119,7 +119,6 @@ struct XorwowRngStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) XorwowRngStateData& operator=(XorwowRngStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/track/SimData.hh b/src/celeritas/track/SimData.hh index 82fd69ec9f..f1b40323ee 100644 --- a/src/celeritas/track/SimData.hh +++ b/src/celeritas/track/SimData.hh @@ -166,7 +166,6 @@ struct SimStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimStateData& operator=(SimStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/track/StatusCheckData.hh b/src/celeritas/track/StatusCheckData.hh index 6452811767..c91dab16e0 100644 --- a/src/celeritas/track/StatusCheckData.hh +++ b/src/celeritas/track/StatusCheckData.hh @@ -81,7 +81,6 @@ struct StatusCheckStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StatusCheckStateData& operator=(StatusCheckStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/track/TrackInitData.hh b/src/celeritas/track/TrackInitData.hh index 13b48cc927..daeaf1fe6f 100644 --- a/src/celeritas/track/TrackInitData.hh +++ b/src/celeritas/track/TrackInitData.hh @@ -133,7 +133,6 @@ struct TrackInitStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) TrackInitStateData& operator=(TrackInitStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/user/ParticleTallyData.hh b/src/celeritas/user/ParticleTallyData.hh index 9c8117f8e3..42c1d1d170 100644 --- a/src/celeritas/user/ParticleTallyData.hh +++ b/src/celeritas/user/ParticleTallyData.hh @@ -74,7 +74,6 @@ struct ParticleTallyStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ParticleTallyStateData& operator=(ParticleTallyStateData& other) { CELER_EXPECT(other); diff --git a/src/celeritas/user/SimpleCaloData.hh b/src/celeritas/user/SimpleCaloData.hh index a4bc15d939..2f0fffd575 100644 --- a/src/celeritas/user/SimpleCaloData.hh +++ b/src/celeritas/user/SimpleCaloData.hh @@ -26,7 +26,6 @@ struct SimpleCaloParamsData explicit CELER_FUNCTION operator bool() const { return num_detectors > 0; } template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimpleCaloParamsData& operator=(SimpleCaloParamsData& other) { CELER_EXPECT(other); @@ -75,7 +74,6 @@ struct SimpleCaloStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) SimpleCaloStateData& operator=(SimpleCaloStateData& other) { energy_deposition = other.energy_deposition; diff --git a/src/celeritas/user/StepData.hh b/src/celeritas/user/StepData.hh index 33da8506ba..03d57263c5 100644 --- a/src/celeritas/user/StepData.hh +++ b/src/celeritas/user/StepData.hh @@ -207,7 +207,6 @@ struct StepPointStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepPointStateData& operator=(StepPointStateData& other) { CELER_EXPECT(other); @@ -290,7 +289,6 @@ struct StepStateDataImpl //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepStateDataImpl& operator=(StepStateDataImpl& other) { // The extra storage used to gather the step data is only required on @@ -372,7 +370,6 @@ struct StepStateData //! Assign from another set of states template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StepStateData& operator=(StepStateData& other) { CELER_EXPECT(other); diff --git a/src/corecel/data/Collection.hh b/src/corecel/data/Collection.hh index 33822ca5f3..34dc8cf918 100644 --- a/src/corecel/data/Collection.hh +++ b/src/corecel/data/Collection.hh @@ -302,7 +302,6 @@ class Collection // Assign (mutable!) from another collection template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) inline Collection& operator=(Collection& other); //// ACCESS //// @@ -417,7 +416,6 @@ Collection::operator=(Collection const& other) template template -// NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) Collection& Collection::operator=(Collection& other) { diff --git a/src/corecel/data/StackAllocatorData.hh b/src/corecel/data/StackAllocatorData.hh index 1747537839..5ffa0a48d6 100644 --- a/src/corecel/data/StackAllocatorData.hh +++ b/src/corecel/data/StackAllocatorData.hh @@ -37,7 +37,6 @@ struct StackAllocatorData //! Assign from another stack template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) StackAllocatorData& operator=(StackAllocatorData& other) { CELER_EXPECT(other); diff --git a/src/geocel/g4/GeantGeoData.hh b/src/geocel/g4/GeantGeoData.hh index 0d6648e97f..95eef193fe 100644 --- a/src/geocel/g4/GeantGeoData.hh +++ b/src/geocel/g4/GeantGeoData.hh @@ -36,7 +36,6 @@ struct GeantGeoParamsData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) GeantGeoParamsData& operator=(GeantGeoParamsData& other) { world = other.world; @@ -87,7 +86,6 @@ struct GeantGeoStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) GeantGeoStateData& operator=(GeantGeoStateData& other) { static_assert(M2 == M && W == Ownership::reference, diff --git a/src/geocel/g4/detail/GeantGeoNavCollection.hh b/src/geocel/g4/detail/GeantGeoNavCollection.hh index bca00f8dfb..7bee0edc79 100644 --- a/src/geocel/g4/detail/GeantGeoNavCollection.hh +++ b/src/geocel/g4/detail/GeantGeoNavCollection.hh @@ -35,7 +35,6 @@ struct GeantGeoNavCollection explicit CELER_FUNCTION operator bool() const { return false; } CELER_FUNCTION TrackSlotId::size_type size() const { return 0; } template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) CELER_FUNCTION GeantGeoNavCollection& operator=(GeantGeoNavCollection&) { diff --git a/src/geocel/rasterize/ImageData.hh b/src/geocel/rasterize/ImageData.hh index 202165b1a5..73f17aba1a 100644 --- a/src/geocel/rasterize/ImageData.hh +++ b/src/geocel/rasterize/ImageData.hh @@ -106,7 +106,6 @@ struct ImageStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) ImageStateData& operator=(ImageStateData& other) { CELER_EXPECT(other); diff --git a/src/orange/OrangeData.hh b/src/orange/OrangeData.hh index 8a239938e1..ffd2444547 100644 --- a/src/orange/OrangeData.hh +++ b/src/orange/OrangeData.hh @@ -511,7 +511,6 @@ struct OrangeStateData //! Assign from another set of data template - // NOLINTNEXTLINE(cppcoreguidelines-c-copy-assignment-signature) OrangeStateData& operator=(OrangeStateData& other) { CELER_EXPECT(other); From 02b91f2ff42479bb970ca7aaed72b79aecdd0ca7 Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 09:57:42 -0800 Subject: [PATCH 04/12] remove missing-std-forward check --- .clang-tidy | 1 + app/celer-g4/DetectorConstruction.cc | 1 - src/celeritas/ext/detail/AllElementReader.hh | 1 - src/celeritas/field/MakeMagFieldPropagator.hh | 5 -- src/celeritas/global/ActionLauncher.hh | 9 ++-- src/celeritas/global/TrackExecutor.hh | 46 +++++++++---------- src/celeritas/mat/ElementSelector.hh | 7 ++- .../optical/action/ActionLauncher.hh | 1 - .../optical/action/TrackSlotExecutor.hh | 18 ++++---- src/celeritas/random/Selector.hh | 1 - src/corecel/data/StreamStore.hh | 4 -- src/corecel/io/StringEnumMapper.hh | 1 - src/corecel/math/Algorithms.hh | 4 +- src/corecel/math/detail/AlgorithmsImpl.hh | 1 - src/corecel/sys/KernelLauncher.hh | 1 - src/corecel/sys/TypeDemangler.hh | 1 - src/geocel/g4/VisitGeantVolumes.hh | 2 - src/orange/detail/BIHEnclosingVolFinder.hh | 6 +-- src/orange/orangeinp/PolySolid.cc | 7 ++- src/orange/surf/LocalSurfaceVisitor.hh | 1 - src/orange/surf/SurfaceTypeTraits.hh | 1 - src/orange/transform/TransformTypeTraits.hh | 1 - src/orange/transform/TransformVisitor.hh | 1 - src/orange/univ/SimpleUnitTracker.hh | 8 ++-- src/orange/univ/TrackerVisitor.hh | 1 - src/orange/univ/UniverseTypeTraits.hh | 1 - src/orange/univ/detail/InfixEvaluator.hh | 1 - 27 files changed, 48 insertions(+), 84 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 76ca3aba7c..3993aaf005 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -28,6 +28,7 @@ Checks: | -cppcoreguidelines-noexcept-destructor -cppcoreguidelines-virtual-class-destructor -cppcoreguidelines-c-copy-assignment-signature + -cppcoreguidelines-missing-std-forward bugprone-* -bugprone-sizeof-expression -bugprone-narrowing-conversions diff --git a/app/celer-g4/DetectorConstruction.cc b/app/celer-g4/DetectorConstruction.cc index 7abe6c7af1..be5ea6bce5 100644 --- a/app/celer-g4/DetectorConstruction.cc +++ b/app/celer-g4/DetectorConstruction.cc @@ -312,7 +312,6 @@ void DetectorConstruction::ConstructSDandField() * Apply a function to the range of volumes for each detector. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void DetectorConstruction::foreach_detector(F&& apply_to_range) const { auto start = detectors_.begin(); diff --git a/src/celeritas/ext/detail/AllElementReader.hh b/src/celeritas/ext/detail/AllElementReader.hh index 63c2183930..592a292347 100644 --- a/src/celeritas/ext/detail/AllElementReader.hh +++ b/src/celeritas/ext/detail/AllElementReader.hh @@ -42,7 +42,6 @@ class AllElementReader //! Load a map of data for all stored elements template - // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) auto operator()(ReadOneElement&& read_el) const -> decltype(auto) { using result_type = typename ReadOneElement::result_type; diff --git a/src/celeritas/field/MakeMagFieldPropagator.hh b/src/celeritas/field/MakeMagFieldPropagator.hh index 08b383d211..07006656e8 100644 --- a/src/celeritas/field/MakeMagFieldPropagator.hh +++ b/src/celeritas/field/MakeMagFieldPropagator.hh @@ -34,7 +34,6 @@ namespace celeritas */ template class StepperT, class FieldT> CELER_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) make_mag_field_stepper(FieldT&& field, units::ElementaryCharge charge) { using Equation_t = MagFieldEquation; @@ -59,12 +58,10 @@ make_mag_field_stepper(FieldT&& field, units::ElementaryCharge charge) */ template CELER_FUNCTION decltype(auto) -// NOLINTBEGIN(cppcoreguidelines-missing-std-forward) make_field_propagator(StepperT&& stepper, FieldDriverOptions const& options, ParticleTrackView const& particle, GTV&& geometry) -// NOLINTEND(cppcoreguidelines-missing-std-forward) { return FieldPropagator{ FieldDriver{options, ::celeritas::forward(stepper)}, @@ -87,14 +84,12 @@ make_field_propagator(StepperT&& stepper, * propagate(0.123); * \endcode */ -// NOLINTBEGIN(cppcoreguidelines-missing-std-forward) template class StepperT, class FieldT, class GTV> CELER_FUNCTION decltype(auto) make_mag_field_propagator(FieldT&& field, FieldDriverOptions const& options, ParticleTrackView const& particle, GTV&& geometry) -// NOLINTEND(cppcoreguidelines-missing-std-forward) { return make_field_propagator( make_mag_field_stepper(::celeritas::forward(field), diff --git a/src/celeritas/global/ActionLauncher.hh b/src/celeritas/global/ActionLauncher.hh index ae32468c6c..b1185f5d23 100644 --- a/src/celeritas/global/ActionLauncher.hh +++ b/src/celeritas/global/ActionLauncher.hh @@ -37,11 +37,10 @@ namespace celeritas * \endcode */ template -void launch_core( - std::string_view label, - celeritas::CoreParams const& params, - celeritas::CoreState& state, - F&& execute_thread) // NOLINT(cppcoreguidelines-missing-std-forward) +void launch_core(std::string_view label, + celeritas::CoreParams const& params, + celeritas::CoreState& state, + F&& execute_thread) { MultiExceptionHandler capture_exception; size_type const size = state.size(); diff --git a/src/celeritas/global/TrackExecutor.hh b/src/celeritas/global/TrackExecutor.hh index d2dea88b6a..1832077b95 100644 --- a/src/celeritas/global/TrackExecutor.hh +++ b/src/celeritas/global/TrackExecutor.hh @@ -159,13 +159,15 @@ CELER_FUNCTION ConditionalTrackExecutor(CoreParamsPtr, * Return a track executor that only applies to active, non-errored tracks. */ template -inline CELER_FUNCTION decltype(auto) make_active_track_executor( - CoreParamsPtr params, - CoreStatePtr const& state, - T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) -{ - return ConditionalTrackExecutor{ - params, state, AppliesValid{}, celeritas::forward(apply_track)}; +inline CELER_FUNCTION decltype(auto) +make_active_track_executor(CoreParamsPtr params, + CoreStatePtr const& state, + T&& apply_track) return ConditionalTrackExecutor { + params, + state, + AppliesValid{}, + celeritas::forward(apply_track) +}; } //---------------------------------------------------------------------------// @@ -177,11 +179,11 @@ inline CELER_FUNCTION decltype(auto) make_active_track_executor( * threads, active or not. */ template -inline CELER_FUNCTION decltype(auto) make_action_track_executor( - CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) +inline CELER_FUNCTION decltype(auto) +make_action_track_executor(CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) { CELER_EXPECT(action); return ConditionalTrackExecutor{params, @@ -195,17 +197,15 @@ inline CELER_FUNCTION decltype(auto) make_action_track_executor( * Return a track executor that only applies for the given along-step action. */ template -inline CELER_FUNCTION decltype(auto) make_along_step_track_executor( - CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) -{ - CELER_EXPECT(action); - return ConditionalTrackExecutor{params, - state, - IsAlongStepActionEqual{action}, - celeritas::forward(apply_track)}; +inline CELER_FUNCTION decltype(auto) +make_along_step_track_executor(CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) CELER_EXPECT(action); +return ConditionalTrackExecutor{params, + state, + IsAlongStepActionEqual{action}, + celeritas::forward(apply_track)}; } //---------------------------------------------------------------------------// diff --git a/src/celeritas/mat/ElementSelector.hh b/src/celeritas/mat/ElementSelector.hh index 6e3e48786c..a1dee7d6b1 100644 --- a/src/celeritas/mat/ElementSelector.hh +++ b/src/celeritas/mat/ElementSelector.hh @@ -93,10 +93,9 @@ class ElementSelector * Construct with material, xs calculator, and storage. */ template -CELER_FUNCTION ElementSelector::ElementSelector( - MaterialView const& material, - MicroXsCalc&& calc_micro_xs, // NOLINT(cppcoreguidelines-missing-std-forward) - SpanReal storage) +CELER_FUNCTION ElementSelector::ElementSelector(MaterialView const& material, + MicroXsCalc&& calc_micro_xs, + SpanReal storage) : elements_(material.elements()), elemental_xs_(storage.data()) { CELER_EXPECT(!elements_.empty()); diff --git a/src/celeritas/optical/action/ActionLauncher.hh b/src/celeritas/optical/action/ActionLauncher.hh index f307e576aa..15d24c63e4 100644 --- a/src/celeritas/optical/action/ActionLauncher.hh +++ b/src/celeritas/optical/action/ActionLauncher.hh @@ -35,7 +35,6 @@ namespace optical * \endcode */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void launch_action(CoreState& state, F&& execute_thread) { MultiExceptionHandler capture_exception; diff --git a/src/celeritas/optical/action/TrackSlotExecutor.hh b/src/celeritas/optical/action/TrackSlotExecutor.hh index 773e0a247e..07d4fc397e 100644 --- a/src/celeritas/optical/action/TrackSlotExecutor.hh +++ b/src/celeritas/optical/action/TrackSlotExecutor.hh @@ -158,10 +158,10 @@ ConditionalTrackSlotExecutor(CoreParamsPtr, * Return a track executor that only applies to active, non-errored tracks. */ template -inline CELER_FUNCTION decltype(auto) make_active_thread_executor( - CoreParamsPtr params, - CoreStatePtr const& state, - T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) +inline CELER_FUNCTION decltype(auto) +make_active_thread_executor(CoreParamsPtr params, + CoreStatePtr const& state, + T&& apply_track) { return ConditionalTrackSlotExecutor{ params, state, AppliesValid{}, celeritas::forward(apply_track)}; @@ -176,11 +176,11 @@ inline CELER_FUNCTION decltype(auto) make_active_thread_executor( * all threads, active or not. */ template -inline CELER_FUNCTION decltype(auto) make_action_thread_executor( - CoreParamsPtr params, - CoreStatePtr state, - ActionId action, - T&& apply_track) // NOLINT(cppcoreguidelines-missing-std-forward) +inline CELER_FUNCTION decltype(auto) +make_action_thread_executor(CoreParamsPtr params, + CoreStatePtr state, + ActionId action, + T&& apply_track) { CELER_EXPECT(action); return ConditionalTrackSlotExecutor{params, diff --git a/src/celeritas/random/Selector.hh b/src/celeritas/random/Selector.hh index 0eca33d0f0..2e154dd430 100644 --- a/src/celeritas/random/Selector.hh +++ b/src/celeritas/random/Selector.hh @@ -80,7 +80,6 @@ class Selector */ template CELER_FUNCTION Selector -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) make_selector(F&& func, T size, decltype(func(size)) total = 1) { return {celeritas::forward(func), size, total}; diff --git a/src/corecel/data/StreamStore.hh b/src/corecel/data/StreamStore.hh index 2299d87904..64df23ad0b 100644 --- a/src/corecel/data/StreamStore.hh +++ b/src/corecel/data/StreamStore.hh @@ -113,7 +113,6 @@ class StreamStore //// FUNCTIONS //// template - // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) static constexpr decltype(auto) states_impl(Self&& self) { if constexpr (M == MemSpace::host) @@ -131,7 +130,6 @@ class StreamStore } template - // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) static decltype(auto) stateptr_impl(Self&& self, StreamId stream_id) { CELER_EXPECT(stream_id < self.num_streams_ || !self); @@ -219,7 +217,6 @@ StreamStore::state(StreamId stream_id, size_type size) * Apply a function to all streams. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void apply_to_all_streams(S&& store, F&& func) { // Apply on host @@ -246,7 +243,6 @@ void apply_to_all_streams(S&& store, F&& func) * Accumulate data over all streams. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void accumulate_over_streams(S&& store, F&& func, std::vector* result) { std::vector temp_host; diff --git a/src/corecel/io/StringEnumMapper.hh b/src/corecel/io/StringEnumMapper.hh index 83cbdd610b..34a69a61b0 100644 --- a/src/corecel/io/StringEnumMapper.hh +++ b/src/corecel/io/StringEnumMapper.hh @@ -91,7 +91,6 @@ StringEnumMapper::from_cstring_func(EnumCStringFuncPtr fp, char const* desc) */ template template -// NOLINTNEXTLINE(bugprone-forwarding-reference-overload,cppcoreguidelines-missing-std-forward) StringEnumMapper::StringEnumMapper(U&& enum_to_string, char const* desc) : description_(desc) { diff --git a/src/corecel/math/Algorithms.hh b/src/corecel/math/Algorithms.hh index 973949b9f7..4a3cc1c4dd 100644 --- a/src/corecel/math/Algorithms.hh +++ b/src/corecel/math/Algorithms.hh @@ -51,7 +51,6 @@ forward(typename std::remove_reference::type&& v) noexcept * Cast a value as an rvalue reference to allow move construction. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_CONSTEXPR_FUNCTION auto move(T&& v) noexcept -> typename std::remove_reference::type&& { @@ -110,8 +109,7 @@ struct Less { template CELER_CONSTEXPR_FUNCTION auto - // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) - operator()(T && lhs, U && rhs) const -> decltype(auto) + operator()(T&& lhs, U&& rhs) const -> decltype(auto) { return ::celeritas::forward(lhs) < ::celeritas::forward(rhs); } diff --git a/src/corecel/math/detail/AlgorithmsImpl.hh b/src/corecel/math/detail/AlgorithmsImpl.hh index 8837e41851..4a6133e6e8 100644 --- a/src/corecel/math/detail/AlgorithmsImpl.hh +++ b/src/corecel/math/detail/AlgorithmsImpl.hh @@ -175,7 +175,6 @@ CELER_FUNCTION BidirectionalIterator partition_impl(BidirectionalIterator first, * Cast a value to an rvalue reference. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_CONSTEXPR_FUNCTION auto trivial_move(T&& v) noexcept -> typename std::remove_reference::type&& { diff --git a/src/corecel/sys/KernelLauncher.hh b/src/corecel/sys/KernelLauncher.hh index c2279d4d5c..e08a1c6826 100644 --- a/src/corecel/sys/KernelLauncher.hh +++ b/src/corecel/sys/KernelLauncher.hh @@ -32,7 +32,6 @@ namespace celeritas * \endcode */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void launch_kernel(size_type num_threads, F&& execute_thread) { MultiExceptionHandler capture_exception; diff --git a/src/corecel/sys/TypeDemangler.hh b/src/corecel/sys/TypeDemangler.hh index 400bc1ef51..5452194165 100644 --- a/src/corecel/sys/TypeDemangler.hh +++ b/src/corecel/sys/TypeDemangler.hh @@ -45,7 +45,6 @@ std::string demangled_typeid_name(char const* typeid_name); //---------------------------------------------------------------------------// //! Demangle the type name of any variable template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) std::string demangled_type(T&&) { return demangled_typeid_name(typeid(T).name()); diff --git a/src/geocel/g4/VisitGeantVolumes.hh b/src/geocel/g4/VisitGeantVolumes.hh index 2ddd12edea..5007edd468 100644 --- a/src/geocel/g4/VisitGeantVolumes.hh +++ b/src/geocel/g4/VisitGeantVolumes.hh @@ -31,7 +31,6 @@ namespace celeritas * as visited using a set. */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void visit_geant_volume_instances(F&& visit, G4VPhysicalVolume const& world) { struct QueuedVolume @@ -78,7 +77,6 @@ void visit_geant_volume_instances(F&& visit, G4VPhysicalVolume const& world) * \code void(*)(G4LogicalVolume const&) \endcode . */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) void visit_geant_volumes(F&& vis, G4VPhysicalVolume const& parent_vol) { std::unordered_set visited; diff --git a/src/orange/detail/BIHEnclosingVolFinder.hh b/src/orange/detail/BIHEnclosingVolFinder.hh index 4c644cd9c6..7f467d8ebe 100644 --- a/src/orange/detail/BIHEnclosingVolFinder.hh +++ b/src/orange/detail/BIHEnclosingVolFinder.hh @@ -95,7 +95,6 @@ BIHEnclosingVolFinder::BIHEnclosingVolFinder(BIHTree const& tree, */ template CELER_FUNCTION LocalVolumeId -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) BIHEnclosingVolFinder::operator()(Real3 const& pos, F&& is_inside) const { BIHNodeId previous_node; @@ -208,9 +207,7 @@ bool BIHEnclosingVolFinder::visit_edge(BIHInnerNode const& node, */ template CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_leaf( - BIHLeafNode const& leaf_node, - Real3 const& pos, - F&& is_inside) const // NOLINT(cppcoreguidelines-missing-std-forward) + BIHLeafNode const& leaf_node, Real3 const& pos, F&& is_inside) const { for (auto id : view_.leaf_volids(leaf_node)) { @@ -228,7 +225,6 @@ CELER_FUNCTION LocalVolumeId BIHEnclosingVolFinder::visit_leaf( */ template CELER_FUNCTION LocalVolumeId -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) BIHEnclosingVolFinder::visit_inf_vols(F&& is_inside) const { for (auto id : view_.inf_volids()) diff --git a/src/orange/orangeinp/PolySolid.cc b/src/orange/orangeinp/PolySolid.cc index 3427e75908..bd7a9a8eac 100644 --- a/src/orange/orangeinp/PolySolid.cc +++ b/src/orange/orangeinp/PolySolid.cc @@ -28,10 +28,9 @@ namespace //---------------------------------------------------------------------------// //! Construct the unioned "interior" of a polysolid template -[[nodiscard]] NodeId construct_segments( - PolySolidBase const& base, - T&& build_region, // NOLINT(cppcoreguidelines-missing-std-forward) - detail::VolumeBuilder& vb) +[[nodiscard]] NodeId construct_segments(PolySolidBase const& base, + T&& build_region, + detail::VolumeBuilder& vb) { std::string const label{base.label()}; auto const& segments = base.segments(); diff --git a/src/orange/surf/LocalSurfaceVisitor.hh b/src/orange/surf/LocalSurfaceVisitor.hh index 708b60c869..00d4bca253 100644 --- a/src/orange/surf/LocalSurfaceVisitor.hh +++ b/src/orange/surf/LocalSurfaceVisitor.hh @@ -110,7 +110,6 @@ LocalSurfaceVisitor::LocalSurfaceVisitor(ParamsRef const& params, */ template CELER_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) LocalSurfaceVisitor::operator()(F&& func, LocalSurfaceId id) { CELER_EXPECT(id < surfaces_.size()); diff --git a/src/orange/surf/SurfaceTypeTraits.hh b/src/orange/surf/SurfaceTypeTraits.hh index 75174811b2..9c44568be8 100644 --- a/src/orange/surf/SurfaceTypeTraits.hh +++ b/src/orange/surf/SurfaceTypeTraits.hh @@ -65,7 +65,6 @@ ORANGE_SURFACE_TRAITS(inv, Involute); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_surface_type(F&& func, SurfaceType st) { #define ORANGE_ST_VISIT_CASE(TYPE) \ diff --git a/src/orange/transform/TransformTypeTraits.hh b/src/orange/transform/TransformTypeTraits.hh index 813719e8b3..64525fcb64 100644 --- a/src/orange/transform/TransformTypeTraits.hh +++ b/src/orange/transform/TransformTypeTraits.hh @@ -47,7 +47,6 @@ ORANGE_TRANSFORM_TRAITS(transformation, Transformation); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_transform_type(F&& func, TransformType st) { #define ORANGE_TT_VISIT_CASE(TYPE) \ diff --git a/src/orange/transform/TransformVisitor.hh b/src/orange/transform/TransformVisitor.hh index 7148a4b625..87cd498030 100644 --- a/src/orange/transform/TransformVisitor.hh +++ b/src/orange/transform/TransformVisitor.hh @@ -95,7 +95,6 @@ CELER_FUNCTION TransformVisitor::TransformVisitor(ParamsRef const& params) */ template CELER_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) TransformVisitor::operator()(F&& func, TransformId id) { CELER_EXPECT(id < transforms_.size()); diff --git a/src/orange/univ/SimpleUnitTracker.hh b/src/orange/univ/SimpleUnitTracker.hh index b1a0023774..b1ae943666 100644 --- a/src/orange/univ/SimpleUnitTracker.hh +++ b/src/orange/univ/SimpleUnitTracker.hh @@ -358,7 +358,6 @@ CELER_FUNCTION auto SimpleUnitTracker::get_neighbors(LocalSurfaceId surf) const */ template CELER_FUNCTION LocalVolumeId -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) SimpleUnitTracker::find_volume_where(Real3 const& pos, F&& predicate) const { detail::BIHEnclosingVolFinder find_volume{unit_record_.bih_tree, @@ -389,10 +388,9 @@ SimpleUnitTracker::find_volume_where(Real3 const& pos, F&& predicate) const * Geant4) */ template -CELER_FUNCTION auto SimpleUnitTracker::intersect_impl( - LocalState const& state, - // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) - F&& is_valid) const -> Intersection +CELER_FUNCTION auto +SimpleUnitTracker::intersect_impl(LocalState const& state, + F&& is_valid) const -> Intersection { CELER_EXPECT(state.volume && !state.temp_sense.empty()); diff --git a/src/orange/univ/TrackerVisitor.hh b/src/orange/univ/TrackerVisitor.hh index 6e7979b4c6..46dda24873 100644 --- a/src/orange/univ/TrackerVisitor.hh +++ b/src/orange/univ/TrackerVisitor.hh @@ -68,7 +68,6 @@ CELER_FUNCTION TrackerVisitor::TrackerVisitor(ParamsRef const& params) */ template CELER_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) TrackerVisitor::operator()(F&& func, UniverseId id) { CELER_EXPECT(id < params_.universe_types.size()); diff --git a/src/orange/univ/UniverseTypeTraits.hh b/src/orange/univ/UniverseTypeTraits.hh index 0a5035af44..8783cf488e 100644 --- a/src/orange/univ/UniverseTypeTraits.hh +++ b/src/orange/univ/UniverseTypeTraits.hh @@ -46,7 +46,6 @@ ORANGE_UNIV_TRAITS(rect_array, RectArray); */ template CELER_CONSTEXPR_FUNCTION decltype(auto) -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) visit_universe_type(F&& func, UniverseType ut) { #define ORANGE_UT_VISIT_CASE(TYPE) \ diff --git a/src/orange/univ/detail/InfixEvaluator.hh b/src/orange/univ/detail/InfixEvaluator.hh index 11641d41a5..30e39e3b87 100644 --- a/src/orange/univ/detail/InfixEvaluator.hh +++ b/src/orange/univ/detail/InfixEvaluator.hh @@ -71,7 +71,6 @@ CELER_FUNCTION InfixEvaluator::InfixEvaluator(SpanConstLogic logic) * matching \c celeritas::Sense */ template -// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) CELER_FUNCTION bool InfixEvaluator::operator()(F&& eval_sense) const { bool result{true}; From e2d40f19b9dd11a95b0a9d1d12b37be76f849526 Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 10:24:54 -0800 Subject: [PATCH 05/12] clang-tidy-15 fix --- src/corecel/data/Collection.hh | 4 ++++ src/corecel/data/CollectionStateStore.hh | 2 ++ src/corecel/data/ParamsDataInterface.hh | 2 ++ src/corecel/io/ExceptionOutput.hh | 2 ++ src/geocel/rasterize/ImageWriter.hh | 2 ++ src/geocel/rasterize/RaytraceImager.hh | 2 ++ 6 files changed, 14 insertions(+) diff --git a/src/corecel/data/Collection.hh b/src/corecel/data/Collection.hh index 34dc8cf918..d77d033bad 100644 --- a/src/corecel/data/Collection.hh +++ b/src/corecel/data/Collection.hh @@ -277,6 +277,8 @@ class Collection //! Default constructors Collection() = default; Collection(Collection const&) = default; + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) Collection(Collection&&) = default; //!@} @@ -293,6 +295,8 @@ class Collection //!@{ //! Default assignment Collection& operator=(Collection const& other) = default; + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) Collection& operator=(Collection&& other) = default; //!@} diff --git a/src/corecel/data/CollectionStateStore.hh b/src/corecel/data/CollectionStateStore.hh index 6b258efbe7..eba1720431 100644 --- a/src/corecel/data/CollectionStateStore.hh +++ b/src/corecel/data/CollectionStateStore.hh @@ -78,6 +78,8 @@ class CollectionStateStore inline CollectionStateStore& operator=(S const& other); //! Default move, delete copy (since ref "points to" val) + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) CELER_DEFAULT_MOVE_DELETE_COPY(CollectionStateStore); //! Whether any data is being stored diff --git a/src/corecel/data/ParamsDataInterface.hh b/src/corecel/data/ParamsDataInterface.hh index bb9ef1b63c..1b3910d477 100644 --- a/src/corecel/data/ParamsDataInterface.hh +++ b/src/corecel/data/ParamsDataInterface.hh @@ -45,6 +45,8 @@ class ParamsDataInterface // Prohibit copy/move beween interface classes ParamsDataInterface() = default; + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) CELER_DEFAULT_COPY_MOVE(ParamsDataInterface); }; diff --git a/src/corecel/io/ExceptionOutput.hh b/src/corecel/io/ExceptionOutput.hh index 6ef2e5a94a..66266d5b8a 100644 --- a/src/corecel/io/ExceptionOutput.hh +++ b/src/corecel/io/ExceptionOutput.hh @@ -33,6 +33,8 @@ namespace celeritas } \endcode */ +// TODO Remove in clang-tidy-18 +// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class ExceptionOutput final : public OutputInterface { public: diff --git a/src/geocel/rasterize/ImageWriter.hh b/src/geocel/rasterize/ImageWriter.hh index df99395fe2..a0a5737e96 100644 --- a/src/geocel/rasterize/ImageWriter.hh +++ b/src/geocel/rasterize/ImageWriter.hh @@ -28,6 +28,8 @@ namespace celeritas * Each row is written progressively. All rows must be written. Currently alpha * values are ignored due to my poor understanding of libpng. */ +// TODO Remove in clang-tidy-18 +// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class ImageWriter { public: diff --git a/src/geocel/rasterize/RaytraceImager.hh b/src/geocel/rasterize/RaytraceImager.hh index 92b7a28980..3fb5f21b20 100644 --- a/src/geocel/rasterize/RaytraceImager.hh +++ b/src/geocel/rasterize/RaytraceImager.hh @@ -71,6 +71,8 @@ class RaytraceImager final : public ImagerInterface //// MEMBER FUNCTIONS //// + // TODO Remove in clang-tidy-18 + // NOLINTNEXTLINE(performance-noexcept-move-constructor) CELER_DEFAULT_MOVE_DELETE_COPY(RaytraceImager); template From bda0dd1814fac7ae2837daad1a2a86a0e40c26a0 Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 10:36:25 -0800 Subject: [PATCH 06/12] fix --- src/celeritas/global/TrackExecutor.hh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/celeritas/global/TrackExecutor.hh b/src/celeritas/global/TrackExecutor.hh index 1832077b95..298531ae58 100644 --- a/src/celeritas/global/TrackExecutor.hh +++ b/src/celeritas/global/TrackExecutor.hh @@ -162,12 +162,10 @@ template inline CELER_FUNCTION decltype(auto) make_active_track_executor(CoreParamsPtr params, CoreStatePtr const& state, - T&& apply_track) return ConditionalTrackExecutor { - params, - state, - AppliesValid{}, - celeritas::forward(apply_track) -}; + T&& apply_track) +{ + return ConditionalTrackExecutor{ + params, state, AppliesValid{}, celeritas::forward(apply_track)}; } //---------------------------------------------------------------------------// @@ -201,11 +199,13 @@ inline CELER_FUNCTION decltype(auto) make_along_step_track_executor(CoreParamsPtr params, CoreStatePtr state, ActionId action, - T&& apply_track) CELER_EXPECT(action); -return ConditionalTrackExecutor{params, - state, - IsAlongStepActionEqual{action}, - celeritas::forward(apply_track)}; + T&& apply_track) +{ + CELER_EXPECT(action); + return ConditionalTrackExecutor{params, + state, + IsAlongStepActionEqual{action}, + celeritas::forward(apply_track)}; } //---------------------------------------------------------------------------// From ffe6a5a89778c6e717dc150297bf7f01e8aab5af Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 11:01:32 -0800 Subject: [PATCH 07/12] more fixes --- src/corecel/io/StringEnumMapper.hh | 2 ++ src/orange/g4org/PhysicalVolumeConverter.hh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/corecel/io/StringEnumMapper.hh b/src/corecel/io/StringEnumMapper.hh index 34a69a61b0..53b6cc758d 100644 --- a/src/corecel/io/StringEnumMapper.hh +++ b/src/corecel/io/StringEnumMapper.hh @@ -91,6 +91,8 @@ StringEnumMapper::from_cstring_func(EnumCStringFuncPtr fp, char const* desc) */ template template +// NOLINTNEXTLINE(bugprone-forwarding-reference-overload) -- TODO Remove in +// clang-tidy-18 StringEnumMapper::StringEnumMapper(U&& enum_to_string, char const* desc) : description_(desc) { diff --git a/src/orange/g4org/PhysicalVolumeConverter.hh b/src/orange/g4org/PhysicalVolumeConverter.hh index 96401b3805..f9226dff8e 100644 --- a/src/orange/g4org/PhysicalVolumeConverter.hh +++ b/src/orange/g4org/PhysicalVolumeConverter.hh @@ -27,6 +27,8 @@ namespace g4org * This recurses through the physical volume. It holds a weak-pointer cache of * logical volumes already created. */ +// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) -- Todo Remove in +// clang-tidy-18 class PhysicalVolumeConverter { public: From 846d0eb53fe73df885cecbd5d0f1d5f18e7fb7ce Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 11:02:37 -0800 Subject: [PATCH 08/12] fix --- src/accel/HepMC3PrimaryGenerator.hh | 2 +- src/celeritas/grid/GridIdFinder.hh | 4 ++-- src/corecel/io/StringEnumMapper.hh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/accel/HepMC3PrimaryGenerator.hh b/src/accel/HepMC3PrimaryGenerator.hh index eb44fc3e35..829991224c 100644 --- a/src/accel/HepMC3PrimaryGenerator.hh +++ b/src/accel/HepMC3PrimaryGenerator.hh @@ -51,7 +51,7 @@ class HepMC3PrimaryGenerator final : public G4VPrimaryGenerator explicit HepMC3PrimaryGenerator(std::string const& filename); CELER_DELETE_COPY_MOVE(HepMC3PrimaryGenerator); - ~HepMC3PrimaryGenerator() override = default; + ~HepMC3PrimaryGenerator() final = default; //! Add primaries to Geant4 event void GeneratePrimaryVertex(G4Event* g4_event) final; diff --git a/src/celeritas/grid/GridIdFinder.hh b/src/celeritas/grid/GridIdFinder.hh index e4b8b757dd..0a2027141a 100644 --- a/src/celeritas/grid/GridIdFinder.hh +++ b/src/celeritas/grid/GridIdFinder.hh @@ -86,10 +86,10 @@ GridIdFinder::operator()(argument_type quant) const -> result_type { auto iter = celeritas::lower_bound(grid_.begin(), grid_.end(), quant.value()); - if (iter == grid_.end() // Higher than end point - // Below first point + if (iter == grid_.end() || (iter == grid_.begin() && quant.value() != *iter)) { + // Higher than end point or below first point return {}; } else if (iter + 1 == grid_.end() || quant.value() != *iter) diff --git a/src/corecel/io/StringEnumMapper.hh b/src/corecel/io/StringEnumMapper.hh index 53b6cc758d..51d83c0a76 100644 --- a/src/corecel/io/StringEnumMapper.hh +++ b/src/corecel/io/StringEnumMapper.hh @@ -91,8 +91,8 @@ StringEnumMapper::from_cstring_func(EnumCStringFuncPtr fp, char const* desc) */ template template -// NOLINTNEXTLINE(bugprone-forwarding-reference-overload) -- TODO Remove in -// clang-tidy-18 +// TODO Remove in clang-tidy-18 +// NOLINTNEXTLINE(bugprone-forwarding-reference-overload) StringEnumMapper::StringEnumMapper(U&& enum_to_string, char const* desc) : description_(desc) { From 27e4636350ae17c3902cd8c4e7600c4a55950ecc Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 11:16:45 -0800 Subject: [PATCH 09/12] disable check until AllowSoleDefaultDtor --- .clang-tidy | 1 + src/corecel/io/ExceptionOutput.hh | 4 ---- src/geocel/rasterize/ImageWriter.hh | 2 -- src/orange/detail/LevelStateAccessor.hh | 1 - src/orange/g4org/PhysicalVolumeConverter.hh | 2 -- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 3993aaf005..c1c5f1b64a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -29,6 +29,7 @@ Checks: | -cppcoreguidelines-virtual-class-destructor -cppcoreguidelines-c-copy-assignment-signature -cppcoreguidelines-missing-std-forward + -cppcoreguidelines-special-member-functions bugprone-* -bugprone-sizeof-expression -bugprone-narrowing-conversions diff --git a/src/corecel/io/ExceptionOutput.hh b/src/corecel/io/ExceptionOutput.hh index 66266d5b8a..7f27ed0448 100644 --- a/src/corecel/io/ExceptionOutput.hh +++ b/src/corecel/io/ExceptionOutput.hh @@ -33,8 +33,6 @@ namespace celeritas } \endcode */ -// TODO Remove in clang-tidy-18 -// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class ExceptionOutput final : public OutputInterface { public: @@ -42,8 +40,6 @@ class ExceptionOutput final : public OutputInterface explicit ExceptionOutput(std::exception_ptr e); // Protected destructor - // TODO Remove in clang-tidy-18 - // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) ~ExceptionOutput(); // Category of data to write diff --git a/src/geocel/rasterize/ImageWriter.hh b/src/geocel/rasterize/ImageWriter.hh index a0a5737e96..df99395fe2 100644 --- a/src/geocel/rasterize/ImageWriter.hh +++ b/src/geocel/rasterize/ImageWriter.hh @@ -28,8 +28,6 @@ namespace celeritas * Each row is written progressively. All rows must be written. Currently alpha * values are ignored due to my poor understanding of libpng. */ -// TODO Remove in clang-tidy-18 -// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class ImageWriter { public: diff --git a/src/orange/detail/LevelStateAccessor.hh b/src/orange/detail/LevelStateAccessor.hh index 13648b1475..0fa9ab25d2 100644 --- a/src/orange/detail/LevelStateAccessor.hh +++ b/src/orange/detail/LevelStateAccessor.hh @@ -20,7 +20,6 @@ namespace detail /*! * Accesss the 2D fields (i.e., {thread, level}) of OrangeStateData */ -// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) class LevelStateAccessor { public: diff --git a/src/orange/g4org/PhysicalVolumeConverter.hh b/src/orange/g4org/PhysicalVolumeConverter.hh index f9226dff8e..96401b3805 100644 --- a/src/orange/g4org/PhysicalVolumeConverter.hh +++ b/src/orange/g4org/PhysicalVolumeConverter.hh @@ -27,8 +27,6 @@ namespace g4org * This recurses through the physical volume. It holds a weak-pointer cache of * logical volumes already created. */ -// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions) -- Todo Remove in -// clang-tidy-18 class PhysicalVolumeConverter { public: From 5a10a68c9233e7c0c09e552c749a89f16ff68dca Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 11:54:22 -0800 Subject: [PATCH 10/12] fix clang-tidy-15 wrong warning --- src/corecel/cont/EnumArray.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corecel/cont/EnumArray.hh b/src/corecel/cont/EnumArray.hh index 8d1130d818..af26f7695f 100644 --- a/src/corecel/cont/EnumArray.hh +++ b/src/corecel/cont/EnumArray.hh @@ -27,6 +27,8 @@ namespace celeritas * \todo The template parameters are reversed!!! */ template +// TODO Remove in clang-tidy-18 +// NOLINTNEXTLINE(bugprone-reserved-identifier) struct EnumArray { static_assert(std::is_enum::value, "Template parameter must be an enum"); From ab35edf71c58ee560066a3b5928e277ca5378419 Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 4 Dec 2024 13:58:18 -0800 Subject: [PATCH 11/12] use final, leave const default copy operators --- src/geocel/g4/detail/GeantGeoNavCollection.hh | 3 +++ src/geocel/rasterize/RaytraceImager.hh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/geocel/g4/detail/GeantGeoNavCollection.hh b/src/geocel/g4/detail/GeantGeoNavCollection.hh index 7bee0edc79..5f233f2a0c 100644 --- a/src/geocel/g4/detail/GeantGeoNavCollection.hh +++ b/src/geocel/g4/detail/GeantGeoNavCollection.hh @@ -102,10 +102,13 @@ struct GeantGeoNavCollection // Default constructors GeantGeoNavCollection() = default; + GeantGeoNavCollection(GeantGeoNavCollection const&) = default; // Obtain reference from host memory GeantGeoNavCollection& operator=(GeantGeoNavCollection& other); + // Default assignment + GeantGeoNavCollection& operator=(GeantGeoNavCollection const&) = default; // Get the navigation state for a given track slot GeantTouchableHandle& touch_handle(TrackSlotId tid) const; diff --git a/src/geocel/rasterize/RaytraceImager.hh b/src/geocel/rasterize/RaytraceImager.hh index 3fb5f21b20..2961d057c8 100644 --- a/src/geocel/rasterize/RaytraceImager.hh +++ b/src/geocel/rasterize/RaytraceImager.hh @@ -37,7 +37,7 @@ class RaytraceImager final : public ImagerInterface public: // Construct with geometry explicit RaytraceImager(SPGeometry geo); - ~RaytraceImager() override = default; + ~RaytraceImager() final = default; // Raytrace an image on host or device void operator()(Image* image) final; From 26c5d8b084170f54136cd2dc7a629535c17d319d Mon Sep 17 00:00:00 2001 From: Seth R Johnson Date: Wed, 4 Dec 2024 17:19:44 -0500 Subject: [PATCH 12/12] Make uniform opaque ID aliases --- src/celeritas/Types.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/celeritas/Types.hh b/src/celeritas/Types.hh index a25d1043ba..2a83000c9a 100644 --- a/src/celeritas/Types.hh +++ b/src/celeritas/Types.hh @@ -40,10 +40,10 @@ using IsotopeId = OpaqueId; //! Opaque index of a material modified by physics options // TODO: rename to PhysMatId; equivalent to "material cuts couple" -using MaterialId = OpaqueId; +using MaterialId = OpaqueId; //! Opaque index of model in the list of physics processes -using ModelId = OpaqueId; +using ModelId = OpaqueId; //! Opaque index to a material with optical properties using OpticalMaterialId = OpaqueId; @@ -52,7 +52,7 @@ using OpticalMaterialId = OpaqueId; using ParticleId = OpaqueId; //! Opaque index of physics process -using ProcessId = OpaqueId; +using ProcessId = OpaqueId; //! Unique ID (for an event) of a track among all primaries and secondaries using TrackId = OpaqueId; @@ -61,6 +61,9 @@ using TrackId = OpaqueId; // (detailed type aliases) //---------------------------------------------------------------------------// +//! Opaque index of particle-nucleon cascade channel +using ChannelId = OpaqueId; + //! Opaque index for mapping volume-specific "sensitive detector" objects using DetectorId = OpaqueId; @@ -79,9 +82,6 @@ using ParticleModelId = OpaqueId; //! Opaque index of electron subshell using SubshellId = OpaqueId; -//! Opaque index of particle-nucleon cascade channel -using ChannelId = OpaqueId; - //---------------------------------------------------------------------------// // ENUMERATIONS //---------------------------------------------------------------------------//