Removed option "-parse-ast-check" from clang driver.  This is now implemented
using "-parse-ast -verify".

Updated all test cases (using a sed script) that invoked -parse-ast-check to
now use -parse-ast -verify.

Fixed a bug where using "-verify" instead of "-parse-ast-check" would not
correctly create the DiagClient needed to accumulate diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42365 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index f1a5ea9..b5c1559 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -53,7 +53,6 @@
   ParseASTPrint,                // Parse ASTs and print them.
   ParseASTDump,                 // Parse ASTs and dump them.
   ParseASTView,                 // Parse ASTs and view them in Graphviz.
-  ParseASTCheck,                // Parse ASTs and check diagnostics.
   BuildAST,                     // Parse ASTs.  
   ParseCFGDump,                 // Parse ASTS. Build CFGs. Print CFGs.
   ParseCFGView,                 // Parse ASTS. Build CFGs. View CFGs.
@@ -93,8 +92,6 @@
                         "Run parser, build ASTs, then dump them"),
              clEnumValN(ParseASTView, "parse-ast-view",
                         "Run parser, build ASTs, and view them with GraphViz."),
-             clEnumValN(ParseASTCheck, "parse-ast-check",
-                        "Run parser, build ASTs, then check diagnostics"),
              clEnumValN(ParseCFGDump, "dump-cfg",
                         "Run parser, then build and print CFGs."),
              clEnumValN(ParseCFGView, "view-cfg",
@@ -809,7 +806,6 @@
 
   ASTConsumer* Consumer = NULL;
   bool ClearSourceMgr = false;
-  bool PerformDiagnosticsCheck = VerifyDiagnostics;
   
   switch (ProgAction) {
   default:
@@ -853,8 +849,6 @@
     ClearSourceMgr = true;
     break;
       
-  case ParseASTCheck:
-    PerformDiagnosticsCheck = true;
   case ParseSyntaxOnly:              // -fsyntax-only
   case BuildAST:
     Consumer = new ASTConsumer();
@@ -895,7 +889,7 @@
   }
   
   if (Consumer) {
-    if (PerformDiagnosticsCheck)
+    if (VerifyDiagnostics)
       exit (CheckASTConsumer(PP, MainFileID, Consumer));
     else
       ParseAST(PP, MainFileID, *Consumer, Stats);
@@ -948,7 +942,7 @@
   InitializeLanguageStandard(LangInfo);
 
   std::auto_ptr<TextDiagnostics> DiagClient;
-  if (ProgAction != ParseASTCheck) {
+  if (!VerifyDiagnostics) {
     // Print diagnostics to stderr by default.
     DiagClient.reset(new TextDiagnosticPrinter(SourceMgr));
   } else {
@@ -957,7 +951,7 @@
    
     if (InputFilenames.size() != 1) {
       fprintf(stderr,
-              "parse-ast-check only works on single input files for now.\n");
+              "-verify only works on single input files for now.\n");
       return 1;
     }
   }
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
index 20d9045..444500d 100644
--- a/test/Lexer/block_cmt_end.c
+++ b/test/Lexer/block_cmt_end.c
@@ -3,7 +3,7 @@
   RUN: clang -E %s | grep foo &&
   RUN: clang -E %s | not grep abc &&
   RUN: clang -E %s | not grep xyz &&
-  RUN: clang -parse-ast-check %s
+  RUN: clang -parse-ast -verify %s
  */
 
 // This is a simple comment, /*/ does not end a comment, the trailing */ does.
diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c
index f7e4cd0..5d0f301 100644
--- a/test/Lexer/constants.c
+++ b/test/Lexer/constants.c
@@ -1,4 +1,4 @@
-/* RUN: clang -parse-ast-check %s
+/* RUN: clang -parse-ast -verify %s
  */
 
 int x = 000000080;  /* expected-error {{invalid digit}} */
diff --git a/test/Lexer/cxx0x_keyword.cpp b/test/Lexer/cxx0x_keyword.cpp
index f3a8a7a..267416a 100644
--- a/test/Lexer/cxx0x_keyword.cpp
+++ b/test/Lexer/cxx0x_keyword.cpp
@@ -1,2 +1,2 @@
-// RUN: clang -parse-ast-check -std=c++0x %s 2>&1
+// RUN: clang -parse-ast -verify -std=c++0x %s 2>&1
 int static_assert; /* expected-error {{expected identifier or '('}}} */
diff --git a/test/Misc/diag-checker.c b/test/Misc/diag-checker.c
index 2aa5051..c988ccb 100644
--- a/test/Misc/diag-checker.c
+++ b/test/Misc/diag-checker.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 #include <stdio.h>
 
diff --git a/test/Parser/CompoundStmtScope.c b/test/Parser/CompoundStmtScope.c
index d6a4730..4d1da43 100644
--- a/test/Parser/CompoundStmtScope.c
+++ b/test/Parser/CompoundStmtScope.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int foo() {
   {
diff --git a/test/Parser/argument_redef.c b/test/Parser/argument_redef.c
index c3dae51..2dce5ab 100644
--- a/test/Parser/argument_redef.c
+++ b/test/Parser/argument_redef.c
@@ -1,4 +1,4 @@
-/* RUN: clang -parse-ast-check %s
+/* RUN: clang -parse-ast -verify %s
 */
 
 int foo(int A) { /* expected-error {{previous definition is here}} */
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
index 6815df7..ecd1237 100644
--- a/test/Parser/attributes.c
+++ b/test/Parser/attributes.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s -pedantic
+// RUN: clang -parse-ast -verify %s -pedantic
 
 static __inline void __attribute__((__always_inline__, __nodebug__)) // expected-warning {{extension used}}
 foo (void)
diff --git a/test/Parser/bad-control.c b/test/Parser/bad-control.c
index 9143934..caad1f1 100644
--- a/test/Parser/bad-control.c
+++ b/test/Parser/bad-control.c
@@ -1,4 +1,4 @@
-/* RUN: clang -parse-ast-check %s
+/* RUN: clang -parse-ast -verify %s
 */
 int foo() { 
   break; /* expected-error {{'break' statement not in loop or switch statement}} */
diff --git a/test/Parser/builtin_classify_type.c b/test/Parser/builtin_classify_type.c
index 87b8bb6..500c16a 100644
--- a/test/Parser/builtin_classify_type.c
+++ b/test/Parser/builtin_classify_type.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 struct foo { int a; };
 
diff --git a/test/Parser/builtin_types_compatible.c b/test/Parser/builtin_types_compatible.c
index ed7ea2c..096b400 100644
--- a/test/Parser/builtin_types_compatible.c
+++ b/test/Parser/builtin_types_compatible.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 extern int funcInt(int);
 extern float funcFloat(float);
diff --git a/test/Parser/check_cast.c b/test/Parser/check_cast.c
index 806cb80..8c329fc 100644
--- a/test/Parser/check_cast.c
+++ b/test/Parser/check_cast.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 struct foo {
   int a;
 };
diff --git a/test/Parser/compound_literal.c b/test/Parser/compound_literal.c
index ef4576d..a5383cc 100644
--- a/test/Parser/compound_literal.c
+++ b/test/Parser/compound_literal.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 int main() {
   char *s;
   s = (char []){"whatever"}; 
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
index 44a2a03..9554379 100644
--- a/test/Parser/cxx-reference.cpp
+++ b/test/Parser/cxx-reference.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 extern char *bork;
 char *& bar = bork;
diff --git a/test/Parser/goto-ident.c b/test/Parser/goto-ident.c
index 0dc7f4e..7231445 100644
--- a/test/Parser/goto-ident.c
+++ b/test/Parser/goto-ident.c
@@ -1,4 +1,4 @@
-/* RUN: clang -parse-ast-check %s
+/* RUN: clang -parse-ast -verify %s
 */
 
 void foo() { 
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
index 6040281..1623eb0 100644
--- a/test/Parser/if-scope-c90.c
+++ b/test/Parser/if-scope-c90.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check --std=c90 %s
+// RUN: clang -parse-ast -verify --std=c90 %s
 
 int f (int z)
 { 
diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c
index 6547e6f..c6ce9b6 100644
--- a/test/Parser/if-scope-c99.c
+++ b/test/Parser/if-scope-c99.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check --std=c99 %s
+// RUN: clang -parse-ast -verify --std=c99 %s
 
 int f (int z)
 { 
diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c
index 4ba56e4..320370d 100644
--- a/test/Parser/implicit-casts.c
+++ b/test/Parser/implicit-casts.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 _Complex double X;
 void test1(int c) {
   X = 5;
diff --git a/test/Parser/ocu_vector_components.c b/test/Parser/ocu_vector_components.c
index 26627b8..a47b9a8 100644
--- a/test/Parser/ocu_vector_components.c
+++ b/test/Parser/ocu_vector_components.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 typedef __attribute__(( ocu_vector_type(2) )) float float2;
 typedef __attribute__(( ocu_vector_type(3) )) float float3;
diff --git a/test/Parser/parmvardecl_conversion.c b/test/Parser/parmvardecl_conversion.c
index 5fb9528..a3e2499 100644
--- a/test/Parser/parmvardecl_conversion.c
+++ b/test/Parser/parmvardecl_conversion.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 void f (int p[]) { p++; }
 
diff --git a/test/Parser/pointer-arithmetic.c b/test/Parser/pointer-arithmetic.c
index 7c7e3ad..4403d20 100644
--- a/test/Parser/pointer-arithmetic.c
+++ b/test/Parser/pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int *test1(int *a)         { return a + 1; }
 int *test2(int *a)         { return 1 + a; }
diff --git a/test/Parser/pointer_promotion.c b/test/Parser/pointer_promotion.c
index 18cd968..9d9a526 100644
--- a/test/Parser/pointer_promotion.c
+++ b/test/Parser/pointer_promotion.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int test() {
   void *vp;
diff --git a/test/Parser/recovery-1.c b/test/Parser/recovery-1.c
index f40eb62..a098aec 100644
--- a/test/Parser/recovery-1.c
+++ b/test/Parser/recovery-1.c
@@ -1,5 +1,5 @@
 // RUN: clang -fsyntax-only -fno-caret-diagnostics -pedantic %s 2>&1 | grep warning | wc -l | grep 1
-// RUN: clang -parse-ast-check -pedantic %s
+// RUN: clang -parse-ast -verify -pedantic %s
 
 char ((((                       /* expected-error {{to match this '('}} */
 *X x ] ))));                    /* expected-error {{expected ')'}} */
diff --git a/test/Parser/typeof.c b/test/Parser/typeof.c
index 14025e5..e1fd6e4 100644
--- a/test/Parser/typeof.c
+++ b/test/Parser/typeof.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 typedef int TInt;
 
diff --git a/test/Sema/arg-duplicate.c b/test/Sema/arg-duplicate.c
index 5d44a72..324e9fa 100644
--- a/test/Sema/arg-duplicate.c
+++ b/test/Sema/arg-duplicate.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 typedef int x; 
 int f3(y, x, 
diff --git a/test/Sema/arg-invalid.c b/test/Sema/arg-invalid.c
index 1eae26c..29b51f4 100644
--- a/test/Sema/arg-invalid.c
+++ b/test/Sema/arg-invalid.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -parse-ast-check
+// RUN: clang %s -parse-ast -verify
 
 void bar (void *); 
 void f11 (z)       // expected-error {{may not have 'void' type}}
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index 867d4e7..0533a84 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check -pedantic %s
+// RUN: clang -parse-ast -verify -pedantic %s
 
 struct s; 
 struct s* t (struct s z[]) {   // expected-error {{array has incomplete element type}}
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index 5eed259..0986354 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check -pedantic %s
+// RUN: clang -parse-ast -verify -pedantic %s
 
 extern int foof() = 1; // expected-error{{illegal initializer (only variables can be initialized)}}
 
diff --git a/test/Sema/assign.c b/test/Sema/assign.c
index 47fee3e..efeaffb 100644
--- a/test/Sema/assign.c
+++ b/test/Sema/assign.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 void *test1(void) { return 0; }
 
diff --git a/test/Sema/c89.c b/test/Sema/c89.c
index fc38909..87ac4fb 100644
--- a/test/Sema/c89.c
+++ b/test/Sema/c89.c
@@ -1,4 +1,4 @@
-/* RUN: clang %s -std=c89 -pedantic -parse-ast-check
+/* RUN: clang %s -std=c89 -pedantic -parse-ast -verify
  */
 void test1() {
   {
diff --git a/test/Sema/cfstring.c b/test/Sema/cfstring.c
index 41181ea..f9fdf3a 100644
--- a/test/Sema/cfstring.c
+++ b/test/Sema/cfstring.c
@@ -1,6 +1,6 @@
 #define CFSTR __builtin___CFStringMakeConstantString
 
-// RUN: clang %s -parse-ast-check
+// RUN: clang %s -parse-ast -verify
 void f() {
   CFSTR("\242"); // expected-warning { CFString literal contains non-ASCII character }
   CFSTR("\0"); // expected-warning { CFString literal contains NUL character }
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index d4e29e8..b31ace6 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int test(char *C) { // nothing here should warn.
   return C != ((void*)0);
diff --git a/test/Sema/decl-invalid.c b/test/Sema/decl-invalid.c
index dda6601..61ad861 100644
--- a/test/Sema/decl-invalid.c
+++ b/test/Sema/decl-invalid.c
@@ -1,3 +1,3 @@
-// RUN: clang %s -parse-ast-check
+// RUN: clang %s -parse-ast -verify
 
 typedef union <anonymous> __mbstate_t;  // expected-error: {{expected identifier or}}
diff --git a/test/Sema/default.c b/test/Sema/default.c
index e714eff..b51ab9a 100644
--- a/test/Sema/default.c
+++ b/test/Sema/default.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 void f5 (int z) { 
   if (z) 
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index 1ba3977..1787c4b 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -parse-ast-check -pedantic
+// RUN: clang %s -parse-ast -verify -pedantic
 
 enum e {A, 
         B = 42LL << 32,        // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
diff --git a/test/Sema/floating-point-compare.c b/test/Sema/floating-point-compare.c
index 008bedf..0c84da2 100644
--- a/test/Sema/floating-point-compare.c
+++ b/test/Sema/floating-point-compare.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int foo(float x, float y) {
   return x == y; // expected-warning {{comparing floating point with ==}}
@@ -6,4 +6,4 @@
 
 int bar(float x, float y) {
   return x != y; // expected-warning {{comparing floating point with ==}}
-}
\ No newline at end of file
+}
diff --git a/test/Sema/for.c b/test/Sema/for.c
index 9004d9f..42932f6 100644
--- a/test/Sema/for.c
+++ b/test/Sema/for.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 // Check C99 6.8.5p3
 void b1 (void) { for (void (*f) (void);;); }
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 403da07..be2706e 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 #include <stdio.h>
 #include <stdarg.h>
diff --git a/test/Sema/offsetof.c b/test/Sema/offsetof.c
index 5848ba4..14b1440 100644
--- a/test/Sema/offsetof.c
+++ b/test/Sema/offsetof.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
 
diff --git a/test/Sema/return-stack-addr.cpp b/test/Sema/return-stack-addr.cpp
index ce4c41b..2e384a1 100644
--- a/test/Sema/return-stack-addr.cpp
+++ b/test/Sema/return-stack-addr.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 
 int* ret_local() {
@@ -110,4 +110,4 @@
 }
 
 // TODO: test case for dynamic_cast.  clang does not yet have
-// support for C++ classes to write such a test case.
\ No newline at end of file
+// support for C++ classes to write such a test case.
diff --git a/test/Sema/switch-duplicate-defaults.c b/test/Sema/switch-duplicate-defaults.c
index 31d46a1..d552c54 100644
--- a/test/Sema/switch-duplicate-defaults.c
+++ b/test/Sema/switch-duplicate-defaults.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 void f (int z) { 
   switch(z) {
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index eacd3c2..b66695b 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 void f (int z) { 
   while (z) { 
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index 341252f..121e716 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 typedef float float4 __attribute__((vector_size(16)));
 typedef int int4 __attribute__((vector_size(16)));
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index e9e2992..d398e74 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang -parse-ast-check %s
+// RUN: clang -parse-ast -verify %s
 
 int foo(int X, int Y);