[PATCH] D20196: [clang-tidy] Inefficient string operation

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 12:27:30 PDT 2016


etienneb added a subscriber: etienneb.
etienneb added a comment.

drive-by, some nits.


================
Comment at: clang-tidy/performance/InefficientStringAdditionCheck.cpp:31
@@ +30,3 @@
+void InefficientStringAdditionCheck::registerMatchers(MatchFinder *Finder) {
+  auto BasicStringType = hasType(cxxRecordDecl(hasName("::std::basic_string")));
+
----------------
nits: I kind of prefer :

const auto BasicStringType

here and below.

================
Comment at: clang-tidy/performance/InefficientStringAdditionCheck.cpp:74
@@ +73,3 @@
+    Finder->addMatcher(WholeMatcher, this);
+
+    Finder->addMatcher(exprWithCleanups(hasDescendant(PlusOperatorMatcher),
----------------
nits: remove this line

================
Comment at: docs/clang-tidy/checks/performance-inefficient-string-addition.rst:4
@@ +3,3 @@
+performance-inefficient-string-addition
+=====================================
+
----------------
line with "===" should be the same length than title.

================
Comment at: docs/clang-tidy/checks/performance-inefficient-string-addition.rst:11
@@ +10,3 @@
+.. code:: c++
+
+    
----------------
nits: delete one blank line

================
Comment at: docs/clang-tidy/checks/performance-inefficient-string-addition.rst:19
@@ +18,3 @@
+.. code:: c++
+
+   
----------------
remove extra blank line (only one)

================
Comment at: docs/clang-tidy/checks/performance-inefficient-string-addition.rst:45
@@ +44,3 @@
+   {
+       f(a+"Bar"+b);
+   }
----------------
nits: spaces between operator "+"


http://reviews.llvm.org/D20196





More information about the cfe-commits mailing list