[all-commits] [llvm/llvm-project] 4d1b7e: Fix a few cases that were incorrectly parsed as un...

Richard Smith via All-commits all-commits at lists.llvm.org
Mon Jun 29 14:41:45 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d1b7e9820ee9c87541619ce4dd41e92dc43cd9c
      https://github.com/llvm/llvm-project/commit/4d1b7e9820ee9c87541619ce4dd41e92dc43cd9c
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-06-29 (Mon, 29 Jun 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/lib/Parse/ParseExpr.cpp
    A clang/test/Parser/expressions.cpp

  Log Message:
  -----------
  Fix a few cases that were incorrectly parsed as unary-expressions
instead of postfix-expressions, and improve error recovery for postfix
operators after unary-expressions.

This covers nullptr, __null, and some calls to type traits with special
parsing rules. We would previously not parse a postfix-expression suffix
for these expressions, so would reject expressions such as
__is_trivial(int)["foo"].

For the case where a postfix-expression suffix is *not* permitted after
a unary-expression (for example, after a new-expression or sizeof
expression), produce a diagnostic if one appears there anyway. That's
always ill-formed, but previously produced very bad diagnostics.




More information about the All-commits mailing list