Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy check for FWCore #20750

Merged
merged 1 commit into from Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions FWCore/Common/src/EventBase.cc
Expand Up @@ -63,8 +63,8 @@ namespace edm
// Look for the parameter set containing the trigger names in the parameter
// set registry using the ID from TriggerResults as the key used to find it.
edm::pset::Registry* psetRegistry = edm::pset::Registry::instance();
edm::ParameterSet const* pset=0;
if (0!=(pset=psetRegistry->getMapped(triggerResults.parameterSetID()))) {
edm::ParameterSet const* pset=nullptr;
if (nullptr!=(pset=psetRegistry->getMapped(triggerResults.parameterSetID()))) {

if (pset->existsAs<std::vector<std::string> >("@trigger_paths", true)) {
TriggerNames triggerNames(*pset);
Expand All @@ -85,7 +85,7 @@ namespace edm
}
}
// For backward compatibility to very old data
if (triggerResults.getTriggerNames().size() > 0U) {
if (!triggerResults.getTriggerNames().empty()) {
edm::ParameterSet fakePset;
fakePset.addParameter<std::vector<std::string> >("@trigger_paths", triggerResults.getTriggerNames());
fakePset.registerIt();
Expand All @@ -105,6 +105,6 @@ namespace edm
triggerNamesMap.insert(std::pair<edm::ParameterSetID, edm::TriggerNames>(fakePset.id(), triggerNames));
return &(ret.first->second);
}
return 0;
return nullptr;
}
}
56 changes: 28 additions & 28 deletions FWCore/Common/src/TriggerResultsByName.cc
Expand Up @@ -13,7 +13,7 @@ namespace edm {
triggerNames_(triggerNames) {

// If either of these is true the object is in an invalid state
if (triggerResults_ == 0 || triggerNames_ == 0) {
if (triggerResults_ == nullptr || triggerNames_ == nullptr) {
return;
}

Expand All @@ -38,178 +38,178 @@ namespace edm {
bool
TriggerResultsByName::
isValid() const {
if (triggerResults_ == 0 || triggerNames_ == 0) return false;
if (triggerResults_ == nullptr || triggerNames_ == nullptr) return false;
return true;
}

ParameterSetID const&
TriggerResultsByName::
parameterSetID() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->parameterSetID();
}

bool
TriggerResultsByName::
wasrun() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->wasrun();
}

bool
TriggerResultsByName::
accept() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->accept();
}

bool
TriggerResultsByName::
error() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->error();
}

HLTPathStatus const&
TriggerResultsByName::
at(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->at(i);
}

HLTPathStatus const&
TriggerResultsByName::
at(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->at(i);
}

HLTPathStatus const&
TriggerResultsByName::
operator[](std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->at(i);
}

HLTPathStatus const&
TriggerResultsByName::
operator[](unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->at(i);
}

bool
TriggerResultsByName::
wasrun(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->wasrun(i);
}

bool
TriggerResultsByName::
wasrun(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->wasrun(i);
}

bool
TriggerResultsByName::
accept(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->accept(i);
}

bool
TriggerResultsByName::
accept(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->accept(i);
}

bool
TriggerResultsByName::
error(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->error(i);
}

bool
TriggerResultsByName::
error(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->error(i);
}

hlt::HLTState
TriggerResultsByName::
state(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->state(i);
}

hlt::HLTState
TriggerResultsByName::
state(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->state(i);
}

unsigned
TriggerResultsByName::
index(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
unsigned i = getAndCheckIndex(pathName);
return triggerResults_->index(i);
}

unsigned
TriggerResultsByName::
index(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->index(i);
}

std::vector<std::string> const&
TriggerResultsByName::
triggerNames() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerNames_ == 0) throwTriggerNamesMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
if (triggerNames_ == nullptr) throwTriggerNamesMissing();
return triggerNames_->triggerNames();
}

std::string const&
TriggerResultsByName::
triggerName(unsigned i) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerNames_ == 0) throwTriggerNamesMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
if (triggerNames_ == nullptr) throwTriggerNamesMissing();
return triggerNames_->triggerName(i);
}

unsigned
TriggerResultsByName::
triggerIndex(std::string const& pathName) const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerNames_ == 0) throwTriggerNamesMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
if (triggerNames_ == nullptr) throwTriggerNamesMissing();
return triggerNames_->triggerIndex(pathName);
}

std::vector<std::string>::size_type
TriggerResultsByName::
size() const {
if (triggerResults_ == 0) throwTriggerResultsMissing();
if (triggerResults_ == nullptr) throwTriggerResultsMissing();
return triggerResults_->size();
}

unsigned
TriggerResultsByName::
getAndCheckIndex(std::string const& pathName) const {
if (triggerNames_ == 0) throwTriggerNamesMissing();
if (triggerNames_ == nullptr) throwTriggerNamesMissing();
unsigned i = triggerNames_->triggerIndex(pathName);
if (i == triggerNames_->size()) {
throw edm::Exception(edm::errors::LogicError)
Expand Down
14 changes: 7 additions & 7 deletions FWCore/Concurrency/src/SerialTaskQueue.cc
Expand Up @@ -37,7 +37,7 @@ bool
SerialTaskQueue::resume() {
if(0==--m_pauseCount) {
tbb::task* t = pickNextTask();
if(0 != t) {
if(nullptr != t) {
tbb::task::spawn(*t);
}
return true;
Expand All @@ -48,15 +48,15 @@ SerialTaskQueue::resume() {
void
SerialTaskQueue::pushTask(TaskBase* iTask) {
tbb::task* t = pushAndGetNextTask(iTask);
if(0!=t) {
if(nullptr!=t) {
tbb::task::spawn(*t);
}
}

tbb::task*
SerialTaskQueue::pushAndGetNextTask(TaskBase* iTask) {
tbb::task* returnValue{0};
if likely(0!=iTask) {
tbb::task* returnValue{nullptr};
if likely(nullptr!=iTask) {
m_tasks.push(iTask);
returnValue = pickNextTask();
}
Expand All @@ -75,7 +75,7 @@ SerialTaskQueue::pickNextTask() {

bool expect = false;
if likely(0 == m_pauseCount and m_taskChosen.compare_exchange_strong(expect,true)) {
TaskBase* t=0;
TaskBase* t=nullptr;
if likely(m_tasks.try_pop(t)) {
return t;
}
Expand All @@ -85,7 +85,7 @@ SerialTaskQueue::pickNextTask() {
//was a new entry added after we called 'try_pop' but before we did the clear?
expect = false;
if(not m_tasks.empty() and m_taskChosen.compare_exchange_strong(expect,true)) {
TaskBase* t=0;
TaskBase* t=nullptr;
if(m_tasks.try_pop(t)) {
return t;
}
Expand All @@ -94,7 +94,7 @@ SerialTaskQueue::pickNextTask() {

}
}
return 0;
return nullptr;
}

void SerialTaskQueue::pushAndWait(tbb::empty_task* iWait, TaskBase* iTask) {
Expand Down
4 changes: 2 additions & 2 deletions FWCore/FWLite/interface/AutoLibraryLoader.h
Expand Up @@ -23,8 +23,8 @@ class AutoLibraryLoader {
private:
static bool enabled_;
AutoLibraryLoader();
AutoLibraryLoader(const AutoLibraryLoader&); // stop default
const AutoLibraryLoader& operator=(const AutoLibraryLoader&); // stop default
AutoLibraryLoader(const AutoLibraryLoader&) = delete; // stop default
const AutoLibraryLoader& operator=(const AutoLibraryLoader&) = delete; // stop default
};


Expand Down
14 changes: 7 additions & 7 deletions FWCore/FWLite/src/BareRootProductGetter.h
Expand Up @@ -44,10 +44,10 @@ class BareRootProductGetter : public edm::EDProductGetter {

public:
BareRootProductGetter();
virtual ~BareRootProductGetter();
~BareRootProductGetter() override;

// ---------- const member functions ---------------------
virtual edm::WrapperBase const* getIt(edm::ProductID const&) const override;
edm::WrapperBase const* getIt(edm::ProductID const&) const override;

// getThinnedProduct assumes getIt was already called and failed to find
// the product. The input key is the index of the desired element in the
Expand All @@ -56,7 +56,7 @@ class BareRootProductGetter : public edm::EDProductGetter {
// in a thinned container and key is modified to be the index into
// that thinned container. If the desired element is not found, then
// nullptr is returned.
virtual edm::WrapperBase const* getThinnedProduct(edm::ProductID const&,
edm::WrapperBase const* getThinnedProduct(edm::ProductID const&,
unsigned int& key) const override;

// getThinnedProducts assumes getIt was already called and failed to find
Expand All @@ -70,7 +70,7 @@ class BareRootProductGetter : public edm::EDProductGetter {
// is modified to be the key into the container where the element
// was found. The WrapperBase pointers might or might not all point
// to the same thinned container.
virtual void getThinnedProducts(edm::ProductID const&,
void getThinnedProducts(edm::ProductID const&,
std::vector<edm::WrapperBase const*>& foundContainers,
std::vector<unsigned int>& keys) const override;

Expand All @@ -79,7 +79,7 @@ class BareRootProductGetter : public edm::EDProductGetter {
// ---------- static member functions --------------------

// ---------- member functions ---------------------------
virtual unsigned int transitionIndex_() const override {
unsigned int transitionIndex_() const override {
return 0u;
}

Expand All @@ -99,9 +99,9 @@ class BareRootProductGetter : public edm::EDProductGetter {
edm::propagate_const<TClass*> class_;
};

BareRootProductGetter(BareRootProductGetter const&); // stop default
BareRootProductGetter(BareRootProductGetter const&) = delete; // stop default

BareRootProductGetter const& operator=(BareRootProductGetter const&); // stop default
BareRootProductGetter const& operator=(BareRootProductGetter const&) = delete; // stop default

Buffer* createNewBuffer(edm::BranchID const&) const;
edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID, Long_t eventEntry) const;
Expand Down