]> granicus.if.org Git - clang/commitdiff
Make the "extra ';' inside a struct or union" diagnostic more
authorDouglas Gregor <dgregor@apple.com>
Wed, 16 Jun 2010 23:08:59 +0000 (23:08 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 16 Jun 2010 23:08:59 +0000 (23:08 +0000)
precise. Fixes PR7336.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106170 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticParseKinds.td
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseObjc.cpp
test/Index/code-complete-errors.c

index 42080d5c4c2be3be68f45b3e684651d1c06380e5..e4f9092628fe2851a8ac065433aa27857526fee2 100644 (file)
@@ -24,7 +24,9 @@ def ext_empty_source_file : Extension<"ISO C forbids an empty source file">;
 def ext_top_level_semi : Extension<
   "extra ';' outside of a function">;
 def ext_extra_struct_semi : Extension<
-  "extra ';' inside a struct or union">;
+  "extra ';' inside a %0">;
+def ext_extra_ivar_semi : Extension<
+  "extra ';' inside instance variable list">;
 
 def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">;
 def ext_plain_complex : ExtWarn<
index 532aff797fbb4bc13f2a6fcd5399d781faa6f23f..65c42193f66e9d6a98d7514d6e14ff3ceeaa10bb 100644 (file)
@@ -1777,6 +1777,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi)
+        << DeclSpec::getSpecifierName((DeclSpec::TST)TagType)
         << FixItHint::CreateRemoval(Tok.getLocation());
       ConsumeToken();
       continue;
index 9cf025df5eda05a0c125a2f053aac986e3b217e9..fe3122645b1e5766ccb3e0dfb851e05d5506bb85 100644 (file)
@@ -1570,6 +1570,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi)
+        << DeclSpec::getSpecifierName((DeclSpec::TST)TagType)
         << FixItHint::CreateRemoval(Tok.getLocation());
       ConsumeToken();
       continue;
index 365733d8c4cb4c46f57216edca3d23f1d7f9b6db..8e32653126fbd165e665cbac86bbf88967aaf61b 100644 (file)
@@ -1014,7 +1014,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
 
     // Check for extraneous top-level semicolon.
     if (Tok.is(tok::semi)) {
-      Diag(Tok, diag::ext_extra_struct_semi)
+      Diag(Tok, diag::ext_extra_ivar_semi)
         << FixItHint::CreateRemoval(Tok.getLocation());
       ConsumeToken();
       continue;
index 29c2a86198693a7a556297b0b8d0a1ae32b88f17..01c298c01d99214ef185ed1b675621c60b107dea 100644 (file)
@@ -1,7 +1,7 @@
 _Complex cd; // CHECK: code-complete-errors.c:1:1: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
 // CHECK: FIX-IT: Insert " double" at 1:9
 struct s {
-  int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct or union
+  int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct
 }; // CHECK: FIX-IT: Remove [4:12 - 4:13]
 
 struct s s0 = { y: 5 }; // CHECK: code-complete-errors.c:7:20: warning: use of GNU old-style field designator extension