Move the warnings for extra semi-colons under -Wextra-semi.  Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156934 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c
index e899517..98130c5 100644
--- a/test/Misc/warning-flags.c
+++ b/test/Misc/warning-flags.c
@@ -17,7 +17,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (245):
+CHECK: Warnings without flags (242):
 CHECK-NEXT:   ext_anonymous_struct_union_qualified
 CHECK-NEXT:   ext_binary_literal
 CHECK-NEXT:   ext_cast_fn_obj
@@ -33,8 +33,6 @@
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_instantiation_without_qualified_id
 CHECK-NEXT:   ext_explicit_specialization_storage_class
-CHECK-NEXT:   ext_extra_ivar_semi
-CHECK-NEXT:   ext_extra_struct_semi
 CHECK-NEXT:   ext_forward_ref_enum
 CHECK-NEXT:   ext_freestanding_complex
 CHECK-NEXT:   ext_hexconstant_invalid
@@ -65,7 +63,6 @@
 CHECK-NEXT:   ext_subscript_non_lvalue
 CHECK-NEXT:   ext_template_arg_extra_parens
 CHECK-NEXT:   ext_thread_before
-CHECK-NEXT:   ext_top_level_semi
 CHECK-NEXT:   ext_typecheck_addrof_void
 CHECK-NEXT:   ext_typecheck_cast_nonscalar
 CHECK-NEXT:   ext_typecheck_cast_to_union
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index 1b3dd41..75e3fba 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -14,9 +14,9 @@
 public:
   void m() {
     int l = 2;
-  };
+  }; // expected-warning{{extra ';' after function definition}}
 
-  template<typename T> void mt(T) { };
+  template<typename T> void mt(T) { }
   ; // expected-warning{{extra ';' inside a class}}
 
   virtual int vf() const volatile = 0;
diff --git a/test/Parser/cxx-extra-semi.cpp b/test/Parser/cxx-extra-semi.cpp
new file mode 100644
index 0000000..35c886b
--- /dev/null
+++ b/test/Parser/cxx-extra-semi.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t
+
+class A {
+  void A1();
+  void A2() { }; // expected-warning{{extra ';' after function definition}}
+  ; // expected-warning{{extra ';' inside a class}}
+  void A3() { };  ;; // expected-warning{{extra ';' after function definition}}
+  ;;;;;;; // expected-warning{{extra ';' inside a class}}
+  ; // expected-warning{{extra ';' inside a class}}
+  ; ;;		 ;  ;;; // expected-warning{{extra ';' inside a class}}
+    ;  ; 	;	;  ;; // expected-warning{{extra ';' inside a class}}
+  void A4();
+};
+
+union B {
+  int a1;
+  int a2;; // expected-warning{{extra ';' inside a union}}
+};
+
+; // expected-warning{{extra ';' outside of a function}}
+; ;;// expected-warning{{extra ';' outside of a function}}
+