Skip to content

WIP:Add clang-tidy to clang build

Stewart Martin-Haugh requested to merge smh/atlasexternals:clang-tidy into master

Add clang-tidy to clang build with bugprone and performance checks all enabled.

Sample output:

/scratch/smh/athena/Calorimeter/CaloCnv/CaloDetMgrDetDescrCnv/src/CaloMgrDetDescrCnv.cxx:77:8: warning: the variable 'ctx' is copy-constructed from a const reference but is only used as const reference; consider making it a const reference [performance-unnecessary-copy-initialization]
  auto ctx = Gaudi::Hive::currentContext();
       ^
  const  &

Overall we end up with a lot of warnings - maybe more than we really want to fix? e.g.

/scratch/smh/athena/Calorimeter/CaloTrackingGeometry/src/CaloSurfaceBuilder.cxx:1124:17: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions]
    float eta = etaMin+(ie+0.5)*deta;

@christos has a set of checks: https://gitlab.cern.ch/ATLAS-EGamma/Software/Reconstruction/clang-tidy-checks/-/blob/master/.clang-tidy which might be a good starting point.

It might also be useful to be able to steer this from within athena rather than atlasexternals if we end up making lots of changes to the list of warnings.

Cheers,

Stewart

Merge request reports

Loading