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.

llvm-svn: 42365
This commit is contained in:
Ted Kremenek 2007-09-26 20:14:22 +00:00
parent a054c5bedd
commit 0883fd5817
44 changed files with 48 additions and 54 deletions

View File

@ -53,7 +53,6 @@ enum ProgActions {
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 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
"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 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
ASTConsumer* Consumer = NULL;
bool ClearSourceMgr = false;
bool PerformDiagnosticsCheck = VerifyDiagnostics;
switch (ProgAction) {
default:
@ -853,8 +849,6 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
ClearSourceMgr = true;
break;
case ParseASTCheck:
PerformDiagnosticsCheck = true;
case ParseSyntaxOnly: // -fsyntax-only
case BuildAST:
Consumer = new ASTConsumer();
@ -895,7 +889,7 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
}
if (Consumer) {
if (PerformDiagnosticsCheck)
if (VerifyDiagnostics)
exit (CheckASTConsumer(PP, MainFileID, Consumer));
else
ParseAST(PP, MainFileID, *Consumer, Stats);
@ -948,7 +942,7 @@ int main(int argc, char **argv) {
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 @@ int main(int argc, char **argv) {
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;
}
}

View File

@ -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.

View File

@ -1,4 +1,4 @@
/* RUN: clang -parse-ast-check %s
/* RUN: clang -parse-ast -verify %s
*/
int x = 000000080; /* expected-error {{invalid digit}} */

View File

@ -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 '('}}} */

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
#include <stdio.h>

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
int foo() {
{

View File

@ -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}} */

View File

@ -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)

View File

@ -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}} */

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
struct foo { int a; };

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
extern int funcInt(int);
extern float funcFloat(float);

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
struct foo {
int a;
};

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
int main() {
char *s;
s = (char []){"whatever"};

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
extern char *bork;
char *& bar = bork;

View File

@ -1,4 +1,4 @@
/* RUN: clang -parse-ast-check %s
/* RUN: clang -parse-ast -verify %s
*/
void foo() {

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check --std=c90 %s
// RUN: clang -parse-ast -verify --std=c90 %s
int f (int z)
{

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check --std=c99 %s
// RUN: clang -parse-ast -verify --std=c99 %s
int f (int z)
{

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
void f (int p[]) { p++; }

View File

@ -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; }

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
int test() {
void *vp;

View File

@ -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 ')'}} */

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
typedef int TInt;

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
typedef int x;
int f3(y, x,

View File

@ -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}}

View File

@ -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}}

View File

@ -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)}}

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
void *test1(void) { return 0; }

View File

@ -1,4 +1,4 @@
/* RUN: clang %s -std=c89 -pedantic -parse-ast-check
/* RUN: clang %s -std=c89 -pedantic -parse-ast -verify
*/
void test1() {
{

View File

@ -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 }

View File

@ -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);

View File

@ -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}}

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
void f5 (int z) {
if (z)

View File

@ -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'}}

View File

@ -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 foo(float x, float y) {
int bar(float x, float y) {
return x != y; // expected-warning {{comparing floating point with ==}}
}
}

View File

@ -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);;); }

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
#include <stdio.h>
#include <stdarg.h>

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
int* ret_local() {
@ -110,4 +110,4 @@ int* ret_cpp_const_cast(const x) {
}
// TODO: test case for dynamic_cast. clang does not yet have
// support for C++ classes to write such a test case.
// support for C++ classes to write such a test case.

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
void f (int z) {
switch(z) {

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
void f (int z) {
while (z) {

View File

@ -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)));

View File

@ -1,4 +1,4 @@
// RUN: clang -parse-ast-check %s
// RUN: clang -parse-ast -verify %s
int foo(int X, int Y);