forked from OSchip/llvm-project
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:
parent
a054c5bedd
commit
0883fd5817
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* RUN: clang -parse-ast-check %s
|
||||
/* RUN: clang -parse-ast -verify %s
|
||||
*/
|
||||
|
||||
int x = 000000080; /* expected-error {{invalid digit}} */
|
||||
|
|
|
@ -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 '('}}} */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
int foo() {
|
||||
{
|
||||
|
|
|
@ -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}} */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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}} */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
struct foo { int a; };
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
extern int funcInt(int);
|
||||
extern float funcFloat(float);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
struct foo {
|
||||
int a;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
int main() {
|
||||
char *s;
|
||||
s = (char []){"whatever"};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
extern char *bork;
|
||||
char *& bar = bork;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* RUN: clang -parse-ast-check %s
|
||||
/* RUN: clang -parse-ast -verify %s
|
||||
*/
|
||||
|
||||
void foo() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check --std=c90 %s
|
||||
// RUN: clang -parse-ast -verify --std=c90 %s
|
||||
|
||||
int f (int z)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check --std=c99 %s
|
||||
// RUN: clang -parse-ast -verify --std=c99 %s
|
||||
|
||||
int f (int z)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
void f (int p[]) { p++; }
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
int test() {
|
||||
void *vp;
|
||||
|
|
|
@ -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 ')'}} */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
typedef int TInt;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
typedef int x;
|
||||
int f3(y, x,
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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)}}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
void *test1(void) { return 0; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* RUN: clang %s -std=c89 -pedantic -parse-ast-check
|
||||
/* RUN: clang %s -std=c89 -pedantic -parse-ast -verify
|
||||
*/
|
||||
void test1() {
|
||||
{
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
void f5 (int z) {
|
||||
if (z)
|
||||
|
|
|
@ -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'}}
|
||||
|
|
|
@ -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 ==}}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);;); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
void f (int z) {
|
||||
switch(z) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
void f (int z) {
|
||||
while (z) {
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
// RUN: clang -parse-ast -verify %s
|
||||
|
||||
int foo(int X, int Y);
|
||||
|
||||
|
|
Loading…
Reference in New Issue