Improve diagnostics for dangling '}'.
Fixes PR6484. Patch from Jason Switzer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148270 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index e4a9fdc..7675a56 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -119,6 +119,7 @@
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/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index e09ee79..db9460b 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -552,7 +552,7 @@
// 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/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m
index 72cb1e1..0bdeb46 100644
--- a/test/Parser/objc-quirks.m
+++ b/test/Parser/objc-quirks.m
@@ -7,7 +7,7 @@
// 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/test/Parser/recovery.c b/test/Parser/recovery.c
index 15fd12b..3916acf 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -16,7 +16,7 @@
// PR3172
-} // expected-error {{expected external declaration}}
+} // expected-error {{extraneous closing brace ('}')}}
// rdar://6094870