The fix to the issue that const char* p = ("foo") is diagnosed as decay
is to ignored the ParenCast.
Resolves PR39583
Details
Details
- Reviewers
aaron.ballman alexfh hokein - Commits
- rGef67ce0f6f97: [clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds…
rCTE346555: [clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds…
rL346555: [clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds…
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp | ||
---|---|---|
65 ↗ | (On Diff #173241) | I think you want ignoringParens() instead, no? |
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. |
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. |
Comment Actions
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. |