More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43580 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp
index aeecdb7..0437c20 100644
--- a/Parse/ParseDecl.cpp
+++ b/Parse/ParseDecl.cpp
@@ -552,6 +552,58 @@
   }
 }
 
+/// ParseObjcTypeQualifierList - This routine parses the objective-c's type
+/// qualifier list and builds their bitmask representation in the input
+/// argument.
+void Parser::ParseObjcTypeQualifierList(ObjcDeclSpec &DS) {
+  bool found = true;
+  while (found) {
+    found = false;
+    if (Tok.is(tok::identifier)) {
+      const IdentifierInfo *II = Tok.getIdentifierInfo();
+      unsigned i;
+      for (i = 0; i < objc_NumQuals; ++i) {
+        if (II == ObjcTypeQuals[i]) {
+          switch (i) {
+            case objc_in:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_In);
+              ConsumeToken();
+              found = true;
+              break;
+            case objc_out:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_Out);
+              ConsumeToken();
+              found = true;
+              break;
+            case objc_inout:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_Inout);
+              ConsumeToken();
+              found = true;
+              break;
+            case objc_oneway:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_Oneway);
+              ConsumeToken();
+              found = true;
+              break;
+            case objc_bycopy:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_Bycopy);
+              ConsumeToken();
+              found = true;
+              break;
+            case objc_byref:
+              DS.setObjcDeclQualifier(ObjcDeclSpec::DQ_Byref);
+              ConsumeToken();
+              found = true;
+              break;
+          }
+          if (found)
+            break;
+        }
+      }
+    }
+  }
+}
+
 /// ParseTag - Parse "struct-or-union-or-class-or-enum identifier[opt]", where
 /// the first token has already been read and has been turned into an instance
 /// of DeclSpec::TST (TagType).  This returns true if there is an error parsing,