This is an archive of the discontinued LLVM Phabricator instance.

Suggest fix-it for missing '{' after base-clause
ClosedPublic

Authored by ismailp on Aug 11 2014, 11:05 AM.

Details

Reviewers
rtrieu
rsmith
Summary

Suggest fix-it for missing '{' after base-clause, and try to recover.

Diff Detail

Event Timeline

ismailp updated this revision to Diff 12355.Aug 11 2014, 11:05 AM
ismailp retitled this revision from to Suggest fix-it for missing '{' after base-clause.
ismailp updated this object.
ismailp edited the test plan for this revision. (Show Details)
ismailp added reviewers: rsmith, rtrieu.
ismailp added a subscriber: Unknown Object (MLST).
rsmith edited edge metadata.Aug 11 2014, 11:14 AM

Is this sufficiently high-confidence for a fix-it? Maybe the problem is a missing ,, or someone put virtual after the type, or similar. Maybe we failed to parse a base class template specialization and we're lost in the middle of a template-argument-list?

Let's try a bit harder to be sure here. How about checking for the next token being at the start of a line, and one of the following:

  • the next token is public, protected, or private, followed by a :
  • the next token is static_assert
  • the next tokens are a valid simple-declaration (see Parser::isCXXSimpleDeclaration)

One more obvious case: the next token is }.

ismailp updated this revision to Diff 13146.Sep 1 2014, 1:58 PM
ismailp edited edge metadata.

To increase confidence when suggesting fix-it:

  • Expect certain keywords at the start of line, and maybe followed by ':'
  • Expect '}'
  • Expect a constructor declaration
rsmith accepted this revision.Sep 24 2014, 8:08 PM
rsmith edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 24 2014, 8:08 PM
ismailp closed this revision.Sep 25 2014, 2:23 PM

Thank you! Landed in r218468.