- Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
The later fails if the token is not an identifier.
- Replace tabs with spaces.
- Various other cleanups.
Patch by Nico Weber!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45368 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp
index 732311d..2e15cbd 100644
--- a/Parse/Parser.cpp
+++ b/Parse/Parser.cpp
@@ -374,8 +374,12 @@
// ObjC2 allows prefix attributes on class interfaces.
if (getLang().ObjC2 && Tok.is(tok::at)) {
SourceLocation AtLoc = ConsumeToken(); // the "@"
- if (Tok.getIdentifierInfo()->getObjCKeywordID() == tok::objc_interface)
- return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes());
+ if (!Tok.isObjCAtKeyword(tok::objc_interface)) {
+ Diag(Tok, diag::err_objc_expected_property_attr);//FIXME:better diagnostic
+ SkipUntil(tok::semi); // FIXME: better skip?
+ return 0;
+ }
+ return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes());
}
// Parse the first declarator.