[llvm-commits] [llvm] r89099 - /llvm/trunk/include/llvm/ADT/StringSwitch.h

Nuno Lopes nunoplopes at sapo.pt
Tue Nov 17 07:35:39 PST 2009


Author: nlopes
Date: Tue Nov 17 09:35:39 2009
New Revision: 89099

URL: http://llvm.org/viewvc/llvm-project?rev=89099&view=rev
Log:
add Case() with 5 args

Modified:
    llvm/trunk/include/llvm/ADT/StringSwitch.h

Modified: llvm/trunk/include/llvm/ADT/StringSwitch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringSwitch.h?rev=89099&r1=89098&r2=89099&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringSwitch.h (original)
+++ llvm/trunk/include/llvm/ADT/StringSwitch.h Tue Nov 17 09:35:39 2009
@@ -83,6 +83,14 @@
                       const T& Value) {
     return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value);
   }
+
+  template<unsigned N0, unsigned N1, unsigned N2, unsigned N3, unsigned N4>
+  StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1],
+                      const char (&S2)[N2], const char (&S3)[N3],
+                       const char (&S4)[N4], const T& Value) {
+    return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value)
+      .Case(S4, Value);
+  }
   
   T Default(const T& Value) {
     if (ResultKnown)





More information about the llvm-commits mailing list