[PATCH] D64151: Enhance abseil-faster-strsplit-delimiter to handle other non-printable characters.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 04:27:54 PDT 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/abseil-faster-strsplit-delimiter.cpp:55
+
+  absl::StrSplit("ABC", R"(A)");
+  // CHECK-MESSAGES: [[@LINE-1]]:25: warning: absl::StrSplit() called with a string literal consisting of a single character; consider using the character overload [abseil-faster-strsplit-delimiter]
----------------
gribozavr wrote:
> lebedev.ri wrote:
> > zhangxy988 wrote:
> > > lebedev.ri wrote:
> > > > Is there a negative test, `absl::StrSplit("ABC", R"(AA)");`?
> > > > Also what about wide chars? (the second assertion)
> > > I don't really know how to write a negative test like that.
> > > This check is only concerned with single character string literal and it doesn't support wide char (since `StrSplit` doesn't).
> > What i'm asking is, those assertions are there just to say "look, i guarantee those invariants hold here",
> > or to say "oh no, we shouldn't have ever violated these invariants here"? The difference being, in former case,
> > there is some other error checking that prevents those assertions from triggering; in latter case there is not.
> There's a test below for multi-character string literals, `absl::StrSplit("ABC", "AB");`.
> 
> As far as wide characters go, code with wide characters won't pass semantic analysis because there's no StrSplit overload that accepts wide characters.
Cool, i have no further comments here then, thanks.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64151





More information about the llvm-commits mailing list