[PATCH] D45702: [clang-tidy] Add a new check, readability-simplify-subscript-expr, that simplifies subscript expressions.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 13 14:17:21 PDT 2018


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with a few minor nits to be fixed.



================
Comment at: clang-tidy/readability/SimplifySubscriptExprCheck.cpp:53-54
+  const auto *Call = Result.Nodes.getNodeAs<CXXMemberCallExpr>("call");
+  if (Result.Context->getSourceManager().isMacroBodyExpansion(
+          Call->getExprLoc())) {
+    return;
----------------
Can remove the braces.


================
Comment at: clang-tidy/readability/SimplifySubscriptExprCheck.cpp:62
+           "'data()'; did you mean to use 'operator[]'?");
+  if (Member->isArrow()) {
+    DiagBuilder << FixItHint::CreateInsertion(Member->getLocStart(), "(*")
----------------
Remove braces.


================
Comment at: clang-tidy/readability/SimplifySubscriptExprCheck.h:22
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-data-call.html
+class SimplifySubscriptExprCheck : public ClangTidyCheck {
----------------
This URL looks stale.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45702





More information about the cfe-commits mailing list