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

Bittner Barni via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 12:33:44 PDT 2016


bittnerbarni added inline comments.

================
Comment at: clang-tidy/performance/InefficientStringConcatenationCheck.cpp:67
@@ +66,3 @@
+    Finder->addMatcher(
+        exprWithCleanups(anyOf(hasDescendant(AssingOperator),
+                               hasDescendant(PlusOperatorMatcher))),
----------------
alexfh wrote:
> 1. The `anyOf(hasAncestor(A), hasAncestor(B), ...)` construct is still there. Please replace it with `hasAncestor(anyOf(A, B, ...))`.
> 2. Is there really no way to change from hasDescendant / hasAncestor to more strict patterns? I believe, running the check on LLVM doesn't help finding performance issues, since LLVM specifically avoids this pattern by using Twine.
  #  I was trying to write it like you suggested since the beginning, but it says it cannot deduce the template parameter that way, what's more interesting is that clang-query accepts it. 

  # It seems to me that the assignment operator is (always?) direct child of  `exprWithCleanups`, but I'm not totally sure of that. As for the + operator it could be anywhere among the children.


http://reviews.llvm.org/D20196





More information about the cfe-commits mailing list