aaron.ballman added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:75
+// and if found, extend the SourceRange to start at 'Name'.
+std::pair<clang::SourceRange, bool>
+CtorSourceRange(const MatchFinder::MatchResult &Result,
----------------
You can drop the `clang::` everywhere -- the code is within the correct 
namespace already.


================
Comment at: 
clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:79-80
+  const SourceManager &SM = *Result.SourceManager;
+  const StringRef Name = Decl->getName();
+  const int NameLength = Name.size();
+  const SourceLocation CtorStartLoc(CtorExpr->getSourceRange().getBegin());
----------------
Please drop top-level `const` qualifiers unless it's a pointer or reference 
declaration (that's not a style we typically use).


================
Comment at: 
clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:128
+      diag(CtorExprRange.first.getBegin(), "redundant string initialization");
+  if (CtorExprRange.second) {
+    Diag << FixItHint::CreateReplacement(CtorExprRange.first, Decl->getName());
----------------
Elide braces per coding style.


================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp:106
   DECL_STRING(e, "");
-  // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
+  // CHECK-MESSAGES: [[@LINE-1]]:1{{[58]}}: warning: redundant string 
initialization
 
----------------
Why does this need a regex?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D69238



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

Reply via email to