summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSean Hunt <rideau3@gmail.com>2010-08-18 23:23:09 +0000
committerSean Hunt <rideau3@gmail.com>2010-08-18 23:23:09 +0000
commit726a3d284ec1949c4ccf77e79ca0506e8a38b05c (patch)
tree75c943e97b2ac83bcba258b0259f2d28e6cc6538 /include
parentcd799ce8f8b93dc203aaee41900e346f097eb428 (diff)
downloadllvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.tar.gz
llvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.tar.bz2
llvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.tar.xz
Finish full attribute class emission for clang.
For more information, see the accompanying clang patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/StringSwitch.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringSwitch.h b/include/llvm/ADT/StringSwitch.h
index 7dd5647df6..74805830d8 100644
--- a/include/llvm/ADT/StringSwitch.h
+++ b/include/llvm/ADT/StringSwitch.h
@@ -61,6 +61,26 @@ public:
return *this;
}
+ template<unsigned N>
+ StringSwitch& EndsWith(const char (&S)[N], const T &Value) {
+ if (!Result && Str.size() >= N-1 &&
+ std::memcmp(S, Str.data() + Str.size() + 1 - N, N-1) == 0) {
+ Result = &Value;
+ }
+
+ return *this;
+ }
+
+ template<unsigned N>
+ StringSwitch& StartsWith(const char (&S)[N], const T &Value) {
+ if (!Result && Str.size() >= N-1 &&
+ std::memcmp(S, Str.data(), N-1) == 0) {
+ Result = &Value;
+ }
+
+ return *this;
+ }
+
template<unsigned N0, unsigned N1>
StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
const T& Value) {