[cfe-commits] r41723 - in /cfe/trunk: Parse/ParseExpr.cpp Parse/ParseObjc.cpp include/clang/Parse/Parser.h test/Parser/method-prototype-1.m
Chris Lattner
clattner at apple.com
Wed Sep 26 16:44:51 PDT 2007
On Sep 5, 2007, at 12:52 PM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Wed Sep 5 14:52:07 2007
> New Revision: 41723
>
> URL: http://llvm.org/viewvc/llvm-project?rev=41723&view=rev
> Log:
> 1. Fix parsing of method prototype involving c-style argument
> declarations.
> 2. Fixes all allowable key-words used as selectors.
> 3. Template to do the messaging parse.
> 4. A test case for all allowable selector names.
Hi Fariborz,
> ======================================================================
> ========
> --- cfe/trunk/Parse/ParseObjc.cpp (original)
> +++ cfe/trunk/Parse/ParseObjc.cpp Wed Sep 5 14:52:07 2007
> @@ -384,10 +384,9 @@
> tok::TokenKind tKind = Tok.getKind();
> IdentifierInfo *II = 0;
>
> + if (tKind == tok::identifier || tKind == tok::kw_typeof ||
> + tKind == tok::kw___alignof ||
> (tKind >= tok::kw_auto && tKind <= tok::kw__Complex)) {
> II = Tok.getIdentifierInfo();
> ConsumeToken();
> }
This predicate in Parser::ParseObjCSelector() seems really fragile to
me, because it prevents reordering of keywords in the keyword table.
Is the idea here to allow any identifier or keyword? If so, a better
thing to do would be:
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II != 0)
ConsumeToken();
...
This will eat and return the identifier info for anything that is an
identifier or keyword. Would this work for your needs here?
-Chris
More information about the cfe-commits
mailing list