[PATCH] D24686: [support] Some improvements to StringSwitch

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 13:26:08 PDT 2016


It just comes to my mind that you could make StringSwitch case-insensitive
instead of adding case-insensitive versions of StartsWith, Case and Cases.
It'd probably be something like

  auto Ret = StringSwtich<T>(Str, /*CaseInsensitive=*/true)
      .Case("foo", bar) //  "foo" is compared in the insensitive manner
      ...

With this, you don't need to double the number of member functions.

On Mon, Oct 3, 2016 at 1:15 PM, Zachary Turner <zturner at google.com> wrote:

> zturner updated this revision to Diff 73327.
> zturner added a comment.
>
> Unit tests for the case-sensitive versions were removed and submitted
> separately.  The `Optional` variant of the function is removed and will be
> submitted later.  This patch only contains case-insensitive versions of the
> functions with associated unit tests.
>
>
> https://reviews.llvm.org/D24686
>
> Files:
>   include/llvm/ADT/StringSwitch.h
>   unittests/ADT/StringSwitchTest.cpp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161003/52642008/attachment.html>


More information about the llvm-commits mailing list