diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 20:51:19 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 20:51:19 +0000 |
commit | 7e411337c0ed226dace6e07f1420486768161308 (patch) | |
tree | 938fcb7c80a0402925b5b00fa684a245ab0936a5 /test | |
parent | 8aaf5818a64e9f7687798852af5945b053c68a54 (diff) | |
download | FreeBSD-src-7e411337c0ed226dace6e07f1420486768161308.zip FreeBSD-src-7e411337c0ed226dace6e07f1420486768161308.tar.gz |
Update clang to r103052.
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/staticinit.c | 10 | ||||
-rw-r--r-- | test/CodeGenCXX/reference-in-blocks.cpp | 24 | ||||
-rw-r--r-- | test/CodeGenObjCXX/ivar-objects.mm | 15 | ||||
-rw-r--r-- | test/Misc/macro-backtrace-limit.c | 32 | ||||
-rw-r--r-- | test/Sema/function-redecl.c | 2 | ||||
-rw-r--r-- | test/SemaCXX/default-assignment-operator.cpp | 28 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-function-params.cpp | 12 |
7 files changed, 121 insertions, 2 deletions
diff --git a/test/CodeGen/staticinit.c b/test/CodeGen/staticinit.c index cd1f059..8c5cdd0 100644 --- a/test/CodeGen/staticinit.c +++ b/test/CodeGen/staticinit.c @@ -29,3 +29,13 @@ void foo(void) { // RUN: grep "f1.l0 = internal global i32 ptrtoint (i32 ()\* @f1 to i32)" %t int f1(void) { static int l0 = (unsigned) f1; } +// PR7044 +char *f2(char key) { + switch (key) { + static char _msg[40]; + case '\014': + return _msg; + } + + return 0; +} diff --git a/test/CodeGenCXX/reference-in-blocks.cpp b/test/CodeGenCXX/reference-in-blocks.cpp index c020bab..388ec7c 100644 --- a/test/CodeGenCXX/reference-in-blocks.cpp +++ b/test/CodeGenCXX/reference-in-blocks.cpp @@ -9,6 +9,26 @@ T _i; T get() {return _i;}; }; +// rdar: // 7495203 +class A { + public: + A() : field(10), d1(3.14) {} + void F(); + void S() { + printf(" field = %d\n", field); + printf(" field = %f\n", d1); + } + int field; + double d1; +}; + +void A::F() + { + __block A &tlc = *this; + // crashed in code gen (radar 7495203) + ^{ tlc.S(); }(); + } + int main() { // works @@ -16,6 +36,8 @@ int main() { //crashes in godegen? void (^bl2)(range<int>& ) = ^(range<int>& i){printf("Hello Blocks %d\n", i.get()); }; + + A *a = new A; + a->F(); return 0; } - diff --git a/test/CodeGenObjCXX/ivar-objects.mm b/test/CodeGenObjCXX/ivar-objects.mm index 79c1a39..d0432ed 100644 --- a/test/CodeGenObjCXX/ivar-objects.mm +++ b/test/CodeGenObjCXX/ivar-objects.mm @@ -69,3 +69,18 @@ int main() { [a release]; } +// rdar: // 7468090 +class S { +public: + S& operator = (const S&); +}; + +@interface I { + S position; +} +@property(assign, nonatomic) S position; +@end + +@implementation I + @synthesize position; +@end diff --git a/test/Misc/macro-backtrace-limit.c b/test/Misc/macro-backtrace-limit.c new file mode 100644 index 0000000..bc7a4da --- /dev/null +++ b/test/Misc/macro-backtrace-limit.c @@ -0,0 +1,32 @@ +// RUN: %clang-cc1 -fsyntax-only -fmacro-backtrace-limit 5 %s > %t 2>&1 +// RUN: FileCheck %s < %t + +#define M1(A, B) ((A) < (B)) +#define M2(A, B) M1(A, B) +#define M3(A, B) M2(A, B) +#define M4(A, B) M3(A, B) +#define M5(A, B) M4(A, B) +#define M6(A, B) M5(A, B) +#define M7(A, B) M6(A, B) +#define M8(A, B) M7(A, B) +#define M9(A, B) M8(A, B) +#define M10(A, B) M9(A, B) +#define M11(A, B) M10(A, B) +#define M12(A, B) M11(A, B) + +void f(int *ip, float *fp) { + // CHECK: macro-backtrace-limit.c:31:7: warning: comparison of distinct pointer types ('int *' and 'float *') + // CHECK: if (M12(ip, fp)) { } + // CHECK: macro-backtrace-limit.c:15:19: note: instantiated from: + // CHECK: #define M12(A, B) M11(A, B) + // CHECK: macro-backtrace-limit.c:14:19: note: instantiated from: + // CHECK: #define M11(A, B) M10(A, B) + // CHECK: note: (skipping 7 contexts in backtrace; use -fmacro-backtrace-limit=0 to see all) + // CHECK: macro-backtrace-limit.c:6:18: note: instantiated from: + // CHECK: #define M3(A, B) M2(A, B) + // CHECK: macro-backtrace-limit.c:5:18: note: instantiated from: + // CHECK: #define M2(A, B) M1(A, B) + // CHECK: macro-backtrace-limit.c:4:23: note: instantiated from: + // CHECK: #define M1(A, B) ((A) < (B)) + if (M12(ip, fp)) { } +} diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c index b8a64af..633ad21 100644 --- a/test/Sema/function-redecl.c +++ b/test/Sema/function-redecl.c @@ -120,7 +120,7 @@ extern __typeof (i1) i1; typedef int a(); typedef int a2(int*); a x; -a2 x2; +a2 x2; // expected-note{{passing argument to parameter here}} void test_x() { x(5); x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}} diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp index a04de37..dee6d13 100644 --- a/test/SemaCXX/default-assignment-operator.cpp +++ b/test/SemaCXX/default-assignment-operator.cpp @@ -89,3 +89,31 @@ void j() { e1 = e2; } +namespace ProtectedCheck { + struct X { + protected: + X &operator=(const X&); // expected-note{{declared protected here}} + }; + + struct Y : public X { }; + + void f(Y y) { y = y; } + + struct Z { // expected-error{{'operator=' is a protected member of 'ProtectedCheck::X'}} + X x; + }; + + void f(Z z) { z = z; } // +} + +namespace MultiplePaths { + struct X0 { + X0 &operator=(const X0&); + }; + + struct X1 : public virtual X0 { }; + + struct X2 : X0, X1 { }; + + void f(X2 x2) { x2 = x2; } +} diff --git a/test/SemaTemplate/instantiate-function-params.cpp b/test/SemaTemplate/instantiate-function-params.cpp index 45de342..54847e4 100644 --- a/test/SemaTemplate/instantiate-function-params.cpp +++ b/test/SemaTemplate/instantiate-function-params.cpp @@ -76,3 +76,15 @@ namespace PR6990 { { }; } + +namespace InstantiateFunctionTypedef { + template<typename T> + struct X { + typedef int functype(int, int); + functype func; + }; + + void f(X<int> x) { + (void)x.func(1, 2); + } +} |