This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy]bugprone-fold-init-type
ClosedPublic

Authored by courbet on Nov 10 2022, 5:14 AM.

Details

Summary

Handle iterators that do not define a value_type type alias.

Get the value type from the return type of Iter::operator* instead.

Diff Detail

Event Timeline

courbet created this revision.Nov 10 2022, 5:14 AM
Herald added a project: Restricted Project. · View Herald Transcript
courbet requested review of this revision.Nov 10 2022, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 5:14 AM
Eugene.Zelenko added inline comments.
clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp
205

Excessive newline.

courbet updated this revision to Diff 474548.Nov 10 2022, 7:44 AM

remove extra training newline

LegalizeAdulthood resigned from this revision.Mar 29 2023, 8:09 AM

Missing ReleaseNotes,

clang-tools-extra/clang-tidy/bugprone/FoldInitTypeCheck.cpp
39

referenceType(pointee -> references

41

BuiltinTypeWithId already got hasCanonicalType, no need to duplicate

43

maybe:

returns(qualType(hasCanonicalType(anyOf(BuiltinTypeWithId(ID), references(BuiltinTypeWithId(ID)), autoType(hasDeducedType(BuiltinTypeWithId(ID)))

instead of having anyOf on top level.

courbet updated this revision to Diff 511424.Apr 6 2023, 8:22 AM
courbet marked 2 inline comments as done.
  • Address review comments
  • Add release notes.

Thanks !

PiotrZSL added inline comments.Apr 6 2023, 12:21 PM
clang-tools-extra/docs/ReleaseNotes.rst
101

Wrong section, this should be in 'Changes in existing checks'

courbet updated this revision to Diff 511634.Apr 7 2023, 12:58 AM

Fix release note placement and phrase it more consistenly with other notes in that section.

PiotrZSL accepted this revision.Apr 7 2023, 4:35 AM

LGTM

This revision is now accepted and ready to land.Apr 7 2023, 4:35 AM

Thanks for the review.

This revision was automatically updated to reflect the committed changes.

Please rebase from latest main.

clang-tools-extra/docs/ReleaseNotes.rst
294

Please keep alphabetical order (by check name) in this section.

courbet marked an inline comment as done.Apr 7 2023, 7:12 AM
courbet added inline comments.
clang-tools-extra/docs/ReleaseNotes.rst
294

Done (in d880d4e7c228).