[cfe-commits] r55417 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/DiagnosticKinds.def include/clang/Basic/LangOptions.h include/clang/Parse/DeclSpec.h lib/AST/ASTContext.cpp lib/AST/Type.cpp lib/AST/TypeSerialization.cpp lib/Parse/ParseDecl.cpp lib/Sema/SemaType.cpp test/Parser/block-pointer-decl.c

Chris Lattner clattner at apple.com
Wed Aug 27 11:47:25 PDT 2008


On Aug 27, 2008, at 9:04 AM, Steve Naroff wrote:

> Author: snaroff
> Date: Wed Aug 27 11:04:49 2008
> New Revision: 55417
>
> URL: http://llvm.org/viewvc/llvm-project?rev=55417&view=rev
> Log:
> First wave of changes to support "blocks" (an extension to C).
> This commit adds the declaration syntax (and associated type).

Very nice Steve!

> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Aug 27 11:04:49 2008
> @@ -1111,14 +1111,15 @@
> void Parser::ParseDeclaratorInternal(Declarator &D) {
>   tok::TokenKind Kind = Tok.getKind();
>
> -  // Not a pointer or C++ reference.
> -  if (Kind != tok::star && (Kind != tok::amp || ! 
> getLang().CPlusPlus))
> +  // Not a pointer, C++ reference, or block.
> +  if (Kind != tok::star && (Kind != tok::amp || ! 
> getLang().CPlusPlus) &&
> +      (Kind != tok::caret || !getLang().Blocks))
>     return ParseDirectDeclarator(D);
>
>   // Otherwise, '*' -> pointer or '&' -> reference.
>   SourceLocation Loc = ConsumeToken();  // Eat the * or &.
>
> -  if (Kind == tok::star) {
> +  if (Kind == tok::star || Kind == tok::caret) {

Does this need a check of getLang().Blocks in the caret case?

Otherwise, patch looks great to me,

-Chris



More information about the cfe-commits mailing list