Skip to content

Commit

Permalink
Address code style and quality issues (#203)
Browse files Browse the repository at this point in the history
Cleaned up by clang-tidy 7.0.0.
Enabled checks:
  - boost-use-to-string
  - misc-uniqueptr-reset-release
  - modernize-deprecated-headers
  - modernize-make-shared
  - modernize-use-bool-literals
  - modernize-use-equals-delete
  - modernize-use-nullptr
  - modernize-use-override
  - performance-unnecessary-copy-initialization
  - readability-container-size-empty
  - readability-redundant-string-cstr
  - readability-static-definition-in-anonymous-namespace
  - readability-uniqueptr-delete-release

See http://releases.llvm.org/7.0.0/tools/clang/tools/extra/docs/clang-tidy/index.html for details.
  • Loading branch information
fwyzard committed Nov 29, 2018
1 parent 2849bee commit b8334a2
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 41 deletions.
14 changes: 7 additions & 7 deletions HeterogeneousCore/CUDAServices/src/CachingHostAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ struct CachingHostAllocator
bytes(0),
bin(INVALID_BIN),
device(INVALID_DEVICE_ORDINAL),
associated_stream(0),
ready_event(0)
associated_stream(nullptr),
ready_event(nullptr)
{}

// Constructor (suitable for searching maps for a range of suitable blocks)
BlockDescriptor() :
d_ptr(NULL),
d_ptr(nullptr),
bytes(0),
bin(INVALID_BIN),
device(INVALID_DEVICE_ORDINAL),
associated_stream(0),
ready_event(0)
associated_stream(nullptr),
ready_event(nullptr)
{}

// Comparison functor for comparing host pointers
Expand Down Expand Up @@ -348,9 +348,9 @@ struct CachingHostAllocator
cudaError_t HostAllocate(
void **d_ptr, ///< [out] Reference to pointer to the allocation
size_t bytes, ///< [in] Minimum number of bytes for the allocation
cudaStream_t active_stream = 0) ///< [in] The stream to be associated with this allocation
cudaStream_t active_stream = nullptr) ///< [in] The stream to be associated with this allocation
{
*d_ptr = NULL;
*d_ptr = nullptr;
int device = INVALID_DEVICE_ORDINAL;
cudaError_t error = cudaSuccess;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class HeterogeneousEDProducer: public Devices, public edm::stream::EDProducer<ed
explicit HeterogeneousEDProducer(const edm::ParameterSet& iConfig):
Devices(iConfig.getUntrackedParameter<edm::ParameterSet>("heterogeneousEnabled_"))
{}
~HeterogeneousEDProducer() = default;
~HeterogeneousEDProducer() override = default;

protected:
edm::EDGetTokenT<HeterogeneousProduct> consumesHeterogeneous(const edm::InputTag& tag) {
Expand All @@ -187,11 +187,11 @@ class HeterogeneousEDProducer: public Devices, public edm::stream::EDProducer<ed
}

private:
void beginStream(edm::StreamID id) {
void beginStream(edm::StreamID id) override {
Devices::call_beginStream(id);
}

void acquire(const edm::Event& iEvent, const edm::EventSetup& iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override final {
void acquire(const edm::Event& iEvent, const edm::EventSetup& iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) final {
const HeterogeneousProductBase *input = nullptr;

std::vector<const HeterogeneousProduct *> products;
Expand All @@ -213,7 +213,7 @@ class HeterogeneousEDProducer: public Devices, public edm::stream::EDProducer<ed
Devices::call_acquire(input, eventWrapper, iSetup, std::move(waitingTaskHolder));
}

void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override final {
void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) final {
if(algoExecutionLocation_.deviceType() == HeterogeneousDeviceId::kInvalidDevice) {
// TODO: eventually fall back to CPU
throw cms::Exception("LogicError") << "Trying to produce(), but algorithm was not executed successfully anywhere?";
Expand Down
2 changes: 1 addition & 1 deletion HeterogeneousCore/Producer/test/TestGPUConcurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestGPUConcurrency: public HeterogeneousEDProducer<heterogeneous::Heteroge
> > {
public:
explicit TestGPUConcurrency(edm::ParameterSet const& config);
~TestGPUConcurrency() = default;
~TestGPUConcurrency() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class TestHeterogeneousEDProducerAnalyzer: public edm::global::EDAnalyzer<> {
public:
explicit TestHeterogeneousEDProducerAnalyzer(edm::ParameterSet const& iConfig);
~TestHeterogeneousEDProducerAnalyzer() = default;
~TestHeterogeneousEDProducerAnalyzer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TestHeterogeneousEDProducerGPU: public HeterogeneousEDProducer<heterogeneo
> > {
public:
explicit TestHeterogeneousEDProducerGPU(edm::ParameterSet const& iConfig);
~TestHeterogeneousEDProducerGPU() = default;
~TestHeterogeneousEDProducerGPU() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestHeterogeneousEDProducerGPUMock: public HeterogeneousEDProducer<heterog
> > {
public:
explicit TestHeterogeneousEDProducerGPUMock(edm::ParameterSet const& iConfig);
~TestHeterogeneousEDProducerGPUMock() = default;
~TestHeterogeneousEDProducerGPUMock() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand All @@ -44,7 +44,7 @@ class TestHeterogeneousEDProducerGPUMock: public HeterogeneousEDProducer<heterog
// simulating GPU memory
unsigned int gpuOutput_;

void acquireGPUMock(const edm::HeterogeneousEvent& iEvent, const edm::EventSetup& iSetup, std::function<void()> callback);
void acquireGPUMock(const edm::HeterogeneousEvent& iEvent, const edm::EventSetup& iSetup, std::function<void()> callback) override;

void produceCPU(edm::HeterogeneousEvent& iEvent, const edm::EventSetup& iSetup) override;
void produceGPUMock(edm::HeterogeneousEvent& iEvent, const edm::EventSetup& iSetup) override;
Expand Down
2 changes: 1 addition & 1 deletion HeterogeneousCore/Product/interface/HeterogeneousProduct.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace heterogeneous {
static bool call(const FunctionTuple& functionTuple, ProductTuple& productTuple, const BitSetArray& bitsetArray) {
constexpr const auto index = std::tuple_size<BitSetArray>::value - sizeMinusIndex;
if(bitsetArray[index].any()) {
const auto func = std::get<index>(functionTuple);
const auto& func = std::get<index>(functionTuple);
if(!func) {
throw cms::Exception("Assert") << "Attempted to call transfer-to-CPU function for device " << index << " but the std::function object is not valid!";
}
Expand Down
4 changes: 2 additions & 2 deletions HeterogeneousCore/Product/test/testHeterogeneousProduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class testHeterogeneousProduct: public CppUnit::TestFixture {
CPPUNIT_TEST(testProduct);
CPPUNIT_TEST_SUITE_END();
public:
void setUp() {}
void tearDown() {}
void setUp() override {}
void tearDown() override {}

void testDefault();
void testCPU();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class SiPixelDigiHeterogeneousConverter: public edm::global::EDProducer<> {
public:
explicit SiPixelDigiHeterogeneousConverter(edm::ParameterSet const& iConfig);
~SiPixelDigiHeterogeneousConverter() = default;
~SiPixelDigiHeterogeneousConverter() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void SiPixelFedCablingMapGPUWrapper::ModulesToUnpack::fillAsync(SiPixelFedCablin
path = {fed, link, roc};
const sipixelobjects::PixelROC* pixelRoc = cabling->findItem(path);
if (pixelRoc != nullptr) {
modToUnpHost[index] = (modules.size() != 0) && (modules.find(pixelRoc->rawId()) == modules.end());
modToUnpHost[index] = (not modules.empty()) and (modules.find(pixelRoc->rawId()) == modules.end());
} else { // store some dummy number
modToUnpHost[index] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PixelCPEFast final : public PixelCPEBase
const SiPixelGenErrorDBObject *, const SiPixelLorentzAngle *);


~PixelCPEFast();
~PixelCPEFast() override;

// The return value can only be used safely in kernels launched on
// the same cudaStream, or after cudaStreamSynchronize.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#ifndef RecoPixelVertexing_PixelTrackFitting_PixelFitterByRiemannParaboloid_H
#define RecoPixelVertexing_PixelTrackFitting_PixelFitterByRiemannParaboloid_H

#include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h"
#include <vector>

#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <vector>


#include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterBase.h"
#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"

class PixelFitterByRiemannParaboloid final : public PixelFitterBase {
public:
explicit PixelFitterByRiemannParaboloid(const edm::EventSetup *es, const MagneticField *field,
bool useErrors, bool useMultipleScattering);
virtual ~PixelFitterByRiemannParaboloid() = default;
virtual std::unique_ptr<reco::Track> run(const std::vector<const TrackingRecHit *>& hits,
const TrackingRegion& region) const override;
~PixelFitterByRiemannParaboloid() override = default;
std::unique_ptr<reco::Track> run(const std::vector<const TrackingRecHit *>& hits,
const TrackingRegion& region) const override;

private:
const edm::EventSetup *es_;
const MagneticField *field_;
bool useErrors_;
bool useMultipleScattering_;
};
#endif

#endif // RecoPixelVertexing_PixelTrackFitting_PixelFitterByRiemannParaboloid_H
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PixelFitterByRiemannParaboloidProducer: public edm::global::EDProducer<> {
{
produces<PixelFitter>();
}
~PixelFitterByRiemannParaboloidProducer() {}
~PixelFitterByRiemannParaboloidProducer() override {}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
Expand All @@ -36,7 +36,7 @@ class PixelFitterByRiemannParaboloidProducer: public edm::global::EDProducer<> {
private:
bool useErrors_;
bool useMultipleScattering_;
virtual void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PixelTrackReconstructionGPU::PixelTrackReconstructionGPU(const ParameterSet& cfg
theCleanerName(cfg.getParameter<std::string>("Cleaner"))
{
edm::InputTag filterTag = cfg.getParameter<edm::InputTag>("Filter");
if(filterTag.label() != "") {
if(!filterTag.label().empty()) {
theFilterToken = iC.consumes<PixelTrackFilter>(filterTag);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void test_helix_fit() {
gen_par(4) = 10.; // R (p_t)
gen_par(5) = 1.; // eta
iteration = 1;
return_err = 1;
return_err = true;
debug2 = 1;

iteration *= 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CAHitNtupletHeterogeneousEDProducer


CAHitNtupletHeterogeneousEDProducer(const edm::ParameterSet &iConfig);
~CAHitNtupletHeterogeneousEDProducer() = default;
~CAHitNtupletHeterogeneousEDProducer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
void beginStreamGPUCuda(edm::StreamID streamId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class PixelVertexHeterogeneousConverter: public edm::global::EDProducer<> {
public:
explicit PixelVertexHeterogeneousConverter(edm::ParameterSet const& iConfig);
~PixelVertexHeterogeneousConverter() = default;
~PixelVertexHeterogeneousConverter() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ClusterTPAssociationHeterogeneous : public HeterogeneousEDProducer<heterog
using PixelRecHitsH = siPixelRecHitsHeterogeneousProduct::HeterogeneousPixelRecHit;

explicit ClusterTPAssociationHeterogeneous(const edm::ParameterSet&);
~ClusterTPAssociationHeterogeneous() = default;
~ClusterTPAssociationHeterogeneous() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ClusterTPAssociationHeterogeneousConverter: public edm::global::EDProducer
using Product = ClusterTPAssociation;

explicit ClusterTPAssociationHeterogeneousConverter(edm::ParameterSet const& iConfig);
~ClusterTPAssociationHeterogeneousConverter() = default;
~ClusterTPAssociationHeterogeneousConverter() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand Down

0 comments on commit b8334a2

Please sign in to comment.