[PATCH] D24686: [support] Some improvements to StringSwitch
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 16 15:08:50 PDT 2016
zturner created this revision.
zturner added reviewers: rsmith, chandlerc.
zturner added a subscriber: llvm-commits.
Herald added subscribers: mgorny, beanz.
This patch does a number of things:
1. Adds case-insensitive versions of all case functions. This means `CaseLower`, `StartsWithLower`, `EndsWithLower`, and `CasesLower`.
2. Converts the `Cases` function to use variadic templates. Thanks to rsmith@ for the magic incantation to make this work.
3. Adds an alternative to `Default()` that returns an `llvm::Expected<T>`. This is useful when you `Default` is insufficient to determine that a switch fell off the end.
3. Adds unit tests for the new case-insensitive versions of the function, as well as the old ones (there were previously 0 unit tests for `StringSwitch`).
https://reviews.llvm.org/D24686
Files:
include/llvm/ADT/StringSwitch.h
unittests/ADT/CMakeLists.txt
unittests/ADT/StringSwitchTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24686.71706.patch
Type: text/x-patch
Size: 15256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160916/4a4f4b0f/attachment.bin>
More information about the llvm-commits
mailing list