Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 17118 Build 17118: arc lint + arc unit
Event Timeline
Please also take a look on 26817 for another idea for .data().
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
20 | Please separate with empty line. | |
32 | Isn't this list redundant for using namespace clang::ast_matchers? | |
docs/ReleaseNotes.rst | ||
63 | I would suggest Finds redundant .data() calls. Same in documentation. Please also move to new checks list in alphabetical order. | |
docs/clang-tidy/checks/readability-redundant-data-call.rst | ||
14 | Please look on other check documentation for example of option descriptions. |
docs/ReleaseNotes.rst | ||
---|---|---|
63 | Please enclose .data() in ``. Same in documentation. |
Have you run this over any large code bases to see whether the check triggers in practice?
docs/clang-tidy/checks/list.rst | ||
---|---|---|
95 | This change looks unrelated to the patch and should be handled separately. | |
docs/clang-tidy/checks/readability-redundant-data-call.rst | ||
6 | What does it mean for a data() call to be redundant? I think the documentation needs to explain that a bit more. |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
23 | Actually you should use static, not anonymous namespace for variables and functions. | |
docs/ReleaseNotes.rst | ||
143 | r is after p :-) | |
146 | Please remove This check and enclose .data() in `, not . Same for documentation. | |
docs/clang-tidy/checks/readability-redundant-data-call.rst | ||
7 | Please use as much of 80 characters as possible. | |
9 | operator[] should be enclosed in `, not . | |
15 | Please insert empty line above. | |
23 | I think will be good idea to specify default value as complete string. |
Addressed more comments.
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
23 | Done, but why? |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
23 |
Have you run this over any large code bases to see whether the check triggers in practice?
I'm still curious about this, btw.
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | Should this check apply equally to std::string::c_str() as well as std::string::data()? | |
58 | I think the word "redundant" isn't going to be immediately obvious to a user who would write code like that. Perhaps "accessing an element of the container does not require a call to 'data()'; did you mean to use 'operator[]()' instead?" | |
docs/clang-tidy/checks/readability-redundant-data-call.rst | ||
8 | doing array subscript -> doing an array subscript |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | readability-redundant-string-cstr do both. |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | How about "readability-circumlocutionary-subscript"? |
From randomly checking several triggerings no I didn't find any false positives. I feel the check should be pretty safe in terms of false positives because we only trigger on configured types.
Good to hear, thank you for the information.
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | hah, I think circumlocutionary might be a bit too much. ;-) I think readability-simplify-array-subscript-expr might be reasonable, however. Right now, the simplification is just for foo.data()[0] but it seems plausible that there are other array subscript simplifications that could be added in the future, like a[1 + 1] being converted to a[2] or x ? a[200] : a[400] going to a[x ? 200 : 400] (etc). |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | Just readability-simplify-subscript-expr? Let me know if this name looks good to you and I'll do the actual renaming (together with addressing other comments) after your confirmation. |
clang-tidy/readability/RedundantDataCallCheck.cpp | ||
---|---|---|
46 | I think readability-simplify-subscript-expr is a reasonable name. |
Please separate with empty line.