[PATCH] D45702: [clang-tidy] Add a new check, readability-redundant-data-call, that finds and removes redundant calls to .data().

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 17:04:48 PDT 2018


shuaiwang added inline comments.


================
Comment at: clang-tidy/readability/RedundantDataCallCheck.cpp:45
+                  anyOf(TypesMatcher, pointerType(pointee(TypesMatcher)))))),
+              callee(namedDecl(hasName("data"))))
+              .bind("call")))),
----------------
aaron.ballman wrote:
> Eugene.Zelenko wrote:
> > aaron.ballman wrote:
> > > Should this check apply equally to `std::string::c_str()` as well as `std::string::data()`?
> > readability-redundant-string-cstr do both.
> Yup! But that makes me wonder if the name "redundant-data-call" is an issue. Perhaps the check name should focus more on the array subscript in the presence of an operator[]()?
How about "readability-circumlocutionary-subscript"?
"readability-circumlocutionary-element-access"?
"circumlocutionary" -> "verbose"?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45702





More information about the cfe-commits mailing list