diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-31 21:59:43 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-31 21:59:43 +0000 |
commit | 19d74e1494fe399f0e2a94e9419c095f8214851b (patch) | |
tree | 071e9d42118902ae072cfc4b2e26f97577a7275c /Parse/ParseDecl.cpp | |
parent | 9544ff2d96a5630b4219bbda41bb7476f01d9bf1 (diff) |
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
Diffstat (limited to 'Parse/ParseDecl.cpp')
-rw-r--r-- | Parse/ParseDecl.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp index aeecdb7872..0437c202f3 100644 --- a/Parse/ParseDecl.cpp +++ b/Parse/ParseDecl.cpp @@ -552,6 +552,58 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { } } +/// 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, |