Generalize the skipping logic to allow skipping until any one of a set of
tokens is found.

llvm-svn: 39419
diff --git a/clang/Parse/Parser.cpp b/clang/Parse/Parser.cpp
index cf440cf..6f49942 100644
--- a/clang/Parse/Parser.cpp
+++ b/clang/Parse/Parser.cpp
@@ -92,19 +92,22 @@
 /// 
 /// If SkipUntil finds the specified token, it returns true, otherwise it
 /// returns false.  
-bool Parser::SkipUntil(tok::TokenKind T, bool StopAtSemi, bool DontConsume) {
+bool Parser::SkipUntil(const tok::TokenKind *Toks, unsigned NumToks,
+                       bool StopAtSemi, bool DontConsume) {
   // We always want this function to skip at least one token if the first token
   // isn't T and if not at EOF.
   bool isFirstTokenSkipped = true;
   while (1) {
-    // If we found the token, stop and return true.
-    if (Tok.getKind() == T) {
-      if (DontConsume) {
-        // Noop, don't consume the token.
-      } else {
-        ConsumeAnyToken();
+    // If we found one of the tokens, stop and return true.
+    for (unsigned i = 0; i != NumToks; ++i) {
+      if (Tok.getKind() == Toks[i]) {
+        if (DontConsume) {
+          // Noop, don't consume the token.
+        } else {
+          ConsumeAnyToken();
+        }
+        return true;
       }
-      return true;
     }
     
     switch (Tok.getKind()) {
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 2e4d654..f4f0bb5 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -228,8 +228,17 @@
   /// If SkipUntil finds the specified token, it returns true, otherwise it
   /// returns false.  
   bool SkipUntil(tok::TokenKind T, bool StopAtSemi = true,
-                 bool DontConsume = false);
-    
+                 bool DontConsume = false) {
+    return SkipUntil(&T, 1, StopAtSemi, DontConsume);
+  }
+  bool SkipUntil(tok::TokenKind T1, tok::TokenKind T2, bool StopAtSemi = true,
+                 bool DontConsume = false) {
+    tok::TokenKind TokArray[] = {T1, T2};
+    return SkipUntil(TokArray, 2, StopAtSemi, DontConsume);
+  }
+  bool SkipUntil(const tok::TokenKind *Toks, unsigned NumToks,
+                 bool StopAtSemi = true, bool DontConsume = false);
+   
   //===--------------------------------------------------------------------===//
   // C99 6.9: External Definitions.
   DeclTy *ParseExternalDeclaration();