[PATCH] Improve diagnostic message for misplaced square brackets

Richard Smith richard at metafoo.co.uk
Thu May 22 19:57:09 PDT 2014


Looks great, ship it!

Wait... one more thing:

  int [3] *x;

We should suggest adding parentheses here, because

  int *x[3];

means the wrong thing.


On Thu, May 22, 2014 at 7:00 PM, Richard Trieu <rtrieu at google.com> wrote:

> Moved the misplaced bracket logic from ParseDirectDeclarator into its own
> method.
> Use a temporary Declarator to store the bracket location instead of using
> a custom storage object.
> Renamed getDiagLoc to getMissingDeclaratorIdLoc.
> Fixed up paren/bracket mistakes.
>
> http://reviews.llvm.org/D2712
>
> Files:
>   include/clang/Basic/DiagnosticParseKinds.td
>   include/clang/Parse/Parser.h
>   lib/Parse/ParseDecl.cpp
>   test/Parser/brackets.c
>   test/Parser/brackets.cpp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140522/56a61c40/attachment.html>


More information about the cfe-commits mailing list