diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
| commit | abe15e553e58165e7692c0d0842865c488ed7b45 (patch) | |
| tree | 1e68501209c9133fbda8d45171e59f8d6f12dd55 /test/FixIt | |
| parent | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (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-cxx0x.cpp | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-errors-1.c | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-errors.c | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit-objc.m | 4 | ||||
| -rw-r--r-- | test/FixIt/fixit-pmem.cpp | 2 | ||||
| -rw-r--r-- | test/FixIt/fixit.c | 4 | ||||
| -rw-r--r-- | test/FixIt/fixit.cpp | 2 | ||||
| -rw-r--r-- | test/FixIt/typo.c | 22 | ||||
| -rw-r--r-- | test/FixIt/typo.cpp | 43 | ||||
| -rw-r--r-- | test/FixIt/typo.m | 9 |
12 files changed, 85 insertions, 11 deletions
diff --git a/test/FixIt/fixit-at.c b/test/FixIt/fixit-at.c index 5eaa5c346926f..c32aee9ea174a 100644 --- a/test/FixIt/fixit-at.c +++ b/test/FixIt/fixit-at.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c - +// RUN: %clang_cc1 -fixit-at=fixit-at.c:3:1 %s -o - | %clang_cc1 -verify -x c - _Complex cd; diff --git a/test/FixIt/fixit-c90.c b/test/FixIt/fixit-c90.c index 7036b08022c01..e84733f49dbcf 100644 --- a/test/FixIt/fixit-c90.c +++ b/test/FixIt/fixit-c90.c @@ -1,4 +1,4 @@ -/* RUN: clang-cc -std=c90 -pedantic -fixit %s -o - | clang-cc -pedantic -x c -std=c90 -Werror - +/* RUN: %clang_cc1 -std=c90 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -x c -std=c90 -Werror - */ /* This is a test of the various code modification hints that are diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp index 2c783bc2e33a9..3694b9db1af33 100644 --- a/test/FixIt/fixit-cxx0x.cpp +++ b/test/FixIt/fixit-cxx0x.cpp @@ -1,4 +1,4 @@ -/* RUN: clang-cc -std=c++0x -fixit %s -o - | clang-cc -x c++ -std=c++0x - +/* RUN: %clang_cc1 -std=c++0x -fixit %s -o - | %clang_cc1 -x c++ -std=c++0x - */ /* This is a test of the various code modification hints that only diff --git a/test/FixIt/fixit-errors-1.c b/test/FixIt/fixit-errors-1.c index 968d1d23151c1..ecad53ceb83dc 100644 --- a/test/FixIt/fixit-errors-1.c +++ b/test/FixIt/fixit-errors-1.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - +// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -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 030f505e610e2..7bf9a58430f11 100644 --- a/test/FixIt/fixit-errors.c +++ b/test/FixIt/fixit-errors.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -pedantic -Werror -x c - +// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -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-objc.m b/test/FixIt/fixit-objc.m index cdf2057290e37..665ac74441ae6 100644 --- a/test/FixIt/fixit-objc.m +++ b/test/FixIt/fixit-objc.m @@ -1,5 +1,5 @@ -// RUN: clang -cc1 -pedantic -fixit %s -o %t -// RUN: clang -cc1 -pedantic -x objective-c %t -verify +// RUN: %clang_cc1 -pedantic -fixit %s -o %t +// RUN: %clang_cc1 -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 diff --git a/test/FixIt/fixit-pmem.cpp b/test/FixIt/fixit-pmem.cpp index f938009b90300..0926309a9ab81 100644 --- a/test/FixIt/fixit-pmem.cpp +++ b/test/FixIt/fixit-pmem.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - +// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -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 4a32682be0522..83d724dffc01a 100644 --- a/test/FixIt/fixit.c +++ b/test/FixIt/fixit.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -pedantic -fixit %s -o - | grep -v 'CHECK' > %t -// RUN: clang-cc -pedantic -Werror -x c - +// RUN: %clang_cc1 -pedantic -fixit %s -o - | grep -v 'CHECK' > %t +// RUN: %clang_cc1 -pedantic -Werror -x c - // RUN: FileCheck -input-file=%t %s /* This is a test of the various code modification hints that are diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index dac1fa03de370..04b99c9416542 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - +// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -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/typo.c b/test/FixIt/typo.c new file mode 100644 index 0000000000000..07775517809f1 --- /dev/null +++ b/test/FixIt/typo.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c - +struct Point { + float x, y; +}; + +struct Rectangle { + struct Point top_left, bottom_right; +}; + +enum Color { Red, Green, Blue }; + +struct Window { + struct Rectangle bounds; + enum Color color; +}; + +struct Window window = { + .bunds. // expected-error{{field designator 'bunds' does not refer to any field in type 'struct Window'; did you mean 'bounds'?}} + topleft.x = 3.14, // expected-error{{field designator 'topleft' does not refer to any field in type 'struct Rectangle'; did you mean 'top_left'?}} + 2.71818, 5.0, 6.0, Red +}; diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp new file mode 100644 index 0000000000000..12bfc712f3ee0 --- /dev/null +++ b/test/FixIt/typo.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ - +namespace std { + template<typename T> class basic_string { + int find(const char *substr); + static const int npos = -1; + }; + + typedef basic_string<char> string; +} + +namespace otherstd { + using namespace std; +} + +using namespace std; + +other_std::strng str1; // expected-error{{use of undeclared identifier 'other_std'; did you mean 'otherstd'?}} \ +// expected-error{{no type named 'strng' in namespace 'otherstd'; did you mean 'string'?}} +tring str2; // expected-error{{unknown type name 'tring'; did you mean 'string'?}} + +::other_std::string str3; // expected-error{{no member named 'other_std' in the global namespace; did you mean 'otherstd'?}} + +float area(float radius, float pi) { + return radious * pi; // expected-error{{use of undeclared identifier 'radious'; did you mean 'radius'?}} +} + +bool test_string(std::string s) { + basc_string<char> b1; // expected-error{{no template named 'basc_string'; did you mean 'basic_string'?}} + std::basic_sting<char> b2; // expected-error{{no template named 'basic_sting' in namespace 'std'; did you mean 'basic_string'?}} + (void)b1; + (void)b2; + return s.fnd("hello") // expected-error{{no member named 'fnd' in 'class std::basic_string<char>'; did you mean 'find'?}} + == std::string::pos; // expected-error{{no member named 'pos' in 'class std::basic_string<char>'; did you mean 'npos'?}} +} + +struct Base { }; +struct Derived : public Base { + int member; + + Derived() : base(), // expected-error{{initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'?}} + ember() { } // expected-error{{initializer 'ember' does not name a non-static data member or base class; did you mean the member 'member'?}} +}; diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m new file mode 100644 index 0000000000000..251684949ef25 --- /dev/null +++ b/test/FixIt/typo.m @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -fixit -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c - + +@interface NSString +@end + +void test() { + NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}} +} |
