Improve diagnostics for dangling '}'.

Fixes PR6484. Patch from Jason Switzer!

llvm-svn: 148270
This commit is contained in:
Nico Weber 2012-01-17 01:04:27 +00:00
parent 64a7e741b0
commit e1df10a79e
4 changed files with 4 additions and 3 deletions

View File

@ -119,6 +119,7 @@ def err_parse_error : Error<"parse error">;
def err_expected_expression : Error<"expected expression">;
def err_expected_type : Error<"expected a type">;
def err_expected_external_declaration : Error<"expected external declaration">;
def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
def err_expected_ident : Error<"expected identifier">;
def err_expected_ident_lparen : Error<"expected identifier or '('">;
def err_expected_ident_lbrace : Error<"expected identifier or '{'">;

View File

@ -552,7 +552,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
// TODO: Invoke action for top-level semicolon.
return DeclGroupPtrTy();
case tok::r_brace:
Diag(Tok, diag::err_expected_external_declaration);
Diag(Tok, diag::err_extraneous_closing_brace);
ConsumeBrace();
return DeclGroupPtrTy();
case tok::eof:

View File

@ -7,7 +7,7 @@ int @"s" = 5; // expected-error {{prefix attribute must be}}
// rdar://6480479
@interface A // expected-note {{class started here}}
}; // expected-error {{missing '@end'}} \
// expected-error {{expected external declaration}} \
// expected-error {{extraneous closing brace ('}')}} \
// expected-warning{{extra ';' outside of a function}}

View File

@ -16,7 +16,7 @@ static void f (char * (*g) (char **, int), char **p, ...) {
// PR3172
} // expected-error {{expected external declaration}}
} // expected-error {{extraneous closing brace ('}')}}
// rdar://6094870