The fix to the issue that const char* p = ("foo") is diagnosed as decay
is to ignored the ParenCast.
Resolves PR39583
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
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 24753 Build 24752: arc lint + arc unit
Event Timeline
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp | ||
---|---|---|
65 | I think you want ignoringParens() instead, no? |
clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp | ||
---|---|---|
65 | 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 | 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. |
LGTM aside from a minor commenting nit.
test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp | ||
---|---|---|
44 | Remove "Cast" as this is not a cast. It's a ParenExpr. |
I think you want ignoringParens() instead, no?