This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Correct sizeof/alignas handling in misc-redundant-expression
ClosedPublic

Authored by PiotrZSL on Jun 12 2023, 8:50 AM.

Details

Summary

Fixed issue with the comparison of UnaryExprOrTypeTraitExpr
objects in which only the argument type was checked, without
considering the kind of expression. This led to false positives when
using sizeof(x) and alignof(x) expressions, as only the
comparison x = x was performed without checking if sizeof
was equal to alignof.

Fixes: https://github.com/llvm/llvm-project/issues/63096

Diff Detail

Event Timeline

PiotrZSL created this revision.Jun 12 2023, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 8:50 AM
Herald added a subscriber: xazax.hun. · View Herald Transcript
PiotrZSL requested review of this revision.Jun 12 2023, 8:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 8:50 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Izaron accepted this revision.Jul 1 2023, 9:19 AM

LGTM! Thank you for the fix!

This revision is now accepted and ready to land.Jul 1 2023, 9:19 AM