This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix a regression of readability-container-size-empty after the AST ElaboratedType change.
ClosedPublic

Authored by hokein on Aug 8 2022, 4:24 AM.

Details

Summary

With 15f3cd6bfc670ba6106184a903eb04be059e5977, we no longer emit a
diagnostic on a real std::vector case where the size method returns a
sugar size_type. This patch fixes it.

std::vector<int> v;
if (v.size() == 0) // => no check diagnostics
  ;

Diff Detail

Event Timeline

hokein created this revision.Aug 8 2022, 4:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 4:24 AM
hokein requested review of this revision.Aug 8 2022, 4:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 4:24 AM
ymandel accepted this revision.Aug 8 2022, 4:42 AM

Thanks! It makes me a little sad that QualType has both isIntegerType and isIntegralType. Nice spotting that difference!

This revision is now accepted and ready to land.Aug 8 2022, 4:42 AM
This revision was landed with ongoing or failed builds.Aug 8 2022, 5:41 AM
This revision was automatically updated to reflect the committed changes.