diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-19 09:00:00 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-19 09:00:00 +0000 |
commit | 6df2408694f81a03eb8b0e3b013272042233c061 (patch) | |
tree | c7f5a7b6fd212399d821b83b22c1e6a42e8c4a0d /test | |
parent | 741c13ecc20fb35b836ad690aeecd402f002d654 (diff) | |
download | FreeBSD-src-6df2408694f81a03eb8b0e3b013272042233c061.zip FreeBSD-src-6df2408694f81a03eb8b0e3b013272042233c061.tar.gz |
Update clang to r89337.
Diffstat (limited to 'test')
31 files changed, 521 insertions, 167 deletions
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index 4604db5..f5c6a10 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -1,6 +1,6 @@ // RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic // RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-purge-dead=false -verify %s +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s // RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef unsigned uintptr_t; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp index b32948b..88bc813 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp @@ -31,7 +31,7 @@ void test() { } namespace Numbers { - struct Number { + struct Number { // expected-note 2 {{candidate}} explicit Number(double d) : d(d) {} double d; }; @@ -57,9 +57,9 @@ void test3() { int i = Ints::zero; Numbers2::f(i); - Numbers2::g(i); // expected-error {{incompatible type passing 'int'}} + Numbers2::g(i); // expected-error {{no viable conversion from 'int' to 'struct Numbers::Number' is possible}} float f = Floats::zero; Numbers2::f(f); - Numbers2::g(f); // expected-error {{incompatible type passing 'float'}} + Numbers2::g(f); // expected-error {{no viable conversion from 'float' to 'struct Numbers::Number' is possible}} } diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp index 35e8c08..9528c4b 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp @@ -4,7 +4,7 @@ template <unsigned N> class test {}; -class foo {}; +class foo {}; // expected-note {{candidate}} test<0> foo(foo); // expected-note {{candidate}} namespace Test0 { @@ -38,7 +38,7 @@ namespace Test0 { test<2> _1 = (foo)(a); class Test0::foo b; - test<2> _2 = (foo)(b); // expected-error {{incompatible type passing}} + test<2> _2 = (foo)(b); // expected-error {{no viable conversion from 'class Test0::foo' to 'class foo' is possible}} } } } diff --git a/test/CXX/special/class.dtor/p2.cpp b/test/CXX/special/class.dtor/p2.cpp new file mode 100644 index 0000000..c0e878f --- /dev/null +++ b/test/CXX/special/class.dtor/p2.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// PR5548 +struct A {~A();}; +void a(const A* x) { + x->~A(); +} diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c index cbbde8a..32fc59f 100644 --- a/test/CodeGen/libcalls.c +++ b/test/CodeGen/libcalls.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s -triple i386-unknown-unknown +// RUN: clang-cc -emit-llvm -o %t %s -triple i386-unknown-unknown // RUN: grep "declare " %t | count 6 // RUN: grep "declare " %t | grep "@llvm." | count 1 -// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s -triple i386-unknown-unknown +// RUN: clang-cc -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown // RUN: grep "declare " %t | count 6 // RUN: grep "declare " %t | grep -v "@llvm." | count 0 diff --git a/test/Driver/analyze.c b/test/Driver/analyze.c index ff35cc5..bdbfbbf 100644 --- a/test/Driver/analyze.c +++ b/test/Driver/analyze.c @@ -6,4 +6,4 @@ // CHECK: "-analyze" // CHECK: "-target-feature" "+sse" -// CHECK: "--fmath-errno=0" +// CHECK: "-fno-math-errno" diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index c57a2b7..fe35184 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -5,7 +5,6 @@ // RUN: grep '"--relocation-model" "static"' %t.log // RUN: grep '"--disable-fp-elim"' %t.log // RUN: grep '"--unwind-tables=0"' %t.log -// RUN: grep '"--fmath-errno=1"' %t.log // RUN: grep '"-Os"' %t.log // RUN: grep '"-o" .*clang-translation.*' %t.log // RUN: grep '"--asm-verbose"' %t.log diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index b18f147..3756a2f 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -1,10 +1,9 @@ // RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t // RUN: grep -F '"-fblocks"' %t -// RUN: grep -F '"--fmath-errno=1"' %t // RUN: grep -F '"-fpascal-strings"' %t // RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2> %t -// RUN: grep -F '"-fbuiltin=0"' %t +// RUN: grep -F '"-fno-builtin"' %t // RUN: grep -F '"-fno-common"' %t -// RUN: grep -F '"--fmath-errno=0"' %t +// RUN: grep -F '"-fno-math-errno"' %t // RUN: grep -F '"-fno-show-source-location"' %t // RUN: grep -F '"-fshort-wchar"' %t diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index 7256d2b..9009f78 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -32,20 +32,20 @@ void function(Foo * arg) // CHECK-scan: {start_line=13 start_col=24 end_line=16 end_col=1} FunctionDecl=function:13:6 // CHECK-scan: {start_line=16 start_col=2 end_line=52 end_col=1} Invalid Cursor => NoDeclFound -// CHECK-load: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=TestClassDecl.m] -// CHECK-load: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=TestClassDecl.m] + + + + + + + + + + + + + + // CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:1 [Context=TestClassDecl.m] // CHECK-load: TestClassDecl.m:13:6: FunctionDefn=function [Context=TestClassDecl.m] // CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 [Context=function] diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 4584445..31b7c6c 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -27,20 +27,20 @@ void function(Foo * arg) // CHECK-scan: {start_line=10 start_col=24 end_line=13 end_col=1} FunctionDecl=function:10:6 // CHECK-scan: {start_line=13 start_col=2 end_line=46 end_col=1} Invalid Cursor => NoDeclFound -// CHECK-load: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag] -// CHECK-load: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=TestClassForwardDecl.m] -// CHECK-load: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=TestClassForwardDecl.m] + + + + + + + + + + + + + + // CHECK-load: TestClassForwardDecl.m:10:6: FunctionDefn=function [Context=TestClassForwardDecl.m] // CHECK-load: TestClassForwardDecl.m:10:21: ParmDecl=arg:10:21 [Context=function] diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index 5427764..7ab1435 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -1,21 +1,21 @@ // RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-load-tu %t.ast all | FileCheck %s -// CHECK: <invalid loc>:0:0: TypedefDecl=__int128_t:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: TypedefDecl=__uint128_t:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: StructDecl=objc_selector:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: TypedefDecl=SEL:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: ObjCInterfaceDecl=Protocol:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: TypedefDecl=id:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:0:0: TypedefDecl=Class:0:0 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:80:16: StructDecl=__va_list_tag:80:16 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:80:42: FieldDecl=gp_offset:80:42 [Context=__va_list_tag] -// CHECK: <invalid loc>:80:63: FieldDecl=fp_offset:80:63 [Context=__va_list_tag] -// CHECK: <invalid loc>:80:81: FieldDecl=overflow_arg_area:80:81 [Context=__va_list_tag] -// CHECK: <invalid loc>:80:107: FieldDecl=reg_save_area:80:107 [Context=__va_list_tag] -// CHECK: <invalid loc>:80:123: TypedefDecl=__va_list_tag:80:123 [Context=c-index-api-loadTU-test.m] -// CHECK: <invalid loc>:80:159: TypedefDecl=__builtin_va_list:80:159 [Context=c-index-api-loadTU-test.m] -// + + + + + + + + + + + + + + + @interface Foo { diff --git a/test/Index/complete-categories.m b/test/Index/complete-categories.m new file mode 100644 index 0000000..92b14db --- /dev/null +++ b/test/Index/complete-categories.m @@ -0,0 +1,39 @@ +/* Note: the RUN lines are near the end of the file, since line/column + matter for this test. */ + +@interface I1 @end +@interface I2 @end +@interface I3 : I2 @end + +@interface I1(Cat1) @end +@interface I1(Cat2) @end +@interface I1(Cat3) @end + +@interface I2 (Cat2) @end +@interface I2 (Cat3) @end +@interface I2 (Cat2) @end +@interface I3 (Cat1) @end +@interface I3 (Cat2) @end + +@implementation I1(Cat2) @end +@implementation I1(Cat3) @end +@implementation I3(Cat2) @end + +// RUN: c-index-test -code-completion-at=%s:12:16 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCCategoryDecl:{TypedText Cat1} +// CHECK-CC1: ObjCCategoryDecl:{TypedText Cat2} +// CHECK-CC1: ObjCCategoryDecl:{TypedText Cat3} +// RUN: c-index-test -code-completion-at=%s:13:16 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ObjCCategoryDecl:{TypedText Cat1} +// CHECK-CC2-NEXT: ObjCCategoryDecl:{TypedText Cat3} +// RUN: c-index-test -code-completion-at=%s:18:20 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: ObjCCategoryDecl:{TypedText Cat1} +// CHECK-CC3: ObjCCategoryDecl:{TypedText Cat2} +// CHECK-CC3: ObjCCategoryDecl:{TypedText Cat3} +// RUN: c-index-test -code-completion-at=%s:19:20 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCCategoryDecl:{TypedText Cat1} +// CHECK-CC4-NEXT: ObjCCategoryDecl:{TypedText Cat3} +// RUN: c-index-test -code-completion-at=%s:20:20 %s | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5: ObjCCategoryDecl:{TypedText Cat1} +// CHECK-CC5-NEXT: ObjCCategoryDecl:{TypedText Cat2} +// CHECK-CC5-NEXT: ObjCCategoryDecl:{TypedText Cat3} diff --git a/test/Index/complete-interfaces.m b/test/Index/complete-interfaces.m new file mode 100644 index 0000000..229ec2d --- /dev/null +++ b/test/Index/complete-interfaces.m @@ -0,0 +1,43 @@ +/* Note: the RUN lines are near the end of the file, since line/column + matter for this test. */ + +@class Int1, Int2, Int3, Int4; + +@interface Int3 +{ +} +@end + +@interface Int2 : Int3 +{ +} +@end + +@implementation Int2 +@end + +@implementation Int3 +@end + +// RUN: c-index-test -code-completion-at=%s:6:12 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCInterfaceDecl:{TypedText Int1} +// CHECK-CC1: ObjCInterfaceDecl:{TypedText Int2} +// CHECK-CC1: ObjCInterfaceDecl:{TypedText Int3} +// CHECK-CC1: ObjCInterfaceDecl:{TypedText Int4} +// RUN: c-index-test -code-completion-at=%s:11:12 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ObjCInterfaceDecl:{TypedText Int1} +// CHECK-CC2-NEXT: ObjCInterfaceDecl:{TypedText Int2} +// CHECK-CC2-NEXT: ObjCInterfaceDecl:{TypedText Int4} +// RUN: c-index-test -code-completion-at=%s:11:19 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: ObjCInterfaceDecl:{TypedText Int1} +// CHECK-CC3-NEXT: ObjCInterfaceDecl:{TypedText Int3} +// CHECK-CC3-NEXT: ObjCInterfaceDecl:{TypedText Int4} +// RUN: c-index-test -code-completion-at=%s:16:17 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCInterfaceDecl:{TypedText Int1} +// CHECK-CC4-NEXT: ObjCInterfaceDecl:{TypedText Int2} +// CHECK-CC4-NEXT: ObjCInterfaceDecl:{TypedText Int3} +// CHECK-CC4-NEXT: ObjCInterfaceDecl:{TypedText Int4} +// RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5: ObjCInterfaceDecl:{TypedText Int1} +// CHECK-CC5-NEXT: ObjCInterfaceDecl:{TypedText Int3} +// CHECK-CC5-NEXT: ObjCInterfaceDecl:{TypedText Int4} diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 8f235d3..b692986c 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -82,6 +82,19 @@ void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) { [ptr protocolInstanceMethod:1]; } +@interface Overload +- (int)Method:(int)i; +- (int)Method; +- (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2; +- (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj; +- (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj; +- (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2; +@end + +void test_overload(Overload *ovl) { + [ovl Method:1 Arg1:1 OtherArg:ovl]; +} + // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: {TypedText categoryClassMethod} // CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{Text withKeyword:}{Placeholder (int)b} @@ -104,4 +117,18 @@ void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) { // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText protocolInstanceMethod:}{Placeholder (int)value} // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText secondProtocolInstanceMethod} - +// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method} +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (int)i} +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2} +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj} +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText Method:}{Placeholder (float)f}{Text SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj} +// CHECK-CC7: ObjCInstanceMethodDecl:{TypedText OtherMethod:}{Placeholder (float)f}{Text Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2} +// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s +// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText } +// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text Arg2:}{Placeholder (int)i2} +// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj} +// CHECK-CC8: ObjCInstanceMethodDecl:{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{Text OtherArg:}{Placeholder (id)obj} +// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s +// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2} +// CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj} diff --git a/test/Index/complete-properties.m b/test/Index/complete-properties.m new file mode 100644 index 0000000..a99b1d1 --- /dev/null +++ b/test/Index/complete-properties.m @@ -0,0 +1,40 @@ +/* Note: the RUN lines are near the end of the file, since line/column + matter for this test. */ + +@interface I1 +{ + id StoredProp3; + int RandomIVar; +} +@property int Prop0; +@property int Prop1; +@property float Prop2; +@end + +@interface I2 : I1 +@property id Prop3; +@property id Prop4; +@end + +@implementation I2 +@synthesize Prop2, Prop1, Prop3 = StoredProp3; +@dynamic Prop4; +@end + +// RUN: c-index-test -code-completion-at=%s:20:13 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop0} +// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop1} +// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop2} +// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop3} +// CHECK-CC1: ObjCPropertyDecl:{TypedText Prop4} +// RUN: c-index-test -code-completion-at=%s:20:20 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop0} +// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop1} +// CHECK-CC2-NEXT: ObjCPropertyDecl:{TypedText Prop3} +// CHECK-CC2: ObjCPropertyDecl:{TypedText Prop4} +// RUN: c-index-test -code-completion-at=%s:20:35 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: ObjCIvarDecl:{TypedText RandomIVar} +// CHECK-CC3: ObjCIvarDecl:{TypedText StoredProp3} +// RUN: c-index-test -code-completion-at=%s:21:10 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCPropertyDecl:{TypedText Prop0} +// CHECK-CC4-NEXT: ObjCPropertyDecl:{TypedText Prop4} diff --git a/test/Index/complete-property-flags.m b/test/Index/complete-property-flags.m new file mode 100644 index 0000000..cd3696f --- /dev/null +++ b/test/Index/complete-property-flags.m @@ -0,0 +1,23 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@interface Foo { + void *isa; +} +@property(copy) Foo *myprop; +@property(retain, nonatomic) id xx; +// RUN: c-index-test -code-completion-at=%s:7:11 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: {TypedText assign} +// CHECK-CC1-NEXT: {TypedText copy} +// CHECK-CC1-NEXT: {TypedText getter}{Text = }{Placeholder method} +// CHECK-CC1-NEXT: {TypedText nonatomic} +// CHECK-CC1-NEXT: {TypedText readonly} +// CHECK-CC1-NEXT: {TypedText readwrite} +// CHECK-CC1-NEXT: {TypedText retain} +// CHECK-CC1-NEXT: {TypedText setter}{Text = }{Placeholder method} +// RUN: c-index-test -code-completion-at=%s:8:18 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: {TypedText getter}{Text = }{Placeholder method} +// CHECK-CC2-NEXT: {TypedText nonatomic} +// CHECK-CC2-NEXT: {TypedText readwrite} +// CHECK-CC2-NEXT: {TypedText setter}{Text = }{Placeholder method} +@end diff --git a/test/Index/complete-property-getset.m b/test/Index/complete-property-getset.m new file mode 100644 index 0000000..a2a8053 --- /dev/null +++ b/test/Index/complete-property-getset.m @@ -0,0 +1,41 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@interface Super { } +- (int)getter1; ++ (int)getter2_not_instance; +- (int)getter2_not:(int)x; +- (int)getter3; +- (void)setter1:(int)x; ++ (void)setter2_not_inst:(int)x; ++ (void)setter2_many_args:(int)x second:(int)y; +- (void)setter3:(int)y; +@property (getter = getter1, setter = setter1:) int blah; +@end + +@interface Sub : Super { } +- (int)getter4; +- (void)setter4:(int)x; +@property (getter = getter4, setter = setter1:) int blarg; +@end + +// RUN: c-index-test -code-completion-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter1} +// CHECK-CC1-NOT: getter2 +// CHECK-CC1: ObjCInstanceMethodDecl:{TypedText getter3} +// RUN: c-index-test -code-completion-at=%s:13:39 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText getter2_not:} +// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter1:} +// CHECK-CC2-NOT: setter2 +// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText setter3:} +// RUN: c-index-test -code-completion-at=%s:19:21 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter1} +// CHECK-CC3-NOT: getter2 +// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter3} +// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText getter4} +// RUN: c-index-test -code-completion-at=%s:19:39 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText getter2_not:}{Informative (int)x} +// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter1:}{Informative (int)x} +// CHECK-CC4-NOT: setter2 +// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter3:}{Informative (int)y} +// CHECK-CC4: ObjCInstanceMethodDecl:{TypedText setter4:}{Informative (int)x} diff --git a/test/Parser/objc-synthesized-recover.m b/test/Parser/objc-synthesized-recover.m new file mode 100644 index 0000000..7de1a57 --- /dev/null +++ b/test/Parser/objc-synthesized-recover.m @@ -0,0 +1,15 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface I1 +{ + int value; + int value2; +} +@property int value; +@property int value2; +@end + +@implementation I1 +@synthesize value, - value2; // expected-error{{expected a property name}} +@synthesize value2; +@end diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 2926900..aae218d 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -155,8 +155,9 @@ // ARM:#define __INT64_TYPE__ long long int // ARM:#define __INT8_TYPE__ char // ARM:#define __INTMAX_MAX__ 9223372036854775807LL -// ARM:#define __INTMAX_TYPE__ long long int +// ARM:#define __INTMAX_WIDTH__ 64 // ARM:#define __INTPTR_TYPE__ long int +// ARM:#define __INTPTR_WIDTH__ 32 // ARM:#define __INT_MAX__ 2147483647 // ARM:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // ARM:#define __LDBL_DIG__ 15 @@ -181,7 +182,6 @@ // ARM:#define __SHRT_MAX__ 32767 // ARM:#define __SIZE_TYPE__ unsigned int // ARM:#define __THUMB_INTERWORK__ 1 -// ARM:#define __UINTMAX_TYPE__ long long unsigned int // ARM:#define __USER_LABEL_PREFIX__ _ // ARM:#define __VFP_FP__ 1 // ARM:#define __WCHAR_MAX__ 2147483647 @@ -233,8 +233,9 @@ // BFIN:#define __INT64_TYPE__ long long int // BFIN:#define __INT8_TYPE__ char // BFIN:#define __INTMAX_MAX__ 9223372036854775807LL -// BFIN:#define __INTMAX_TYPE__ long long int +// BFIN:#define __INTMAX_WIDTH__ 64 // BFIN:#define __INTPTR_TYPE__ long int +// BFIN:#define __INTPTR_WIDTH__ 32 // BFIN:#define __INT_MAX__ 2147483647 // BFIN:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // BFIN:#define __LDBL_DIG__ 15 @@ -257,7 +258,6 @@ // BFIN:#define __SCHAR_MAX__ 127 // BFIN:#define __SHRT_MAX__ 32767 // BFIN:#define __SIZE_TYPE__ long unsigned int -// BFIN:#define __UINTMAX_TYPE__ long long unsigned int // BFIN:#define __USER_LABEL_PREFIX__ _ // BFIN:#define __WCHAR_MAX__ 2147483647 // BFIN:#define __WCHAR_TYPE__ int @@ -304,8 +304,9 @@ // I386:#define __INT64_TYPE__ long long int // I386:#define __INT8_TYPE__ char // I386:#define __INTMAX_MAX__ 9223372036854775807LL -// I386:#define __INTMAX_TYPE__ long long int +// I386:#define __INTMAX_WIDTH__ 64 // I386:#define __INTPTR_TYPE__ int +// I386:#define __INTPTR_WIDTH__ 32 // I386:#define __INT_MAX__ 2147483647 // I386:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L // I386:#define __LDBL_DIG__ 18 @@ -331,7 +332,6 @@ // I386:#define __SCHAR_MAX__ 127 // I386:#define __SHRT_MAX__ 32767 // I386:#define __SIZE_TYPE__ unsigned int -// I386:#define __UINTMAX_TYPE__ long long unsigned int // I386:#define __USER_LABEL_PREFIX__ _ // I386:#define __WCHAR_MAX__ 2147483647 // I386:#define __WCHAR_TYPE__ int @@ -381,8 +381,9 @@ // MSP430:#define __INT32_TYPE__ long int // MSP430:#define __INT8_TYPE__ char // MSP430:#define __INTMAX_MAX__ 2147483647L -// MSP430:#define __INTMAX_TYPE__ long int +// MSP430:#define __INTMAX_WIDTH__ 32 // MSP430:#define __INTPTR_TYPE__ short +// MSP430:#define __INTPTR_WIDTH__ 16 // MSP430:#define __INT_MAX__ 32767 // MSP430:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // MSP430:#define __LDBL_DIG__ 15 @@ -406,7 +407,6 @@ // MSP430:#define __SCHAR_MAX__ 127 // MSP430:#define __SHRT_MAX__ 32767 // MSP430:#define __SIZE_TYPE__ unsigned int -// MSP430:#define __UINTMAX_TYPE__ long unsigned int // MSP430:#define __USER_LABEL_PREFIX__ _ // MSP430:#define __WCHAR_MAX__ 32767 // MSP430:#define __WCHAR_TYPE__ int @@ -451,8 +451,9 @@ // PIC16:#define __INT32_TYPE__ long int // PIC16:#define __INT8_TYPE__ char // PIC16:#define __INTMAX_MAX__ 2147483647L -// PIC16:#define __INTMAX_TYPE__ long int +// PIC16:#define __INTMAX_WIDTH__ 32 // PIC16:#define __INTPTR_TYPE__ short +// PIC16:#define __INTPTR_WIDTH__ 16 // PIC16:#define __INT_MAX__ 32767 // PIC16:#define __LDBL_DENORM_MIN__ 1.40129846e-45F // PIC16:#define __LDBL_DIG__ 6 @@ -475,7 +476,6 @@ // PIC16:#define __SCHAR_MAX__ 127 // PIC16:#define __SHRT_MAX__ 32767 // PIC16:#define __SIZE_TYPE__ unsigned int -// PIC16:#define __UINTMAX_TYPE__ long unsigned int // PIC16:#define __USER_LABEL_PREFIX__ _ // PIC16:#define __WCHAR_MAX__ 32767 // PIC16:#define __WCHAR_TYPE__ int @@ -533,8 +533,9 @@ // PPC64:#define __INT64_TYPE__ long int // PPC64:#define __INT8_TYPE__ char // PPC64:#define __INTMAX_MAX__ 9223372036854775807L -// PPC64:#define __INTMAX_TYPE__ long int +// PPC64:#define __INTMAX_WIDTH__ 64 // PPC64:#define __INTPTR_TYPE__ long int +// PPC64:#define __INTPTR_WIDTH__ 64 // PPC64:#define __INT_MAX__ 2147483647 // PPC64:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // PPC64:#define __LDBL_DIG__ 15 @@ -562,7 +563,6 @@ // PPC64:#define __SCHAR_MAX__ 127 // PPC64:#define __SHRT_MAX__ 32767 // PPC64:#define __SIZE_TYPE__ long unsigned int -// PPC64:#define __UINTMAX_TYPE__ long unsigned int // PPC64:#define __USER_LABEL_PREFIX__ _ // PPC64:#define __WCHAR_MAX__ 2147483647 // PPC64:#define __WCHAR_TYPE__ int @@ -612,8 +612,9 @@ // PPC:#define __INT64_TYPE__ long long int // PPC:#define __INT8_TYPE__ char // PPC:#define __INTMAX_MAX__ 9223372036854775807LL -// PPC:#define __INTMAX_TYPE__ long long int +// PPC:#define __INTMAX_WIDTH__ 64 // PPC:#define __INTPTR_TYPE__ long int +// PPC:#define __INTPTR_WIDTH__ 32 // PPC:#define __INT_MAX__ 2147483647 // PPC:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // PPC:#define __LDBL_DIG__ 15 @@ -640,7 +641,6 @@ // PPC:#define __SCHAR_MAX__ 127 // PPC:#define __SHRT_MAX__ 32767 // PPC:#define __SIZE_TYPE__ long unsigned int -// PPC:#define __UINTMAX_TYPE__ long long unsigned int // PPC:#define __USER_LABEL_PREFIX__ _ // PPC:#define __WCHAR_MAX__ 2147483647 // PPC:#define __WCHAR_TYPE__ int @@ -686,8 +686,9 @@ // S390X:#define __INT64_TYPE__ long int // S390X:#define __INT8_TYPE__ char // S390X:#define __INTMAX_MAX__ 9223372036854775807LL -// S390X:#define __INTMAX_TYPE__ long long int +// S390X:#define __INTMAX_WIDTH__ 64 // S390X:#define __INTPTR_TYPE__ long int +// S390X:#define __INTPTR_WIDTH__ 64 // S390X:#define __INT_MAX__ 2147483647 // S390X:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // S390X:#define __LDBL_DIG__ 15 @@ -710,7 +711,6 @@ // S390X:#define __SCHAR_MAX__ 127 // S390X:#define __SHRT_MAX__ 32767 // S390X:#define __SIZE_TYPE__ long unsigned int -// S390X:#define __UINTMAX_TYPE__ long long unsigned int // S390X:#define __USER_LABEL_PREFIX__ _ // S390X:#define __WCHAR_MAX__ 2147483647 // S390X:#define __WCHAR_TYPE__ int @@ -756,8 +756,9 @@ // SPARC:#define __INT64_TYPE__ long long int // SPARC:#define __INT8_TYPE__ char // SPARC:#define __INTMAX_MAX__ 9223372036854775807LL -// SPARC:#define __INTMAX_TYPE__ long long int +// SPARC:#define __INTMAX_WIDTH__ 64 // SPARC:#define __INTPTR_TYPE__ long int +// SPARC:#define __INTPTR_WIDTH__ 32 // SPARC:#define __INT_MAX__ 2147483647 // SPARC:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 // SPARC:#define __LDBL_DIG__ 15 @@ -781,7 +782,6 @@ // SPARC:#define __SCHAR_MAX__ 127 // SPARC:#define __SHRT_MAX__ 32767 // SPARC:#define __SIZE_TYPE__ long unsigned int -// SPARC:#define __UINTMAX_TYPE__ long long unsigned int // SPARC:#define __USER_LABEL_PREFIX__ _ // SPARC:#define __VERSION__ "4.2.1 Compatible Clang Compiler" // SPARC:#define __WCHAR_MAX__ 2147483647 @@ -828,8 +828,9 @@ // TCE:#define __INT32_TYPE__ int // TCE:#define __INT8_TYPE__ char // TCE:#define __INTMAX_MAX__ 2147483647L -// TCE:#define __INTMAX_TYPE__ long int +// TCE:#define __INTMAX_WIDTH__ 32 // TCE:#define __INTPTR_TYPE__ int +// TCE:#define __INTPTR_WIDTH__ 32 // TCE:#define __INT_MAX__ 2147483647 // TCE:#define __LDBL_DENORM_MIN__ 1.40129846e-45F // TCE:#define __LDBL_DIG__ 6 @@ -854,7 +855,6 @@ // TCE:#define __SIZE_TYPE__ unsigned int // TCE:#define __TCE_V1__ 1 // TCE:#define __TCE__ 1 -// TCE:#define __UINTMAX_TYPE__ long unsigned int // TCE:#define __USER_LABEL_PREFIX__ _ // TCE:#define __WCHAR_MAX__ 2147483647 // TCE:#define __WCHAR_TYPE__ int @@ -902,8 +902,9 @@ // X86_64:#define __INT64_TYPE__ long int // X86_64:#define __INT8_TYPE__ char // X86_64:#define __INTMAX_MAX__ 9223372036854775807L -// X86_64:#define __INTMAX_TYPE__ long int +// X86_64:#define __INTMAX_WIDTH__ 64 // X86_64:#define __INTPTR_TYPE__ long int +// X86_64:#define __INTPTR_WIDTH__ 64 // X86_64:#define __INT_MAX__ 2147483647 // X86_64:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L // X86_64:#define __LDBL_DIG__ 18 @@ -935,7 +936,6 @@ // X86_64:#define __SSE2__ 1 // X86_64:#define __SSE_MATH__ 1 // X86_64:#define __SSE__ 1 -// X86_64:#define __UINTMAX_TYPE__ long unsigned int // X86_64:#define __USER_LABEL_PREFIX__ _ // X86_64:#define __WCHAR_MAX__ 2147483647 // X86_64:#define __WCHAR_TYPE__ int diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c index 641f704..9c98e29 100644 --- a/test/Preprocessor/stdint.c +++ b/test/Preprocessor/stdint.c @@ -28,11 +28,11 @@ // ARM:typedef int8_t int_fast8_t; // ARM:typedef uint8_t uint_fast8_t; // -// ARM:typedef long int intptr_t; -// ARM:typedef unsigned long int uintptr_t; +// ARM:typedef int32_t intptr_t; +// ARM:typedef uint32_t uintptr_t; // -// ARM:typedef long long int intmax_t; -// ARM:typedef long long unsigned int uintmax_t; +// ARM:typedef int64_t intmax_t; +// ARM:typedef uint64_t uintmax_t; // // ARM:INT8_MAX_ 127 // ARM:INT8_MIN_ (-127 -1) @@ -83,7 +83,7 @@ // // ARM:INTMAX_MIN_ (-9223372036854775807LL -1) // ARM:INTMAX_MAX_ 9223372036854775807LL -// ARM:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// ARM:UINTMAX_MAX_ 18446744073709551615ULL // // ARM:SIG_ATOMIC_MIN_ (-2147483647 -1) // ARM:SIG_ATOMIC_MAX_ 2147483647 @@ -136,11 +136,11 @@ // BFIN:typedef int8_t int_fast8_t; // BFIN:typedef uint8_t uint_fast8_t; // -// BFIN:typedef long int intptr_t; -// BFIN:typedef unsigned long int uintptr_t; +// BFIN:typedef int32_t intptr_t; +// BFIN:typedef uint32_t uintptr_t; // -// BFIN:typedef long long int intmax_t; -// BFIN:typedef long long unsigned int uintmax_t; +// BFIN:typedef int64_t intmax_t; +// BFIN:typedef uint64_t uintmax_t; // // BFIN:INT8_MAX_ 127 // BFIN:INT8_MIN_ (-127 -1) @@ -191,7 +191,7 @@ // // BFIN:INTMAX_MIN_ (-9223372036854775807LL -1) // BFIN:INTMAX_MAX_ 9223372036854775807LL -// BFIN:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// BFIN:UINTMAX_MAX_ 18446744073709551615ULL // // BFIN:SIG_ATOMIC_MIN_ (-2147483647 -1) // BFIN:SIG_ATOMIC_MAX_ 2147483647 @@ -244,11 +244,11 @@ // I386:typedef int8_t int_fast8_t; // I386:typedef uint8_t uint_fast8_t; // -// I386:typedef int intptr_t; -// I386:typedef unsigned int uintptr_t; +// I386:typedef int32_t intptr_t; +// I386:typedef uint32_t uintptr_t; // -// I386:typedef long long int intmax_t; -// I386:typedef long long unsigned int uintmax_t; +// I386:typedef int64_t intmax_t; +// I386:typedef uint64_t uintmax_t; // // I386:INT8_MAX_ 127 // I386:INT8_MIN_ (-127 -1) @@ -299,7 +299,7 @@ // // I386:INTMAX_MIN_ (-9223372036854775807LL -1) // I386:INTMAX_MAX_ 9223372036854775807LL -// I386:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// I386:UINTMAX_MAX_ 18446744073709551615ULL // // I386:SIG_ATOMIC_MIN_ (-2147483647 -1) // I386:SIG_ATOMIC_MAX_ 2147483647 @@ -344,11 +344,11 @@ // MSP430:typedef int8_t int_fast8_t; // MSP430:typedef uint8_t uint_fast8_t; // -// MSP430:typedef short intptr_t; -// MSP430:typedef unsigned short uintptr_t; +// MSP430:typedef int16_t intptr_t; +// MSP430:typedef uint16_t uintptr_t; // -// MSP430:typedef long int intmax_t; -// MSP430:typedef long unsigned int uintmax_t; +// MSP430:typedef int32_t intmax_t; +// MSP430:typedef uint32_t uintmax_t; // // MSP430:INT8_MAX_ 127 // MSP430:INT8_MIN_ (-127 -1) @@ -399,7 +399,7 @@ // // MSP430:INTMAX_MIN_ (-2147483647L -1) // MSP430:INTMAX_MAX_ 2147483647L -// MSP430:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// MSP430:UINTMAX_MAX_ 4294967295UL // // MSP430:SIG_ATOMIC_MIN_ (-2147483647L -1) // MSP430:SIG_ATOMIC_MAX_ 2147483647L @@ -418,8 +418,8 @@ // MSP430:INT64_C_(0) INT64_C(0) // MSP430:UINT64_C_(0) UINT64_C(0) // -// MSP430:INTMAX_C_(0) 0LL -// MSP430:UINTMAX_C_(0) 0ULL +// MSP430:INTMAX_C_(0) 0L +// MSP430:UINTMAX_C_(0) 0UL // // RUN: clang-cc -E -ffreestanding -triple=pic16-none-none %s | FileCheck -check-prefix PIC16 %s // @@ -444,11 +444,11 @@ // PIC16:typedef int8_t int_fast8_t; // PIC16:typedef uint8_t uint_fast8_t; // -// PIC16:typedef short intptr_t; -// PIC16:typedef unsigned short uintptr_t; +// PIC16:typedef int16_t intptr_t; +// PIC16:typedef uint16_t uintptr_t; // -// PIC16:typedef long int intmax_t; -// PIC16:typedef long unsigned int uintmax_t; +// PIC16:typedef int32_t intmax_t; +// PIC16:typedef uint32_t uintmax_t; // // PIC16:INT8_MAX_ 127 // PIC16:INT8_MIN_ (-127 -1) @@ -499,7 +499,7 @@ // // PIC16:INTMAX_MIN_ (-2147483647L -1) // PIC16:INTMAX_MAX_ 2147483647L -// PIC16:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// PIC16:UINTMAX_MAX_ 4294967295UL // // PIC16:SIG_ATOMIC_MIN_ (-2147483647L -1) // PIC16:SIG_ATOMIC_MAX_ 2147483647L @@ -518,8 +518,8 @@ // PIC16:INT64_C_(0) INT64_C(0) // PIC16:UINT64_C_(0) UINT64_C(0) // -// PIC16:INTMAX_C_(0) 0LL -// PIC16:UINTMAX_C_(0) 0ULL +// PIC16:INTMAX_C_(0) 0L +// PIC16:UINTMAX_C_(0) 0UL // // RUN: clang-cc -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s // @@ -551,11 +551,11 @@ // PPC64:typedef int8_t int_fast8_t; // PPC64:typedef uint8_t uint_fast8_t; // -// PPC64:typedef long int intptr_t; -// PPC64:typedef unsigned long int uintptr_t; +// PPC64:typedef int64_t intptr_t; +// PPC64:typedef uint64_t uintptr_t; // -// PPC64:typedef long int intmax_t; -// PPC64:typedef long unsigned int uintmax_t; +// PPC64:typedef int64_t intmax_t; +// PPC64:typedef uint64_t uintmax_t; // // PPC64:INT8_MAX_ 127 // PPC64:INT8_MIN_ (-127 -1) @@ -606,7 +606,7 @@ // // PPC64:INTMAX_MIN_ (-9223372036854775807L -1) // PPC64:INTMAX_MAX_ 9223372036854775807L -// PPC64:UINTMAX_MAX_ (9223372036854775807L*2ULL +1ULL) +// PPC64:UINTMAX_MAX_ 18446744073709551615UL // // PPC64:SIG_ATOMIC_MIN_ (-2147483647 -1) // PPC64:SIG_ATOMIC_MAX_ 2147483647 @@ -625,8 +625,8 @@ // PPC64:INT64_C_(0) 0L // PPC64:UINT64_C_(0) 0UL // -// PPC64:INTMAX_C_(0) 0LL -// PPC64:UINTMAX_C_(0) 0ULL +// PPC64:INTMAX_C_(0) 0L +// PPC64:UINTMAX_C_(0) 0UL // // RUN: clang-cc -E -ffreestanding -triple=powerpc-none-none %s | FileCheck -check-prefix PPC %s // @@ -659,11 +659,11 @@ // PPC:typedef int8_t int_fast8_t; // PPC:typedef uint8_t uint_fast8_t; // -// PPC:typedef long int intptr_t; -// PPC:typedef unsigned long int uintptr_t; +// PPC:typedef int32_t intptr_t; +// PPC:typedef uint32_t uintptr_t; // -// PPC:typedef long long int intmax_t; -// PPC:typedef long long unsigned int uintmax_t; +// PPC:typedef int64_t intmax_t; +// PPC:typedef uint64_t uintmax_t; // // PPC:INT8_MAX_ 127 // PPC:INT8_MIN_ (-127 -1) @@ -714,7 +714,7 @@ // // PPC:INTMAX_MIN_ (-9223372036854775807LL -1) // PPC:INTMAX_MAX_ 9223372036854775807LL -// PPC:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// PPC:UINTMAX_MAX_ 18446744073709551615ULL // // PPC:SIG_ATOMIC_MIN_ (-2147483647 -1) // PPC:SIG_ATOMIC_MAX_ 2147483647 @@ -766,11 +766,11 @@ // S390X:typedef int8_t int_fast8_t; // S390X:typedef uint8_t uint_fast8_t; // -// S390X:typedef long int intptr_t; -// S390X:typedef unsigned long int uintptr_t; +// S390X:typedef int64_t intptr_t; +// S390X:typedef uint64_t uintptr_t; // -// S390X:typedef long long int intmax_t; -// S390X:typedef long long unsigned int uintmax_t; +// S390X:typedef int64_t intmax_t; +// S390X:typedef uint64_t uintmax_t; // // S390X:INT8_MAX_ 127 // S390X:INT8_MIN_ (-127 -1) @@ -819,9 +819,9 @@ // S390X:PTRDIFF_MAX_ 9223372036854775807L // S390X:SIZE_MAX_ 18446744073709551615UL // -// S390X:INTMAX_MIN_ (-9223372036854775807LL -1) -// S390X:INTMAX_MAX_ 9223372036854775807LL -// S390X:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// S390X:INTMAX_MIN_ (-9223372036854775807L -1) +// S390X:INTMAX_MAX_ 9223372036854775807L +// S390X:UINTMAX_MAX_ 18446744073709551615UL // // S390X:SIG_ATOMIC_MIN_ (-2147483647 -1) // S390X:SIG_ATOMIC_MAX_ 2147483647 @@ -840,8 +840,8 @@ // S390X:INT64_C_(0) 0L // S390X:UINT64_C_(0) 0UL // -// S390X:INTMAX_C_(0) 0LL -// S390X:UINTMAX_C_(0) 0ULL +// S390X:INTMAX_C_(0) 0L +// S390X:UINTMAX_C_(0) 0UL // // RUN: clang-cc -E -ffreestanding -triple=sparc-none-none %s | FileCheck -check-prefix SPARC %s // @@ -873,11 +873,11 @@ // SPARC:typedef int8_t int_fast8_t; // SPARC:typedef uint8_t uint_fast8_t; // -// SPARC:typedef long int intptr_t; -// SPARC:typedef unsigned long int uintptr_t; +// SPARC:typedef int32_t intptr_t; +// SPARC:typedef uint32_t uintptr_t; // -// SPARC:typedef long long int intmax_t; -// SPARC:typedef long long unsigned int uintmax_t; +// SPARC:typedef int64_t intmax_t; +// SPARC:typedef uint64_t uintmax_t; // // SPARC:INT8_MAX_ 127 // SPARC:INT8_MIN_ (-127 -1) @@ -928,7 +928,7 @@ // // SPARC:INTMAX_MIN_ (-9223372036854775807LL -1) // SPARC:INTMAX_MAX_ 9223372036854775807LL -// SPARC:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// SPARC:UINTMAX_MAX_ 18446744073709551615ULL // // SPARC:SIG_ATOMIC_MIN_ (-2147483647 -1) // SPARC:SIG_ATOMIC_MAX_ 2147483647 @@ -973,11 +973,11 @@ // TCE:typedef int8_t int_fast8_t; // TCE:typedef uint8_t uint_fast8_t; // -// TCE:typedef int intptr_t; -// TCE:typedef unsigned int uintptr_t; +// TCE:typedef int32_t intptr_t; +// TCE:typedef uint32_t uintptr_t; // -// TCE:typedef long int intmax_t; -// TCE:typedef long unsigned int uintmax_t; +// TCE:typedef int32_t intmax_t; +// TCE:typedef uint32_t uintmax_t; // // TCE:INT8_MAX_ 127 // TCE:INT8_MIN_ (-127 -1) @@ -1026,9 +1026,9 @@ // TCE:PTRDIFF_MAX_ 2147483647 // TCE:SIZE_MAX_ 4294967295U // -// TCE:INTMAX_MIN_ (-2147483647L -1) -// TCE:INTMAX_MAX_ 2147483647L -// TCE:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// TCE:INTMAX_MIN_ (-2147483647 -1) +// TCE:INTMAX_MAX_ 2147483647 +// TCE:UINTMAX_MAX_ 4294967295U // // TCE:SIG_ATOMIC_MIN_ (-2147483647 -1) // TCE:SIG_ATOMIC_MAX_ 2147483647 @@ -1047,8 +1047,8 @@ // TCE:INT64_C_(0) INT64_C(0) // TCE:UINT64_C_(0) UINT64_C(0) // -// TCE:INTMAX_C_(0) 0LL -// TCE:UINTMAX_C_(0) 0ULL +// TCE:INTMAX_C_(0) 0 +// TCE:UINTMAX_C_(0) 0U // // RUN: clang-cc -E -ffreestanding -triple=x86_64-none-none %s | FileCheck -check-prefix X86_64 %s // @@ -1081,11 +1081,11 @@ // X86_64:typedef int8_t int_fast8_t; // X86_64:typedef uint8_t uint_fast8_t; // -// X86_64:typedef long int intptr_t; -// X86_64:typedef unsigned long int uintptr_t; +// X86_64:typedef int64_t intptr_t; +// X86_64:typedef uint64_t uintptr_t; // -// X86_64:typedef long int intmax_t; -// X86_64:typedef long unsigned int uintmax_t; +// X86_64:typedef int64_t intmax_t; +// X86_64:typedef uint64_t uintmax_t; // // X86_64:INT8_MAX_ 127 // X86_64:INT8_MIN_ (-127 -1) @@ -1136,7 +1136,7 @@ // // X86_64:INTMAX_MIN_ (-9223372036854775807L -1) // X86_64:INTMAX_MAX_ 9223372036854775807L -// X86_64:UINTMAX_MAX_ (9223372036854775807L*2ULL +1ULL) +// X86_64:UINTMAX_MAX_ 18446744073709551615UL // // X86_64:SIG_ATOMIC_MIN_ (-2147483647 -1) // X86_64:SIG_ATOMIC_MAX_ 2147483647 @@ -1155,8 +1155,8 @@ // X86_64:INT64_C_(0) 0L // X86_64:UINT64_C_(0) 0UL // -// X86_64:INTMAX_C_(0) 0LL -// X86_64:UINTMAX_C_(0) 0ULL +// X86_64:INTMAX_C_(0) 0L +// X86_64:UINTMAX_C_(0) 0UL // #include <stdint.h> diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c index acf4887..522fda4 100644 --- a/test/Sema/unused-expr.c +++ b/test/Sema/unused-expr.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fmath-errno=0 %s +// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s int foo(int X, int Y); diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp index 42b8d7f..3db607a 100644 --- a/test/SemaCXX/abstract.cpp +++ b/test/SemaCXX/abstract.cpp @@ -138,3 +138,20 @@ namespace PR5222 { C c; } + +// PR5550 - instantiating template didn't track overridden methods +namespace PR5550 { + struct A { + virtual void a() = 0; + virtual void b() = 0; + }; + template<typename T> struct B : public A { + virtual void b(); + virtual void c() = 0; + }; + struct C : public B<int> { + virtual void a(); + virtual void c(); + }; + C x; +} diff --git a/test/SemaCXX/cxx-member-pointer-op.cpp b/test/SemaCXX/cxx-member-pointer-op.cpp new file mode 100644 index 0000000..63b29c72 --- /dev/null +++ b/test/SemaCXX/cxx-member-pointer-op.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -fsyntax-only -pedantic -verify %s + +struct C { + static int (C::* a); +}; + +typedef void (C::*pmfc)(); + +void g(pmfc) { + C *c; + c->*pmfc(); // expected-error {{invalid use of pointer to member type after ->*}} + C c1; + c1.*pmfc(); // expected-error {{invalid use of pointer to member type after .*}} + c->*(pmfc()); // expected-error {{invalid use of pointer to member type after ->*}} + c1.*((pmfc())); // expected-error {{invalid use of pointer to member type after .*}} +} + +int a(C* x) { + return x->*C::a; +} + diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 7762667..16d3704 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -286,3 +286,41 @@ class RegAlloc { } int usepri[LastReg + 1]; }; + +// PR5546: Don't generate incorrect and ambiguous overloads for multi-level +// arrays. +namespace pr5546 +{ + enum { X }; + extern const char *const sMoveCommands[][2][2]; + const char* a() { return sMoveCommands[X][0][0]; } + const char* b() { return (*(sMoveCommands+X))[0][0]; } +} + +// PR5512 and its discussion +namespace pr5512 { + struct Y { + operator short(); + operator float(); + }; + void g_test(Y y) { + short s = 0; + // DR507, this should be ambiguous, but we special-case assignment + s = y; + // Note: DR507, this is ambiguous as specified + //s += y; + } + + struct S {}; + void operator +=(int&, S); + void f(S s) { + int i = 0; + i += s; + } + + struct A {operator int();}; + int a; + void b(A x) { + a += x; + } +} diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp index 91b72cc..be960a3 100644 --- a/test/SemaCXX/reinterpret-cast.cpp +++ b/test/SemaCXX/reinterpret-cast.cpp @@ -88,3 +88,9 @@ void memptrs() (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)()' is not allowed}} (void)reinterpret_cast<int structure::*>(0); // expected-error {{reinterpret_cast from 'int' to 'int struct structure::*' is not allowed}} } + +// PR5545 +class A; +class B; +void (A::*a)(); +void (B::*b)() = reinterpret_cast<void (B::*)()>(a); diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index a7d26bb..5132c2a 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -65,9 +65,9 @@ int&& should_not_warn(int&& i) { // But GCC 4.4 does // Test the return dance. This also tests IsReturnCopyElidable. struct MoveOnly { MoveOnly(); - MoveOnly(const MoveOnly&) = delete; - MoveOnly(MoveOnly&&); - MoveOnly(int&&); + MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}} + MoveOnly(MoveOnly&&); // expected-note {{candidate function}} + MoveOnly(int&&); // expected-note {{candidate function}} }; MoveOnly returning() { @@ -87,5 +87,5 @@ MoveOnly returningNonEligible() { else if (0) // Copy from reference can't be elided return r; // expected-error {{incompatible type returning}} else // Construction from different type can't be elided - return i; // expected-error {{incompatible type returning}} + return i; // expected-error {{no viable conversion from 'int' to 'struct MoveOnly'}} } diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp index 78ad0429..3b67c7a 100644 --- a/test/SemaCXX/using-directive.cpp +++ b/test/SemaCXX/using-directive.cpp @@ -45,22 +45,18 @@ namespace A { using namespace E; // expected-error{{reference to 'E' is ambiguous}} } - struct K2 {}; // expected-note{{candidate found by name lookup is 'A::K2'}} + struct K2 {}; // expected-note 2{{candidate found by name lookup is 'A::K2'}} } -struct K2 {}; // expected-note{{candidate found by name lookup is 'K2'}} +struct K2 {}; // expected-note 2{{candidate found by name lookup is 'K2'}} using namespace A; void K1::foo() {} // okay -// FIXME: Do we want err_ovl_no_viable_function_in_init here? -struct K2 k2; // expected-error{{reference to 'K2' is ambiguous}} \ - expected-error{{incomplete type}} - -// FIXME: This case is incorrectly diagnosed! -//K2 k3; +struct K2 *k2; // expected-error{{reference to 'K2' is ambiguous}} +K2 *k3; // expected-error{{reference to 'K2' is ambiguous}} class X { // expected-note{{candidate found by name lookup is 'X'}} // FIXME: produce a suitable error message for this diff --git a/test/SemaObjC/class-protocol.m b/test/SemaObjC/class-protocol.m new file mode 100644 index 0000000..12b6381 --- /dev/null +++ b/test/SemaObjC/class-protocol.m @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// pr5552 + +@interface Protocol +@end + diff --git a/test/SemaObjC/no-warn-qual-mismatch.m b/test/SemaObjC/no-warn-qual-mismatch.m new file mode 100644 index 0000000..3bd4dba --- /dev/null +++ b/test/SemaObjC/no-warn-qual-mismatch.m @@ -0,0 +1,16 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// radar 7211563 + +@interface X + ++ (void)prototypeWithScalar:(int)aParameter; ++ (void)prototypeWithPointer:(void *)aParameter; + +@end + +@implementation X + ++ (void)prototypeWithScalar:(const int)aParameter {} ++ (void)prototypeWithPointer:(void * const)aParameter {} + +@end diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp index 12c6f8b9..203977e 100644 --- a/test/SemaTemplate/constructor-template.cpp +++ b/test/SemaTemplate/constructor-template.cpp @@ -53,7 +53,7 @@ struct B { A<int> x; B(B& a) : x(a.x) {} }; struct X2 { X2(); - X2(X2&); + X2(X2&); // expected-note {{candidate function}} template<typename T> X2(T); }; @@ -61,7 +61,7 @@ X2 test(bool Cond, X2 x2) { if (Cond) return x2; // okay, uses copy constructor - return X2(); // expected-error{{incompatible type}} + return X2(); // expected-error{{no viable conversion from 'struct X2' to 'struct X2' is possible}} } struct X3 { @@ -73,12 +73,12 @@ template<> X3::X3(X3); // expected-error{{must pass its first argument by refere struct X4 { X4(); ~X4(); - X4(X4&); + X4(X4&); // expected-note {{candidate function}} template<typename T> X4(const T&, int = 17); }; X4 test_X4(bool Cond, X4 x4) { X4 a(x4, 17); // okay, constructor template X4 b(x4); // okay, copy constructor - return X4(); // expected-error{{incompatible type}} + return X4(); // expected-error{{no viable conversion}} } diff --git a/test/SemaTemplate/instantiate-case.cpp b/test/SemaTemplate/instantiate-case.cpp new file mode 100644 index 0000000..bed39d7 --- /dev/null +++ b/test/SemaTemplate/instantiate-case.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<class T> +static int alpha(T c) +{ + return *c; // expected-error{{indirection requires pointer operand}} +} + +template<class T> +static void +_shexp_match() +{ + switch(1) { + case 1: + alpha(1); // expected-note{{instantiation of function template}} + } +} +int main() { + _shexp_match<char>(); // expected-note{{instantiation of function template}} + return 0; +} |