[cfe-commits] r41333 - in /cfe/trunk/Parse: ParseObjc.cpp Parser.cpp
Steve Naroff
snaroff at apple.com
Thu Aug 23 12:56:31 PDT 2007
Author: snaroff
Date: Thu Aug 23 14:56:30 2007
New Revision: 41333
URL: http://llvm.org/viewvc/llvm-project?rev=41333&view=rev
Log:
- Cleanup "hack" comment and fix typos.
- Use getLang().ObjC2 when appropriate.
Modified:
cfe/trunk/Parse/ParseObjc.cpp
cfe/trunk/Parse/Parser.cpp
Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=41333&r1=41332&r2=41333&view=diff
==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Thu Aug 23 14:56:30 2007
@@ -122,15 +122,18 @@
IdentifierInfo *nameId = Tok.getIdentifierInfo();
SourceLocation nameLoc = ConsumeToken();
- if (Tok.getKind() == tok::l_paren) { // we have a category
+ if (Tok.getKind() == tok::l_paren) { // we have a category.
SourceLocation lparenLoc = ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
- // OBJC2: The cateogry name is optional (not an error).
+ // For ObjC2, the category name is optional (not an error).
if (Tok.getKind() == tok::identifier) {
categoryId = Tok.getIdentifierInfo();
categoryLoc = ConsumeToken();
+ } else if (!getLang().ObjC2) {
+ Diag(Tok, diag::err_expected_ident); // missing category name.
+ return 0;
}
if (Tok.getKind() != tok::r_paren) {
Diag(Tok, diag::err_expected_rparen);
@@ -268,7 +271,7 @@
ParseObjCMethodDecl(methodType, methodLoc);
// If attributes exist after the method, parse them.
- if (Tok.getKind() == tok::kw___attribute)
+ if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute)
ParseAttributes();
// Consume the ';'.
@@ -387,7 +390,7 @@
ParseObjCTypeName();
// If attributes exist before the argument name, parse them.
- if (Tok.getKind() == tok::kw___attribute)
+ if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute)
ParseAttributes();
if (Tok.getKind() != tok::identifier) {
Modified: cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/Parser.cpp?rev=41333&r1=41332&r2=41333&view=diff
==============================================================================
--- cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/trunk/Parse/Parser.cpp Thu Aug 23 14:56:30 2007
@@ -370,8 +370,8 @@
return Actions.ParsedFreeStandingDeclSpec(CurScope, DS);
}
- // OBJC: This grammar hack allows prefix attributes on class interfaces.
- if (Tok.getKind() == tok::at) {
+ // ObjC2 allows prefix attributes on class interfaces.
+ if (getLang().ObjC2 && Tok.getKind() == tok::at) {
SourceLocation AtLoc = ConsumeToken(); // the "@"
if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_interface)
return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes());
More information about the cfe-commits
mailing list