diff options
author | Sean Hunt <rideau3@gmail.com> | 2010-08-18 23:23:09 +0000 |
---|---|---|
committer | Sean Hunt <rideau3@gmail.com> | 2010-08-18 23:23:09 +0000 |
commit | 726a3d284ec1949c4ccf77e79ca0506e8a38b05c (patch) | |
tree | 75c943e97b2ac83bcba258b0259f2d28e6cc6538 /include | |
parent | cd799ce8f8b93dc203aaee41900e346f097eb428 (diff) | |
download | external_llvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.zip external_llvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.tar.gz external_llvm-726a3d284ec1949c4ccf77e79ca0506e8a38b05c.tar.bz2 |
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.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringSwitch.h b/include/llvm/ADT/StringSwitch.h index 7dd5647..7480583 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) { |