Page MenuHomePhabricator

[clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds-array-to-pointer-decay
ClosedPublic

Authored by JonasToth on Nov 8 2018, 3:44 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

JonasToth created this revision.Nov 8 2018, 3:44 PM
aaron.ballman added inline comments.Nov 8 2018, 3:50 PM
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
65 ↗(On Diff #173241)

I think you want ignoringParens() instead, no?

JonasToth added inline comments.Nov 8 2018, 3:59 PM
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
65 ↗(On Diff #173241)

That doesn't seem to compile, it only applies to QualType. There is ignoringParenCasts and ignoringParenImpCasts that match on everything. Ignoring the imp-casts is not what we want.

aaron.ballman added inline comments.Nov 8 2018, 4:03 PM
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
65 ↗(On Diff #173241)

Neither is ignoring the paren casts because that covers actual casts like reinterpret_cast. There is an Expr::IgnoreParens(), so I'm betting that the ignoringParens() matcher just needs an overload for Expr.

JonasToth updated this revision to Diff 173311.Nov 9 2018, 6:10 AM
  • use ignoringParens instead
JonasToth marked 3 inline comments as done.Nov 9 2018, 6:13 AM
aaron.ballman accepted this revision.Nov 9 2018, 8:53 AM

LGTM aside from a minor commenting nit.

test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
44 ↗(On Diff #173311)

Remove "Cast" as this is not a cast. It's a ParenExpr.

This revision is now accepted and ready to land.Nov 9 2018, 8:53 AM
JonasToth updated this revision to Diff 173423.Nov 9 2018, 12:57 PM
  • use ignoringParens instead
JonasToth marked an inline comment as done.Nov 9 2018, 12:59 PM
JonasToth updated this revision to Diff 173425.Nov 9 2018, 12:59 PM
  • fix comment
This revision was automatically updated to reflect the committed changes.