[all-commits] [llvm/llvm-project] 6e63f9: [Parse] Improve diagnostic and recovery when there...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Oct 18 01:00:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e63f96e11ee9af300b166c994980d3b80cea0c7
      https://github.com/llvm/llvm-project/commit/6e63f96e11ee9af300b166c994980d3b80cea0c7
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2021-10-18 (Mon, 18 Oct 2021)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/lib/Parse/ParseDecl.cpp
    A clang/test/Parser/cxx-extra-virtual-specifiers.cpp

  Log Message:
  -----------
  [Parse] Improve diagnostic and recovery when there is an extra override in the outline method definition.

The clang behavior was poor before this patch:

```
void B::foo() override {}
// Before: clang emited "expcted function body after function
// declarator", and skiped all contents until it hits a ";", the
// following function f() is discarded.

// VS

// Now "override is not allowed" with a remove fixit, and following f()
// is retained.
void f();
```

Differential Revision: https://reviews.llvm.org/D111883




More information about the All-commits mailing list