[PATCH] D51061: [clang-tidy] abseil-str-cat-append

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 24 09:49:01 PDT 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/abseil/StrCatAppendCheck.cpp:91-92
+  diag(Op->getBeginLoc(),
+       "please use absl::StrAppend instead of absl::StrCat when appending to "        
+       "an existing string")
+      << FixItHint::CreateReplacement(
----------------
aaron.ballman wrote:
> This wins the award for "kindest diagnostic message". :-D How about: `call 'absl::StrAppend' instead of 'absl::StrCat' when appending to a string`?
> 
> That said, the diagnostic doesn't say *why* the code is wrong in the first place. The documentation doesn't really go into it either. Is it a correctness issue, a performance issue, something else?
So this is a performance concern, not a correctness concern? In that case, how about: `call 'absl::StrAppend' instead of 'absl::StrCat' to avoid a performance penalty when appending to a string`?


https://reviews.llvm.org/D51061





More information about the cfe-commits mailing list