aaron.ballman added a comment.

Mostly just nits from me. At a high level, I think this is good, but if someone 
else wanted to double-check the changes to the matcher statements themselves, 
that'd be good.



================
Comment at: 
clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.cpp:95
+
+  const auto SourceRange = CE->getSourceRange();
 
----------------
Drop top-level const and spell out the type explicitly.


================
Comment at: 
clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.cpp:97-100
   std::string ReplacementText;
-  ReplacementText = std::string(Lexer::getSourceText(
-      CharSourceRange::getTokenRange(DRE->getSourceRange()),
-      *Result.SourceManager, getLangOpts()));
-  if (DRE->getType()->isPointerType())
+  ReplacementText = std::string(
+      Lexer::getSourceText(CharSourceRange::getTokenRange(SourceRange),
+                           *Result.SourceManager, getLangOpts()));
----------------
Might as well use the constructor rather than assignment operator here.


================
Comment at: 
clang-tools-extra/clang-tidy/readability/ContainerDataPointerCheck.cpp:102-103
+
+  if (!isa<DeclRefExpr>(CE) && !isa<ArraySubscriptExpr>(CE) &&
+      !isa<CXXOperatorCallExpr>(CE) && !isa<CallExpr>(CE))
+    ReplacementText = "(" + ReplacementText + ")";
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113863/new/

https://reviews.llvm.org/D113863

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to