-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[DQM] [Clang]Cleanup clang-analyzer warnings #46227
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -593,6 +593,7 @@ void DTRecHitQuality::compute(const DTGeometry &dtGeom, | |
} | ||
|
||
// Fill | ||
assert(hRes); | ||
hRes->fill(simHitWireDist, | ||
simHitTheta, | ||
simHitFEDist, | ||
|
@@ -685,6 +686,7 @@ void DTRecHitQuality::compute(const DTGeometry &dtGeom, | |
} | ||
} | ||
// Fill | ||
assert(hEff); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, just to make sure these pointers are not null |
||
hEff->fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed); | ||
if (hEffTot != nullptr) { | ||
hEffTot->fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,7 @@ void EnergyScaleAnalyzer::analyze(const edm::Event &evt, const edm::EventSetup & | |
Labels l; | ||
labelsForToken(hepMCLabel_, l); | ||
|
||
[[clang::suppress]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const HepMC::GenEvent *genEvent = hepMC->GetEvent(); | ||
if (!(hepMC.isValid())) { | ||
LogInfo("EnergyScaleAnalyzer") << "Could not get MC Product!"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -741,7 +741,7 @@ void GlobalDigisAnalyzer::fillECal(const edm::Event &iEvent, const edm::EventSet | |
bool validDigiES = true; | ||
if (!EcalDigiES.isValid()) { | ||
LogDebug(MsgLoggerCat) << "Unable to find EcalDigiES in event!"; | ||
validDigiES = false; | ||
[[clang::suppress]] validDigiES = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang analyzer complains as we force set |
||
} | ||
|
||
// ONLY WHILE GEOMETRY IS REMOVED | ||
|
@@ -1468,7 +1468,7 @@ void GlobalDigisAnalyzer::fillMuon(const edm::Event &iEvent, const edm::EventSet | |
bool validrpcdigi = true; | ||
if (!rpcDigis.isValid()) { | ||
LogDebug(MsgLoggerCat) << "Unable to find rpcDigis in event!"; | ||
validrpcdigi = false; | ||
[[clang::suppress]] validrpcdigi = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang analyzer complains as we force set |
||
} | ||
|
||
// ONLY UNTIL PROBLEM WITH RPC DIGIS IS FIGURED OUT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cms-sw/dqm-l2 , may be there is better way to fix this code . All these pointers are not set in https://github.com/cms-sw/cmssw/blob/master/Validation/CaloTowers/src/CaloTowersClient.cc#L63-L87 block. So clang-analyzer warns that these might be null. For now I have added
assert
to instruct clang static analyzer that we fail if these are nullThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your proposed solution for the null pointer error handling is fine.