hokein marked an inline comment as done.
hokein added inline comments.

================
Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:92
+  const auto VectorAppendCall = expr(
+      anyOf(VectorAppendCallExpr, 
exprWithCleanups(has(VectorAppendCallExpr))));
   const auto VectorVarDefStmt =
----------------
malcolm.parsons wrote:
> I'd use ignoringImplicit(VectorAppendCallExpr) to ignore ExprWithCleanups.
Good to know. Thanks!


================
Comment at: clang-tidy/performance/InefficientVectorOperationCheck.cpp:208
+           "consider pre-allocating the vector capacity before the loop")
+      << VectorAppendCall->getMethodDecl()->getDeclName();
 
----------------
alexfh wrote:
> Diagnostic builder should be able to format NamedDecls directly, this 
> `->getDeclName()` is not necessary. The only difference is that it will 
> likely add quotes around the name, which seems to be good anyway.
I tried it, but I found the behavior between using `getDeclName()` and not 
using `getDeclName()` is different when handling the template functions:

* `diag(...) << VectorAppendCall->getMethodDecl()` will print the function name 
with instantiated template arguments like "emplace_back<int&>";
*  `diag(...) << VectorAppendCall->getMethodDecl()->getDeclName()` will just 
print the function name without template arguments, which is what we expect.


https://reviews.llvm.org/D33209



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

Reply via email to