summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-01-17 01:04:27 +0000
committerNico Weber <nicolasweber@gmx.de>2012-01-17 01:04:27 +0000
commite1df10a79ea070a16cf8b3aa666e74b14cbe6798 (patch)
tree4956d3f3447044cbb279859f0df01ff3af1af417 /clang
parent64a7e741b0654cebaa9948aebf15f5e3522d4bea (diff)
downloadbcm5719-llvm-e1df10a79ea070a16cf8b3aa666e74b14cbe6798.tar.gz
bcm5719-llvm-e1df10a79ea070a16cf8b3aa666e74b14cbe6798.zip
Improve diagnostics for dangling '}'.
Fixes PR6484. Patch from Jason Switzer! llvm-svn: 148270
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/DiagnosticParseKinds.td1
-rw-r--r--clang/lib/Parse/Parser.cpp2
-rw-r--r--clang/test/Parser/objc-quirks.m2
-rw-r--r--clang/test/Parser/recovery.c2
4 files changed, 4 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index e4a9fdc3a42..7675a566ebd 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -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 '{'">;
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index e09ee79c8cb..db9460bca4f 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -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:
diff --git a/clang/test/Parser/objc-quirks.m b/clang/test/Parser/objc-quirks.m
index 72cb1e1d7c9..0bdeb464e77 100644
--- a/clang/test/Parser/objc-quirks.m
+++ b/clang/test/Parser/objc-quirks.m
@@ -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}}
diff --git a/clang/test/Parser/recovery.c b/clang/test/Parser/recovery.c
index 15fd12b715b..3916acfda1e 100644
--- a/clang/test/Parser/recovery.c
+++ b/clang/test/Parser/recovery.c
@@ -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
OpenPOWER on IntegriCloud