diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:59:57 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:59:57 +0000 |
| commit | b3d5a323a5ca92ea73443499cee2f15db1ff0fb3 (patch) | |
| tree | 60a1694bec5a44d15456acc880cb2f91619f66aa /test/FixIt | |
| parent | 8f57cb0305232cb53fff00ef151ca716766f3437 (diff) | |
Notes
Diffstat (limited to 'test/FixIt')
| -rw-r--r-- | test/FixIt/fixit-at.c | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-c90.c | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-errors-1.c | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-errors.c | 12 | ||||
| -rw-r--r-- | test/FixIt/fixit-objc.m | 32 | ||||
| -rw-r--r-- | test/FixIt/fixit-pmem.cpp | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit.c | 14 | ||||
| -rw-r--r-- | test/FixIt/fixit.cpp | 11 |
8 files changed, 67 insertions, 10 deletions
diff --git a/test/FixIt/fixit-at.c b/test/FixIt/fixit-at.c index 42488f56bc7b..5eaa5c346926 100644 --- a/test/FixIt/fixit-at.c +++ b/test/FixIt/fixit-at.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c - +// RUN: clang-cc -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c - _Complex cd; diff --git a/test/FixIt/fixit-c90.c b/test/FixIt/fixit-c90.c index 03c94953db4e..7036b08022c0 100644 --- a/test/FixIt/fixit-c90.c +++ b/test/FixIt/fixit-c90.c @@ -1,4 +1,4 @@ -/* RUN: clang-cc -fsyntax-only -std=c90 -pedantic -fixit %s -o - | clang-cc -pedantic -x c -std=c90 -Werror - +/* RUN: clang-cc -std=c90 -pedantic -fixit %s -o - | clang-cc -pedantic -x c -std=c90 -Werror - */ /* This is a test of the various code modification hints that are diff --git a/test/FixIt/fixit-errors-1.c b/test/FixIt/fixit-errors-1.c index 14329ead8599..968d1d23151c 100644 --- a/test/FixIt/fixit-errors-1.c +++ b/test/FixIt/fixit-errors-1.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - +// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the diff --git a/test/FixIt/fixit-errors.c b/test/FixIt/fixit-errors.c index 9c5258dbcb74..030f505e610e 100644 --- a/test/FixIt/fixit-errors.c +++ b/test/FixIt/fixit-errors.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - +// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the @@ -8,3 +8,13 @@ struct s; // expected-note{{previous use is here}} union s *s1; // expected-error{{use of 's' with tag type that does not match previous declaration}} + +struct Point { + float x, y, z; +}; + +struct Point *get_origin(); + +void test_point() { + (void)get_origin->x; +} diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m index baef2337c10c..21aebfe3a968 100644 --- a/test/FixIt/fixit-objc.m +++ b/test/FixIt/fixit-objc.m @@ -1,8 +1,36 @@ -// RUN: clang-cc -fsyntax-only -fixit-at=fixit-at.c:3:1 %s -o %t.m && -// RUN: clang-cc -verify %t.m +// RUN: clang-cc -pedantic -fixit %s -o %t +// RUN: clang-cc -pedantic -x objective-c %t -verify + +/* This is a test of the various code modification hints that are + provided as part of warning or extension diagnostics. All of the + warnings will be fixed by -fixit, and the resulting file should + compile cleanly with -Werror -pedantic. */ @protocol X; void foo() { <X> *P; // should be fixed to 'id<X>'. } + +@class A; +@class NSString; + +@interface Test +- (void)test:(NSString *)string; + +@property (copy) NSString *property; +@end + +void g(NSString *a); +void h(id a); + +void f(Test *t) { + NSString *a = "Foo"; + id b = "Foo"; + A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'char [4]', expected 'A *'}} + g("Foo"); + h("Foo"); + h(("Foo")); + [t test:"Foo"]; + t.property = "Foo"; +} diff --git a/test/FixIt/fixit-pmem.cpp b/test/FixIt/fixit-pmem.cpp index bb36f7fa9343..f938009b9030 100644 --- a/test/FixIt/fixit-pmem.cpp +++ b/test/FixIt/fixit-pmem.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - +// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c index 1378df4de152..4a32682be052 100644 --- a/test/FixIt/fixit.c +++ b/test/FixIt/fixit.c @@ -1,10 +1,14 @@ -// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - +// RUN: clang-cc -pedantic -fixit %s -o - | grep -v 'CHECK' > %t +// RUN: clang-cc -pedantic -Werror -x c - +// RUN: FileCheck -input-file=%t %s /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the warnings will be fixed by -fixit, and the resulting file should compile cleanly with -Werror -pedantic. */ -#include <string.h> // FIXME: FIX-IT hint should add this for us! + +// FIXME: FIX-IT should add #include <string.h>? +int strcmp(const char *s1, const char *s2); void f0(void) { }; @@ -12,9 +16,13 @@ struct s { int x, y;; }; +// CHECK: _Complex double cd; _Complex cd; +// CHECK: struct s s0 = { .y = 5 }; struct s s0 = { y: 5 }; + +// CHECK: int array0[5] = { [3] = 3 }; int array0[5] = { [3] 3 }; void f1(x, y) @@ -25,5 +33,7 @@ int i0 = { 17 }; int f2(const char *my_string) { // FIXME: terminal output isn't so good when "my_string" is shorter +// CHECK: return strcmp(my_string , "foo") == 0; return my_string == "foo"; } + diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index ccddd959452b..dac1fa03de37 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - +// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the @@ -27,3 +27,12 @@ public: struct CT<0> { }; // expected-error{{'template<>'}} template<> class CT<1> { }; // expected-error{{tag type}} + +// PR5444 +namespace PR5444 { + void foo(int x, int y = 0); + void foo(int x, int y = 0) { } + + void foo(int = 0); + void foo(int = 0) { } +} |
