diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-06 09:23:02 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-06 09:23:02 +0000 |
commit | dd5132ce2569a1ef901c92772eb8581aa1705f25 (patch) | |
tree | 7e0a88c3c6cb70271946aaa95a231b3da55d9f91 /test | |
parent | 79ade4e028932fcb9dab15e2fb2305ca15ab0f14 (diff) | |
download | src-dd5132ce2569a1ef901c92772eb8581aa1705f25.tar.gz src-dd5132ce2569a1ef901c92772eb8581aa1705f25.zip |
Update clang to r97873.
Notes
Notes:
svn path=/vendor/clang/dist/; revision=204793
Diffstat (limited to 'test')
25 files changed, 510 insertions, 66 deletions
diff --git a/test/Analysis/inline3.c b/test/Analysis/inline3.c new file mode 100644 index 000000000000..3661263b6bae --- /dev/null +++ b/test/Analysis/inline3.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s + + +// Test when entering f1(), we set the right AnalysisContext to Environment. +// Otherwise, block-level expr '1 && a' would not be block-level. +int a; + +void f1() { + if (1 && a) + return; +} + +void f2() { + f1(); +} diff --git a/test/CXX/class.derived/class.member.lookup/p8.cpp b/test/CXX/class.derived/class.member.lookup/p8.cpp new file mode 100644 index 000000000000..4d4acc3460e4 --- /dev/null +++ b/test/CXX/class.derived/class.member.lookup/p8.cpp @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// FIXME: Access control checks + +namespace PR5820 { + // also <rdar://problem/7535045> + struct Base { + void Foo(); + int Member; + }; + + struct D1 : public Base {}; + struct D2 : public Base {}; + + struct Derived : public D1, public D2 { + void Inner(); + }; + + void Test() { + Derived d; + d.D1::Foo(); + d.D1::Member = 17; + } + + void Derived::Inner() { + D1::Foo(); + D1::Member = 42; + this->D1::Foo(); + this->D1::Member = 42; + } +} + +template<typename T> +struct BaseT { + void Foo(); // expected-note{{found by ambiguous name lookup}} + int Member; +}; + +template<typename T> struct Derived1T : BaseT<T> { }; +template<typename T> struct Derived2T : BaseT<T> { }; + +template<typename T> +struct DerivedT : public Derived1T<T>, public Derived2T<T> { + void Inner(); +}; + +template<typename T> +void DerivedT<T>::Inner() { + Derived1T<T>::Foo(); + Derived2T<T>::Member = 42; + this->Derived1T<T>::Foo(); + this->Derived2T<T>::Member = 42; + this->Foo(); // expected-error{{non-static member 'Foo' found in multiple base-class subobjects of type 'BaseT<int>'}} +} + +template<typename T> +void Test(DerivedT<T> d) { + d.template Derived1T<T>::Foo(); + d.template Derived2T<T>::Member = 17; + d.Inner(); // expected-note{{in instantiation}} +} + +template void Test(DerivedT<int>); diff --git a/test/CXX/except/except.handle/p16.cpp b/test/CXX/except/except.handle/p16.cpp new file mode 100644 index 000000000000..87972f59856e --- /dev/null +++ b/test/CXX/except/except.handle/p16.cpp @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// The object declared in an exception-declaration or, if the +// exception-declaration does not specify a name, a temporary (12.2) +// is copy-initialized (8.5) from the exception object. +// +template<typename T> +class X { + T* ptr; + +public: + X(const X<T> &) { + int *ip = 0; + ptr = ip; // expected-error{{incompatible type assigning 'int *', expected 'float *'}} + } + + ~X() { + float *fp = 0; + ptr = fp; // expected-error{{incompatible type assigning 'float *', expected 'int *'}} + } +}; + +void f() { + try { + } catch (X<float>) { // expected-note{{instantiation}} + // copy constructor + } catch (X<int> xi) { // expected-note{{instantiation}} + // destructor + } +} + +struct Abstract { + virtual void f() = 0; // expected-note{{pure virtual}} +}; + +void g() { + try { + } catch (Abstract) { // expected-error{{variable type 'Abstract' is an abstract class}} + } +} diff --git a/test/CodeGen/asm-2.c b/test/CodeGen/asm-2.c deleted file mode 100644 index 9d73608a4c18..000000000000 --- a/test/CodeGen/asm-2.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm %s -o %t -triple i386-pc-linux-gnu -O2 -// RUN: not grep "load" %t - -// <rdar://problem/6841383> -int cpuid(unsigned data) { - int a, b; - - asm("xyz" :"=a"(a), "=d"(b) : "a"(data)); - return a + b; -} diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c deleted file mode 100644 index 407660927100..000000000000 --- a/test/CodeGen/asm-inout.c +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t -// RUN: grep "load i8\*\*\* %p.addr" %t | count 1 -// XFAIL: * - -// PR3800 -void f(void **p) -{ - __asm__ volatile("" :"+m"(*p)); -} - -#if 0 -// FIXME: Once this works again, we must verify that the code below behaves as expected -// See PR4677. -void f() { - unsigned _data = 42; - __asm__("bswap %0":"+r"(_data)); -} -#endif diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index df593d79fa17..bf1c806a2c47 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s void t1(int len) { __asm__ volatile("" : "=&r"(len), "+&r"(len)); } @@ -28,14 +28,16 @@ void t6(void) { __asm__ volatile("" : : "i" (t6)); } -// RUN: grep "T7 NAMED: \$1" %t void t7(int a) { __asm__ volatile("T7 NAMED: %[input]" : "+r"(a): [input] "i" (4)); + // CHECK: @t7(i32 + // CHECK: T7 NAMED: $1 } -// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t void t8() { __asm__ volatile("T8 NAMED MODIFIER: %c[input]" :: [input] "i" (4)); + // CHECK: @t8() + // CHECK: T8 NAMED MODIFIER: ${0:c} } // PR3682 @@ -45,9 +47,11 @@ unsigned t9(unsigned int a) { } // PR3908 -// RUN: grep "PR3908 \$1 \$3 \$2 \$0" %t void t10(int r) { __asm__("PR3908 %[lf] %[xx] %[li] %[r]" : [r] "+r" (r) : [lf] "mx" (0), [li] "mr" (0), [xx] "x" ((double)(0))); + +// CHECK: @t10( +// CHECK:PR3908 $1 $3 $2 $0 } @@ -110,3 +114,24 @@ int t16() { ); return 0; } + +// PR6475 +void t17() { + int i; + __asm__ ( "nop": "=m"(i)); + +// CHECK: @t17() +// CHECK: call void asm "nop", "=*m, +} + +// <rdar://problem/6841383> +int t18(unsigned data) { + int a, b; + + asm("xyz" :"=a"(a), "=d"(b) : "a"(data)); + return a + b; +// CHECK: t18(i32 +// CHECK: = call {{.*}}asm "xyz" +// CHECK-NEXT: extractvalue +// CHECK-NEXT: extractvalue +} diff --git a/test/CodeGen/attr-weakref.c b/test/CodeGen/attr-weakref.c new file mode 100644 index 000000000000..c1cc03b668d9 --- /dev/null +++ b/test/CodeGen/attr-weakref.c @@ -0,0 +1,62 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s +// RUN: FileCheck --input-file=%t %s + +// CHECK: declare extern_weak void @test1_f() +void test1_f(void); +static void test1_g(void) __attribute__((weakref("test1_f"))); +void test1_h(void) { + test1_g(); +} + +// CHECK: define void @test2_f() +void test2_f(void) {} +static void test2_g(void) __attribute__((weakref("test2_f"))); +void test2_h(void) { + test2_g(); +} + +// CHECK: declare void @test3_f() +void test3_f(void); +static void test3_g(void) __attribute__((weakref("test3_f"))); +void test3_foo(void) { + test3_f(); +} +void test3_h(void) { + test3_g(); +} + +// CHECK: define void @test4_f() +void test4_f(void); +static void test4_g(void) __attribute__((weakref("test4_f"))); +void test4_h(void) { + test4_g(); +} +void test4_f(void) {} + +// CHECK: declare void @test5_f() +void test5_f(void); +static void test5_g(void) __attribute__((weakref("test5_f"))); +void test5_h(void) { + test5_g(); +} +void test5_foo(void) { + test5_f(); +} + +// CHECK: declare extern_weak void @test6_f() +void test6_f(void) __attribute__((weak)); +static void test6_g(void) __attribute__((weakref("test6_f"))); +void test6_h(void) { + test6_g(); +} +void test6_foo(void) { + test6_f(); +} + +// CHECK: declare extern_weak void @test7_f() +void test7_f(void); +static void test7_g(void) __attribute__((weakref("test7_f"))); +static void *const test7_zed = (void *) &test7_g; +void* test7_h(void) { + return test7_zed; +} diff --git a/test/CodeGen/attr-weakref2.c b/test/CodeGen/attr-weakref2.c new file mode 100644 index 000000000000..99760635581d --- /dev/null +++ b/test/CodeGen/attr-weakref2.c @@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s +// RUN: FileCheck --input-file=%t %s + +// CHECK: @test1_f = extern_weak global i32 +extern int test1_f; +static int test1_g __attribute__((weakref("test1_f"))); +int test1_h(void) { + return test1_g; +} + +// CHECK: @test2_f = common global i32 0, align 4 +int test2_f; +static int test2_g __attribute__((weakref("test2_f"))); +int test2_h(void) { + return test2_g; +} + +// CHECK: @test3_f = external global i32 +extern int test3_f; +static int test3_g __attribute__((weakref("test3_f"))); +int test3_foo(void) { + return test3_f; +} +int test3_h(void) { + return test3_g; +} + +// CHECK: @test4_f = common global i32 0, align 4 +extern int test4_f; +static int test4_g __attribute__((weakref("test4_f"))); +int test4_h(void) { + return test4_g; +} +int test4_f; + +// CHECK: @test5_f = external global i32 +extern int test5_f; +static int test5_g __attribute__((weakref("test5_f"))); +int test5_h(void) { + return test5_g; +} +int test5_foo(void) { + return test5_f; +} + +// CHECK: @test6_f = extern_weak global i32 +extern int test6_f __attribute__((weak)); +static int test6_g __attribute__((weakref("test6_f"))); +int test6_h(void) { + return test6_g; +} +int test6_foo(void) { + return test6_f; +} diff --git a/test/CodeGen/attributes.c b/test/CodeGen/attributes.c index 4fdf1a51762b..770ce766dfba 100644 --- a/test/CodeGen/attributes.c +++ b/test/CodeGen/attributes.c @@ -30,12 +30,6 @@ int t12 __attribute__((section("SECT"))); void __t8() {} void t9() __attribute__((weak, alias("__t8"))); -static void t22(void) __attribute__((weakref("t8"))); -// CHECK: @t22 = alias weak void ()* @t8 - -static void t23(void) __attribute__((weakref, alias("t8"))); -// CHECK: @t23 = alias weak void ()* @t8 - // CHECK: declare extern_weak i32 @t15() int __attribute__((weak_import)) t15(void); int t17() { diff --git a/test/CodeGen/blockstret.c b/test/CodeGen/blockstret.c new file mode 100644 index 000000000000..09292b809f5a --- /dev/null +++ b/test/CodeGen/blockstret.c @@ -0,0 +1,106 @@ +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X64 +// RUN: %clang_cc1 -fblocks -triple i686-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X32 + +// X64: internal constant %2 { i8** @_NSConcreteGlobalBlock, i32 1879048192 +// X64: store i32 1610612736, i32* %want + +// X32: @_NSConcreteGlobalBlock, i32 1879048192, i32 0, +// X32: store i32 1610612736, i32* %want + +// rdar://7677537 +int printf(const char *, ...); +void *malloc(__SIZE_TYPE__ size); + +typedef struct bigbig { + int array[512]; + char more[32]; +} BigStruct_t; + +BigStruct_t (^global)(void) = ^{ return *(BigStruct_t *)malloc(sizeof(struct bigbig)); }; + +const char * getBlockSignature(void *); + +BigStruct_t foo(int param) { + BigStruct_t x; + BigStruct_t (^f)(int) = ^(int param) { + BigStruct_t *result = malloc(sizeof(BigStruct_t)); + result->array[23] = param; + return *result; + }; + getBlockSignature(f); + return x; +} + +enum { + BLOCK_HAS_COPY_DISPOSE = (1 << 25), + BLOCK_HAS_CXX_OBJ = (1 << 26), + BLOCK_IS_GLOBAL = (1 << 28), + BLOCK_USE_STRET = (1 << 29), + BLOCK_HAS_OBJC_TYPE = (1 << 30) +}; + +struct block_descriptor_big { + unsigned long int reserved; + unsigned long int size; + void (*copy)(void *dst, void *src); // conditional on BLOCK_HAS_COPY_DISPOSE + void (*dispose)(void *); // conditional on BLOCK_HAS_COPY_DISPOSE + const char *signature; // conditional on BLOCK_HAS_OBJC + const char *layout; // conditional on BLOCK_HAS_OBJC +}; +struct block_descriptor_small { + unsigned long int reserved; + unsigned long int size; + const char *signature; // conditional on BLOCK_HAS_OBJC + const char *layout; // conditional on BLOCK_HAS_OBJC +}; + +struct block_layout_abi { // can't change + void *isa; + int flags; + int reserved; + void (*invoke)(void *, ...); + struct block_descriptor_big *descriptor; +}; + +const char *getBlockSignature(void *block) { + struct block_layout_abi *layout = (struct block_layout_abi *)block; + if ((layout->flags & BLOCK_HAS_OBJC_TYPE) != BLOCK_HAS_OBJC_TYPE) return 0; + if (layout->flags & BLOCK_HAS_COPY_DISPOSE) + return layout->descriptor->signature; + else + return ((struct block_descriptor_small *)layout->descriptor)->signature; +} + +int usesStruct(void *block) { + struct block_layout_abi *layout = (struct block_layout_abi *)block; + int want = BLOCK_HAS_OBJC_TYPE | BLOCK_USE_STRET; + return (layout->flags & want) == want; +} + + +int main(int argc, char *argv[]) { + printf("desired global flags: %d\n", BLOCK_USE_STRET | BLOCK_IS_GLOBAL | BLOCK_HAS_OBJC_TYPE); + printf("desired stack flags: %d\n", BLOCK_USE_STRET | BLOCK_HAS_OBJC_TYPE); + + printf("should be non-zero: %d\n", usesStruct(global)); + BigStruct_t x; + BigStruct_t (^local)(int) = ^(int param) { + BigStruct_t *result = (BigStruct_t *)malloc(sizeof(BigStruct_t)); + result->array[23] = argc; + return *result; + }; + printf("should be non-zero: %d\n", usesStruct(global)); + printf("should be non-zero: %d\n", usesStruct(local)); + printf("should be zero: %d\n", usesStruct(^void(int x){ })); + return 0; +} + +/* +desired global flags: 1879048192 +desired stack flags: 1610612736 +should be non-zero: 0 +should be non-zero: 0 +should be non-zero: 1 +should be zero: 0 + +*/ diff --git a/test/CodeGen/builtins-arm.c b/test/CodeGen/builtins-arm.c new file mode 100644 index 000000000000..555375754959 --- /dev/null +++ b/test/CodeGen/builtins-arm.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o %t %s + +void *f0() +{ + return __builtin_thread_pointer(); +} diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c index 2eadd7f884d8..b5878144981f 100644 --- a/test/CodeGen/builtins-x86.c +++ b/test/CodeGen/builtins-x86.c @@ -360,8 +360,8 @@ void f0() { tmp_V2LLi = __builtin_ia32_pmuldq128(tmp_V4i, tmp_V4i); tmp_V4i = __builtin_ia32_pmulld128(tmp_V4i, tmp_V4i); tmp_V4f = __builtin_ia32_roundps(tmp_V4f, imm_i_0_16); - // tmp_V4f = __builtin_ia32_roundss(tmp_V4f, tmp_V4f, imm_i_0_16); - // tmp_V2d = __builtin_ia32_roundsd(tmp_V2d, tmp_V2d, imm_i_0_16); + tmp_V4f = __builtin_ia32_roundss(tmp_V4f, tmp_V4f, imm_i_0_16); + tmp_V2d = __builtin_ia32_roundsd(tmp_V2d, tmp_V2d, imm_i_0_16); tmp_V2d = __builtin_ia32_roundpd(tmp_V2d, imm_i_0_16); tmp_V4f = __builtin_ia32_insertps128(tmp_V4f, tmp_V4f, tmp_i); #endif diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c index 417ca7def5f2..a4424d77428f 100644 --- a/test/CodeGen/builtins.c +++ b/test/CodeGen/builtins.c @@ -118,6 +118,7 @@ int main() { // V(clear_cache, (&N, &N+1)); V(trap, ()); R(extract_return_addr, (&N)); + P(signbit, (1.0)); return 0; } diff --git a/test/CodeGenCXX/mangle-local-class-names.cpp b/test/CodeGenCXX/mangle-local-class-names.cpp new file mode 100644 index 000000000000..332146076ae5 --- /dev/null +++ b/test/CodeGenCXX/mangle-local-class-names.cpp @@ -0,0 +1,57 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: @_ZZ4FUNCvEN4SSSSC1ERKf +// CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf +// CHECK: @_ZZ4GORFfEN4SSSSC1ERKf +// CHECK: @_ZZ4GORFfEN4SSSSC2E_0RKf + +void FUNC () +{ + { + float IVAR1 ; + + struct SSSS + { + float bv; + SSSS( const float& from): bv(from) { } + }; + + SSSS VAR1(IVAR1); + } + + { + float IVAR2 ; + + struct SSSS + { + SSSS( const float& from) {} + }; + + SSSS VAR2(IVAR2); + } +} + +void GORF (float IVAR1) +{ + { + struct SSSS + { + float bv; + SSSS( const float& from): bv(from) { } + }; + + SSSS VAR1(IVAR1); + } + + { + float IVAR2 ; + + struct SSSS + { + SSSS( const float& from) {} + }; + + SSSS VAR2(IVAR2); + } +} + diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m index 3179e11b7f39..e893aaa4f3c2 100644 --- a/test/CodeGenObjC/id-isa-codegen.m +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm -o - %s typedef struct objc_class *Class; @@ -48,3 +48,19 @@ id Test2() { return (*[Foo method]).isa; return [Foo method]->isa; } + +// rdar 7709015 +@interface Cat {} +@end + +@interface SuperCat : Cat {} ++(void)geneticallyAlterCat:(Cat *)cat; +@end + +@implementation SuperCat ++ (void)geneticallyAlterCat:(Cat *)cat { + Class dynamicSubclass; + ((id)cat)->isa = dynamicSubclass; +} +@end + diff --git a/test/Index/linkage.c b/test/Index/linkage.c index b597c263a03c..d1f1c5bca541 100644 --- a/test/Index/linkage.c +++ b/test/Index/linkage.c @@ -9,15 +9,18 @@ void bar(int y) { int k; } extern int n; +static int wibble(int); // CHECK: EnumDecl=Baz:3:6 (Definition)linkage=External // CHECK: EnumConstantDecl=Qux:3:12 (Definition)linkage=External // CHECK: VarDecl=x:4:5linkage=External // CHECK: FunctionDecl=foo:5:6linkage=External -// CHECK: VarDecl=w:6:12linkage=External +// CHECK: VarDecl=w:6:12linkage=Internal // CHECK: FunctionDecl=bar:7:6 (Definition)linkage=External -// CHECK: ParmDecl=y:7:14 (Definition)linkage=External -// CHECK: VarDecl=z:8:14 (Definition)linkage=External -// CHECK: VarDecl=k:9:7 (Definition)linkage=External -// CHECK: VarDecl=n:11:12 +// CHECK: ParmDecl=y:7:14 (Definition)linkage=NoLinkage +// CHECK: VarDecl=z:8:14 (Definition)linkage=NoLinkage +// CHECK: VarDecl=k:9:7 (Definition)linkage=NoLinkage +// CHECK: VarDecl=n:11:12linkage=External +// CHECK: FunctionDecl=wibble:12:12linkage=Internal +// CHECL: ParmDecl=:12:22 (Definition)linkage=NoLinkage diff --git a/test/Rewriter/rewrite-byref-vars.mm b/test/Rewriter/rewrite-byref-vars.mm index 58b925a2b28c..007ab43d097b 100644 --- a/test/Rewriter/rewrite-byref-vars.mm +++ b/test/Rewriter/rewrite-byref-vars.mm @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks -o - %s +// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp +// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp // radar 7540194 extern "C" __declspec(dllexport) void BreakTheRewriter(int i) { diff --git a/test/Rewriter/rewrite-nested-ivar.mm b/test/Rewriter/rewrite-nested-ivar.mm index bbc9d28d2513..1787cc76af07 100644 --- a/test/Rewriter/rewrite-nested-ivar.mm +++ b/test/Rewriter/rewrite-nested-ivar.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp -// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s +// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp +// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp // radar 7583971 @@ -29,5 +29,3 @@ _internal->response->InnerResponse = 0; } @end - -// CHECK-LP: ((struct NSURLResponse_IMPL *)((struct NSCachedURLResponseInternal_IMPL *)((struct NSCachedURLResponse_IMPL *)self)->_internal)->response)->InnerResponse diff --git a/test/Rewriter/rewrite-protocol-qualified.mm b/test/Rewriter/rewrite-protocol-qualified.mm index e91c3db8616f..5f12010afd4e 100644 --- a/test/Rewriter/rewrite-protocol-qualified.mm +++ b/test/Rewriter/rewrite-protocol-qualified.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp -// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s +// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp +// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"id=void*" -D"__declspec(X)=" %t-rw.cpp // radar 7589414 @protocol NSPortDelegate; @@ -30,12 +30,3 @@ void f() { id a; id b = bar((id <Proto>)a); } - -// CHECK-LP: NSConnection /*<NSPortDelegate>*/ *conn = 0; - -// CHECK-LP: id /*<NSPortDelegate>*/ *idc = 0; - -// CHECK-LP: func(id/*<Proto1, Proto2>*/ inProxy); - -// CHECK-LP: bar((id /*<Proto>*/)a); - diff --git a/test/Rewriter/rewrite-static-block.mm b/test/Rewriter/rewrite-static-block.mm new file mode 100644 index 000000000000..c99557f52ef3 --- /dev/null +++ b/test/Rewriter/rewrite-static-block.mm @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp +// RUN: %clang_cc1 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp -emit-llvm -o %t-rw.ll +// RUN: FileCheck --input-file=%t-rw.ll %s + +typedef void (^void_block_t)(void); + +static const void_block_t myblock = ^{ + +}; + +// CHECK: myblock = internal global diff --git a/test/Sema/block-byref-args.c b/test/Sema/block-byref-args.c index 7b7cc3d2c49b..255c97b280c9 100644 --- a/test/Sema/block-byref-args.c +++ b/test/Sema/block-byref-args.c @@ -13,6 +13,10 @@ int main(int argc, char **argv) { int (^XXX)(void) = ^{ return III+JJJJ; }; + // rdar 7671883 + __block char array[10] = {'a', 'b', 'c', 'd'}; + char (^ch)() = ^{ array[1] = 'X'; return array[5]; }; + ch(); + return 0; } - diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c index 7d293f2747ed..6f8640255a9e 100644 --- a/test/Sema/scope-check.c +++ b/test/Sema/scope-check.c @@ -140,13 +140,13 @@ L2: ; L3: L4: - goto *P; // expected-error {{illegal indirect goto in protected scope, unknown effect on scopes}} + goto *P; // expected-warning {{illegal indirect goto in protected scope, unknown effect on scopes}} goto L3; // ok goto L4; // ok void *Ptrs[] = { &&L2, // Ok. - &&L3 // expected-error {{address taken of label in protected scope, jump to it would have unknown effect on scope}} + &&L3 // expected-warning {{address taken of label in protected scope, jump to it would have unknown effect on scope}} }; } diff --git a/test/SemaObjC/check-dup-objc-decls-1.m b/test/SemaObjC/check-dup-objc-decls-1.m index 1f80293588a6..8dde777f7437 100644 --- a/test/SemaObjC/check-dup-objc-decls-1.m +++ b/test/SemaObjC/check-dup-objc-decls-1.m @@ -37,3 +37,8 @@ void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symb @interface A(Cat)<P> @end // expected-note {{previous definition is here}} @interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}} + +// rdar 7626768 +@class NSString; +NSString * TestBaz; // expected-note {{previous definition is here}} +NSString * const TestBaz; // expected-error {{redefinition of 'TestBaz' with a different type}} diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m index e99418875ae2..a33a1bc02f9d 100644 --- a/test/SemaObjC/unused.m +++ b/test/SemaObjC/unused.m @@ -39,7 +39,15 @@ void test2() { // instance variables, which GCC does not. //===------------------------------------------------------------------------=== +#if __has_feature(attribute_objc_ivar_unused) +#define UNUSED_IVAR __attribute__((unused)) +#else +#error __attribute__((unused)) not supported on ivars +#endif + @interface TestUnusedIvar { - id x __attribute__((unused)); // no-warning + id y __attribute__((unused)); // no-warning + id x UNUSED_IVAR; // no-warning } @end + diff --git a/test/lit.cfg b/test/lit.cfg index beb8ae03b4f6..3565edc779b8 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -97,6 +97,18 @@ if config.test_exec_root is None: ### +import re +site_exp = {} +for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')): + m = re.match('set ([^ ]+) "([^"]*)"', line) + if m: + site_exp[m.group(1)] = m.group(2) + +targets = set(site_exp['TARGETS_TO_BUILD'].split()) +def llvm_supports_target(name): + return name in targets +config.conditions['TARGET'] = llvm_supports_target + # Discover the 'clang' and 'clangcc' to use. import os |