//===--- ParseObjc.cpp - Objective C Parsing ------------------------------===////// The LLVM Compiler Infrastructure//// This file was developed by Steve Naroff and is distributed under// the University of Illinois Open Source License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the Objective-C portions of the Parser interface.////===----------------------------------------------------------------------===//#include"clang/Parse/Parser.h"#include"clang/Parse/DeclSpec.h"#include"clang/Basic/Diagnostic.h"#include"llvm/ADT/SmallVector.h"usingnamespaceclang;/// ParseExternalDeclaration:/// external-declaration: [C99 6.9]/// [OBJC] objc-class-definition/// [OBJC] objc-class-declaration/// [OBJC] objc-alias-declaration/// [OBJC] objc-protocol-definition/// [OBJC] objc-method-definition/// [OBJC] '@' 'end'Parser::DeclTy*Parser::ParseObjCAtDirectives(){SourceLocationAtLoc=ConsumeToken();// the "@"switch(Tok.getObjCKeywordID()){casetok::objc_class:returnParseObjCAtClassDeclaration(AtLoc);casetok::objc_interface:returnParseObjCAtInterfaceDeclaration(AtLoc);casetok::objc_protocol:returnParseObjCAtProtocolDeclaration(AtLoc);casetok::objc_implementation:returnObjcImpDecl=ParseObjCAtImplementationDeclaration(AtLoc);casetok::objc_end:returnParseObjCAtEndDeclaration(AtLoc);casetok::objc_compatibility_alias:returnParseObjCAtAliasDeclaration(AtLoc);casetok::objc_synthesize:returnParseObjCPropertySynthesize(AtLoc);casetok::objc_dynamic:returnParseObjCPropertyDynamic(AtLoc);default:Diag(AtLoc,diag::err_unexpected_at);SkipUntil(tok::semi);return0;}}////// objc-class-declaration: /// '@' 'class' identifier-list ';'/// Parser::DeclTy*Parser::ParseObjCAtClassDeclaration(SourceLocationatLoc){ConsumeToken();// the identifier "class"llvm::SmallVector<IdentifierInfo*,8>ClassNames;while(1){if(Tok.isNot(tok::identifier)){Diag(Tok,diag::err_expected_ident);SkipUntil(tok::semi);return0;}ClassNames.push_back(Tok.getIdentifierInfo());ConsumeToken();if