diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 36981b17ed939300f6f8fc2355a255f711fcef71 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /test | |
parent | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff) | |
download | src-36981b17ed939300f6f8fc2355a255f711fcef71.tar.gz src-36981b17ed939300f6f8fc2355a255f711fcef71.zip |
Vendor import of clang release_30 branch r142614:vendor/clang/clang-r142614
Notes
Notes:
svn path=/vendor/clang/dist/; revision=226586
svn path=/vendor/clang/clang-r142614/; revision=226587; tag=vendor/clang/clang-r142614
Diffstat (limited to 'test')
1691 files changed, 29566 insertions, 6393 deletions
diff --git a/test/ARCMT/Common.h b/test/ARCMT/Common.h index c57f3e75e49e..2603730cad9d 100644 --- a/test/ARCMT/Common.h +++ b/test/ARCMT/Common.h @@ -4,6 +4,10 @@ #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE #endif +#define CF_CONSUMED __attribute__((cf_consumed)) + +#define nil ((void*) 0) + typedef int BOOL; typedef unsigned NSUInteger; typedef int int32_t; @@ -11,8 +15,14 @@ typedef unsigned char uint8_t; typedef int32_t UChar32; typedef unsigned char UChar; +typedef struct _NSZone NSZone; + +typedef const void * CFTypeRef; +CFTypeRef CFRetain(CFTypeRef cf); + @protocol NSObject - (BOOL)isEqual:(id)object; +- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; diff --git a/test/ARCMT/api.m b/test/ARCMT/api.m new file mode 100644 index 000000000000..b186ec724745 --- /dev/null +++ b/test/ARCMT/api.m @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t +// RUN: diff %t %s.result + +#include "Common.h" + +void test(NSObject *o) { + NSZone *z = [o zone]; +} diff --git a/test/ARCMT/api.m.result b/test/ARCMT/api.m.result new file mode 100644 index 000000000000..e3093751b626 --- /dev/null +++ b/test/ARCMT/api.m.result @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t +// RUN: diff %t %s.result + +#include "Common.h" + +void test(NSObject *o) { + NSZone *z = nil; +} diff --git a/test/ARCMT/assign-prop-no-arc-runtime.m b/test/ARCMT/assign-prop-no-arc-runtime.m index 0baa1d28ff56..de1c456b3d19 100644 --- a/test/ARCMT/assign-prop-no-arc-runtime.m +++ b/test/ARCMT/assign-prop-no-arc-runtime.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fobjc-nonfragile-abi -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/assign-prop-no-arc-runtime.m.result b/test/ARCMT/assign-prop-no-arc-runtime.m.result index 49e91d83cfec..23848d357268 100644 --- a/test/ARCMT/assign-prop-no-arc-runtime.m.result +++ b/test/ARCMT/assign-prop-no-arc-runtime.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fobjc-nonfragile-abi -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.6 -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/assign-prop-with-arc-runtime.m b/test/ARCMT/assign-prop-with-arc-runtime.m index 4e4ae774a25c..9e10b58f621f 100644 --- a/test/ARCMT/assign-prop-with-arc-runtime.m +++ b/test/ARCMT/assign-prop-with-arc-runtime.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fobjc-nonfragile-abi -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" @@ -20,8 +20,9 @@ typedef _NSCachedAttributedString *BadClassForWeak; id not_safe1; NSObject *not_safe2; Forw *not_safe3; + Foo *assign_plus1; } -@property (readonly,assign) Foo *x; +@property (readonly) Foo *x; @property (assign) Foo *w; @property Foo *q1, *q2; @property (assign) WeakOptOut *oo; @@ -29,6 +30,9 @@ typedef _NSCachedAttributedString *BadClassForWeak; @property (assign) id not_safe1; @property () NSObject *not_safe2; @property Forw *not_safe3; +@property (readonly) Foo *assign_plus1; +@property (readonly) Foo *assign_plus2; +@property (readonly) Foo *assign_plus3; @property (assign) Foo *no_user_ivar1; @property (readonly) Foo *no_user_ivar2; @@ -37,4 +41,11 @@ typedef _NSCachedAttributedString *BadClassForWeak; @implementation Foo @synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3; @synthesize no_user_ivar1, no_user_ivar2; +@synthesize assign_plus1, assign_plus2, assign_plus3; + +-(void)test:(Foo *)parm { + assign_plus1 = [[Foo alloc] init]; + assign_plus2 = [Foo new]; + assign_plus3 = [parm retain]; +} @end diff --git a/test/ARCMT/assign-prop-with-arc-runtime.m.result b/test/ARCMT/assign-prop-with-arc-runtime.m.result index eb34c168e406..8a3a0f78b6b6 100644 --- a/test/ARCMT/assign-prop-with-arc-runtime.m.result +++ b/test/ARCMT/assign-prop-with-arc-runtime.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fobjc-nonfragile-abi -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" @@ -20,8 +20,9 @@ typedef _NSCachedAttributedString *BadClassForWeak; id __unsafe_unretained not_safe1; NSObject *__unsafe_unretained not_safe2; Forw *__unsafe_unretained not_safe3; + Foo *assign_plus1; } -@property (readonly,weak) Foo *x; +@property (readonly) Foo *x; @property (weak) Foo *w; @property (weak) Foo *q1, *q2; @property (unsafe_unretained) WeakOptOut *oo; @@ -29,6 +30,9 @@ typedef _NSCachedAttributedString *BadClassForWeak; @property (unsafe_unretained) id not_safe1; @property (unsafe_unretained) NSObject *not_safe2; @property (unsafe_unretained) Forw *not_safe3; +@property (readonly) Foo *assign_plus1; +@property (strong, readonly) Foo *assign_plus2; +@property (strong, readonly) Foo *assign_plus3; @property (weak) Foo *no_user_ivar1; @property (weak, readonly) Foo *no_user_ivar2; @@ -37,4 +41,11 @@ typedef _NSCachedAttributedString *BadClassForWeak; @implementation Foo @synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3; @synthesize no_user_ivar1, no_user_ivar2; +@synthesize assign_plus1, assign_plus2, assign_plus3; + +-(void)test:(Foo *)parm { + assign_plus1 = [[Foo alloc] init]; + assign_plus2 = [Foo new]; + assign_plus3 = parm; +} @end diff --git a/test/ARCMT/atautorelease-2.m b/test/ARCMT/atautorelease-2.m index 5d2977227781..b9bc10655325 100644 --- a/test/ARCMT/atautorelease-2.m +++ b/test/ARCMT/atautorelease-2.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSAutoreleasePool diff --git a/test/ARCMT/atautorelease-2.m.result b/test/ARCMT/atautorelease-2.m.result index 7bb164723e19..205473380b73 100644 --- a/test/ARCMT/atautorelease-2.m.result +++ b/test/ARCMT/atautorelease-2.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSAutoreleasePool diff --git a/test/ARCMT/atautorelease-3.m b/test/ARCMT/atautorelease-3.m index 5d71c33b6bc8..87b80af9350e 100644 --- a/test/ARCMT/atautorelease-3.m +++ b/test/ARCMT/atautorelease-3.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSAutoreleasePool diff --git a/test/ARCMT/atautorelease-3.m.result b/test/ARCMT/atautorelease-3.m.result index 682118e82f28..801376a7e82b 100644 --- a/test/ARCMT/atautorelease-3.m.result +++ b/test/ARCMT/atautorelease-3.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSAutoreleasePool diff --git a/test/ARCMT/atautorelease-check.m b/test/ARCMT/atautorelease-check.m index 6528f3e62d1e..d74ef3b61d1f 100644 --- a/test/ARCMT/atautorelease-check.m +++ b/test/ARCMT/atautorelease-check.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 %s #if __has_feature(objc_arr) #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) diff --git a/test/ARCMT/atautorelease.m b/test/ARCMT/atautorelease.m index bdf77197a8a5..a6aed146497b 100644 --- a/test/ARCMT/atautorelease.m +++ b/test/ARCMT/atautorelease.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" @@ -45,3 +45,17 @@ int main2(int argc, char *argv[]) { [pool release]; return result; } + +@interface Foo : NSObject +@property (assign) id myProp; +@end + +@implementation Foo +@synthesize myProp; + +-(void)test:(id)p { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [pool drain]; + self.myProp = p; +} +@end diff --git a/test/ARCMT/atautorelease.m.result b/test/ARCMT/atautorelease.m.result index ccce1bd87570..e24339a3b9e3 100644 --- a/test/ARCMT/atautorelease.m.result +++ b/test/ARCMT/atautorelease.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" @@ -44,3 +44,17 @@ int main2(int argc, char *argv[]) { return result; } } + +@interface Foo : NSObject +@property (unsafe_unretained) id myProp; +@end + +@implementation Foo +@synthesize myProp; + +-(void)test:(id)p { + @autoreleasepool { + } + self.myProp = p; +} +@end diff --git a/test/ARCMT/autoreleases.m b/test/ARCMT/autoreleases.m index a12db8178f7a..ed78cb4e2e57 100644 --- a/test/ARCMT/autoreleases.m +++ b/test/ARCMT/autoreleases.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result typedef unsigned char BOOL; diff --git a/test/ARCMT/autoreleases.m.result b/test/ARCMT/autoreleases.m.result index 796bfbb9d659..acb81b50647a 100644 --- a/test/ARCMT/autoreleases.m.result +++ b/test/ARCMT/autoreleases.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result typedef unsigned char BOOL; diff --git a/test/ARCMT/check-api.m b/test/ARCMT/check-api.m new file mode 100644 index 000000000000..11f431377da6 --- /dev/null +++ b/test/ARCMT/check-api.m @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-macosx10.7 %s + +#include "Common.h" + +@interface NSInvocation : NSObject +- (void)getReturnValue:(void *)retLoc; +- (void)setReturnValue:(void *)retLoc; + +- (void)getArgument:(void *)argumentLocation atIndex:(int)idx; +- (void)setArgument:(void *)argumentLocation atIndex:(int)idx; +@end + +@interface Test +@end + +@implementation Test { + id strong_id; + __weak id weak_id; + __unsafe_unretained id unsafe_id; + int arg; +} +- (void) test:(NSInvocation *)invok { + [invok getReturnValue:&strong_id]; // expected-error {{NSInvocation's getReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok getReturnValue:&weak_id]; // expected-error {{NSInvocation's getReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok getReturnValue:&unsafe_id]; + [invok getReturnValue:&arg]; + + [invok setReturnValue:&strong_id]; // expected-error {{NSInvocation's setReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok setReturnValue:&weak_id]; // expected-error {{NSInvocation's setReturnValue is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok setReturnValue:&unsafe_id]; + [invok setReturnValue:&arg]; + + [invok getArgument:&strong_id atIndex:0]; // expected-error {{NSInvocation's getArgument is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok getArgument:&weak_id atIndex:0]; // expected-error {{NSInvocation's getArgument is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok getArgument:&unsafe_id atIndex:0]; + [invok getArgument:&arg atIndex:0]; + + [invok setArgument:&strong_id atIndex:0]; // expected-error {{NSInvocation's setArgument is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok setArgument:&weak_id atIndex:0]; // expected-error {{NSInvocation's setArgument is not safe to be used with an object with ownership other than __unsafe_unretained}} + [invok setArgument:&unsafe_id atIndex:0]; + [invok setArgument:&arg atIndex:0]; +} +@end diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m index eea7a9f2547c..7c24dc485a2d 100644 --- a/test/ARCMT/checking.m +++ b/test/ARCMT/checking.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 %s #include "Common.h" diff --git a/test/ARCMT/cxx-checking.mm b/test/ARCMT/cxx-checking.mm index 27e0ea3869b8..ab6b29bafe62 100644 --- a/test/ARCMT/cxx-checking.mm +++ b/test/ARCMT/cxx-checking.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fblocks -Warc-abi %s +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks -Warc-abi %s // Classes that have an Objective-C object pointer. struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} diff --git a/test/ARCMT/cxx-rewrite.mm b/test/ARCMT/cxx-rewrite.mm index aba3f7568b03..4a9c50c92426 100644 --- a/test/ARCMT/cxx-rewrite.mm +++ b/test/ARCMT/cxx-rewrite.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c++ %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c++ %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c++ %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s > %t // RUN: diff %t %s.result #include "Common.h" @@ -14,6 +14,8 @@ struct foo { NSAutoreleasePool *pool = [NSAutoreleasePool new]; [[[NSString string] retain] release]; [pool drain]; + if (s) + [s release]; } ~foo(){ [s release]; } private: diff --git a/test/ARCMT/cxx-rewrite.mm.result b/test/ARCMT/cxx-rewrite.mm.result index 145ccd39e884..0dd67e8b27f4 100644 --- a/test/ARCMT/cxx-rewrite.mm.result +++ b/test/ARCMT/cxx-rewrite.mm.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c++ %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c++ %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c++ %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/dealloc.m b/test/ARCMT/dealloc.m index dac964403f27..d7a72af4f726 100644 --- a/test/ARCMT/dealloc.m +++ b/test/ARCMT/dealloc.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface A diff --git a/test/ARCMT/dealloc.m.result b/test/ARCMT/dealloc.m.result index 24756d25484b..fbd9e445d275 100644 --- a/test/ARCMT/dealloc.m.result +++ b/test/ARCMT/dealloc.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface A diff --git a/test/ARCMT/driver-migrate.m b/test/ARCMT/driver-migrate.m index e283857cb574..32e84d757819 100644 --- a/test/ARCMT/driver-migrate.m +++ b/test/ARCMT/driver-migrate.m @@ -1,3 +1,12 @@ // RUN: %clang -### -ccc-arcmt-migrate /foo/bar -fsyntax-only %s 2>&1 | FileCheck %s // CHECK: "-arcmt-migrate" "-arcmt-migrate-directory" "{{[^"]*}}/foo/bar" + +// RUN: touch %t.o +// RUN: %clang -ccc-arcmt-check -ccc-host-triple i386-apple-darwin9 -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK %s < %t.log +// RUN: %clang -ccc-arcmt-migrate /foo/bar -ccc-host-triple i386-apple-darwin9 -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK %s < %t.log + +// LINK-NOT: {{ld(.exe)?"}} +// LINK: {{touch(.exe)?"}} diff --git a/test/ARCMT/init.m b/test/ARCMT/init.m index f0d24f60e1e3..8636e3733d22 100644 --- a/test/ARCMT/init.m +++ b/test/ARCMT/init.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSObject diff --git a/test/ARCMT/init.m.result b/test/ARCMT/init.m.result index 4f3b4e724e2e..0140bb96919c 100644 --- a/test/ARCMT/init.m.result +++ b/test/ARCMT/init.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface NSObject diff --git a/test/ARCMT/migrate-emit-errors.m b/test/ARCMT/migrate-emit-errors.m new file mode 100644 index 000000000000..6a4a3963ca0b --- /dev/null +++ b/test/ARCMT/migrate-emit-errors.m @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t -arcmt-migrate-emit-errors %s 2>&1 | FileCheck %s +// RUN: rm -rf %t + +@protocol NSObject +- (oneway void)release; +@end + +void test(id p) { + [p release]; +} + +// CHECK: error: ARC forbids explicit message send of 'release'
\ No newline at end of file diff --git a/test/ARCMT/migrate-plist-output.m b/test/ARCMT/migrate-plist-output.m new file mode 100644 index 000000000000..e5b74e91f8d0 --- /dev/null +++ b/test/ARCMT/migrate-plist-output.m @@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t.dir -arcmt-migrate-report-output %t.plist %s +// RUN: FileCheck %s -input-file=%t.plist +// RUN: rm -rf %t.dir + +@protocol NSObject +- (oneway void)release; +@end + +void test(id p) { + [p release]; +} + +// CHECK: <?xml version="1.0" encoding="UTF-8"?> +// CHECK: <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +// CHECK: <plist version="1.0"> +// CHECK: <dict> +// CHECK: <key>files</key> +// CHECK: <array> +// CHECK: </array> +// CHECK: <key>diagnostics</key> +// CHECK: <array> +// CHECK: <dict> +// CHECK: <key>description</key><string>ARC forbids explicit message send of 'release'</string> +// CHECK: <key>category</key><string>Automatic Reference Counting Issue</string> +// CHECK: <key>type</key><string>error</string> +// CHECK: <key>location</key> +// CHECK: <dict> +// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>col</key><integer>4</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <key>ranges</key> +// CHECK: <array> +// CHECK: <array> +// CHECK: <dict> +// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>col</key><integer>6</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>col</key><integer>12</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: </array> +// CHECK: </array> +// CHECK: </dict> +// CHECK: </array> +// CHECK: </dict> +// CHECK: </plist> diff --git a/test/ARCMT/migrate-space-in-path.m b/test/ARCMT/migrate-space-in-path.m new file mode 100644 index 000000000000..32617666a96e --- /dev/null +++ b/test/ARCMT/migrate-space-in-path.m @@ -0,0 +1,5 @@ +// RUN: rm -rf %t.migrate +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t.migrate %S/"with space"/test1.m.in -x objective-c +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t.migrate %S/"with space"/test2.m.in -x objective-c +// RUN: c-arcmt-test -arcmt-migrate-directory %t.migrate | arcmt-test -verify-transformed-files %S/"with space"/test1.m.in.result %S/"with space"/test2.m.in.result %S/"with space"/test.h.result +// RUN: rm -rf %t.migrate diff --git a/test/ARCMT/migrate.m b/test/ARCMT/migrate.m index 51029c5204f7..cfd7115acc1e 100644 --- a/test/ARCMT/migrate.m +++ b/test/ARCMT/migrate.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c -fobjc-nonfragile-abi -// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c -fobjc-nonfragile-abi +// RUN: rm -rf %t +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t %S/Inputs/test1.m.in -x objective-c +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t %S/Inputs/test2.m.in -x objective-c // RUN: c-arcmt-test -arcmt-migrate-directory %t | arcmt-test -verify-transformed-files %S/Inputs/test1.m.in.result %S/Inputs/test2.m.in.result %S/Inputs/test.h.result // RUN: rm -rf %t diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m index 46ef02400e8c..5dba61f023fd 100644 --- a/test/ARCMT/nonobjc-to-objc-cast-2.m +++ b/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -1,9 +1,13 @@ -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 %s -typedef int BOOL; -typedef const struct __CFString * CFStringRef; +#include "Common.h" + +@interface NSString : NSObject +-(id)string; +-(id)newString; +@end -@class NSString; +typedef const struct __CFString * CFStringRef; void f(BOOL b) { CFStringRef cfstr; @@ -12,3 +16,16 @@ void f(BOOL b) { // expected-note{{use __bridge_transfer to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} void *vp = str; // expected-error {{disallowed}} } + +void f2(NSString *s) { + CFStringRef ref; + ref = [(CFStringRef)[s string] retain]; // expected-error {{cast of Objective-C pointer type 'id' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \ + // expected-error {{ bad receiver type 'CFStringRef' (aka 'const struct __CFString *')}} \ + // expected-note{{use __bridge to convert directly (no change in ownership)}} \ + // expected-note{{use __bridge_retained to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} +} + +CFStringRef f3() { + return (CFStringRef)[[[NSString alloc] init] autorelease]; // expected-error {{it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object}} \ + // expected-note {{remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased}} +} diff --git a/test/ARCMT/nonobjc-to-objc-cast.m b/test/ARCMT/nonobjc-to-objc-cast.m index 4e1e293efbac..4fa110919917 100644 --- a/test/ARCMT/nonobjc-to-objc-cast.m +++ b/test/ARCMT/nonobjc-to-objc-cast.m @@ -1,10 +1,12 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" @interface NSString : NSObject +-(id)string; +-(id)newString; @end typedef const struct __CFString * CFStringRef; @@ -27,6 +29,7 @@ void f(BOOL b, id p) { CFUUIDRef _uuid; NSString *_uuidString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); _uuidString = [(NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid) autorelease]; + _uuidString = CFRetain(_uuid); } @implementation NSString (StrExt) @@ -36,3 +39,23 @@ void f(BOOL b, id p) { return self; } @end + +extern void consumeParam(CFStringRef CF_CONSUMED p); + +void f2(NSString *s) { + CFStringRef ref = [s string]; + ref = (CFStringRef)[s string]; + ref = s.string; + ref = [NSString new]; + ref = [s newString]; + ref = (CFStringRef)[NSString new]; + ref = [[NSString alloc] init]; + ref = [[s string] retain]; + ref = CFRetain((CFStringRef)[s string]); + ref = CFRetain([s string]); + ref = CFRetain(s); + ref = [s retain]; + + consumeParam((CFStringRef)s); + consumeParam(s); +} diff --git a/test/ARCMT/nonobjc-to-objc-cast.m.result b/test/ARCMT/nonobjc-to-objc-cast.m.result index 53dde7553d6d..bf6aad931948 100644 --- a/test/ARCMT/nonobjc-to-objc-cast.m.result +++ b/test/ARCMT/nonobjc-to-objc-cast.m.result @@ -1,10 +1,12 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" @interface NSString : NSObject +-(id)string; +-(id)newString; @end typedef const struct __CFString * CFStringRef; @@ -27,6 +29,7 @@ void f(BOOL b, id p) { CFUUIDRef _uuid; NSString *_uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); _uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, _uuid); + _uuidString = (__bridge_transfer NSString *)(CFRetain(_uuid)); } @implementation NSString (StrExt) @@ -36,3 +39,23 @@ void f(BOOL b, id p) { return self; } @end + +extern void consumeParam(CFStringRef CF_CONSUMED p); + +void f2(NSString *s) { + CFStringRef ref = (__bridge CFStringRef)([s string]); + ref = (__bridge CFStringRef)[s string]; + ref = (__bridge CFStringRef)(s.string); + ref = (__bridge_retained CFStringRef)([NSString new]); + ref = (__bridge_retained CFStringRef)([s newString]); + ref = (__bridge_retained CFStringRef)[NSString new]; + ref = (__bridge_retained CFStringRef)([[NSString alloc] init]); + ref = (__bridge_retained CFStringRef)([s string]); + ref = (__bridge_retained CFStringRef)[s string]; + ref = (__bridge_retained CFTypeRef)([s string]); + ref = (__bridge_retained CFTypeRef)(s); + ref = (__bridge_retained CFStringRef)(s); + + consumeParam((__bridge_retained CFStringRef)s); + consumeParam((__bridge_retained CFStringRef)(s)); +} diff --git a/test/ARCMT/releases-driver.m b/test/ARCMT/releases-driver.m index a016b26f4482..b75432ac2318 100644 --- a/test/ARCMT/releases-driver.m +++ b/test/ARCMT/releases-driver.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: cp %s %t -// RUN: %clang_cc1 -arcmt-modify -triple x86_64-apple-macosx10.6 -fobjc-nonfragile-abi -x objective-c %t +// RUN: %clang_cc1 -arcmt-modify -triple x86_64-apple-macosx10.6 -x objective-c %t // RUN: diff %t %s.result // RUN: rm %t diff --git a/test/ARCMT/releases-driver.m.result b/test/ARCMT/releases-driver.m.result index c5f527fec1c1..70c0aecaf475 100644 --- a/test/ARCMT/releases-driver.m.result +++ b/test/ARCMT/releases-driver.m.result @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: cp %s %t -// RUN: %clang_cc1 -arcmt-modify -triple x86_64-apple-macosx10.6 -fobjc-nonfragile-abi -x objective-c %t +// RUN: %clang_cc1 -arcmt-modify -triple x86_64-apple-macosx10.6 -x objective-c %t // RUN: diff %t %s.result // RUN: rm %t diff --git a/test/ARCMT/releases.m b/test/ARCMT/releases.m index d5f21dc4c2a7..867fab9cec74 100644 --- a/test/ARCMT/releases.m +++ b/test/ARCMT/releases.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-exceptions -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-exceptions -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -fobjc-exceptions -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-exceptions -fblocks -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #define nil 0 @@ -85,3 +85,15 @@ void test2(id p) { RELEASE_MACRO(p); RELEASE_MACRO2(p); } + +@implementation Foo2 + +static id internal_var = 0; + ++ (void)setIt:(id)newone { + if (internal_var != newone) { + [internal_var release]; + internal_var = [newone retain]; + } +} +@end diff --git a/test/ARCMT/releases.m.result b/test/ARCMT/releases.m.result index 1d36f3e6b7de..556610ab2a53 100644 --- a/test/ARCMT/releases.m.result +++ b/test/ARCMT/releases.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-exceptions -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-exceptions -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -fobjc-exceptions -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-exceptions -fblocks -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #define nil 0 @@ -77,3 +77,14 @@ void block_test(Foo *p) { void test2(id p) { } + +@implementation Foo2 + +static id internal_var = 0; + ++ (void)setIt:(id)newone { + if (internal_var != newone) { + internal_var = newone; + } +} +@end diff --git a/test/ARCMT/remove-dealloc-method.m b/test/ARCMT/remove-dealloc-method.m index 5c2d785ba716..8e39fc874c95 100644 --- a/test/ARCMT/remove-dealloc-method.m +++ b/test/ARCMT/remove-dealloc-method.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #define nil ((void*) 0) diff --git a/test/ARCMT/remove-dealloc-method.m.result b/test/ARCMT/remove-dealloc-method.m.result index ecb752cf2f88..47e31f9d249a 100644 --- a/test/ARCMT/remove-dealloc-method.m.result +++ b/test/ARCMT/remove-dealloc-method.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #define nil ((void*) 0) diff --git a/test/ARCMT/remove-dealloc-zerouts.m b/test/ARCMT/remove-dealloc-zerouts.m index 3ba85f1edcab..4176ec580c3e 100644 --- a/test/ARCMT/remove-dealloc-zerouts.m +++ b/test/ARCMT/remove-dealloc-zerouts.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface Foo diff --git a/test/ARCMT/remove-dealloc-zerouts.m.result b/test/ARCMT/remove-dealloc-zerouts.m.result index dc6ffd311490..9ae831abacf2 100644 --- a/test/ARCMT/remove-dealloc-zerouts.m.result +++ b/test/ARCMT/remove-dealloc-zerouts.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result @interface Foo diff --git a/test/ARCMT/remove-statements.m b/test/ARCMT/remove-statements.m index 7e102961263a..286a8e715e0d 100644 --- a/test/ARCMT/remove-statements.m +++ b/test/ARCMT/remove-statements.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/remove-statements.m.result b/test/ARCMT/remove-statements.m.result index 9a1153e287c2..6a4ea08b8c95 100644 --- a/test/ARCMT/remove-statements.m.result +++ b/test/ARCMT/remove-statements.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/retains.m b/test/ARCMT/retains.m index fa90f218dd5d..60283a695ff4 100644 --- a/test/ARCMT/retains.m +++ b/test/ARCMT/retains.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/retains.m.result b/test/ARCMT/retains.m.result index 54df864e58cb..2011e506360c 100644 --- a/test/ARCMT/retains.m.result +++ b/test/ARCMT/retains.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/rewrite-block-var.m b/test/ARCMT/rewrite-block-var.m index 81407f92e9bb..e6a8fb72e00a 100644 --- a/test/ARCMT/rewrite-block-var.m +++ b/test/ARCMT/rewrite-block-var.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fobjc-nonfragile-abi -fblocks -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fblocks -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/rewrite-block-var.m.result b/test/ARCMT/rewrite-block-var.m.result index 85093ac52d27..27c81bd58825 100644 --- a/test/ARCMT/rewrite-block-var.m.result +++ b/test/ARCMT/rewrite-block-var.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result -// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fobjc-nonfragile-abi -fblocks -fsyntax-only %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result +// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fblocks -fsyntax-only %s > %t // RUN: diff %t %s.result #include "Common.h" diff --git a/test/ARCMT/safe-arc-assign.m b/test/ARCMT/safe-arc-assign.m index 368c2b6639da..4a0a575794e1 100644 --- a/test/ARCMT/safe-arc-assign.m +++ b/test/ARCMT/safe-arc-assign.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result void test12(id collection) { diff --git a/test/ARCMT/safe-arc-assign.m.result b/test/ARCMT/safe-arc-assign.m.result index cacd1093c524..c25955ea7d1c 100644 --- a/test/ARCMT/safe-arc-assign.m.result +++ b/test/ARCMT/safe-arc-assign.m.result @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t // RUN: diff %t %s.result void test12(id collection) { diff --git a/test/ARCMT/with space/test.h b/test/ARCMT/with space/test.h new file mode 100644 index 000000000000..756295f27e69 --- /dev/null +++ b/test/ARCMT/with space/test.h @@ -0,0 +1,15 @@ +@protocol NSObject +- (oneway void)release; +@end + +#ifdef PART1 +static inline void part1(id p) { + [p release]; +} +#endif + +#ifdef PART2 +static inline void part2(id p) { + [p release]; +} +#endif diff --git a/test/ARCMT/with space/test.h.result b/test/ARCMT/with space/test.h.result new file mode 100644 index 000000000000..0638a3378c1c --- /dev/null +++ b/test/ARCMT/with space/test.h.result @@ -0,0 +1,13 @@ +@protocol NSObject +- (oneway void)release; +@end + +#ifdef PART1 +static inline void part1(id p) { +} +#endif + +#ifdef PART2 +static inline void part2(id p) { +} +#endif diff --git a/test/ARCMT/with space/test1.m.in b/test/ARCMT/with space/test1.m.in new file mode 100644 index 000000000000..8416a8896569 --- /dev/null +++ b/test/ARCMT/with space/test1.m.in @@ -0,0 +1,6 @@ +#define PART1 +#include "test.h" + +void test1(id p) { + [p release]; +} diff --git a/test/ARCMT/with space/test1.m.in.result b/test/ARCMT/with space/test1.m.in.result new file mode 100644 index 000000000000..f351fe6c8355 --- /dev/null +++ b/test/ARCMT/with space/test1.m.in.result @@ -0,0 +1,5 @@ +#define PART1 +#include "test.h" + +void test1(id p) { +} diff --git a/test/ARCMT/with space/test2.m.in b/test/ARCMT/with space/test2.m.in new file mode 100644 index 000000000000..99f87b072171 --- /dev/null +++ b/test/ARCMT/with space/test2.m.in @@ -0,0 +1,6 @@ +#define PART2 +#include "test.h" + +void test2(id p) { + [p release]; +} diff --git a/test/ARCMT/with space/test2.m.in.result b/test/ARCMT/with space/test2.m.in.result new file mode 100644 index 000000000000..f8e918ce2598 --- /dev/null +++ b/test/ARCMT/with space/test2.m.in.result @@ -0,0 +1,5 @@ +#define PART2 +#include "test.h" + +void test2(id p) { +} diff --git a/test/ARCMT/with-arc-mode-check.m b/test/ARCMT/with-arc-mode-check.m index c3146ef3b614..33f31f522a58 100644 --- a/test/ARCMT/with-arc-mode-check.m +++ b/test/ARCMT/with-arc-mode-check.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -arcmt-check -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s +// RUN: %clang_cc1 -arcmt-check -fsyntax-only -fobjc-arc -x objective-c %s @protocol NSObject - (oneway void)release; diff --git a/test/ARCMT/with-arc-mode-migrate.m b/test/ARCMT/with-arc-mode-migrate.m index 3851bc77312e..32bcad195042 100644 --- a/test/ARCMT/with-arc-mode-migrate.m +++ b/test/ARCMT/with-arc-mode-migrate.m @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t -fsyntax-only -fobjc-arc %s // RUN: c-arcmt-test -arcmt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result // RUN: rm -rf %t diff --git a/test/ARCMT/with-arc-mode-migrate.m.result b/test/ARCMT/with-arc-mode-migrate.m.result index c2222ae7b659..f060793f6eb4 100644 --- a/test/ARCMT/with-arc-mode-migrate.m.result +++ b/test/ARCMT/with-arc-mode-migrate.m.result @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result -// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -arcmt-migrate -arcmt-migrate-directory %t -fsyntax-only -fobjc-arc %s // RUN: c-arcmt-test -arcmt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result // RUN: rm -rf %t diff --git a/test/ARCMT/with-arc-mode-modify.m b/test/ARCMT/with-arc-mode-modify.m index 17a398072e1f..fbbd630700f4 100644 --- a/test/ARCMT/with-arc-mode-modify.m +++ b/test/ARCMT/with-arc-mode-modify.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: cp %s %t -// RUN: %clang_cc1 -arcmt-modify -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %t +// RUN: %clang_cc1 -arcmt-modify -fsyntax-only -fobjc-arc -x objective-c %t // RUN: diff %t %s.result // RUN: rm %t diff --git a/test/ARCMT/with-arc-mode-modify.m.result b/test/ARCMT/with-arc-mode-modify.m.result index 97c5128cd950..631f276516f6 100644 --- a/test/ARCMT/with-arc-mode-modify.m.result +++ b/test/ARCMT/with-arc-mode-modify.m.result @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -x objective-c %s.result // RUN: cp %s %t -// RUN: %clang_cc1 -arcmt-modify -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %t +// RUN: %clang_cc1 -arcmt-modify -fsyntax-only -fobjc-arc -x objective-c %t // RUN: diff %t %s.result // RUN: rm %t diff --git a/test/ASTMerge/interface.m b/test/ASTMerge/interface.m index e37e3807e514..747ef38223ec 100644 --- a/test/ASTMerge/interface.m +++ b/test/ASTMerge/interface.m @@ -4,7 +4,7 @@ // CHECK: interface2.m:16:9: error: instance variable 'ivar2' declared with incompatible types in different translation units ('float' vs. 'int') // CHECK: interface1.m:16:7: note: declared here with type 'int' -// CHECK: interface1.m:21:1: error: class 'I4' has incompatible superclasses +// CHECK: interface1.m:21:12: error: class 'I4' has incompatible superclasses // CHECK: interface1.m:21:17: note: inherits from superclass 'I2' here // CHECK: interface2.m:21:17: note: inherits from superclass 'I1' here // CHECK: interface2.m:33:1: error: class method 'foo' has incompatible result types in different translation units ('float' vs. 'int') @@ -15,8 +15,8 @@ // CHECK: interface1.m:46:1: note: class method 'bar:' also declared here // CHECK: interface2.m:57:20: error: instance method 'bar:' has a parameter with a different types in different translation units ('double' vs. 'float') // CHECK: interface1.m:58:19: note: declared here with type 'float' -// CHECK: interface1.m:100:1: error: class 'I15' has incompatible superclasses -// CHECK: interface1.m:100:1: note: inherits from superclass 'I12' here -// CHECK: interface2.m:99:1: note: inherits from superclass 'I11' here +// CHECK: interface1.m:100:17: error: class 'I15' has incompatible superclasses +// CHECK: interface1.m:100:17: note: inherits from superclass 'I12' here +// CHECK: interface2.m:99:17: note: inherits from superclass 'I11' here // CHECK: 8 errors generated diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index bd1a4b7967ca..69b99f052b01 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -1,8 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c index 11af0747a317..fbbe4d15f49f 100644 --- a/test/Analysis/CFNumber.c +++ b/test/Analysis/CFNumber.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s typedef signed long CFIndex; typedef const struct __CFAllocator * CFAllocatorRef; diff --git a/test/Analysis/CFRetainRelease_NSAssertionHandler.m b/test/Analysis/CFRetainRelease_NSAssertionHandler.m index ee52201e6285..e0c9be1c1ebf 100644 --- a/test/Analysis/CFRetainRelease_NSAssertionHandler.m +++ b/test/Analysis/CFRetainRelease_NSAssertionHandler.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=basic -analyzer-store=basic -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=range -analyzer-store=basic -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=basic -analyzer-store=region -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=range -analyzer-store=region +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -verify %s -analyzer-constraints=basic -analyzer-store=region +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -verify %s -analyzer-constraints=range -analyzer-store=region typedef struct objc_selector *SEL; typedef signed char BOOL; @@ -22,6 +20,7 @@ extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); @interface NSAssertionHandler : NSObject {} + (NSAssertionHandler *)currentHandler; - (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,...; +- (void)handleFailureInFunction:(NSString *)functionName file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,...; @end extern NSString * const NSConnectionReplyMode; @@ -65,3 +64,10 @@ extern NSString * const NSConnectionReplyMode; } @end + +void pointerFunction (int *x) { + // Manual expansion of NSCAssert( x != 0, @"") + do { if (!((x != 0))) { [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] file:[NSString stringWithUTF8String:__FILE__] lineNumber:__LINE__ description:((@""))]; } } while(0); + + *x = 1; // no-warning +} diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c index ea458404c5dd..1bd20fa1cfa1 100644 --- a/test/Analysis/CGColorSpace.c +++ b/test/Analysis/CGColorSpace.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify %s typedef struct CGColorSpace *CGColorSpaceRef; extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); diff --git a/test/Analysis/CheckNSError.m b/test/Analysis/CheckNSError.m index 3bc7d8f748e1..5bf7e08a587a 100644 --- a/test/Analysis/CheckNSError.m +++ b/test/Analysis/CheckNSError.m @@ -1,6 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=basic -analyzer-constraints=basic -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=basic -analyzer-constraints=range -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=range -verify %s diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m index e7930d1223b7..51a5912d4443 100644 --- a/test/Analysis/MissingDealloc.m +++ b/test/Analysis/MissingDealloc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.experimental.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.osx.cocoa.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify typedef signed char BOOL; @protocol NSObject - (BOOL)isEqual:(id)object; diff --git a/test/Analysis/NSPanel.m b/test/Analysis/NSPanel.m index 19b72d8f692f..ac725716457f 100644 --- a/test/Analysis/NSPanel.m +++ b/test/Analysis/NSPanel.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s // BEGIN delta-debugging reduced header stuff diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m index 6ff4bb1e554f..48450daa013d 100644 --- a/test/Analysis/NSString.m +++ b/test/Analysis/NSString.m @@ -1,13 +1,8 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s - -// ==-- FIXME: -analyzer-store=basic fails on this file (false negatives). --== -// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s && -// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s + //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m index 404448574ea1..495f8e19d8ef 100644 --- a/test/Analysis/NSWindow.m +++ b/test/Analysis/NSWindow.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core,deadcode.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core,deadcode.DeadStores -analyzer-store=region -analyzer-constraints=range -verify %s // These declarations were reduced using Delta-Debugging from Foundation.h // on Mac OS X. The test cases are below. diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m index 42952ed3a7cc..ea2efd061711 100644 --- a/test/Analysis/NoReturn.m +++ b/test/Analysis/NoReturn.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s #include <stdarg.h> diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m index 103db486b1c2..d88e0571e4c1 100644 --- a/test/Analysis/ObjCProperties.m +++ b/test/Analysis/ObjCProperties.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic %s -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range %s -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic %s -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range %s -verify // The point of this test cases is to exercise properties in the static // analyzer diff --git a/test/Analysis/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m index 9778e41d9ced..02be25717a63 100644 --- a/test/Analysis/ObjCRetSigs.m +++ b/test/Analysis/ObjCRetSigs.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify %s int printf(const char *, ...); diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m index b9e9d6b757de..5436063738a6 100644 --- a/test/Analysis/PR2599.m +++ b/test/Analysis/PR2599.m @@ -1,7 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -fobjc-gc -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=basic -fobjc-gc -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -fobjc-gc -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=region -fobjc-gc -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-constraints=range -analyzer-store=region -fobjc-gc -verify %s typedef const void * CFTypeRef; typedef const struct __CFString * CFStringRef; diff --git a/test/Analysis/PR2978.m b/test/Analysis/PR2978.m index c07150f0ce2a..ea139d28af82 100644 --- a/test/Analysis/PR2978.m +++ b/test/Analysis/PR2978.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=osx.cocoa.experimental.Dealloc %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=experimental.osx.cocoa.Dealloc %s -verify // Tests for the checker which checks missing/extra ivar 'release' calls // in dealloc. diff --git a/test/Analysis/PR3991.m b/test/Analysis/PR3991.m index 23f199311e47..38d0bc0b5293 100644 --- a/test/Analysis/PR3991.m +++ b/test/Analysis/PR3991.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s //===----------------------------------------------------------------------===// // Delta-debugging produced forward declarations. diff --git a/test/Analysis/PR9741.cpp b/test/Analysis/PR9741.cpp index e20e56c9406a..7497d5627c91 100644 --- a/test/Analysis/PR9741.cpp +++ b/test/Analysis/PR9741.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -cc1 -std=c++0x -Wuninitialized -verify %s +// RUN: %clang_cc1 -cc1 -std=c++11 -Wuninitialized -verify %s void f() { int a[] = { 1, 2, 3 }; diff --git a/test/Analysis/additive-folding-range-constraints.c b/test/Analysis/additive-folding-range-constraints.c index e342bb453cda..32e0cfe142ad 100644 --- a/test/Analysis/additive-folding-range-constraints.c +++ b/test/Analysis/additive-folding-range-constraints.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify -analyzer-constraints=range %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -verify -analyzer-constraints=range %s // These are used to trigger warnings. typedef typeof(sizeof(int)) size_t; diff --git a/test/Analysis/additive-folding.c b/test/Analysis/additive-folding.c index 17d9db6ea23a..71d0151f22af 100644 --- a/test/Analysis/additive-folding.c +++ b/test/Analysis/additive-folding.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,unix.experimental.Malloc -verify -analyzer-constraints=basic %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,unix.experimental.Malloc -verify -analyzer-constraints=range %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.unix.Malloc -verify -analyzer-constraints=basic %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.unix.Malloc -verify -analyzer-constraints=range %s // These are used to trigger warnings. typedef typeof(sizeof(int)) size_t; diff --git a/test/Analysis/analyzeOneFunction.m b/test/Analysis/analyzeOneFunction.m new file mode 100644 index 000000000000..1ff2fc8fe8a3 --- /dev/null +++ b/test/Analysis/analyzeOneFunction.m @@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -analyze -analyze-function="myMethodWithY:withX:" -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -verify %s + +typedef signed char BOOL; +typedef unsigned int NSUInteger; +typedef struct _NSZone NSZone; +@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; +@protocol NSObject - (BOOL)isEqual:(id)object; @end +@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end +@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end +@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end +@interface NSObject <NSObject> {} ++(id)alloc; +-(id)init; +-(id)autorelease; +-(id)copy; +-(id)retain; +@end +@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> +- (NSUInteger)length; +-(id)initWithFormat:(NSString *)f,...; +-(BOOL)isEqualToString:(NSString *)s; ++ (id)string; +@end + +@interface Test1 : NSObject { + NSString *text; +} +-(id)myMethod; +-(id)myMethodWithY:(int)Y withX:(int)X; + +@property (nonatomic, assign) NSString *text; +@end + +@implementation Test1 + +@synthesize text; + +-(id)myMethod { + Test1 *cell = [[[Test1 alloc] init] autorelease]; + + NSString *string1 = [[NSString alloc] initWithFormat:@"test %f", 0.0]; // No warning: this function is not analized. + cell.text = string1; + + return cell; +} + +-(id)myMethodWithY:(int)Y withX:(int)X { + Test1 *cell = [[[Test1 alloc] init] autorelease]; + + NSString *string1 = [[NSString alloc] initWithFormat:@"test %f %d", 0.0, X+Y]; // expected-warning {{Potential leak}} + cell.text = string1; + + return cell; +} + +@end diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c index 37a6f75b3ca2..1284933db09d 100644 --- a/test/Analysis/array-struct-region.c +++ b/test/Analysis/array-struct-region.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,deadcode.experimental.UnreachableCode -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,deadcode.experimental.UnreachableCode -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,experimental.deadcode.UnreachableCode -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,experimental.deadcode.UnreachableCode -analyzer-store=region -analyzer-constraints=range -verify %s int string_literal_init() { char a[] = "abc"; diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index 6b8bb6c5f675..c5bdb86a14ed 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core.CastToStruct -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core.CastToStruct -analyzer-store=region -analyzer-constraints=range -verify %s struct s { int data; diff --git a/test/Analysis/auto-obj-dtors-cfg-output.cpp b/test/Analysis/auto-obj-dtors-cfg-output.cpp index c877061eb6ae..17aa486de0ce 100644 --- a/test/Analysis/auto-obj-dtors-cfg-output.cpp +++ b/test/Analysis/auto-obj-dtors-cfg-output.cpp @@ -155,655 +155,718 @@ void test_catch_copy() { } } -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: const A &b = a; -// CHECK: 4: A() -// CHECK: 5: const A &c = A(); -// CHECK: 6: [B1.5].~A() (Implicit destructor) -// CHECK: 7: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A a[2]; -// CHECK: 3: -// CHECK: 4: A b[0]; -// CHECK: 5: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: -// CHECK: 4: A c; -// CHECK: 5: -// CHECK: 6: A d; -// CHECK: 7: [B1.6].~A() (Implicit destructor) -// CHECK: 8: [B1.4].~A() (Implicit destructor) -// CHECK: 9: -// CHECK: 10: A b; -// CHECK: 11: [B1.10].~A() (Implicit destructor) -// CHECK: 12: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B4 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B3 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B1.2].~A() (Implicit destructor) -// CHECK: 4: [B3.4].~A() (Implicit destructor) -// CHECK: 5: [B3.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: return; -// CHECK: 2: [B3.4].~A() (Implicit destructor) -// CHECK: 3: [B3.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B3 -// CHECK: Successors (1): B0 -// CHECK: [ B3 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: -// CHECK: 4: A b; -// CHECK: 5: UV -// CHECK: T: if [B3.5] -// CHECK: Predecessors (1): B4 -// CHECK: Successors (2): B2 B1 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (2): B1 B2 -// CHECK: Successors (0): -// CHECK: [ B8 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B7 -// CHECK: [ B1 ] -// CHECK: l1: -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B1.2].~A() (Implicit destructor) -// CHECK: 4: [B6.2].~A() (Implicit destructor) -// CHECK: 5: [B7.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A b; -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: 4: [B6.4].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: [B6.4].~A() (Implicit destructor) -// CHECK: T: goto l1; -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: UV -// CHECK: T: if [B4.1] -// CHECK: Predecessors (1): B6 -// CHECK: Successors (2): B3 B2 -// CHECK: [ B5 ] -// CHECK: 1: [B6.4].~A() (Implicit destructor) -// CHECK: 2: [B6.2].~A() (Implicit destructor) -// CHECK: T: goto l0; -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B6 -// CHECK: [ B6 ] -// CHECK: l0: -// CHECK: 1: -// CHECK: 2: A b; -// CHECK: 3: -// CHECK: 4: A a; -// CHECK: 5: UV -// CHECK: T: if [B6.5] -// CHECK: Predecessors (2): B7 B5 -// CHECK: Successors (2): B5 B4 -// CHECK: [ B7 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B6 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B5 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B4 -// CHECK: [ B1 ] -// CHECK: 1: [B4.4].~A() (Implicit destructor) -// CHECK: 2: [B4.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B3.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: a -// CHECK: 4: A b = a; -// CHECK: 5: b.operator int() -// CHECK: 6: [B4.5] -// CHECK: T: if [B4.6] -// CHECK: Predecessors (1): B5 -// CHECK: Successors (2): B3 B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B9 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B8 -// CHECK: [ B1 ] -// CHECK: 1: [B8.4].~A() (Implicit destructor) -// CHECK: 2: -// CHECK: 3: A e; -// CHECK: 4: [B1.3].~A() (Implicit destructor) -// CHECK: 5: [B8.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B5 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A d; -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: 4: [B4.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: return; -// CHECK: 2: [B4.2].~A() (Implicit destructor) -// CHECK: 3: [B8.4].~A() (Implicit destructor) -// CHECK: 4: [B8.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B0 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: UV -// CHECK: T: if [B4.3] -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B3 B2 -// CHECK: [ B5 ] -// CHECK: 1: -// CHECK: 2: A d; -// CHECK: 3: [B5.2].~A() (Implicit destructor) -// CHECK: 4: [B7.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B1 -// CHECK: [ B6 ] -// CHECK: 1: return; -// CHECK: 2: [B7.2].~A() (Implicit destructor) -// CHECK: 3: [B8.4].~A() (Implicit destructor) -// CHECK: 4: [B8.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B0 -// CHECK: [ B7 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: UV -// CHECK: T: if [B7.3] -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B6 B5 -// CHECK: [ B8 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: a -// CHECK: 4: A b = a; -// CHECK: 5: b.operator int() -// CHECK: 6: [B8.5] -// CHECK: T: if [B8.6] -// CHECK: Predecessors (1): B9 -// CHECK: Successors (2): B7 B4 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (3): B1 B3 B6 -// CHECK: Successors (0): -// CHECK: [ B6 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B5 -// CHECK: [ B1 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: 2: [B5.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: a -// CHECK: 2: A b = a; -// CHECK: 3: b.operator int() -// CHECK: 4: [B2.3] -// CHECK: T: while [B2.4] -// CHECK: Predecessors (2): B3 B5 -// CHECK: Successors (2): B4 B1 -// CHECK: [ B3 ] -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B2 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: 4: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B3 -// CHECK: [ B5 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B12 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B11 -// CHECK: [ B1 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: 2: -// CHECK: 3: A e; -// CHECK: 4: [B1.3].~A() (Implicit destructor) -// CHECK: 5: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B9 B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: a -// CHECK: 2: A b = a; -// CHECK: 3: b.operator int() -// CHECK: 4: [B2.3] -// CHECK: T: while [B2.4] -// CHECK: Predecessors (2): B3 B11 -// CHECK: Successors (2): B10 B1 -// CHECK: [ B3 ] -// CHECK: Predecessors (2): B4 B7 -// CHECK: Successors (1): B2 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A d; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: 4: [B10.2].~A() (Implicit destructor) -// CHECK: 5: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B3 -// CHECK: [ B5 ] -// CHECK: 1: return; -// CHECK: 2: [B10.2].~A() (Implicit destructor) -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: 4: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B0 -// CHECK: [ B6 ] -// CHECK: 1: UV -// CHECK: T: if [B6.1] -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B5 B4 -// CHECK: [ B7 ] -// CHECK: 1: [B10.2].~A() (Implicit destructor) -// CHECK: 2: [B2.2].~A() (Implicit destructor) -// CHECK: T: continue; -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B3 -// CHECK: [ B8 ] -// CHECK: 1: UV -// CHECK: T: if [B8.1] -// CHECK: Predecessors (1): B10 -// CHECK: Successors (2): B7 B6 -// CHECK: [ B9 ] -// CHECK: 1: [B10.2].~A() (Implicit destructor) -// CHECK: T: break; -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B1 -// CHECK: [ B10 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: UV -// CHECK: T: if [B10.3] -// CHECK: Predecessors (1): B2 -// CHECK: Successors (2): B9 B8 -// CHECK: [ B11 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: Predecessors (1): B12 -// CHECK: Successors (1): B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (2): B1 B5 -// CHECK: Successors (0): -// CHECK: [ B4 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B2 -// CHECK: [ B1 ] -// CHECK: 1: UV -// CHECK: T: do ... while [B1.1] -// CHECK: Predecessors (1): B2 -// CHECK: Successors (2): B3 B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B3 B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (1): B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B12 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B11 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A d; -// CHECK: 3: [B1.2].~A() (Implicit destructor) -// CHECK: 4: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B8 B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: UV -// CHECK: T: do ... while [B2.1] -// CHECK: Predecessors (2): B3 B6 -// CHECK: Successors (2): B10 B1 -// CHECK: [ B3 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B3.2].~A() (Implicit destructor) -// CHECK: 4: [B9.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B5 -// CHECK: Successors (1): B2 -// CHECK: [ B4 ] -// CHECK: 1: return; -// CHECK: 2: [B9.2].~A() (Implicit destructor) -// CHECK: 3: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B5 -// CHECK: Successors (1): B0 -// CHECK: [ B5 ] -// CHECK: 1: UV -// CHECK: T: if [B5.1] -// CHECK: Predecessors (1): B7 -// CHECK: Successors (2): B4 B3 -// CHECK: [ B6 ] -// CHECK: 1: [B9.2].~A() (Implicit destructor) -// CHECK: T: continue; -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B2 -// CHECK: [ B7 ] -// CHECK: 1: UV -// CHECK: T: if [B7.1] -// CHECK: Predecessors (1): B9 -// CHECK: Successors (2): B6 B5 -// CHECK: [ B8 ] -// CHECK: 1: [B9.2].~A() (Implicit destructor) -// CHECK: T: break; -// CHECK: Predecessors (1): B9 -// CHECK: Successors (1): B1 -// CHECK: [ B9 ] -// CHECK: 1: -// CHECK: 2: A b; -// CHECK: 3: UV -// CHECK: T: if [B9.3] -// CHECK: Predecessors (2): B10 B11 -// CHECK: Successors (2): B8 B7 -// CHECK: [ B10 ] -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B9 -// CHECK: [ B11 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: Predecessors (1): B12 -// CHECK: Successors (1): B9 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (2): B1 B4 -// CHECK: Successors (0): -// CHECK: [ B4 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B2 -// CHECK: [ B1 ] -// CHECK: 1: [B2.4].~A() (Implicit destructor) -// CHECK: 2: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B3 B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: a -// CHECK: 4: A b = a; -// CHECK: 5: b.operator int() -// CHECK: T: switch [B2.5] -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B3.2].~A() (Implicit destructor) -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B9 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B2 -// CHECK: [ B1 ] -// CHECK: 1: [B2.4].~A() (Implicit destructor) -// CHECK: 2: -// CHECK: 3: A g; -// CHECK: 4: [B1.3].~A() (Implicit destructor) -// CHECK: 5: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (3): B3 B7 B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: a -// CHECK: 4: A b = a; -// CHECK: 5: b.operator int() -// CHECK: T: switch [B2.5] -// CHECK: Predecessors (1): B9 -// CHECK: Successors (3): B3 B8 -// CHECK: B1 -// CHECK: [ B3 ] -// CHECK: case 1: -// CHECK: T: break; -// CHECK: Predecessors (2): B2 B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A f; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: 4: [B8.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B3 -// CHECK: [ B5 ] -// CHECK: 1: return; -// CHECK: 2: [B8.2].~A() (Implicit destructor) -// CHECK: 3: [B2.4].~A() (Implicit destructor) -// CHECK: 4: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B0 -// CHECK: [ B6 ] -// CHECK: 1: UV -// CHECK: T: if [B6.1] -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B5 B4 -// CHECK: [ B7 ] -// CHECK: 1: [B8.2].~A() (Implicit destructor) -// CHECK: T: break; -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B1 -// CHECK: [ B8 ] -// CHECK: case 0: -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: UV -// CHECK: T: if [B8.3] -// CHECK: Predecessors (1): B2 -// CHECK: Successors (2): B7 B6 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (2): B1 B5 -// CHECK: Successors (0): -// CHECK: [ B6 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B5 -// CHECK: [ B1 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: 2: [B5.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: a -// CHECK: 2: A b = a; -// CHECK: 3: b.operator int() -// CHECK: 4: [B2.3] -// CHECK: T: for (...; [B2.4]; ) -// CHECK: Predecessors (2): B3 B5 -// CHECK: Successors (2): B4 B1 -// CHECK: [ B3 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B2 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A c; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B3 -// CHECK: [ B5 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B12 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B11 -// CHECK: [ B1 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: 2: [B11.4].~A() (Implicit destructor) -// CHECK: 3: -// CHECK: 4: A f; -// CHECK: 5: [B1.4].~A() (Implicit destructor) -// CHECK: 6: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B9 B2 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: b -// CHECK: 2: A c = b; -// CHECK: 3: c.operator int() -// CHECK: 4: [B2.3] -// CHECK: T: for (...; [B2.4]; ) -// CHECK: Predecessors (2): B3 B11 -// CHECK: Successors (2): B10 B1 -// CHECK: [ B3 ] -// CHECK: 1: [B2.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B4 B7 -// CHECK: Successors (1): B2 -// CHECK: [ B4 ] -// CHECK: 1: -// CHECK: 2: A e; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: 4: [B10.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B3 -// CHECK: [ B5 ] -// CHECK: 1: return; -// CHECK: 2: [B10.2].~A() (Implicit destructor) -// CHECK: 3: [B2.2].~A() (Implicit destructor) -// CHECK: 4: [B11.4].~A() (Implicit destructor) -// CHECK: 5: [B11.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B6 -// CHECK: Successors (1): B0 -// CHECK: [ B6 ] -// CHECK: 1: UV -// CHECK: T: if [B6.1] -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B5 B4 -// CHECK: [ B7 ] -// CHECK: 1: [B10.2].~A() (Implicit destructor) -// CHECK: T: continue; -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B3 -// CHECK: [ B8 ] -// CHECK: 1: UV -// CHECK: T: if [B8.1] -// CHECK: Predecessors (1): B10 -// CHECK: Successors (2): B7 B6 -// CHECK: [ B9 ] -// CHECK: 1: [B10.2].~A() (Implicit destructor) -// CHECK: T: break; -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B1 -// CHECK: [ B10 ] -// CHECK: 1: -// CHECK: 2: A d; -// CHECK: 3: UV -// CHECK: T: if [B10.3] -// CHECK: Predecessors (1): B2 -// CHECK: Successors (2): B9 B8 -// CHECK: [ B11 ] -// CHECK: 1: -// CHECK: 2: A a; -// CHECK: 3: -// CHECK: 4: A b; -// CHECK: Predecessors (1): B12 -// CHECK: Successors (1): B2 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (2): B1 B5 -// CHECK: Successors (0): -// CHECK: [ B3 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B0 -// CHECK: [ B1 ] -// CHECK: T: try ... -// CHECK: Predecessors (0): -// CHECK: Successors (2): B2 B0 -// CHECK: [ B2 ] -// CHECK: catch (const A &e): -// CHECK: Predecessors (1): B1 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (3): B2 B1 B3 -// CHECK: Successors (0): -// CHECK: [ B3 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B0 -// CHECK: [ B1 ] -// CHECK: T: try ... -// CHECK: Predecessors (0): -// CHECK: Successors (2): B2 B0 -// CHECK: [ B2 ] -// CHECK: catch (A e): -// CHECK: 1: .~A() (Implicit destructor) -// CHECK: Predecessors (1): B1 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (3): B2 B1 B3 -// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: a +// CHECK: 4: [B1.3] +// CHECK: 5: const A &b = a; +// CHECK: 6: A() +// CHECK: 7: [B1.6] (BindTemporary) +// CHECK: 8: [B1.7] +// CHECK: 9: [B1.8] +// CHECK: 10: const A &c = A(); +// CHECK: 11: [B1.10].~A() (Implicit destructor) +// CHECK: 12: [B1.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A a[2]; +// CHECK: 3: +// CHECK: 4: A b[0]; +// CHECK: 5: [B1.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: +// CHECK: 4: A c; +// CHECK: 5: +// CHECK: 6: A d; +// CHECK: 7: [B1.6].~A() (Implicit destructor) +// CHECK: 8: [B1.4].~A() (Implicit destructor) +// CHECK: 9: +// CHECK: 10: A b; +// CHECK: 11: [B1.10].~A() (Implicit destructor) +// CHECK: 12: [B1.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B4 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B3 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B1.2].~A() (Implicit destructor) +// CHECK: 4: [B3.4].~A() (Implicit destructor) +// CHECK: 5: [B3.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: return; +// CHECK: 2: [B3.4].~A() (Implicit destructor) +// CHECK: 3: [B3.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B3 +// CHECK: Successors (1): B0 +// CHECK: [ B3 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: +// CHECK: 4: A b; +// CHECK: 5: UV +// CHECK: 6: [B3.5] +// CHECK: T: if [B3.6] +// CHECK: Predecessors (1): B4 +// CHECK: Successors (2): B2 B1 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (2): B1 B2 +// CHECK: Successors (0): +// CHECK: [ B8 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B7 +// CHECK: [ B1 ] +// CHECK: l1: +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B1.2].~A() (Implicit destructor) +// CHECK: 4: [B6.2].~A() (Implicit destructor) +// CHECK: 5: [B7.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A b; +// CHECK: 3: [B2.2].~A() (Implicit destructor) +// CHECK: 4: [B6.4].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: [B6.4].~A() (Implicit destructor) +// CHECK: T: goto l1; +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: UV +// CHECK: 2: [B4.1] +// CHECK: T: if [B4.2] +// CHECK: Predecessors (1): B6 +// CHECK: Successors (2): B3 B2 +// CHECK: [ B5 ] +// CHECK: 1: [B6.4].~A() (Implicit destructor) +// CHECK: 2: [B6.2].~A() (Implicit destructor) +// CHECK: T: goto l0; +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B6 +// CHECK: [ B6 ] +// CHECK: l0: +// CHECK: 1: +// CHECK: 2: A b; +// CHECK: 3: +// CHECK: 4: A a; +// CHECK: 5: UV +// CHECK: 6: [B6.5] +// CHECK: T: if [B6.6] +// CHECK: Predecessors (2): B7 B5 +// CHECK: Successors (2): B5 B4 +// CHECK: [ B7 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B6 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B5 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B4 +// CHECK: [ B1 ] +// CHECK: 1: [B4.6].~A() (Implicit destructor) +// CHECK: 2: [B4.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B2.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B3.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: a +// CHECK: 4: [B4.3] +// CHECK: 5: [B4.4] +// CHECK: 6: A b = a; +// CHECK: 7: b +// CHECK: 8: [B4.7] +// CHECK: 9: [B4.8].operator int +// CHECK: 10: [B4.9]() +// CHECK: 11: [B4.10] +// CHECK: T: if [B4.11] +// CHECK: Predecessors (1): B5 +// CHECK: Successors (2): B3 B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B9 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B8 +// CHECK: [ B1 ] +// CHECK: 1: [B8.6].~A() (Implicit destructor) +// CHECK: 2: +// CHECK: 3: A e; +// CHECK: 4: [B1.3].~A() (Implicit destructor) +// CHECK: 5: [B8.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B5 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A d; +// CHECK: 3: [B2.2].~A() (Implicit destructor) +// CHECK: 4: [B4.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: return; +// CHECK: 2: [B4.2].~A() (Implicit destructor) +// CHECK: 3: [B8.6].~A() (Implicit destructor) +// CHECK: 4: [B8.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B0 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: UV +// CHECK: 4: [B4.3] +// CHECK: T: if [B4.4] +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B3 B2 +// CHECK: [ B5 ] +// CHECK: 1: +// CHECK: 2: A d; +// CHECK: 3: [B5.2].~A() (Implicit destructor) +// CHECK: 4: [B7.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B1 +// CHECK: [ B6 ] +// CHECK: 1: return; +// CHECK: 2: [B7.2].~A() (Implicit destructor) +// CHECK: 3: [B8.6].~A() (Implicit destructor) +// CHECK: 4: [B8.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B0 +// CHECK: [ B7 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: UV +// CHECK: 4: [B7.3] +// CHECK: T: if [B7.4] +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B6 B5 +// CHECK: [ B8 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: a +// CHECK: 4: [B8.3] +// CHECK: 5: [B8.4] +// CHECK: 6: A b = a; +// CHECK: 7: b +// CHECK: 8: [B8.7] +// CHECK: 9: [B8.8].operator int +// CHECK: 10: [B8.9]() +// CHECK: 11: [B8.10] +// CHECK: T: if [B8.11] +// CHECK: Predecessors (1): B9 +// CHECK: Successors (2): B7 B4 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (3): B1 B3 B6 +// CHECK: Successors (0): +// CHECK: [ B6 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B5 +// CHECK: [ B1 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: 2: [B5.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: a +// CHECK: 2: [B2.1] +// CHECK: 3: [B2.2] +// CHECK: 4: A b = a; +// CHECK: 5: b +// CHECK: 6: [B2.5] +// CHECK: 7: [B2.6].operator int +// CHECK: 8: [B2.7]() +// CHECK: 9: [B2.8] +// CHECK: T: while [B2.9] +// CHECK: Predecessors (2): B3 B5 +// CHECK: Successors (2): B4 B1 +// CHECK: [ B3 ] +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B2 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B4.2].~A() (Implicit destructor) +// CHECK: 4: [B2.4].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B3 +// CHECK: [ B5 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B12 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B11 +// CHECK: [ B1 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: 2: +// CHECK: 3: A e; +// CHECK: 4: [B1.3].~A() (Implicit destructor) +// CHECK: 5: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B9 B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: a +// CHECK: 2: [B2.1] +// CHECK: 3: [B2.2] +// CHECK: 4: A b = a; +// CHECK: 5: b +// CHECK: 6: [B2.5] +// CHECK: 7: [B2.6].operator int +// CHECK: 8: [B2.7]() +// CHECK: 9: [B2.8] +// CHECK: T: while [B2.9] +// CHECK: Predecessors (2): B3 B11 +// CHECK: Successors (2): B10 B1 +// CHECK: [ B3 ] +// CHECK: Predecessors (2): B4 B7 +// CHECK: Successors (1): B2 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A d; +// CHECK: 3: [B4.2].~A() (Implicit destructor) +// CHECK: 4: [B10.2].~A() (Implicit destructor) +// CHECK: 5: [B2.4].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B3 +// CHECK: [ B5 ] +// CHECK: 1: return; +// CHECK: 2: [B10.2].~A() (Implicit destructor) +// CHECK: 3: [B2.4].~A() (Implicit destructor) +// CHECK: 4: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B0 +// CHECK: [ B6 ] +// CHECK: 1: UV +// CHECK: 2: [B6.1] +// CHECK: T: if [B6.2] +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B5 B4 +// CHECK: [ B7 ] +// CHECK: 1: [B10.2].~A() (Implicit destructor) +// CHECK: 2: [B2.4].~A() (Implicit destructor) +// CHECK: T: continue; +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B3 +// CHECK: [ B8 ] +// CHECK: 1: UV +// CHECK: 2: [B8.1] +// CHECK: T: if [B8.2] +// CHECK: Predecessors (1): B10 +// CHECK: Successors (2): B7 B6 +// CHECK: [ B9 ] +// CHECK: 1: [B10.2].~A() (Implicit destructor) +// CHECK: T: break; +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B1 +// CHECK: [ B10 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: UV +// CHECK: 4: [B10.3] +// CHECK: T: if [B10.4] +// CHECK: Predecessors (1): B2 +// CHECK: Successors (2): B9 B8 +// CHECK: [ B11 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: Predecessors (1): B12 +// CHECK: Successors (1): B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (2): B1 B5 +// CHECK: Successors (0): +// CHECK: [ B4 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B2 +// CHECK: [ B1 ] +// CHECK: 1: UV +// CHECK: 2: [B1.1] +// CHECK: T: do ... while [B1.2] +// CHECK: Predecessors (1): B2 +// CHECK: Successors (2): B3 B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: [B2.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B3 B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (1): B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B12 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B11 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A d; +// CHECK: 3: [B1.2].~A() (Implicit destructor) +// CHECK: 4: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B8 B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: UV +// CHECK: 2: [B2.1] +// CHECK: T: do ... while [B2.2] +// CHECK: Predecessors (2): B3 B6 +// CHECK: Successors (2): B10 B1 +// CHECK: [ B3 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B3.2].~A() (Implicit destructor) +// CHECK: 4: [B9.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B5 +// CHECK: Successors (1): B2 +// CHECK: [ B4 ] +// CHECK: 1: return; +// CHECK: 2: [B9.2].~A() (Implicit destructor) +// CHECK: 3: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B5 +// CHECK: Successors (1): B0 +// CHECK: [ B5 ] +// CHECK: 1: UV +// CHECK: 2: [B5.1] +// CHECK: T: if [B5.2] +// CHECK: Predecessors (1): B7 +// CHECK: Successors (2): B4 B3 +// CHECK: [ B6 ] +// CHECK: 1: [B9.2].~A() (Implicit destructor) +// CHECK: T: continue; +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B2 +// CHECK: [ B7 ] +// CHECK: 1: UV +// CHECK: 2: [B7.1] +// CHECK: T: if [B7.2] +// CHECK: Predecessors (1): B9 +// CHECK: Successors (2): B6 B5 +// CHECK: [ B8 ] +// CHECK: 1: [B9.2].~A() (Implicit destructor) +// CHECK: T: break; +// CHECK: Predecessors (1): B9 +// CHECK: Successors (1): B1 +// CHECK: [ B9 ] +// CHECK: 1: +// CHECK: 2: A b; +// CHECK: 3: UV +// CHECK: 4: [B9.3] +// CHECK: T: if [B9.4] +// CHECK: Predecessors (2): B10 B11 +// CHECK: Successors (2): B8 B7 +// CHECK: [ B10 ] +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B9 +// CHECK: [ B11 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: Predecessors (1): B12 +// CHECK: Successors (1): B9 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (2): B1 B4 +// CHECK: Successors (0): +// CHECK: [ B4 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B2 +// CHECK: [ B1 ] +// CHECK: 1: [B2.6].~A() (Implicit destructor) +// CHECK: 2: [B2.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B3 B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: a +// CHECK: 4: [B2.3] +// CHECK: 5: [B2.4] +// CHECK: 6: A b = a; +// CHECK: 7: b +// CHECK: 8: [B2.7] +// CHECK: 9: [B2.8].operator int +// CHECK: 10: [B2.9]() +// CHECK: T: switch [B2.10] +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B3.2].~A() (Implicit destructor) +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B9 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B2 +// CHECK: [ B1 ] +// CHECK: 1: [B2.6].~A() (Implicit destructor) +// CHECK: 2: +// CHECK: 3: A g; +// CHECK: 4: [B1.3].~A() (Implicit destructor) +// CHECK: 5: [B2.2].~A() (Implicit destructor) +// CHECK: Predecessors (3): B3 B7 B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: a +// CHECK: 4: [B2.3] +// CHECK: 5: [B2.4] +// CHECK: 6: A b = a; +// CHECK: 7: b +// CHECK: 8: [B2.7] +// CHECK: 9: [B2.8].operator int +// CHECK: 10: [B2.9]() +// CHECK: T: switch [B2.10] +// CHECK: Predecessors (1): B9 +// CHECK: Successors (3): B3 B8 +// CHECK: B1 +// CHECK: [ B3 ] +// CHECK: case 1: +// CHECK: T: break; +// CHECK: Predecessors (2): B2 B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A f; +// CHECK: 3: [B4.2].~A() (Implicit destructor) +// CHECK: 4: [B8.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B3 +// CHECK: [ B5 ] +// CHECK: 1: return; +// CHECK: 2: [B8.2].~A() (Implicit destructor) +// CHECK: 3: [B2.6].~A() (Implicit destructor) +// CHECK: 4: [B2.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B0 +// CHECK: [ B6 ] +// CHECK: 1: UV +// CHECK: 2: [B6.1] +// CHECK: T: if [B6.2] +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B5 B4 +// CHECK: [ B7 ] +// CHECK: 1: [B8.2].~A() (Implicit destructor) +// CHECK: T: break; +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B1 +// CHECK: [ B8 ] +// CHECK: case 0: +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: UV +// CHECK: 4: [B8.3] +// CHECK: T: if [B8.4] +// CHECK: Predecessors (1): B2 +// CHECK: Successors (2): B7 B6 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (2): B1 B5 +// CHECK: Successors (0): +// CHECK: [ B6 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B5 +// CHECK: [ B1 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: 2: [B5.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: a +// CHECK: 2: [B2.1] +// CHECK: 3: [B2.2] +// CHECK: 4: A b = a; +// CHECK: 5: b +// CHECK: 6: [B2.5] +// CHECK: 7: [B2.6].operator int +// CHECK: 8: [B2.7]() +// CHECK: 9: [B2.8] +// CHECK: T: for (...; [B2.9]; ) +// CHECK: Predecessors (2): B3 B5 +// CHECK: Successors (2): B4 B1 +// CHECK: [ B3 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B2 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A c; +// CHECK: 3: [B4.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B3 +// CHECK: [ B5 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B12 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B11 +// CHECK: [ B1 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: 2: [B11.4].~A() (Implicit destructor) +// CHECK: 3: +// CHECK: 4: A f; +// CHECK: 5: [B1.4].~A() (Implicit destructor) +// CHECK: 6: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (2): B9 B2 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: b +// CHECK: 2: [B2.1] +// CHECK: 3: [B2.2] +// CHECK: 4: A c = b; +// CHECK: 5: c +// CHECK: 6: [B2.5] +// CHECK: 7: [B2.6].operator int +// CHECK: 8: [B2.7]() +// CHECK: 9: [B2.8] +// CHECK: T: for (...; [B2.9]; ) +// CHECK: Predecessors (2): B3 B11 +// CHECK: Successors (2): B10 B1 +// CHECK: [ B3 ] +// CHECK: 1: [B2.4].~A() (Implicit destructor) +// CHECK: Predecessors (2): B4 B7 +// CHECK: Successors (1): B2 +// CHECK: [ B4 ] +// CHECK: 1: +// CHECK: 2: A e; +// CHECK: 3: [B4.2].~A() (Implicit destructor) +// CHECK: 4: [B10.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B3 +// CHECK: [ B5 ] +// CHECK: 1: return; +// CHECK: 2: [B10.2].~A() (Implicit destructor) +// CHECK: 3: [B2.4].~A() (Implicit destructor) +// CHECK: 4: [B11.4].~A() (Implicit destructor) +// CHECK: 5: [B11.2].~A() (Implicit destructor) +// CHECK: Predecessors (1): B6 +// CHECK: Successors (1): B0 +// CHECK: [ B6 ] +// CHECK: 1: UV +// CHECK: 2: [B6.1] +// CHECK: T: if [B6.2] +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B5 B4 +// CHECK: [ B7 ] +// CHECK: 1: [B10.2].~A() (Implicit destructor) +// CHECK: T: continue; +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B3 +// CHECK: [ B8 ] +// CHECK: 1: UV +// CHECK: 2: [B8.1] +// CHECK: T: if [B8.2] +// CHECK: Predecessors (1): B10 +// CHECK: Successors (2): B7 B6 +// CHECK: [ B9 ] +// CHECK: 1: [B10.2].~A() (Implicit destructor) +// CHECK: T: break; +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B1 +// CHECK: [ B10 ] +// CHECK: 1: +// CHECK: 2: A d; +// CHECK: 3: UV +// CHECK: 4: [B10.3] +// CHECK: T: if [B10.4] +// CHECK: Predecessors (1): B2 +// CHECK: Successors (2): B9 B8 +// CHECK: [ B11 ] +// CHECK: 1: +// CHECK: 2: A a; +// CHECK: 3: +// CHECK: 4: A b; +// CHECK: Predecessors (1): B12 +// CHECK: Successors (1): B2 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (2): B1 B5 +// CHECK: Successors (0): +// CHECK: [ B3 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B0 +// CHECK: [ B1 ] +// CHECK: T: try ... +// CHECK: Predecessors (0): +// CHECK: Successors (2): B2 B0 +// CHECK: [ B2 ] +// CHECK: catch (const A &e): +// CHECK: Predecessors (1): B1 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (3): B2 B1 B3 +// CHECK: Successors (0): +// CHECK: [ B3 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B0 +// CHECK: [ B1 ] +// CHECK: T: try ... +// CHECK: Predecessors (0): +// CHECK: Successors (2): B2 B0 +// CHECK: [ B2 ] +// CHECK: catch (A e): +// CHECK: 1: .~A() (Implicit destructor) +// CHECK: Predecessors (1): B1 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (3): B2 B1 B3 +// CHECK: Successors (0): diff --git a/test/Analysis/bstring.c b/test/Analysis/bstring.c index cd43e36d0351..e23059fcec48 100644 --- a/test/Analysis/bstring.c +++ b/test/Analysis/bstring.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,unix.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,unix.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.CString -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,experimental.unix.CString -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,experimental.unix.CString -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,experimental.unix.CString -analyzer-store=region -Wno-null-dereference -verify %s //===----------------------------------------------------------------------=== // Declarations diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index 35d97fec675d..8b88a2db432e 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // Test if the 'storage' region gets properly initialized after it is cast to // 'struct sockaddr *'. diff --git a/test/Analysis/casts.m b/test/Analysis/casts.m index d073dff963fc..d9700fe5c754 100644 --- a/test/Analysis/casts.m +++ b/test/Analysis/casts.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // Test function pointer casts. Currently we track function addresses using // loc::FunctionVal. Because casts can be arbitrary, do we need to model @@ -20,3 +19,23 @@ void* test2(void *p) { MyFuncTest1 fp = (MyFuncTest1) p; return (*fp)(); } + +// <radar://10087620> +// A cast from int onjective C property reference to int. +typedef signed char BOOL; +@protocol NSObject - (BOOL)isEqual:(id)object; @end +@interface NSObject <NSObject> {} - (id)init; @end +typedef enum { + EEOne, + EETwo +} RDR10087620Enum; +@interface RDR10087620 : NSObject { + RDR10087620Enum elem; +} +@property (readwrite, nonatomic) RDR10087620Enum elem; +static void +adium_media_ready_cb(RDR10087620 *InObj) +{ + InObj.elem |= EEOne; +} +@end
\ No newline at end of file diff --git a/test/Analysis/cfref_PR2519.c b/test/Analysis/cfref_PR2519.c index 280676330a46..529210986916 100644 --- a/test/Analysis/cfref_PR2519.c +++ b/test/Analysis/cfref_PR2519.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s typedef unsigned char Boolean; typedef signed long CFIndex; diff --git a/test/Analysis/cfref_rdar6080742.c b/test/Analysis/cfref_rdar6080742.c index aceefbe54872..ea4c3ee6d549 100644 --- a/test/Analysis/cfref_rdar6080742.c +++ b/test/Analysis/cfref_rdar6080742.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s // This test case was reported in <rdar:problem/6080742>. // It tests path-sensitivity with respect to '!(cfstring != 0)' (negation of inequality). diff --git a/test/Analysis/chroot.c b/test/Analysis/chroot.c index 7a584da6c05c..1948f48471f1 100644 --- a/test/Analysis/chroot.c +++ b/test/Analysis/chroot.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=unix.experimental.Chroot -analyzer-store region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.Chroot -analyzer-store region -verify %s extern int chroot(const char* path); extern int chdir(const char* path); diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c index b125a502f1df..c118a61455af 100644 --- a/test/Analysis/complex.c +++ b/test/Analysis/complex.c @@ -1,5 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s diff --git a/test/Analysis/concrete-address.c b/test/Analysis/concrete-address.c index a722ab092e2c..f6c445ebf56e 100644 --- a/test/Analysis/concrete-address.c +++ b/test/Analysis/concrete-address.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s void foo() { int *p = (int*) 0x10000; // Should not crash here. diff --git a/test/Analysis/constant-folding.c b/test/Analysis/constant-folding.c index d3cbf9c56479..e7a5705fa59a 100644 --- a/test/Analysis/constant-folding.c +++ b/test/Analysis/constant-folding.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode -Wno-null-dereference -verify %s // Trigger a warning if the analyzer reaches this point in the control flow. #define WARN ((void)*(char*)0) diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index 85ea1ee2cb64..5ddb4528c1b2 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -1,6 +1,4 @@ // RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s -// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=basic -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s -// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=basic -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s // RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=region -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s // RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=region -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp index 932e94092847..43d8796ce091 100644 --- a/test/Analysis/dead-stores.cpp +++ b/test/Analysis/dead-stores.cpp @@ -1,6 +1,4 @@ // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=basic -analyzer-constraints=basic -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=basic -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=region -analyzer-constraints=basic -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=region -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m index 3a06a8adeb0d..4ed71c4e8bfa 100644 --- a/test/Analysis/dead-stores.m +++ b/test/Analysis/dead-stores.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=deadcode.DeadStores -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores,osx.cocoa.RetainCount -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/Analysis/default-diagnostic-visitors.c b/test/Analysis/default-diagnostic-visitors.c new file mode 100644 index 000000000000..9cb9ba8c33e3 --- /dev/null +++ b/test/Analysis/default-diagnostic-visitors.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-output=text -verify %s + +// This file is for testing enhanced diagnostics produced by the default BugReporterVisitors. + +int getPasswordAndItem() +{ + int err = 0; + int *password; // expected-note {{Variable 'password' declared without an initial value}} + if (password == 0) { // expected-warning {{The left operand of '==' is a garbage value}} // expected-note {{The left operand of '==' is a garbage value}} + err = *password; + } + return err; +} diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m index 218083598919..8f42b83b0eeb 100644 --- a/test/Analysis/delegates.m +++ b/test/Analysis/delegates.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// diff --git a/test/Analysis/div-zero.cpp b/test/Analysis/div-zero.cpp new file mode 100644 index 000000000000..d1261dc57335 --- /dev/null +++ b/test/Analysis/div-zero.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core.DivideZero -verify %s + +int fooPR10616 (int qX ) { + int a, c, d; + + d = (qX-1); + while ( d != 0 ) { + d = c - (c/d) * d; + } + + return (a % (qX-1)); // expected-warning {{Division by zero}} + +} diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c index d41202a1f07f..7452a0a124fe 100644 --- a/test/Analysis/elementtype.c +++ b/test/Analysis/elementtype.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region %s typedef struct added_obj_st { int type; diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c index 02772a148b6b..5dd1f3f12bd2 100644 --- a/test/Analysis/exercise-ps.c +++ b/test/Analysis/exercise-ps.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // // Just exercise the analyzer on code that has at one point caused issues // (i.e., no assertions or crashes). diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c index 0991d00868cf..2e72c77d9fac 100644 --- a/test/Analysis/fields.c +++ b/test/Analysis/fields.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=basic -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=region -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core %s -analyzer-store=region -verify unsigned foo(); typedef struct bf { unsigned x:2; } bf; diff --git a/test/Analysis/flat-store.c b/test/Analysis/flat-store.c deleted file mode 100644 index bf93c724400f..000000000000 --- a/test/Analysis/flat-store.c +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=flat -Wno-null-dereference -verify %s -#define FAIL ((void)*(char*)0) -struct simple { int x; }; - -void PR7297 () { - struct simple a; - struct simple *p = &a; - p->x = 5; - if (!p[0].x) FAIL; // no-warning - if (p[0].x) FAIL; // expected-warning {{null}} -} diff --git a/test/Analysis/free.c b/test/Analysis/free.c index d57da69ba456..44c4f19f1b3c 100644 --- a/test/Analysis/free.c +++ b/test/Analysis/free.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.experimental.Malloc -fblocks -verify %s +// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,experimental.unix.Malloc -fblocks -verify %s void free(void *); void t1 () { diff --git a/test/Analysis/func.c b/test/Analysis/func.c index 0694f7bd4c26..b6cebde81091 100644 --- a/test/Analysis/func.c +++ b/test/Analysis/func.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s void f(void) { void (*p)(void); diff --git a/test/Analysis/idempotent-operations.m b/test/Analysis/idempotent-operations.m index 8f534940c975..b4765082d84a 100644 --- a/test/Analysis/idempotent-operations.m +++ b/test/Analysis/idempotent-operations.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations -verify %s +// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations,osx.cocoa.RetainCount -verify %s typedef signed char BOOL; typedef unsigned long NSUInteger; diff --git a/test/Analysis/initializers-cfg-output.cpp b/test/Analysis/initializers-cfg-output.cpp index 5c5d51494749..b73809f2b83a 100644 --- a/test/Analysis/initializers-cfg-output.cpp +++ b/test/Analysis/initializers-cfg-output.cpp @@ -44,51 +44,60 @@ TestControlFlow::TestControlFlow(bool b) int v; } -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: -// CHECK: 2: A([B1.1]) (Base initializer) -// CHECK: 3: -// CHECK: 4: C([B1.3]) (Base initializer) -// CHECK: 5: -// CHECK: 6: B([B1.5]) (Base initializer) -// CHECK: 7: -// CHECK: 8: A([B1.7]) (Base initializer) -// CHECK: 9: i(/*implicit*/int()) (Member initializer) -// CHECK: 10: r(this->i) (Member initializer) -// CHECK: 11: -// CHECK: 12: A a; -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B5 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B4 -// CHECK: [ B1 ] -// CHECK: 1: [B4.2] ? [B2.1] : [B3.1] -// CHECK: 2: y([B1.1]) (Member initializer) -// CHECK: 3: z(this->y) (Member initializer) -// CHECK: 4: int v; -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: 0 -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: 1 -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: x(0) (Member initializer) -// CHECK: 2: b -// CHECK: T: [B4.2] ? ... : ... -// CHECK: Predecessors (1): B5 -// CHECK: Successors (2): B2 B3 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: +// CHECK: 2: A([B1.1]) (Base initializer) +// CHECK: 3: +// CHECK: 4: C([B1.3]) (Base initializer) +// CHECK: 5: +// CHECK: 6: B([B1.5]) (Base initializer) +// CHECK: 7: +// CHECK: 8: A([B1.7]) (Base initializer) +// CHECK: 9: /*implicit*/int() +// CHECK: 10: i([B1.9]) (Member initializer) +// CHECK: 11: this +// CHECK: 12: [B1.11]->i +// CHECK: 13: r([B1.12]) (Member initializer) +// CHECK: 14: +// CHECK: 15: A a; +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B5 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B4 +// CHECK: [ B1 ] +// CHECK: 1: [B4.4] ? [B2.1] : [B3.1] +// CHECK: 2: y([B1.1]) (Member initializer) +// CHECK: 3: this +// CHECK: 4: [B1.3]->y +// CHECK: 5: [B1.4] +// CHECK: 6: z([B1.5]) (Member initializer) +// CHECK: 7: int v; +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: 0 +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: 1 +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: 0 +// CHECK: 2: x([B4.1]) (Member initializer) +// CHECK: 3: b +// CHECK: 4: [B4.3] +// CHECK: T: [B4.4] ? ... : ... +// CHECK: Predecessors (1): B5 +// CHECK: Successors (2): B2 B3 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): + diff --git a/test/Analysis/iterators.cpp b/test/Analysis/iterators.cpp index c3416f5beac1..741970aa6c47 100644 --- a/test/Analysis/iterators.cpp +++ b/test/Analysis/iterators.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.experimental.Iterators -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.cplusplus.Iterators -verify %s // XFAIL: win32 #include <vector> diff --git a/test/Analysis/keychainAPI-diagnostic-visitor.m b/test/Analysis/keychainAPI-diagnostic-visitor.m new file mode 100644 index 000000000000..a78b114a00fb --- /dev/null +++ b/test/Analysis/keychainAPI-diagnostic-visitor.m @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=osx.SecKeychainAPI -analyzer-store=region -analyzer-output=text -verify %s + +// This file is for testing enhanced diagnostics produced by the default SecKeychainAPI checker. + +typedef unsigned int OSStatus; +typedef unsigned int SecKeychainAttributeList; +typedef unsigned int SecKeychainItemRef; +typedef unsigned int SecItemClass; +typedef unsigned int UInt32; +enum { + noErr = 0, + GenericError = 1 +}; +OSStatus SecKeychainItemCopyContent ( + SecKeychainItemRef itemRef, + SecItemClass *itemClass, + SecKeychainAttributeList *attrList, + UInt32 *length, + void **outData + ); + +void DellocWithCFStringCreate4() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + char *bytes; + char *x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, (void **)&bytes); // expected-note {{Data is allocated here}} + x = bytes; + if (st == noErr) // expected-note {{Assuming 'st' is equal to noErr}} // expected-note{{Taking true branch}} + x = bytes;; + + length++; // expected-warning {{Allocated data is not released}} // expected-note{{Allocated data is not released}} +} + diff --git a/test/Analysis/keychainAPI.m b/test/Analysis/keychainAPI.m new file mode 100644 index 000000000000..d10600dea590 --- /dev/null +++ b/test/Analysis/keychainAPI.m @@ -0,0 +1,323 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=osx.SecKeychainAPI %s -verify + +// Fake typedefs. +typedef unsigned int OSStatus; +typedef unsigned int SecKeychainAttributeList; +typedef unsigned int SecKeychainItemRef; +typedef unsigned int SecItemClass; +typedef unsigned int UInt32; +typedef unsigned int CFTypeRef; +typedef unsigned int UInt16; +typedef unsigned int SecProtocolType; +typedef unsigned int SecAuthenticationType; +typedef unsigned int SecKeychainAttributeInfo; +enum { + noErr = 0, + GenericError = 1 +}; + +// Functions that allocate data. +OSStatus SecKeychainItemCopyContent ( + SecKeychainItemRef itemRef, + SecItemClass *itemClass, + SecKeychainAttributeList *attrList, + UInt32 *length, + void **outData +); +OSStatus SecKeychainFindGenericPassword ( + CFTypeRef keychainOrArray, + UInt32 serviceNameLength, + const char *serviceName, + UInt32 accountNameLength, + const char *accountName, + UInt32 *passwordLength, + void **passwordData, + SecKeychainItemRef *itemRef +); +OSStatus SecKeychainFindInternetPassword ( + CFTypeRef keychainOrArray, + UInt32 serverNameLength, + const char *serverName, + UInt32 securityDomainLength, + const char *securityDomain, + UInt32 accountNameLength, + const char *accountName, + UInt32 pathLength, + const char *path, + UInt16 port, + SecProtocolType protocol, + SecAuthenticationType authenticationType, + UInt32 *passwordLength, + void **passwordData, + SecKeychainItemRef *itemRef +); +OSStatus SecKeychainItemCopyAttributesAndData ( + SecKeychainItemRef itemRef, + SecKeychainAttributeInfo *info, + SecItemClass *itemClass, + SecKeychainAttributeList **attrList, + UInt32 *length, + void **outData +); + +// Functions which free data. +OSStatus SecKeychainItemFreeContent ( + SecKeychainAttributeList *attrList, + void *data +); +OSStatus SecKeychainItemFreeAttributesAndData ( + SecKeychainAttributeList *attrList, + void *data +); + +void errRetVal() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); + if (st == GenericError) // expected-warning{{Allocated data is not released: missing a call to 'SecKeychainItemFreeContent'.}} + SecKeychainItemFreeContent(ptr, outData); // expected-warning{{Call to free data when error was returned during allocation.}} +} + +// If null is passed in, the data is not allocated, so no need for the matching free. +void fooDoNotReportNull() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 *length = 0; + void **outData = 0; + SecKeychainItemCopyContent(2, ptr, ptr, 0, 0); + SecKeychainItemCopyContent(2, ptr, ptr, length, outData); +}// no-warning + +void doubleAlloc() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); // expected-warning {{Allocated data should be released before another call to the allocator:}} + if (st == noErr) + SecKeychainItemFreeContent(ptr, outData); +} + +void fooOnlyFree() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData = &length; + SecKeychainItemFreeContent(ptr, outData);// expected-warning{{Trying to free data which has not been allocated}} +} + +// Do not warn if undefined value is passed to a function. +void fooOnlyFreeUndef() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + SecKeychainItemFreeContent(ptr, outData); +}// no-warning + +// Do not warn if the address is a parameter in the enclosing function. +void fooOnlyFreeParam(void *attrList, void* X) { + SecKeychainItemFreeContent(attrList, X); +}// no-warning + +// If we are returning the value, do not report. +void* returnContent() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); + return outData; +} // no-warning + +// Password was passed in as an argument and does nt have to be deleted. +OSStatus getPasswordAndItem(void** password, UInt32* passwordLength) { + OSStatus err; + SecKeychainItemRef item; + err = SecKeychainFindGenericPassword(0, 3, "xx", 3, "xx", + passwordLength, password, &item); + return err; +} // no-warning + +// Make sure we do not report an error if we call free only if password != 0. +// Also, do not report double allocation if first allocation returned an error. +OSStatus testSecKeychainFindGenericPassword(UInt32* passwordLength, + CFTypeRef keychainOrArray, SecProtocolType protocol, + SecAuthenticationType authenticationType) { + OSStatus err; + SecKeychainItemRef item; + void *password; + err = SecKeychainFindGenericPassword(0, 3, "xx", 3, "xx", + passwordLength, &password, &item); + if( err == GenericError ) { + err = SecKeychainFindInternetPassword(keychainOrArray, + 16, "server", 16, "domain", 16, "account", + 16, "path", 222, protocol, authenticationType, + passwordLength, &(password), 0); + } + + if (err == noErr && password) { + SecKeychainItemFreeContent(0, password); + } + return err; +} + +int apiMismatch(SecKeychainItemRef itemRef, + SecKeychainAttributeInfo *info, + SecItemClass *itemClass) { + OSStatus st = 0; + SecKeychainAttributeList *attrList; + UInt32 length; + void *outData; + + st = SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass, + &attrList, &length, &outData); + if (st == noErr) + SecKeychainItemFreeContent(attrList, outData); // expected-warning{{Deallocator doesn't match the allocator}} + return 0; +} + +int ErrorCodesFromDifferentAPISDoNotInterfere(SecKeychainItemRef itemRef, + SecKeychainAttributeInfo *info, + SecItemClass *itemClass) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + OSStatus st2 = 0; + SecKeychainAttributeList *attrList; + UInt32 length2; + void *outData2; + + st2 = SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass, + &attrList, &length2, &outData2); + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); + if (st == noErr) { + SecKeychainItemFreeContent(ptr, outData); + if (st2 == noErr) { + SecKeychainItemFreeAttributesAndData(attrList, outData2); + } + } + return 0; // expected-warning{{Allocated data is not released: missing a call to 'SecKeychainItemFreeAttributesAndData'}} +} + +int foo(CFTypeRef keychainOrArray, SecProtocolType protocol, + SecAuthenticationType authenticationType, SecKeychainItemRef *itemRef) { + unsigned int *ptr = 0; + OSStatus st = 0; + + UInt32 length; + void *outData[5]; + + st = SecKeychainFindInternetPassword(keychainOrArray, + 16, "server", 16, "domain", 16, "account", + 16, "path", 222, protocol, authenticationType, + &length, &(outData[3]), itemRef); + if (length == 5) { + if (st == noErr) + SecKeychainItemFreeContent(ptr, outData[3]); + } + if (length) { // expected-warning{{Allocated data is not released: missing a call to 'SecKeychainItemFreeContent'.}} + length++; + } + return 0; +}// no-warning + +void free(void *ptr); +void deallocateWithFree() { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *outData; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); + if (st == noErr) + free(outData); // expected-warning{{Deallocator doesn't match the allocator: 'SecKeychainItemFreeContent' should be used}} +} + +// Typesdefs for CFStringCreateWithBytesNoCopy. +typedef char uint8_t; +typedef signed long CFIndex; +typedef UInt32 CFStringEncoding; +typedef unsigned Boolean; +typedef const struct __CFString * CFStringRef; +typedef const struct __CFAllocator * CFAllocatorRef; +extern const CFAllocatorRef kCFAllocatorDefault; +extern const CFAllocatorRef kCFAllocatorSystemDefault; +extern const CFAllocatorRef kCFAllocatorMalloc; +extern const CFAllocatorRef kCFAllocatorMallocZone; +extern const CFAllocatorRef kCFAllocatorNull; +extern const CFAllocatorRef kCFAllocatorUseContext; +CFStringRef CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc, const uint8_t *bytes, CFIndex numBytes, CFStringEncoding encoding, Boolean externalFormat, CFAllocatorRef contentsDeallocator); +extern void CFRelease(CFStringRef cf); + +void DellocWithCFStringCreate1(CFAllocatorRef alloc) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *bytes; + char * x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes); + if (st == noErr) { + CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, kCFAllocatorDefault); // expected-warning{{Deallocator doesn't match the allocator:}} + CFRelease(userStr); + } +} + +void DellocWithCFStringCreate2(CFAllocatorRef alloc) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *bytes; + char * x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes); + if (st == noErr) { + CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, kCFAllocatorNull); // expected-warning{{Allocated data is not released}} + CFRelease(userStr); + } +} + +void DellocWithCFStringCreate3(CFAllocatorRef alloc) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *bytes; + char * x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes); + if (st == noErr) { + CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, kCFAllocatorUseContext); + CFRelease(userStr); + } +} + +void DellocWithCFStringCreate4(CFAllocatorRef alloc) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *bytes; + char * x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes); + if (st == noErr) { + CFStringRef userStr = CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, 0); // expected-warning{{Deallocator doesn't match the allocator:}} + CFRelease(userStr); + } +} + +//Example from bug 10797. +__inline__ static +const char *__WBASLLevelString(int level) { + return "foo"; +} + +static int *bug10798(int *p, int columns, int prevRow) { + int *row = 0; + row = p + prevRow * columns; + prevRow += 2; + do { + ++prevRow; + row+=columns; + } while(10 >= row[1]); + return row; +} diff --git a/test/Analysis/malloc-overflow.c b/test/Analysis/malloc-overflow.c new file mode 100644 index 000000000000..714fd3d308ad --- /dev/null +++ b/test/Analysis/malloc-overflow.c @@ -0,0 +1,113 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.MallocOverflow -verify %s + +#define NULL ((void *) 0) +typedef __typeof__(sizeof(int)) size_t; +extern void * malloc(size_t); + +void * f1(int n) +{ + return malloc(n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} +} + +void * f2(int n) +{ + return malloc(sizeof(int) * n); // // expected-warning {{the computation of the size of the memory allocation may overflow}} +} + +void * f3() +{ + return malloc(4 * sizeof(int)); // no-warning +} + +struct s4 +{ + int n; +}; + +void * f4(struct s4 *s) +{ + return malloc(s->n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} +} + +void * f5(struct s4 *s) +{ + struct s4 s2 = *s; + return malloc(s2.n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} +} + +void * f6(int n) +{ + return malloc((n + 1) * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} +} + +extern void * malloc (size_t); + +void * f7(int n) +{ + if (n > 10) + return NULL; + return malloc(n * sizeof(int)); // no-warning +} + +void * f8(int n) +{ + if (n < 10) + return malloc(n * sizeof(int)); // no-warning + else + return NULL; +} + +void * f9(int n) +{ + int * x = malloc(n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} + for (int i = 0; i < n; i++) + x[i] = i; + return x; +} + +void * f10(int n) +{ + int * x = malloc(n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} + int i = 0; + while (i < n) + x[i++] = 0; + return x; +} + +void * f11(int n) +{ + int * x = malloc(n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} + int i = 0; + do { + x[i++] = 0; + } while (i < n); + return x; +} + +void * f12(int n) +{ + n = (n > 10 ? 10 : n); + int * x = malloc(n * sizeof(int)); // no-warning + for (int i = 0; i < n; i++) + x[i] = i; + return x; +} + +struct s13 +{ + int n; +}; + +void * f13(struct s13 *s) +{ + if (s->n > 10) + return NULL; + return malloc(s->n * sizeof(int)); // no warning +} + +void * f14(int n) +{ + if (n < 0) + return NULL; + return malloc(n * sizeof(int)); // expected-warning {{the computation of the size of the memory allocation may overflow}} +} diff --git a/test/Analysis/malloc-overflow.cpp b/test/Analysis/malloc-overflow.cpp new file mode 100644 index 000000000000..c1ac6be4b029 --- /dev/null +++ b/test/Analysis/malloc-overflow.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.MallocOverflow -verify %s + +class A { +public: + A& operator<<(const A &a); +}; + +void f() { + A a = A(), b = A(); + a << b; +} diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index f9af199b5fad..d9087ab83093 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,core.experimental.CastSize,unix.experimental.Malloc -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.deadcode.UnreachableCode,experimental.core.CastSize,experimental.unix.Malloc -analyzer-store=region -verify %s typedef __typeof(sizeof(int)) size_t; void *malloc(size_t); void free(void *); @@ -41,7 +41,7 @@ void f2_realloc_0() { void f2_realloc_1() { int *p = malloc(12); - int *q = realloc(p,0); // expected-warning{{Assigned value is garbage or undefined}} + int *q = realloc(p,0); // no-warning } // ownership attributes tests diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m index 1cd738292781..e20a27f611e7 100644 --- a/test/Analysis/misc-ps-64.m +++ b/test/Analysis/misc-ps-64.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s // <rdar://problem/6440393> - A bunch of misc. failures involving evaluating // these expressions and building CFGs. These tests are here to prevent diff --git a/test/Analysis/misc-ps-basic-store.m b/test/Analysis/misc-ps-basic-store.m deleted file mode 100644 index a29326d8b0e7..000000000000 --- a/test/Analysis/misc-ps-basic-store.m +++ /dev/null @@ -1,35 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify -fblocks %s - -//--------------------------------------------------------------------------- -// Test case 'checkaccess_union' differs for region store and basic store. -// The basic store doesn't reason about compound literals, so the code -// below won't fire an "uninitialized value" warning. -//--------------------------------------------------------------------------- - -// PR 2948 (testcase; crash on VisitLValue for union types) -// http://llvm.org/bugs/show_bug.cgi?id=2948 - -void checkaccess_union() { - int ret = 0, status; - if (((((__extension__ (((union { // no-warning - __typeof (status) __in; int __i;} - ) - { - .__in = (status)} - ).__i))) & 0xff00) >> 8) == 1) - ret = 1; -} - -// BasicStore handles this case incorrectly because it doesn't reason about -// the value pointed to by 'x' and thus creates different symbolic values -// at the declarations of 'a' and 'b' respectively. See the companion test -// in 'misc-ps-region-store.m'. -void test_trivial_symbolic_comparison_pointer_parameter(int *x) { - int a = *x; - int b = *x; - if (a != b) { - int *p = 0; - *p = 0xDEADBEEF; // expected-warning{{null}} - } -} - diff --git a/test/Analysis/misc-ps-cxx0x.cpp b/test/Analysis/misc-ps-cxx0x.cpp index f21e82c4bcb4..53b6fa29ad6e 100644 --- a/test/Analysis/misc-ps-cxx0x.cpp +++ b/test/Analysis/misc-ps-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang --analyze -std=c++0x %s -Xclang -verify +// RUN: %clang --analyze -std=c++11 %s -Xclang -verify -o /dev/null void test_static_assert() { static_assert(sizeof(void *) == sizeof(void*), "test_static_assert"); @@ -9,3 +9,62 @@ void test_analyzer_working() { *p = 0xDEADBEEF; // expected-warning {{null}} } +// Test that pointer-to-member functions don't cause the analyzer +// to crash. +struct RDar10243398 { + void bar(int x); +}; + +typedef void (RDar10243398::*RDar10243398MemberFn)(int x); + +void test_rdar10243398(RDar10243398 *p) { + RDar10243398MemberFn q = &RDar10243398::bar; + ((*p).*(q))(1); +} + +// Tests for CXXTemporaryObjectExpr. +struct X { + X( int *ip, int ); +}; + +// Test to see if CXXTemporaryObjectExpr is being handled. +int tempobj1() +{ + int j; + int i; + X a = X( &j, 1 ); + + return i; // expected-warning {{Undefined or garbage value returned to caller}} +} + +// Test to see if CXXTemporaryObjectExpr invalidates arguments. +int tempobj2() +{ + int j; + X a = X( &j, 1 ); + + return j; // no-warning +} + + +// Test for correct handling of C++ ForRange statement. +void test1() { + int array[2] = { 1, 2 }; + int j = 0; + for ( int i : array ) + j += i; + int *p = 0; + *p = 0xDEADBEEF; // expected-warning {{null}} +} + +void test2() { + int array[2] = { 1, 2 }; + int j = 0; + for (int i : array) + j += i; + if (j == 3) + return; + int *p = 0; + *p = 0xDEADBEEF; // no-warning +} + diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m index 4380a187b800..0aff8e49b274 100644 --- a/test/Analysis/misc-ps-eager-assume.m +++ b/test/Analysis/misc-ps-eager-assume.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume // Delta-reduced header stuff (needed for test cases). typedef signed char BOOL; diff --git a/test/Analysis/misc-ps-flat-store.c b/test/Analysis/misc-ps-flat-store.c deleted file mode 100644 index e6369cbfb079..000000000000 --- a/test/Analysis/misc-ps-flat-store.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=flat -verify %s - -void f1() { - int x; - int *p; - x = 1; - p = 0; - if (x != 1) - *p = 1; // no-warning -} diff --git a/test/Analysis/misc-ps-ranges.m b/test/Analysis/misc-ps-ranges.m index f2851f3257dd..00337f448147 100644 --- a/test/Analysis/misc-ps-ranges.m +++ b/test/Analysis/misc-ps-ranges.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s // <rdar://problem/6776949> // main's 'argc' argument is always > 0 diff --git a/test/Analysis/misc-ps-region-store-i386.m b/test/Analysis/misc-ps-region-store-i386.m index 2988dca4abd9..3106a24c5c7f 100644 --- a/test/Analysis/misc-ps-region-store-i386.m +++ b/test/Analysis/misc-ps-region-store-i386.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks %s // Here is a case where a pointer is treated as integer, invalidated as an // integer, and then used again as a pointer. This test just makes sure diff --git a/test/Analysis/misc-ps-region-store-x86_64.m b/test/Analysis/misc-ps-region-store-x86_64.m index 9f1498ef47f4..2c604cfdcdf7 100644 --- a/test/Analysis/misc-ps-region-store-x86_64.m +++ b/test/Analysis/misc-ps-region-store-x86_64.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks %s // Here is a case where a pointer is treated as integer, invalidated as an // integer, and then used again as a pointer. This test just makes sure diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp index 795935959628..37153f765062 100644 --- a/test/Analysis/misc-ps-region-store.cpp +++ b/test/Analysis/misc-ps-region-store.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s // Test basic handling of references. char &test1_aux(); @@ -414,3 +414,56 @@ void TestAssignIntoSymbolicOffset::test(int x, int y) { } } +// Test loads from static fields. This previously triggered an uninitialized +// value warning. +class ClassWithStatic { +public: + static const unsigned value = 1; +}; + +int rdar9948787_negative() { + ClassWithStatic classWithStatic; + unsigned value = classWithStatic.value; + if (value == 1) + return 1; + int *p = 0; + *p = 0xDEADBEEF; // no-warning + return 0; +} + +int rdar9948787_positive() { + ClassWithStatic classWithStatic; + unsigned value = classWithStatic.value; + if (value == 0) + return 1; + int *p = 0; + *p = 0xDEADBEEF; // expected-warning {{null}} + return 0; +} + +// Regression test against global constants and switches. +enum rdar10202899_ValT { rdar10202899_ValTA, rdar10202899_ValTB, rdar10202899_ValTC }; +const rdar10202899_ValT val = rdar10202899_ValTA; +void rdar10202899_test1() { + switch (val) { + case rdar10202899_ValTA: {} + }; +} + +void rdar10202899_test2() { + if (val == rdar10202899_ValTA) + return; + int *p = 0; + *p = 0xDEADBEEF; +} + +void rdar10202899_test3() { + switch (val) { + case rdar10202899_ValTA: return; + default: ; + }; + int *p = 0; + *p = 0xDEADBEEF; +} + + diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 27f12c9a893a..0fdab83d7f8a 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental.CastToStruct,security.experimental.ReturnPtrRange,security.experimental.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental.CastToStruct,security.experimental.ReturnPtrRange,security.experimental.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s typedef long unsigned int size_t; void *memcpy(void *, const void *, size_t); diff --git a/test/Analysis/misc-ps-region-store.mm b/test/Analysis/misc-ps-region-store.mm index 08f3e2486f8a..fee9433dac3b 100644 --- a/test/Analysis/misc-ps-region-store.mm +++ b/test/Analysis/misc-ps-region-store.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s //===------------------------------------------------------------------------------------------===// // This files tests our path-sensitive handling of Objective-c++ files. diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index da84b2487a8e..007c558299f5 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -1,12 +1,8 @@ // NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued. -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s #ifndef __clang_analyzer__ #error __clang__analyzer__ not defined @@ -553,7 +549,6 @@ int test_array_compound(int *q, int *r, int *z) { return j; } -// This test case previously crashed with -analyzer-store=basic because the // symbolic value stored in 'x' wouldn't be implicitly casted to a signed value // during the comparison. int rdar_7124210(unsigned int x) { diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m index 80eeaf69ddbc..e2ad1176e33f 100644 --- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m +++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=range -analyzer-store=region -verify %s // <rdar://problem/6888289> - This test case shows that a nil instance // variable can possibly be initialized by a method. diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m index 3fcbc55044ea..eb15435600b9 100644 --- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -1,9 +1,6 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s -// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s -// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s -// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s +// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s +// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s @interface MyClass {} - (void *)voidPtrM; diff --git a/test/Analysis/no-exit-cfg.c b/test/Analysis/no-exit-cfg.c index cfcd76d6e0cf..1a80a254cba9 100644 --- a/test/Analysis/no-exit-cfg.c +++ b/test/Analysis/no-exit-cfg.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // This is a test case for the issue reported in PR 2819: // http://llvm.org/bugs/show_bug.cgi?id=2819 diff --git a/test/Analysis/no-outofbounds.c b/test/Analysis/no-outofbounds.c index 2d77cc92adf9..821f48610fc0 100644 --- a/test/Analysis/no-outofbounds.c +++ b/test/Analysis/no-outofbounds.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,unix.experimental,security.experimental.ArrayBound -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,unix.experimental,security.experimental.ArrayBound -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,experimental.unix,experimental.security.ArrayBound -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// // This file tests cases where we should not flag out-of-bounds warnings. diff --git a/test/Analysis/null-deref-ps-region.c b/test/Analysis/null-deref-ps-region.c index 85784558161e..08bfac748c2b 100644 --- a/test/Analysis/null-deref-ps-region.c +++ b/test/Analysis/null-deref-ps-region.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -std=gnu99 -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -std=gnu99 -analyzer-store=region -verify %s // The store for 'a[1]' should not be removed mistakenly. SymbolicRegions may diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index 4d0cc3fbddad..641dde207558 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -verify %s -analyzer-constraints=basic -analyzer-store=basic -Wreturn-type -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -verify %s -analyzer-constraints=range -analyzer-store=basic -Wreturn-type -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s -Wreturn-type -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-purge=none -verify %s -Wreturn-type +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type typedef unsigned uintptr_t; diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp index 6f78baebfe22..fc7e7ef482b8 100644 --- a/test/Analysis/nullptr.cpp +++ b/test/Analysis/nullptr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -analyze -analyzer-checker=core -analyzer-store region -verify %s +// RUN: %clang_cc1 -std=c++11 -analyze -analyzer-checker=core -analyzer-store region -verify %s // test to see if nullptr is detected as a null pointer void foo1(void) { diff --git a/test/Analysis/objc-arc.m b/test/Analysis/objc-arc.m index 6b22fd099b06..b02af0515186 100644 --- a/test/Analysis/objc-arc.m +++ b/test/Analysis/objc-arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-checker=deadcode -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -fobjc-nonfragile-abi -fobjc-arc %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,deadcode -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -fobjc-arc %s typedef signed char BOOL; typedef struct _NSZone NSZone; @@ -147,3 +147,9 @@ void test_objc_unretainedObject() { (void) x; } +// Previously this resulted in a "return of stack address" warning. +id test_return() { + id x = (__bridge_transfer id) CFCreateString(); + return x; // no-warning +} + diff --git a/test/Analysis/operator-calls.cpp b/test/Analysis/operator-calls.cpp index 766d16140ed0..73cd28ac0d56 100644 --- a/test/Analysis/operator-calls.cpp +++ b/test/Analysis/operator-calls.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -verify %s struct X0 { }; bool operator==(const X0&, const X0&); diff --git a/test/Analysis/out-of-bounds.c b/test/Analysis/out-of-bounds.c index 8c65b478f1c2..ac2cdc82598d 100644 --- a/test/Analysis/out-of-bounds.c +++ b/test/Analysis/out-of-bounds.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,security.experimental.ArrayBoundV2 -verify %s +// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,experimental.security.ArrayBoundV2 -verify %s // Tests doing an out-of-bounds access after the end of an array using: // - constant integer index @@ -94,7 +94,6 @@ void test2_ptr(int x) { p[-1] = 1; // expected-warning{{Out of bound memory access}} } -// ** FIXME ** Doesn't work yet because we don't support pointer arithmetic. // Tests doing an out-of-bounds access before the start of an array using: // - indirect pointer to buffer, manipulated using simple pointer arithmetic // - constant integer index @@ -103,7 +102,7 @@ void test2_ptr_arith(int x) { int buf[100]; int *p = buf; --p; - p[0] = 1; // no-warning + p[0] = 1; // expected-warning {{Out of bound memory access (accessed memory precedes memory block)}} } // Tests doing an out-of-bounds access before the start of a multi-dimensional diff --git a/test/Analysis/outofbound-notwork.c b/test/Analysis/outofbound-notwork.c new file mode 100644 index 000000000000..45e713b6880a --- /dev/null +++ b/test/Analysis/outofbound-notwork.c @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,experimental.unix,experimental.security.ArrayBound -analyzer-store=region -verify %s +// XFAIL: * + +// Once we better handle modeling of sizes of VLAs, we can pull this back +// into outofbound.c. + +void sizeof_vla(int a) { + if (a == 5) { + char x[a]; + int y[sizeof(x)]; + y[4] = 4; // no-warning + y[5] = 5; // expected-warning{{out-of-bound}} + } +} + +void sizeof_vla_2(int a) { + if (a == 5) { + char x[a]; + int y[sizeof(x) / sizeof(char)]; + y[4] = 4; // no-warning + y[5] = 5; // expected-warning{{out-of-bound}} + } +} + +void sizeof_vla_3(int a) { + if (a == 5) { + char x[a]; + int y[sizeof(*&*&*&x)]; + y[4] = 4; // no-warning + y[5] = 5; // expected-warning{{out-of-bound}} + } +} diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index 891719c1932f..2e7a7d30d67f 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,unix.experimental,security.experimental.ArrayBound -analyzer-store=region -verify %s +// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,experimental.unix,experimental.security.ArrayBound -analyzer-store=region -verify %s typedef __typeof(sizeof(int)) size_t; void *malloc(size_t); @@ -63,15 +63,6 @@ void vla(int a) { } } -void sizeof_vla(int a) { - if (a == 5) { - char x[a]; - int y[sizeof(x)]; - y[4] = 4; // no-warning - y[5] = 5; // expected-warning{{out-of-bound}} - } -} - void alloca_region(int a) { if (a == 5) { char *x = __builtin_alloca(a); diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c index 1b1f9e1c0169..d3b75f694d0b 100644 --- a/test/Analysis/override-werror.c +++ b/test/Analysis/override-werror.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -Werror %s -analyzer-store=basic -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -Werror %s -analyzer-store=region -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -Werror %s -analyzer-store=region -verify // This test case illustrates that using '-analyze' overrides the effect of // -Werror. This allows basic warnings not to interfere with producing diff --git a/test/Analysis/plist-output-alternate.m b/test/Analysis/plist-output-alternate.m index 0f4d3aee0744..23a260a129c7 100644 --- a/test/Analysis/plist-output-alternate.m +++ b/test/Analysis/plist-output-alternate.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s void test_null_init(void) { int *p = 0; @@ -69,34 +69,6 @@ void rdar8331641(int x) { // CHECK: <key>path</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>kind</key><string>event</string> -// CHECK: <key>location</key> -// CHECK: <dict> -// CHECK: <key>line</key><integer>4</integer> -// CHECK: <key>col</key><integer>3</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: <key>ranges</key> -// CHECK: <array> -// CHECK: <array> -// CHECK: <dict> -// CHECK: <key>line</key><integer>4</integer> -// CHECK: <key>col</key><integer>3</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: <dict> -// CHECK: <key>line</key><integer>4</integer> -// CHECK: <key>col</key><integer>8</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: </array> -// CHECK: </array> -// CHECK: <key>extended_message</key> -// CHECK: <string>Variable 'p' initialized to a null pointer value</string> -// CHECK: <key>message</key> -// CHECK: <string>Variable 'p' initialized to a null pointer value</string> -// CHECK: </dict> -// CHECK: <dict> // CHECK: <key>kind</key><string>control</string> // CHECK: <key>edges</key> // CHECK: <array> @@ -110,7 +82,7 @@ void rdar8331641(int x) { // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>4</integer> -// CHECK: <key>col</key><integer>8</integer> +// CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -193,13 +165,13 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>line</key><integer>11</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -210,7 +182,7 @@ void rdar8331641(int x) { // CHECK: <key>kind</key><string>event</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>line</key><integer>11</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -218,22 +190,36 @@ void rdar8331641(int x) { // CHECK: <array> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> -// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> // CHECK: </array> // CHECK: <key>extended_message</key> -// CHECK: <string>Null pointer value stored to 'p'</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> // CHECK: <key>message</key> -// CHECK: <string>Null pointer value stored to 'p'</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> // CHECK: </dict> +// CHECK: </array> +// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <key>category</key><string>Logic error</string> +// CHECK: <key>type</key><string>Dereference of null pointer</string> +// CHECK: <key>location</key> +// CHECK: <dict> +// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>path</key> +// CHECK: <array> // CHECK: <dict> // CHECK: <key>kind</key><string>control</string> // CHECK: <key>edges</key> @@ -242,12 +228,12 @@ void rdar8331641(int x) { // CHECK: <key>start</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>line</key><integer>15</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>10</integer> +// CHECK: <key>line</key><integer>15</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -255,12 +241,12 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -272,7 +258,7 @@ void rdar8331641(int x) { // CHECK: <key>kind</key><string>event</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -280,29 +266,29 @@ void rdar8331641(int x) { // CHECK: <array> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>4</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> // CHECK: </array> // CHECK: <key>extended_message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'q')</string> // CHECK: <key>message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'q')</string> // CHECK: </dict> // CHECK: </array> -// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'q')</string> // CHECK: <key>category</key><string>Logic error</string> // CHECK: <key>type</key><string>Dereference of null pointer</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>11</integer> +// CHECK: <key>line</key><integer>18</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -318,12 +304,12 @@ void rdar8331641(int x) { // CHECK: <key>start</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>15</integer> +// CHECK: <key>line</key><integer>22</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>15</integer> +// CHECK: <key>line</key><integer>22</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -331,12 +317,12 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> +// CHECK: <key>line</key><integer>22</integer> // CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -348,29 +334,29 @@ void rdar8331641(int x) { // CHECK: <key>kind</key><string>event</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <key>ranges</key> // CHECK: <array> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> +// CHECK: <key>line</key><integer>22</integer> // CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> // CHECK: </array> // CHECK: <key>extended_message</key> -// CHECK: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK: <string>Assuming 'p' is null</string> // CHECK: <key>message</key> -// CHECK: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK: <string>Assuming 'p' is null</string> // CHECK: </dict> // CHECK: <dict> // CHECK: <key>kind</key><string>control</string> @@ -380,12 +366,12 @@ void rdar8331641(int x) { // CHECK: <key>start</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>17</integer> +// CHECK: <key>line</key><integer>22</integer> // CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -393,13 +379,13 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>5</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>4</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>6</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -410,38 +396,38 @@ void rdar8331641(int x) { // CHECK: <key>kind</key><string>event</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>5</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <key>ranges</key> // CHECK: <array> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>4</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>6</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>4</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>6</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> // CHECK: </array> // CHECK: <key>extended_message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'q')</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> // CHECK: <key>message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'q')</string> +// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> // CHECK: </dict> // CHECK: </array> -// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'q')</string> +// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string> // CHECK: <key>category</key><string>Logic error</string> // CHECK: <key>type</key><string>Dereference of null pointer</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>18</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>line</key><integer>23</integer> +// CHECK: <key>col</key><integer>5</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </dict> @@ -456,12 +442,12 @@ void rdar8331641(int x) { // CHECK: <key>start</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>line</key><integer>28</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>22</integer> +// CHECK: <key>line</key><integer>28</integer> // CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> @@ -469,13 +455,13 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>5</integer> +// CHECK: <key>line</key><integer>28</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>6</integer> +// CHECK: <key>line</key><integer>28</integer> +// CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -486,44 +472,30 @@ void rdar8331641(int x) { // CHECK: <key>kind</key><string>event</string> // CHECK: <key>location</key> // CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>5</integer> +// CHECK: <key>line</key><integer>28</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <key>ranges</key> // CHECK: <array> // CHECK: <array> // CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>6</integer> +// CHECK: <key>line</key><integer>28</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>6</integer> +// CHECK: <key>line</key><integer>28</integer> +// CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> // CHECK: </array> // CHECK: <key>extended_message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <string>Assuming 'q' is null</string> // CHECK: <key>message</key> -// CHECK: <string>Dereference of null pointer (loaded from variable 'p')</string> +// CHECK: <string>Assuming 'q' is null</string> // CHECK: </dict> -// CHECK: </array> -// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable 'p')</string> -// CHECK: <key>category</key><string>Logic error</string> -// CHECK: <key>type</key><string>Dereference of null pointer</string> -// CHECK: <key>location</key> -// CHECK: <dict> -// CHECK: <key>line</key><integer>23</integer> -// CHECK: <key>col</key><integer>5</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: </dict> -// CHECK: <dict> -// CHECK: <key>path</key> -// CHECK: <array> // CHECK: <dict> // CHECK: <key>kind</key><string>control</string> // CHECK: <key>edges</key> @@ -533,12 +505,12 @@ void rdar8331641(int x) { // CHECK: <array> // CHECK: <dict> // CHECK: <key>line</key><integer>28</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>7</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>28</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>8</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -551,7 +523,7 @@ void rdar8331641(int x) { // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>29</integer> -// CHECK: <key>col</key><integer>10</integer> +// CHECK: <key>col</key><integer>5</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -559,34 +531,6 @@ void rdar8331641(int x) { // CHECK: </array> // CHECK: </dict> // CHECK: <dict> -// CHECK: <key>kind</key><string>event</string> -// CHECK: <key>location</key> -// CHECK: <dict> -// CHECK: <key>line</key><integer>29</integer> -// CHECK: <key>col</key><integer>5</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: <key>ranges</key> -// CHECK: <array> -// CHECK: <array> -// CHECK: <dict> -// CHECK: <key>line</key><integer>29</integer> -// CHECK: <key>col</key><integer>5</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: <dict> -// CHECK: <key>line</key><integer>29</integer> -// CHECK: <key>col</key><integer>10</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: </array> -// CHECK: </array> -// CHECK: <key>extended_message</key> -// CHECK: <string>Variable 'p' initialized to a null pointer value</string> -// CHECK: <key>message</key> -// CHECK: <string>Variable 'p' initialized to a null pointer value</string> -// CHECK: </dict> -// CHECK: <dict> // CHECK: <key>kind</key><string>control</string> // CHECK: <key>edges</key> // CHECK: <array> @@ -600,7 +544,7 @@ void rdar8331641(int x) { // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>29</integer> -// CHECK: <key>col</key><integer>10</integer> +// CHECK: <key>col</key><integer>5</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -676,7 +620,7 @@ void rdar8331641(int x) { // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>35</integer> -// CHECK: <key>col</key><integer>8</integer> +// CHECK: <key>col</key><integer>3</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -923,13 +867,75 @@ void rdar8331641(int x) { // CHECK: <key>end</key> // CHECK: <array> // CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: </array> +// CHECK: </dict> +// CHECK: </array> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>kind</key><string>event</string> +// CHECK: <key>location</key> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <key>ranges</key> +// CHECK: <array> +// CHECK: <array> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: </array> +// CHECK: </array> +// CHECK: <key>extended_message</key> +// CHECK: <string>Assuming 'x' is 0</string> +// CHECK: <key>message</key> +// CHECK: <string>Assuming 'x' is 0</string> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>kind</key><string>control</string> +// CHECK: <key>edges</key> +// CHECK: <array> +// CHECK: <dict> +// CHECK: <key>start</key> +// CHECK: <array> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: <dict> +// CHECK: <key>line</key><integer>54</integer> +// CHECK: <key>col</key><integer>7</integer> +// CHECK: <key>file</key><integer>0</integer> +// CHECK: </dict> +// CHECK: </array> +// CHECK: <key>end</key> +// CHECK: <array> +// CHECK: <dict> // CHECK: <key>line</key><integer>56</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>10</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>56</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>10</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -945,12 +951,12 @@ void rdar8331641(int x) { // CHECK: <array> // CHECK: <dict> // CHECK: <key>line</key><integer>56</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>10</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: <dict> // CHECK: <key>line</key><integer>56</integer> -// CHECK: <key>col</key><integer>3</integer> +// CHECK: <key>col</key><integer>10</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> // CHECK: </array> @@ -978,21 +984,6 @@ void rdar8331641(int x) { // CHECK: <key>col</key><integer>1</integer> // CHECK: <key>file</key><integer>0</integer> // CHECK: </dict> -// CHECK: <key>ranges</key> -// CHECK: <array> -// CHECK: <array> -// CHECK: <dict> -// CHECK: <key>line</key><integer>57</integer> -// CHECK: <key>col</key><integer>1</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: <dict> -// CHECK: <key>line</key><integer>57</integer> -// CHECK: <key>col</key><integer>1</integer> -// CHECK: <key>file</key><integer>0</integer> -// CHECK: </dict> -// CHECK: </array> -// CHECK: </array> // CHECK: <key>extended_message</key> // CHECK: <string>Object leaked: object allocated and stored into 'value' is not referenced later in this execution path and has a retain count of +1</string> // CHECK: <key>message</key> @@ -1001,7 +992,7 @@ void rdar8331641(int x) { // CHECK: </array> // CHECK: <key>description</key><string>Potential leak of an object allocated on line 53 and stored into 'value'</string> // CHECK: <key>category</key><string>Memory (Core Foundation/Objective-C)</string> -// CHECK: <key>type</key><string>Leak of returned object</string> +// CHECK: <key>type</key><string>Leak</string> // CHECK: <key>location</key> // CHECK: <dict> // CHECK: <key>line</key><integer>57</integer> @@ -1012,4 +1003,3 @@ void rdar8331641(int x) { // CHECK: </array> // CHECK: </dict> // CHECK: </plist> - diff --git a/test/Analysis/plist-output.m b/test/Analysis/plist-output.m index 224f5194765e..e08ccc43dec8 100644 --- a/test/Analysis/plist-output.m +++ b/test/Analysis/plist-output.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s // XFAIL: * void test_null_init(void) { diff --git a/test/Analysis/pr4209.m b/test/Analysis/pr4209.m index e3bc5cc14333..e16d1aa0ed5b 100644 --- a/test/Analysis/pr4209.m +++ b/test/Analysis/pr4209.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // This test case was crashing due to how CFRefCount.cpp resolved the // ObjCInterfaceDecl* and ClassName in EvalObjCMessageExpr. diff --git a/test/Analysis/pr_2542_rdar_6793404.m b/test/Analysis/pr_2542_rdar_6793404.m index 73218d8bc80e..d5125a649d2b 100644 --- a/test/Analysis/pr_2542_rdar_6793404.m +++ b/test/Analysis/pr_2542_rdar_6793404.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -pedantic -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -pedantic -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -pedantic -analyzer-store=region -verify %s // BEGIN delta-debugging reduced header stuff diff --git a/test/Analysis/pr_4164.c b/test/Analysis/pr_4164.c index c58c8abe3f67..187f4c6bca43 100644 --- a/test/Analysis/pr_4164.c +++ b/test/Analysis/pr_4164.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // PR 4164: http://llvm.org/bugs/show_bug.cgi?id=4164 // diff --git a/test/Analysis/properties.m b/test/Analysis/properties.m index ad9db1ad6818..6d04a4ab4e78 100644 --- a/test/Analysis/properties.m +++ b/test/Analysis/properties.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/Analysis/pthreadlock.c b/test/Analysis/pthreadlock.c new file mode 100644 index 000000000000..4735d20eaa5c --- /dev/null +++ b/test/Analysis/pthreadlock.c @@ -0,0 +1,137 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.PthreadLock -verify %s + +// Tests performing normal locking patterns and wrong locking orders + +typedef struct { + void *foo; +} pthread_mutex_t; + +typedef pthread_mutex_t lck_mtx_t; + +extern int pthread_mutex_lock(pthread_mutex_t *); +extern int pthread_mutex_unlock(pthread_mutex_t *); +extern int pthread_mutex_trylock(pthread_mutex_t *); +extern int lck_mtx_lock(lck_mtx_t *); +extern int lck_mtx_unlock(lck_mtx_t *); +extern int lck_mtx_try_lock(lck_mtx_t *); + +pthread_mutex_t mtx1, mtx2; +lck_mtx_t lck1, lck2; + +void +ok1(void) +{ + pthread_mutex_lock(&mtx1); // no-warning +} + +void +ok2(void) +{ + pthread_mutex_unlock(&mtx1); // no-warning +} + +void +ok3(void) +{ + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_unlock(&mtx1); // no-warning + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_unlock(&mtx1); // no-warning +} + +void +ok4(void) +{ + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_unlock(&mtx1); // no-warning + pthread_mutex_lock(&mtx2); // no-warning + pthread_mutex_unlock(&mtx2); // no-warning +} + +void +ok5(void) +{ + if (pthread_mutex_trylock(&mtx1) == 0) // no-warning + pthread_mutex_unlock(&mtx1); // no-warning +} + +void +ok6(void) +{ + lck_mtx_lock(&lck1); // no-warning +} + +void +ok7(void) +{ + if (lck_mtx_try_lock(&lck1) != 0) // no-warning + lck_mtx_unlock(&lck1); // no-warning +} + +void +bad1(void) +{ + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_lock(&mtx1); // expected-warning{{This lock has already been acquired}} +} + +void +bad2(void) +{ + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_unlock(&mtx1); // no-warning + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_lock(&mtx1); // expected-warning{{This lock has already been acquired}} +} + +void +bad3(void) +{ + pthread_mutex_lock(&mtx1); // no-warning + pthread_mutex_lock(&mtx2); // no-warning + pthread_mutex_unlock(&mtx1); // expected-warning{{This was not the most recently acquired lock}} + pthread_mutex_unlock(&mtx2); +} + +void +bad4(void) +{ + if (pthread_mutex_trylock(&mtx1)) // no-warning + return; + pthread_mutex_lock(&mtx2); // no-warning + pthread_mutex_unlock(&mtx1); // expected-warning{{This was not the most recently acquired lock}} +} + +void +bad5(void) +{ + lck_mtx_lock(&lck1); // no-warning + lck_mtx_lock(&lck1); // expected-warning{{This lock has already been acquired}} +} + +void +bad6(void) +{ + lck_mtx_lock(&lck1); // no-warning + lck_mtx_unlock(&lck1); // no-warning + lck_mtx_lock(&lck1); // no-warning + lck_mtx_lock(&lck1); // expected-warning{{This lock has already been acquired}} +} + +void +bad7(void) +{ + lck_mtx_lock(&lck1); // no-warning + lck_mtx_lock(&lck2); // no-warning + lck_mtx_unlock(&lck1); // expected-warning{{This was not the most recently acquired lock}} + lck_mtx_unlock(&lck2); +} + +void +bad8(void) +{ + if (lck_mtx_try_lock(&lck1) == 0) // no-warning + return; + lck_mtx_lock(&lck2); // no-warning + lck_mtx_unlock(&lck1); // expected-warning{{This was not the most recently acquired lock}} +} diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c index 502de6c3ef9a..995470a369cb 100644 --- a/test/Analysis/ptr-arith.c +++ b/test/Analysis/ptr-arith.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-store=region -verify -triple i686-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core.FixedAddr,experimental.core.PointerArithm,experimental.core.PointerSub -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core.FixedAddr,experimental.core.PointerArithm,experimental.core.PointerSub -analyzer-store=region -verify -triple i686-apple-darwin9 %s // Used to trigger warnings for unreachable paths. #define WARN do { int a, b; int c = &b-&a; } while (0) diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m index d576eae8f652..62992d0146aa 100644 --- a/test/Analysis/rdar-6442306-1.m +++ b/test/Analysis/rdar-6442306-1.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=basic -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=region -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core %s -analyzer-store=region -verify typedef int bar_return_t; typedef struct { diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m index 4c70dbc0758f..b2a113c20dcf 100644 --- a/test/Analysis/rdar-6540084.m +++ b/test/Analysis/rdar-6540084.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=deadcode.DeadStores -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores -verify %s // // This test exercises the live variables analysis (LiveVariables.cpp). // The case originally identified a non-termination bug. diff --git a/test/Analysis/rdar-6541136-region.c b/test/Analysis/rdar-6541136-region.c index 5555b018578f..b90d4f43ddf7 100644 --- a/test/Analysis/rdar-6541136-region.c +++ b/test/Analysis/rdar-6541136-region.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core,security.experimental.ArrayBound -analyzer-store=region %s +// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core,experimental.security.ArrayBound -analyzer-store=region %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; diff --git a/test/Analysis/rdar-6541136.c b/test/Analysis/rdar-6541136.c deleted file mode 100644 index 095aefadb8ce..000000000000 --- a/test/Analysis/rdar-6541136.c +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic %s - -struct tea_cheese { unsigned magic; }; -typedef struct tea_cheese kernel_tea_cheese_t; -extern kernel_tea_cheese_t _wonky_gesticulate_cheese; - -// This test case exercises the ElementRegion::getRValueType() logic. -// All it tests is that it does not crash or do anything weird. -// The out-of-bounds-access on line 19 is caught using the region store variant. - -void foo( void ) -{ - kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese; - struct load_wine *cmd = (void*) &wonky[1]; - cmd = cmd; - char *p = (void*) &wonky[1]; - *p = 1; - kernel_tea_cheese_t *q = &wonky[1]; - kernel_tea_cheese_t r = *q; // no-warning -} diff --git a/test/Analysis/rdar-6562655.m b/test/Analysis/rdar-6562655.m index 1e0998aa974e..3a592730a897 100644 --- a/test/Analysis/rdar-6562655.m +++ b/test/Analysis/rdar-6562655.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-constraints=basic -analyzer-store=region -verify %s // // This test case mainly checks that the retain/release checker doesn't crash // on this file. diff --git a/test/Analysis/rdar-6582778-basic-store.c b/test/Analysis/rdar-6582778-basic-store.c deleted file mode 100644 index 0642b64cd7fd..000000000000 --- a/test/Analysis/rdar-6582778-basic-store.c +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s - -typedef const void * CFTypeRef; -typedef double CFTimeInterval; -typedef CFTimeInterval CFAbsoluteTime; -typedef const struct __CFAllocator * CFAllocatorRef; -typedef const struct __CFDate * CFDateRef; - -extern CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at); -CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); - -void f(void) { - CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); - CFTypeRef vals[] = { CFDateCreate(0, t) }; // no-warning -} - -CFTypeRef global; - -void g(void) { - CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); - global = CFDateCreate(0, t); // no-warning -} diff --git a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m index 03b2656c7ee6..e9711e70c204 100644 --- a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m +++ b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s -verify -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s -verify typedef struct Foo { int x; } Bar; diff --git a/test/Analysis/rdar-7168531.m b/test/Analysis/rdar-7168531.m index b2b66b279296..151625569ca7 100644 --- a/test/Analysis/rdar-7168531.m +++ b/test/Analysis/rdar-7168531.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -triple i386-apple-darwin10 -analyzer-store=region %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -triple i386-apple-darwin10 -analyzer-store=basic %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -triple i386-apple-darwin10 -fobjc-fragile-abi -analyzer-store=region %s // Note that the target triple is important for this test case. It specifies that we use the // fragile Objective-C ABI. diff --git a/test/Analysis/refcnt_naming.m b/test/Analysis/refcnt_naming.m index 8e99f3409b81..aff713be49f2 100644 --- a/test/Analysis/refcnt_naming.m +++ b/test/Analysis/refcnt_naming.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -verify %s typedef const struct __CFString * CFStringRef; typedef const struct __CFAllocator * CFAllocatorRef; diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp index 3422b58d3fe8..c7912f4f029e 100644 --- a/test/Analysis/reference.cpp +++ b/test/Analysis/reference.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s +// XFAIL typedef typeof(sizeof(int)) size_t; void malloc (size_t); diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m index 7f4cd26e405e..be9276609136 100644 --- a/test/Analysis/region-1.m +++ b/test/Analysis/region-1.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s // // This test case simply should not crash. It evaluates the logic of not // using MemRegion::getRValueType in incorrect places. diff --git a/test/Analysis/retain-release-basic-store.m b/test/Analysis/retain-release-basic-store.m deleted file mode 100644 index 7fd17ffb995f..000000000000 --- a/test/Analysis/retain-release-basic-store.m +++ /dev/null @@ -1,104 +0,0 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s - -//===----------------------------------------------------------------------===// -// The following code is reduced using delta-debugging from -// Foundation.h (Mac OS X). -// -// It includes the basic definitions for the test cases below. -// Not including Foundation.h directly makes this test case both svelte and -// portable to non-Mac platforms. -//===----------------------------------------------------------------------===// - -typedef unsigned int __darwin_natural_t; -typedef unsigned long UInt32; -typedef signed long CFIndex; -typedef const void * CFTypeRef; -typedef const struct __CFString * CFStringRef; -typedef const struct __CFAllocator * CFAllocatorRef; -extern const CFAllocatorRef kCFAllocatorDefault; -extern CFTypeRef CFRetain(CFTypeRef cf); -extern void CFRelease(CFTypeRef cf); -typedef struct { -} -CFArrayCallBacks; -extern const CFArrayCallBacks kCFTypeArrayCallBacks; -typedef const struct __CFArray * CFArrayRef; -typedef struct __CFArray * CFMutableArrayRef; -extern CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFArrayCallBacks *callBacks); -extern const void *CFArrayGetValueAtIndex(CFArrayRef theArray, CFIndex idx); -typedef const struct __CFDictionary * CFDictionaryRef; -typedef UInt32 CFStringEncoding; -enum { -kCFStringEncodingMacRoman = 0, kCFStringEncodingWindowsLatin1 = 0x0500, kCFStringEncodingISOLatin1 = 0x0201, kCFStringEncodingNextStepLatin = 0x0B01, kCFStringEncodingASCII = 0x0600, kCFStringEncodingUnicode = 0x0100, kCFStringEncodingUTF8 = 0x08000100, kCFStringEncodingNonLossyASCII = 0x0BFF , kCFStringEncodingUTF16 = 0x0100, kCFStringEncodingUTF16BE = 0x10000100, kCFStringEncodingUTF16LE = 0x14000100, kCFStringEncodingUTF32 = 0x0c000100, kCFStringEncodingUTF32BE = 0x18000100, kCFStringEncodingUTF32LE = 0x1c000100 }; -extern CFStringRef CFStringCreateWithCString(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding); -typedef double CFTimeInterval; -typedef CFTimeInterval CFAbsoluteTime; -typedef const struct __CFDate * CFDateRef; -extern CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at); -extern CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef theDate); -typedef __darwin_natural_t natural_t; -typedef natural_t mach_port_name_t; -typedef mach_port_name_t mach_port_t; -typedef signed char BOOL; -typedef struct _NSZone NSZone; -@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; -@protocol NSObject - (BOOL)isEqual:(id)object; -- (id)retain; -- (oneway void)release; -@end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; -@end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; -@end @interface NSObject <NSObject> { -} -@end typedef float CGFloat; -typedef double NSTimeInterval; -@interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; -@end enum { -NSObjCNoType = 0, NSObjCVoidType = 'v', NSObjCCharType = 'c', NSObjCShortType = 's', NSObjCLongType = 'l', NSObjCLonglongType = 'q', NSObjCFloatType = 'f', NSObjCDoubleType = 'd', NSObjCBoolType = 'B', NSObjCSelectorType = ':', NSObjCObjectType = '@', NSObjCStructType = '{', NSObjCPointerType = '^', NSObjCStringType = '*', NSObjCArrayType = '[', NSObjCUnionType = '(', NSObjCBitfield = 'b' } -__attribute__((deprecated)); -typedef int kern_return_t; -typedef kern_return_t mach_error_t; -typedef mach_port_t io_object_t; -typedef io_object_t io_service_t; -typedef struct __DASession * DASessionRef; -extern DASessionRef DASessionCreate( CFAllocatorRef allocator ); -typedef struct __DADisk * DADiskRef; -extern DADiskRef DADiskCreateFromBSDName( CFAllocatorRef allocator, DASessionRef session, const char * name ); -extern DADiskRef DADiskCreateFromIOMedia( CFAllocatorRef allocator, DASessionRef session, io_service_t media ); -extern CFDictionaryRef DADiskCopyDescription( DADiskRef disk ); -extern DADiskRef DADiskCopyWholeDisk( DADiskRef disk ); -@interface NSAppleEventManager : NSObject { -} -@end enum { -kDAReturnSuccess = 0, kDAReturnError = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x01, kDAReturnBusy = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x02, kDAReturnBadArgument = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x03, kDAReturnExclusiveAccess = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x04, kDAReturnNoResources = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x05, kDAReturnNotFound = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x06, kDAReturnNotMounted = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x07, kDAReturnNotPermitted = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x08, kDAReturnNotPrivileged = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x09, kDAReturnNotReady = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0A, kDAReturnNotWritable = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0B, kDAReturnUnsupported = (((0x3eU)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0C }; -typedef mach_error_t DAReturn; -typedef const struct __DADissenter * DADissenterRef; -extern DADissenterRef DADissenterCreate( CFAllocatorRef allocator, DAReturn status, CFStringRef string ); - -//===----------------------------------------------------------------------===// -// Test cases. -//===----------------------------------------------------------------------===// - -// Test to see if we supresss an error when we store the pointer -// to a struct. This is because the value "escapes" the basic reasoning -// of basic store. - -struct foo { - NSDate* f; -}; - -CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); - -CFAbsoluteTime f4() { - struct foo x; - - CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); - CFDateRef date = CFDateCreate(0, t); - [((NSDate*) date) retain]; - CFRelease(date); - CFDateGetAbsoluteTime(date); // no-warning - x.f = (NSDate*) date; - [((NSDate*) date) release]; - t = CFDateGetAbsoluteTime(date); // no-warning - return t; -} - diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m index ee1a6b4b782e..4e1b8466c322 100644 --- a/test/Analysis/retain-release-gc-only.m +++ b/test/Analysis/retain-release-gc-only.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSAutoreleasePool -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSAutoreleasePool -analyzer-store=region -fobjc-gc-only -fblocks -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,osx.cocoa.NSAutoreleasePool -analyzer-store=region -fobjc-gc-only -fblocks -verify %s //===----------------------------------------------------------------------===// // Header stuff. @@ -92,7 +91,7 @@ typedef struct _NSZone NSZone; + (id)allocWithZone:(NSZone *)zone; + (id)alloc; - (void)dealloc; -- (void)release; +- (oneway void)release; - (id)copy; @end @interface NSObject (NSCoderMethods) diff --git a/test/Analysis/retain-release-path-notes-gc.m b/test/Analysis/retain-release-path-notes-gc.m index 21d314fa1541..19e6d7b8b337 100644 --- a/test/Analysis/retain-release-path-notes-gc.m +++ b/test/Analysis/retain-release-path-notes-gc.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -analyzer-output=text -fobjc-gc-only -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -analyzer-output=text -fobjc-gc-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=text -fobjc-gc-only -verify %s /*** This file is for testing the path-sensitive notes for retain/release errors. diff --git a/test/Analysis/retain-release-path-notes.m b/test/Analysis/retain-release-path-notes.m index bac0afb3f7ab..e34942a8968c 100644 --- a/test/Analysis/retain-release-path-notes.m +++ b/test/Analysis/retain-release-path-notes.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -analyzer-output=text -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -analyzer-output=text -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -analyzer-output=text -verify %s /*** This file is for testing the path-sensitive notes for retain/release errors. diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m index ac2362a4a73c..89950ce7cd25 100644 --- a/test/Analysis/retain-release-region-store.m +++ b/test/Analysis/retain-release-region-store.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-max-loop 6 -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-max-loop 6 -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 71ae756cf045..6f8bf09ebd74 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1,7 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify -x objective-c++ %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify -x objective-c++ %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -x objective-c++ %s #if __has_feature(attribute_ns_returns_retained) #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) @@ -148,7 +146,9 @@ NSFastEnumerationState; typedef double NSTimeInterval; @interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; @end typedef unsigned short unichar; -@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; +@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> +- (NSUInteger)length; +- (NSString *)stringByAppendingString:(NSString *)aString; - ( const char *)UTF8String; - (id)initWithUTF8String:(const char *)nullTerminatedCString; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; @@ -270,6 +270,12 @@ extern void CGContextDrawLinearGradient(CGContextRef context, CGGradientDrawingOptions options); extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); +@interface NSMutableArray : NSObject +- (void)addObject:(id)object; ++ (id)array; +@end + + //===----------------------------------------------------------------------===// // Test cases. //===----------------------------------------------------------------------===// @@ -654,6 +660,12 @@ void rdar6704930(unsigned char *s, unsigned int length) { [window release]; [super dealloc]; } + +- (void)radar10102244 { + NSMutableDictionary *dict = [[NSMutableDictionary dictionaryWithCapacity:4] retain]; // expected-warning{{leak}} + if (window) + NSLog(@"%@", window); +} @end //===----------------------------------------------------------------------===// @@ -1446,7 +1458,7 @@ static void rdar_8724287(CFErrorRef error) while (error_to_dump != ((void*)0)) { CFDictionaryRef info; - info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1449 and stored into 'info'}} + info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line}} if (info != ((void*)0)) { } @@ -1540,3 +1552,55 @@ CFArrayRef camel_copymachine() { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } +// rdar://problem/8024350 +@protocol F18P +- (id) clone; +@end +@interface F18 : NSObject<F18P> @end +@interface F18(Cat) +- (id) clone NS_RETURNS_RETAINED; +@end + +@implementation F18 +- (id) clone { + return [F18 alloc]; +} +@end + +// Radar 6582778. +void rdar6582778(void) { + CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); + CFTypeRef vals[] = { CFDateCreate(0, t) }; // expected-warning {{leak}} +} + +CFTypeRef global; + +void rdar6582778_2(void) { + CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); + global = CFDateCreate(0, t); // no-warning +} + +// <rdar://problem/10232019> - Test that objects passed to containers +// are marked "escaped". + +void rdar10232019() { + NSMutableArray *array = [NSMutableArray array]; + + NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; + [array addObject:string]; + [string release]; + + NSString *otherString = [string stringByAppendingString:@"bar"]; // no-warning + NSLog(@"%@", otherString); +} + +void rdar10232019_positive() { + NSMutableArray *array = [NSMutableArray array]; + + NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; + [string release]; + + NSString *otherString = [string stringByAppendingString:@"bar"]; // expected-warning {{Reference-counted object is used after it is release}} + NSLog(@"%@", otherString); +} + diff --git a/test/Analysis/retain-release.mm b/test/Analysis/retain-release.mm index bdc3dc03964a..bae8dc339254 100644 --- a/test/Analysis/retain-release.mm +++ b/test/Analysis/retain-release.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify %s #if __has_feature(attribute_ns_returns_retained) #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) @@ -304,4 +304,14 @@ void test_smartpointer_3() { foo.noAdopt(x); } +extern CFStringRef ElectronMicroscopyEngage(void); +void test_microscopy() { + NSString *token = (NSString*) ElectronMicroscopyEngage(); + [token release]; // expected-warning {{object that is not owned}} +} +extern CFStringRef Scopy(void); +void test_Scopy() { + NSString *token = (NSString*) Scopy(); + [token release]; // expected-warning {{object that is not owned}} +} diff --git a/test/Analysis/security-syntax-checks-no-emit.c b/test/Analysis/security-syntax-checks-no-emit.c index 4e37c44247c2..cbd432a19b31 100644 --- a/test/Analysis/security-syntax-checks-no-emit.c +++ b/test/Analysis/security-syntax-checks-no-emit.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=security.experimental.SecuritySyntactic %s -verify +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=experimental.security.SecuritySyntactic %s -verify // This file complements 'security-syntax-checks.m', but tests that we omit // specific checks on platforms where they don't make sense. diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m index 160dcf657387..6fb5b3cf14ef 100644 --- a/test/Analysis/security-syntax-checks.m +++ b/test/Analysis/security-syntax-checks.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=security.experimental.SecuritySyntactic %s -verify -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -analyzer-checker=security.experimental.SecuritySyntactic %s -verify -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DVARIANT -analyzer-checker=security.experimental.SecuritySyntactic %s -verify -// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=security.experimental.SecuritySyntactic %s -verify +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=experimental.security.SecuritySyntactic %s -verify +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -analyzer-checker=experimental.security.SecuritySyntactic %s -verify +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DVARIANT -analyzer-checker=experimental.security.SecuritySyntactic %s -verify +// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=experimental.security.SecuritySyntactic %s -verify #ifdef USE_BUILTINS # define BUILTIN(f) __builtin_ ## f @@ -164,3 +164,14 @@ void test_strcat() { strcat(x, y); //expected-warning{{Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strncat'. CWE-119.}} } + +//===----------------------------------------------------------------------=== +// vfork() +//===----------------------------------------------------------------------=== +typedef int __int32_t; +typedef __int32_t pid_t; +pid_t vfork(void); //expected-warning{{declaration of built-in function 'vfork' requires inclusion of the header <setjmp.h>}} + +void test_vfork() { + vfork(); //expected-warning{{Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process.}} +} diff --git a/test/Analysis/self-init.m b/test/Analysis/self-init.m index 92006a6d2459..019fdcd0c2bf 100644 --- a/test/Analysis/self-init.m +++ b/test/Analysis/self-init.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.experimental.SelfInit %s -verify +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.osx.cocoa.SelfInit %s -verify @class NSZone, NSCoder; @protocol NSObject diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c index 6d0a2c4d2c26..0c86de88ae28 100644 --- a/test/Analysis/sizeofpointer.c +++ b/test/Analysis/sizeofpointer.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.SizeofPtr -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core.SizeofPtr -verify %s struct s { }; diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c index bf2a4fa4e13c..558986d308d4 100644 --- a/test/Analysis/stack-addr-ps.c +++ b/test/Analysis/stack-addr-ps.c @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -fblocks -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s int* f1() { @@ -59,7 +58,7 @@ int struct_test(struct baz byVal, int flag) { typedef int (^ComparatorBlock)(int a, int b); ComparatorBlock test_return_block(void) { ComparatorBlock b = ^int(int a, int b){ return a > b; }; - return b; // expected-warning{{Address of stack-allocated block declared on line 61 returned to caller}} + return b; // expected-warning{{Address of stack-allocated block declared on line 60 returned to caller}} } ComparatorBlock test_return_block_neg_aux(void); diff --git a/test/Analysis/stack-addr-ps.cpp b/test/Analysis/stack-addr-ps.cpp index 0c1ffba4f8c5..b09e43560830 100644 --- a/test/Analysis/stack-addr-ps.cpp +++ b/test/Analysis/stack-addr-ps.cpp @@ -1,38 +1,38 @@ -// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s // FIXME: Only the stack-address checking in Sema catches this right now, and // the stack analyzer doesn't handle the ImplicitCastExpr (lvalue). const int& g() { int s; - return s; // expected-warning{{reference to stack memory associated with local variable 's' returned}} + return s; // expected-warning{{Address of stack memory associated with local variable 's' returned}} expected-warning{{reference to stack memory associated with local variable 's' returned}} } const int& g2() { int s1; int &s2 = s1; // expected-note {{binding reference variable 's2' here}} - return s2; // expected-warning {{reference to stack memory associated with local variable 's1' returned}} + return s2; // expected-warning{{Address of stack memory associated with local variable 's1' returned}} expected-warning {{reference to stack memory associated with local variable 's1' returned}} } const int& g3() { int s1; int &s2 = s1; // expected-note {{binding reference variable 's2' here}} int &s3 = s2; // expected-note {{binding reference variable 's3' here}} - return s3; // expected-warning {{reference to stack memory associated with local variable 's1' returned}} + return s3; // expected-warning{{Address of stack memory associated with local variable 's1' returned}} expected-warning {{reference to stack memory associated with local variable 's1' returned}} } int get_value(); -const int &get_reference1() { return get_value(); } // expected-warning {{returning reference to local temporary}} +const int &get_reference1() { return get_value(); } // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}} const int &get_reference2() { const int &x = get_value(); // expected-note {{binding reference variable 'x' here}} - return x; // expected-warning {{returning reference to local temporary}} + return x; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}} } const int &get_reference3() { const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}} const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}} - return x2; // expected-warning {{returning reference to local temporary}} + return x2; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning reference to local temporary}} } int global_var; @@ -44,19 +44,19 @@ int *f1() { int *f2() { int x1; int &x2 = x1; // expected-note {{binding reference variable 'x2' here}} - return &x2; // expected-warning {{address of stack memory associated with local variable 'x1' returned}} + return &x2; // expected-warning{{Address of stack memory associated with local variable 'x1' returned}} expected-warning {{address of stack memory associated with local variable 'x1' returned}} } int *f3() { int x1; int *const &x2 = &x1; // expected-note {{binding reference variable 'x2' here}} - return x2; // expected-warning {{address of stack memory associated with local variable 'x1' returned}} + return x2; // expected-warning {{address of stack memory associated with local variable 'x1' returned}} expected-warning {{Address of stack memory associated with local variable 'x1' returned to caller}} } const int *f4() { const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}} const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}} - return &x2; // expected-warning {{returning address of local temporary}} + return &x2; // expected-warning{{Address of stack memory associated with temporary object of type 'const int' returned}} expected-warning {{returning address of local temporary}} } struct S { @@ -67,7 +67,7 @@ int *mf() { S s1; S &s2 = s1; // expected-note {{binding reference variable 's2' here}} int &x = s2.x; // expected-note {{binding reference variable 'x' here}} - return &x; // expected-warning {{address of stack memory associated with local variable 's1' returned}} + return &x; // expected-warning{{Address of stack memory associated with local variable 's1' returned}} expected-warning {{address of stack memory associated with local variable 's1' returned}} } void *lf() { @@ -76,14 +76,6 @@ void *lf() { return x; // expected-warning {{returning address of label, which is local}} } -typedef void (^bptr)(void); - -bptr bf(int j) { - __block int i; - const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}} - return qq; // expected-error {{returning block that lives on the local stack}} -} - template <typename T> struct TS { int *get(); diff --git a/test/Analysis/stack-block-returned.cpp b/test/Analysis/stack-block-returned.cpp new file mode 100644 index 000000000000..af2cec776697 --- /dev/null +++ b/test/Analysis/stack-block-returned.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s + +typedef void (^bptr)(void); + +bptr bf(int j) { + __block int i; + const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}} + return qq; // expected-error {{returning block that lives on the local stack}} +} diff --git a/test/Analysis/stream.c b/test/Analysis/stream.c index 2f372e755153..e68835e5cfc4 100644 --- a/test/Analysis/stream.c +++ b/test/Analysis/stream.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=unix.experimental.Stream -analyzer-store region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.unix.Stream -analyzer-store region -verify %s typedef __typeof__(sizeof(int)) size_t; typedef struct _IO_FILE FILE; diff --git a/test/Analysis/string-fail.c b/test/Analysis/string-fail.c index 64ac504d6d80..3bff6d40dd51 100644 --- a/test/Analysis/string-fail.c +++ b/test/Analysis/string-fail.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s // XFAIL: * // This file is for tests that may eventually go into string.c, or may be diff --git a/test/Analysis/string.c b/test/Analysis/string.c index dc97e1a119e0..a71e1f008817 100644 --- a/test/Analysis/string.c +++ b/test/Analysis/string.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s -// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,unix.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s +// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,experimental.unix.CString,experimental.deadcode.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s //===----------------------------------------------------------------------=== // Declarations diff --git a/test/Analysis/temp-obj-dtors-cfg-output.cpp b/test/Analysis/temp-obj-dtors-cfg-output.cpp index 5ed782c690a1..17864e4c5485 100644 --- a/test/Analysis/temp-obj-dtors-cfg-output.cpp +++ b/test/Analysis/temp-obj-dtors-cfg-output.cpp @@ -106,486 +106,661 @@ TestCtorInits::TestCtorInits() : a(int(A()) + int(B())) , b() {} -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A() -// CHECK: 2: [B1.1].operator int() -// CHECK: 3: B() -// CHECK: 4: [B1.3].operator int() -// CHECK: 5: int a = int(A().operator int()) + int(B().operator int()); -// CHECK: 6: ~B() (Temporary object destructor) -// CHECK: 7: ~A() (Temporary object destructor) -// CHECK: 8: A() -// CHECK: 9: [B1.8].operator int() -// CHECK: 10: B() -// CHECK: 11: [B1.10].operator int() -// CHECK: 12: foo(int([B1.9]) + int([B1.11])) -// CHECK: 13: ~B() (Temporary object destructor) -// CHECK: 14: ~A() (Temporary object destructor) -// CHECK: 15: int b; -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B10 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B8 -// CHECK: [ B1 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: int b; -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B3 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: [B4.3] && [B5.2] -// CHECK: 2: foo([B3.1]) -// CHECK: T: [B4.3] && ... -// CHECK: Predecessors (2): B5 B4 -// CHECK: Successors (2): B2 B1 -// CHECK: [ B4 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: A() -// CHECK: 3: [B4.2].operator _Bool() -// CHECK: T: [B4.3] && ... -// CHECK: Predecessors (2): B6 B7 -// CHECK: Successors (2): B5 B3 -// CHECK: [ B5 ] -// CHECK: 1: B() -// CHECK: 2: [B5.1].operator _Bool() -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B3 -// CHECK: [ B6 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: [B8.2] && [B9.2] -// CHECK: 2: bool a = A().operator _Bool() && B().operator _Bool(); -// CHECK: T: [B8.2] && ... -// CHECK: Predecessors (2): B9 B8 -// CHECK: Successors (2): B6 B4 -// CHECK: [ B8 ] -// CHECK: 1: A() -// CHECK: 2: [B8.1].operator _Bool() -// CHECK: T: [B8.2] && ... -// CHECK: Predecessors (1): B10 -// CHECK: Successors (2): B9 B7 -// CHECK: [ B9 ] -// CHECK: 1: B() -// CHECK: 2: [B9.1].operator _Bool() -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B7 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B10 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B8 -// CHECK: [ B1 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: int b; -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B3 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: [B4.3] || [B5.2] -// CHECK: 2: foo([B3.1]) -// CHECK: T: [B4.3] || ... -// CHECK: Predecessors (2): B5 B4 -// CHECK: Successors (2): B1 B2 -// CHECK: [ B4 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: A() -// CHECK: 3: [B4.2].operator _Bool() -// CHECK: T: [B4.3] || ... -// CHECK: Predecessors (2): B6 B7 -// CHECK: Successors (2): B3 B5 -// CHECK: [ B5 ] -// CHECK: 1: B() -// CHECK: 2: [B5.1].operator _Bool() -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B3 -// CHECK: [ B6 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: [B8.2] || [B9.2] -// CHECK: 2: bool a = A().operator _Bool() || B().operator _Bool(); -// CHECK: T: [B8.2] || ... -// CHECK: Predecessors (2): B9 B8 -// CHECK: Successors (2): B4 B6 -// CHECK: [ B8 ] -// CHECK: 1: A() -// CHECK: 2: [B8.1].operator _Bool() -// CHECK: T: [B8.2] || ... -// CHECK: Predecessors (1): B10 -// CHECK: Successors (2): B7 B9 -// CHECK: [ B9 ] -// CHECK: 1: B() -// CHECK: 2: [B9.1].operator _Bool() -// CHECK: Predecessors (1): B8 -// CHECK: Successors (1): B7 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B11 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B10 -// CHECK: [ B1 ] -// CHECK: 1: int b; -// CHECK: 2: [B7.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: foo(0) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: foo(0) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: 2: B() -// CHECK: 3: [B4.2].operator _Bool() -// CHECK: 4: ~B() (Temporary object destructor) -// CHECK: T: if [B4.3] -// CHECK: Predecessors (2): B5 B6 -// CHECK: Successors (2): B3 B2 -// CHECK: [ B5 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B6 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: 3: ~A() (Temporary object destructor) -// CHECK: 4: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: [B10.2] ? [B8.2] : [B9.3] -// CHECK: 2: A a = B().operator _Bool() ? A() : A(B().operator A()); -// CHECK: T: [B10.2] ? ... : ... -// CHECK: Predecessors (2): B8 B9 -// CHECK: Successors (2): B5 B6 -// CHECK: [ B8 ] -// CHECK: 1: A() -// CHECK: 2: [B8.1] (BindTemporary) -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B7 -// CHECK: [ B9 ] -// CHECK: 1: B() -// CHECK: 2: [B9.1].operator A() -// CHECK: 3: A([B9.2]) (BindTemporary) -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B7 -// CHECK: [ B10 ] -// CHECK: 1: B() -// CHECK: 2: [B10.1].operator _Bool() -// CHECK: T: [B10.2] ? ... : ... -// CHECK: Predecessors (1): B11 -// CHECK: Successors (2): B8 B9 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B14 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B13 -// CHECK: [ B1 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: 2: int b; -// CHECK: 3: [B10.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: 3: ~A() (Temporary object destructor) -// CHECK: 4: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: [B7.3] ? [B5.2] : [B6.3] -// CHECK: 2: foo([B4.1]) -// CHECK: T: [B7.3] ? ... : ... -// CHECK: Predecessors (2): B5 B6 -// CHECK: Successors (2): B2 B3 -// CHECK: [ B5 ] -// CHECK: 1: A() -// CHECK: 2: [B5.1] (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B6 ] -// CHECK: 1: B() -// CHECK: 2: [B6.1].operator A() -// CHECK: 3: A([B6.2]) (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: ~B() (Temporary object destructor) -// CHECK: 2: B() -// CHECK: 3: [B7.2].operator _Bool() -// CHECK: T: [B7.3] ? ... : ... -// CHECK: Predecessors (2): B8 B9 -// CHECK: Successors (2): B5 B6 -// CHECK: [ B8 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B7 -// CHECK: [ B9 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: 3: ~B() (Temporary object destructor) -// CHECK: Predecessors (1): B10 -// CHECK: Successors (1): B7 -// CHECK: [ B10 ] -// CHECK: 1: [B13.2] ? [B11.2] : [B12.3] -// CHECK: 2: const A &a = B().operator _Bool() ? A() : A(B().operator A()); -// CHECK: T: [B13.2] ? ... : ... -// CHECK: Predecessors (2): B11 B12 -// CHECK: Successors (2): B8 B9 -// CHECK: [ B11 ] -// CHECK: 1: A() -// CHECK: 2: [B11.1] (BindTemporary) -// CHECK: Predecessors (1): B13 -// CHECK: Successors (1): B10 -// CHECK: [ B12 ] -// CHECK: 1: B() -// CHECK: 2: [B12.1].operator A() -// CHECK: 3: A([B12.2]) (BindTemporary) -// CHECK: Predecessors (1): B13 -// CHECK: Successors (1): B10 -// CHECK: [ B13 ] -// CHECK: 1: B() -// CHECK: 2: [B13.1].operator _Bool() -// CHECK: T: [B13.2] ? ... : ... -// CHECK: Predecessors (1): B14 -// CHECK: Successors (2): B11 B12 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B8 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B7 -// CHECK: [ B1 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: int b; -// CHECK: 3: [B4.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: [B7.2] ?: [B6.2] -// CHECK: 2: A a = A() ?: A(); -// CHECK: T: [B7.3] ? ... : ... -// CHECK: Predecessors (2): B5 B6 -// CHECK: Successors (2): B2 B3 -// CHECK: [ B5 ] -// CHECK: 1: -// CHECK: 2: [B5.1] (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B6 ] -// CHECK: 1: A() -// CHECK: 2: [B6.1] (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: A() -// CHECK: 2: [B7.1] (BindTemporary) -// CHECK: 3: .operator _Bool() -// CHECK: T: [B7.3] ? ... : ... -// CHECK: Predecessors (1): B8 -// CHECK: Successors (2): B5 B6 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B13 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B12 -// CHECK: [ B1 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: int b; -// CHECK: 3: [B9.2].~A() (Implicit destructor) -// CHECK: Predecessors (2): B2 B3 -// CHECK: Successors (1): B0 -// CHECK: [ B2 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B3 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B4 -// CHECK: Successors (1): B1 -// CHECK: [ B4 ] -// CHECK: 1: [B7.3] ?: [B6.2] -// CHECK: 2: foo([B4.1]) -// CHECK: T: [B7.4] ? ... : ... -// CHECK: Predecessors (2): B5 B6 -// CHECK: Successors (2): B2 B3 -// CHECK: [ B5 ] -// CHECK: 1: -// CHECK: 2: [B5.1] (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B6 ] -// CHECK: 1: A() -// CHECK: 2: [B6.1] (BindTemporary) -// CHECK: Predecessors (1): B7 -// CHECK: Successors (1): B4 -// CHECK: [ B7 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: 2: A() -// CHECK: 3: [B7.2] (BindTemporary) -// CHECK: 4: .operator _Bool() -// CHECK: T: [B7.4] ? ... : ... -// CHECK: Predecessors (2): B9 B8 -// CHECK: Successors (2): B5 B6 -// CHECK: [ B8 ] -// CHECK: 1: ~A() (Temporary object destructor) -// CHECK: Predecessors (1): B9 -// CHECK: Successors (1): B7 -// CHECK: [ B9 ] -// CHECK: 1: [B12.2] ?: [B11.2] -// CHECK: 2: const A &a = A() ?: A(); -// CHECK: T: [B12.3] ? ... : ... -// CHECK: Predecessors (2): B10 B11 -// CHECK: Successors (2): B7 B8 -// CHECK: [ B10 ] -// CHECK: 1: -// CHECK: 2: [B10.1] (BindTemporary) -// CHECK: Predecessors (1): B12 -// CHECK: Successors (1): B9 -// CHECK: [ B11 ] -// CHECK: 1: A() -// CHECK: 2: [B11.1] (BindTemporary) -// CHECK: Predecessors (1): B12 -// CHECK: Successors (1): B9 -// CHECK: [ B12 ] -// CHECK: 1: A() -// CHECK: 2: [B12.1] (BindTemporary) -// CHECK: 3: .operator _Bool() -// CHECK: T: [B12.3] ? ... : ... -// CHECK: Predecessors (1): B13 -// CHECK: Successors (2): B10 B11 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A() -// CHECK: 2: A a = A(); -// CHECK: 3: ~A() (Temporary object destructor) -// CHECK: 4: int b; -// CHECK: 5: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A() -// CHECK: 2: const A &a = A(); -// CHECK: 3: A() -// CHECK: 4: foo([B1.3]) -// CHECK: 5: ~A() (Temporary object destructor) -// CHECK: 6: int b; -// CHECK: 7: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A::make() -// CHECK: 2: A a = A::make(); -// CHECK: 3: ~A() (Temporary object destructor) -// CHECK: 4: int b; -// CHECK: 5: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A::make() -// CHECK: 2: const A &a = A::make(); -// CHECK: 3: A::make() -// CHECK: 4: foo([B1.3]) -// CHECK: 5: ~A() (Temporary object destructor) -// CHECK: 6: int b; -// CHECK: 7: [B1.2].~A() (Implicit destructor) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: int a; -// CHECK: 2: A() -// CHECK: 3: [B1.2].operator int() -// CHECK: 4: a = [B1.3] -// CHECK: 5: ~A() (Temporary object destructor) -// CHECK: 6: int b; -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): -// CHECK: [ B2 (ENTRY) ] -// CHECK: Predecessors (0): -// CHECK: Successors (1): B1 -// CHECK: [ B1 ] -// CHECK: 1: A() -// CHECK: 2: [B1.1].operator int() -// CHECK: 3: B() -// CHECK: 4: [B1.3].operator int() -// CHECK: 5: a(int([B1.2]) + int([B1.4])) (Member initializer) -// CHECK: 6: ~B() (Temporary object destructor) -// CHECK: 7: ~A() (Temporary object destructor) -// CHECK: 8: b(/*implicit*/int()) (Member initializer) -// CHECK: Predecessors (1): B2 -// CHECK: Successors (1): B0 -// CHECK: [ B0 (EXIT) ] -// CHECK: Predecessors (1): B1 -// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A() +// CHECK: 2: [B1.1] (BindTemporary) +// CHECK: 3: [B1.2].operator int +// CHECK: 4: [B1.3]() +// CHECK: 5: [B1.4] +// CHECK: 6: int([B1.5]) +// CHECK: 7: B() +// CHECK: 8: [B1.7] (BindTemporary) +// CHECK: 9: [B1.8].operator int +// CHECK: 10: [B1.9]() +// CHECK: 11: [B1.10] +// CHECK: 12: int([B1.11]) +// CHECK: 13: [B1.6] + [B1.12] +// CHECK: 14: int a = int(A().operator int()) + int(B().operator int()); +// CHECK: 15: ~B() (Temporary object destructor) +// CHECK: 16: ~A() (Temporary object destructor) +// CHECK: 17: A() +// CHECK: 18: [B1.17] (BindTemporary) +// CHECK: 19: [B1.18].operator int +// CHECK: 20: [B1.19]() +// CHECK: 21: [B1.20] +// CHECK: 22: int([B1.21]) +// CHECK: 23: B() +// CHECK: 24: [B1.23] (BindTemporary) +// CHECK: 25: [B1.24].operator int +// CHECK: 26: [B1.25]() +// CHECK: 27: [B1.26] +// CHECK: 28: int([B1.27]) +// CHECK: 29: [B1.22] + [B1.28] +// CHECK: 30: foo +// CHECK: 31: [B1.30] +// CHECK: 32: [B1.31]([B1.29]) +// CHECK: 33: ~B() (Temporary object destructor) +// CHECK: 34: ~A() (Temporary object destructor) +// CHECK: 35: int b; +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B10 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B8 +// CHECK: [ B1 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B3 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: [B4.5] && [B5.4] +// CHECK: 2: foo +// CHECK: 3: [B3.2] +// CHECK: 4: [B3.3]([B3.1]) +// CHECK: T: [B4.5] && ... +// CHECK: Predecessors (2): B5 B4 +// CHECK: Successors (2): B2 B1 +// CHECK: [ B4 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: A() +// CHECK: 3: [B4.2] (BindTemporary) +// CHECK: 4: [B4.3].operator _Bool +// CHECK: 5: [B4.4]() +// CHECK: T: [B4.5] && ... +// CHECK: Predecessors (2): B6 B7 +// CHECK: Successors (2): B5 B3 +// CHECK: [ B5 ] +// CHECK: 1: B() +// CHECK: 2: [B5.1] (BindTemporary) +// CHECK: 3: [B5.2].operator _Bool +// CHECK: 4: [B5.3]() +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B3 +// CHECK: [ B6 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: [B8.4] && [B9.4] +// CHECK: 2: bool a = A().operator _Bool() && B().operator _Bool(); +// CHECK: T: [B8.4] && ... +// CHECK: Predecessors (2): B9 B8 +// CHECK: Successors (2): B6 B4 +// CHECK: [ B8 ] +// CHECK: 1: A() +// CHECK: 2: [B8.1] (BindTemporary) +// CHECK: 3: [B8.2].operator _Bool +// CHECK: 4: [B8.3]() +// CHECK: T: [B8.4] && ... +// CHECK: Predecessors (1): B10 +// CHECK: Successors (2): B9 B7 +// CHECK: [ B9 ] +// CHECK: 1: B() +// CHECK: 2: [B9.1] (BindTemporary) +// CHECK: 3: [B9.2].operator _Bool +// CHECK: 4: [B9.3]() +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B7 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B10 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B8 +// CHECK: [ B1 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B3 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: [B4.5] || [B5.4] +// CHECK: 2: foo +// CHECK: 3: [B3.2] +// CHECK: 4: [B3.3]([B3.1]) +// CHECK: T: [B4.5] || ... +// CHECK: Predecessors (2): B5 B4 +// CHECK: Successors (2): B1 B2 +// CHECK: [ B4 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: A() +// CHECK: 3: [B4.2] (BindTemporary) +// CHECK: 4: [B4.3].operator _Bool +// CHECK: 5: [B4.4]() +// CHECK: T: [B4.5] || ... +// CHECK: Predecessors (2): B6 B7 +// CHECK: Successors (2): B3 B5 +// CHECK: [ B5 ] +// CHECK: 1: B() +// CHECK: 2: [B5.1] (BindTemporary) +// CHECK: 3: [B5.2].operator _Bool +// CHECK: 4: [B5.3]() +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B3 +// CHECK: [ B6 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: [B8.4] || [B9.4] +// CHECK: 2: bool a = A().operator _Bool() || B().operator _Bool(); +// CHECK: T: [B8.4] || ... +// CHECK: Predecessors (2): B9 B8 +// CHECK: Successors (2): B4 B6 +// CHECK: [ B8 ] +// CHECK: 1: A() +// CHECK: 2: [B8.1] (BindTemporary) +// CHECK: 3: [B8.2].operator _Bool +// CHECK: 4: [B8.3]() +// CHECK: T: [B8.4] || ... +// CHECK: Predecessors (1): B10 +// CHECK: Successors (2): B7 B9 +// CHECK: [ B9 ] +// CHECK: 1: B() +// CHECK: 2: [B9.1] (BindTemporary) +// CHECK: 3: [B9.2].operator _Bool +// CHECK: 4: [B9.3]() +// CHECK: Predecessors (1): B8 +// CHECK: Successors (1): B7 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B11 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B10 +// CHECK: [ B1 ] +// CHECK: 1: int b; +// CHECK: 2: [B7.4].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: 0 +// CHECK: 2: foo +// CHECK: 3: [B2.2] +// CHECK: 4: [B2.3]([B2.1]) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: 0 +// CHECK: 2: foo +// CHECK: 3: [B3.2] +// CHECK: 4: [B3.3]([B3.1]) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: 2: B() +// CHECK: 3: [B4.2] (BindTemporary) +// CHECK: 4: [B4.3].operator _Bool +// CHECK: 5: [B4.4]() +// CHECK: 6: ~B() (Temporary object destructor) +// CHECK: T: if [B4.5] +// CHECK: Predecessors (2): B5 B6 +// CHECK: Successors (2): B3 B2 +// CHECK: [ B5 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B6 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: 3: ~A() (Temporary object destructor) +// CHECK: 4: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: [B10.4] ? [B8.5] : [B9.13] +// CHECK: 2: [B7.1] +// CHECK: 3: [B7.2] +// CHECK: 4: A a = B().operator _Bool() ? A() : A(B().operator A()); +// CHECK: T: [B10.4] ? ... : ... +// CHECK: Predecessors (2): B8 B9 +// CHECK: Successors (2): B5 B6 +// CHECK: [ B8 ] +// CHECK: 1: A() +// CHECK: 2: [B8.1] (BindTemporary) +// CHECK: 3: [B8.2] +// CHECK: 4: [B8.3] +// CHECK: 5: [B8.4] (BindTemporary) +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B7 +// CHECK: [ B9 ] +// CHECK: 1: B() +// CHECK: 2: [B9.1] (BindTemporary) +// CHECK: 3: [B9.2].operator A +// CHECK: 4: [B9.3]() +// CHECK: 5: [B9.4] (BindTemporary) +// CHECK: 6: [B9.5] +// CHECK: 7: [B9.6] +// CHECK: 8: [B9.7] +// CHECK: 9: [B9.8] (BindTemporary) +// CHECK: 10: A([B9.9]) +// CHECK: 11: [B9.10] +// CHECK: 12: [B9.11] +// CHECK: 13: [B9.12] (BindTemporary) +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B7 +// CHECK: [ B10 ] +// CHECK: 1: B() +// CHECK: 2: [B10.1] (BindTemporary) +// CHECK: 3: [B10.2].operator _Bool +// CHECK: 4: [B10.3]() +// CHECK: T: [B10.4] ? ... : ... +// CHECK: Predecessors (1): B11 +// CHECK: Successors (2): B8 B9 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B14 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B13 +// CHECK: [ B1 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: 3: [B10.4].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: 3: ~A() (Temporary object destructor) +// CHECK: 4: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: [B7.5] ? [B5.5] : [B6.13] +// CHECK: 2: [B4.1] +// CHECK: 3: [B4.2] +// CHECK: 4: foo +// CHECK: 5: [B4.4] +// CHECK: 6: [B4.5]([B4.3]) +// CHECK: T: [B7.5] ? ... : ... +// CHECK: Predecessors (2): B5 B6 +// CHECK: Successors (2): B2 B3 +// CHECK: [ B5 ] +// CHECK: 1: A() +// CHECK: 2: [B5.1] (BindTemporary) +// CHECK: 3: [B5.2] +// CHECK: 4: [B5.3] +// CHECK: 5: [B5.4] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B6 ] +// CHECK: 1: B() +// CHECK: 2: [B6.1] (BindTemporary) +// CHECK: 3: [B6.2].operator A +// CHECK: 4: [B6.3]() +// CHECK: 5: [B6.4] (BindTemporary) +// CHECK: 6: [B6.5] +// CHECK: 7: [B6.6] +// CHECK: 8: [B6.7] +// CHECK: 9: [B6.8] (BindTemporary) +// CHECK: 10: A([B6.9]) +// CHECK: 11: [B6.10] +// CHECK: 12: [B6.11] +// CHECK: 13: [B6.12] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: ~B() (Temporary object destructor) +// CHECK: 2: B() +// CHECK: 3: [B7.2] (BindTemporary) +// CHECK: 4: [B7.3].operator _Bool +// CHECK: 5: [B7.4]() +// CHECK: T: [B7.5] ? ... : ... +// CHECK: Predecessors (2): B8 B9 +// CHECK: Successors (2): B5 B6 +// CHECK: [ B8 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B7 +// CHECK: [ B9 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: 3: ~B() (Temporary object destructor) +// CHECK: Predecessors (1): B10 +// CHECK: Successors (1): B7 +// CHECK: [ B10 ] +// CHECK: 1: [B13.4] ? [B11.5] : [B12.13] +// CHECK: 2: [B10.1] +// CHECK: 3: [B10.2] +// CHECK: 4: const A &a = B().operator _Bool() ? A() : A(B().operator A()); +// CHECK: T: [B13.4] ? ... : ... +// CHECK: Predecessors (2): B11 B12 +// CHECK: Successors (2): B8 B9 +// CHECK: [ B11 ] +// CHECK: 1: A() +// CHECK: 2: [B11.1] (BindTemporary) +// CHECK: 3: [B11.2] +// CHECK: 4: [B11.3] +// CHECK: 5: [B11.4] (BindTemporary) +// CHECK: Predecessors (1): B13 +// CHECK: Successors (1): B10 +// CHECK: [ B12 ] +// CHECK: 1: B() +// CHECK: 2: [B12.1] (BindTemporary) +// CHECK: 3: [B12.2].operator A +// CHECK: 4: [B12.3]() +// CHECK: 5: [B12.4] (BindTemporary) +// CHECK: 6: [B12.5] +// CHECK: 7: [B12.6] +// CHECK: 8: [B12.7] +// CHECK: 9: [B12.8] (BindTemporary) +// CHECK: 10: A([B12.9]) +// CHECK: 11: [B12.10] +// CHECK: 12: [B12.11] +// CHECK: 13: [B12.12] (BindTemporary) +// CHECK: Predecessors (1): B13 +// CHECK: Successors (1): B10 +// CHECK: [ B13 ] +// CHECK: 1: B() +// CHECK: 2: [B13.1] (BindTemporary) +// CHECK: 3: [B13.2].operator _Bool +// CHECK: 4: [B13.3]() +// CHECK: T: [B13.4] ? ... : ... +// CHECK: Predecessors (1): B14 +// CHECK: Successors (2): B11 B12 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B8 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B7 +// CHECK: [ B1 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: 3: [B4.4].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: [B7.2] ?: [B6.5] +// CHECK: 2: [B4.1] +// CHECK: 3: [B4.2] +// CHECK: 4: A a = A() ?: A(); +// CHECK: T: [B7.5] ? ... : ... +// CHECK: Predecessors (2): B5 B6 +// CHECK: Successors (2): B2 B3 +// CHECK: [ B5 ] +// CHECK: 1: [B7.3] +// CHECK: 2: [B7.3] +// CHECK: 3: [B5.2] +// CHECK: 4: [B5.3] +// CHECK: 5: [B5.4] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B6 ] +// CHECK: 1: A() +// CHECK: 2: [B6.1] (BindTemporary) +// CHECK: 3: [B6.2] +// CHECK: 4: [B6.3] +// CHECK: 5: [B6.4] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: A() +// CHECK: 2: [B7.1] (BindTemporary) +// CHECK: 3: +// CHECK: 4: [B7.3].operator _Bool +// CHECK: 5: [B7.4]() +// CHECK: T: [B7.5] ? ... : ... +// CHECK: Predecessors (1): B8 +// CHECK: Successors (2): B5 B6 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B13 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B12 +// CHECK: [ B1 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: int b; +// CHECK: 3: [B9.4].~A() (Implicit destructor) +// CHECK: Predecessors (2): B2 B3 +// CHECK: Successors (1): B0 +// CHECK: [ B2 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B3 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B4 +// CHECK: Successors (1): B1 +// CHECK: [ B4 ] +// CHECK: 1: [B7.3] ?: [B6.5] +// CHECK: 2: [B4.1] +// CHECK: 3: [B4.2] +// CHECK: 4: foo +// CHECK: 5: [B4.4] +// CHECK: 6: [B4.5]([B4.3]) +// CHECK: T: [B7.6] ? ... : ... +// CHECK: Predecessors (2): B5 B6 +// CHECK: Successors (2): B2 B3 +// CHECK: [ B5 ] +// CHECK: 1: [B7.4] +// CHECK: 2: [B7.4] +// CHECK: 3: [B5.2] +// CHECK: 4: [B5.3] +// CHECK: 5: [B5.4] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B6 ] +// CHECK: 1: A() +// CHECK: 2: [B6.1] (BindTemporary) +// CHECK: 3: [B6.2] +// CHECK: 4: [B6.3] +// CHECK: 5: [B6.4] (BindTemporary) +// CHECK: Predecessors (1): B7 +// CHECK: Successors (1): B4 +// CHECK: [ B7 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: 2: A() +// CHECK: 3: [B7.2] (BindTemporary) +// CHECK: 4: +// CHECK: 5: [B7.4].operator _Bool +// CHECK: 6: [B7.5]() +// CHECK: T: [B7.6] ? ... : ... +// CHECK: Predecessors (2): B9 B8 +// CHECK: Successors (2): B5 B6 +// CHECK: [ B8 ] +// CHECK: 1: ~A() (Temporary object destructor) +// CHECK: Predecessors (1): B9 +// CHECK: Successors (1): B7 +// CHECK: [ B9 ] +// CHECK: 1: [B12.2] ?: [B11.5] +// CHECK: 2: [B9.1] +// CHECK: 3: [B9.2] +// CHECK: 4: const A &a = A() ?: A(); +// CHECK: T: [B12.5] ? ... : ... +// CHECK: Predecessors (2): B10 B11 +// CHECK: Successors (2): B7 B8 +// CHECK: [ B10 ] +// CHECK: 1: [B12.3] +// CHECK: 2: [B12.3] +// CHECK: 3: [B10.2] +// CHECK: 4: [B10.3] +// CHECK: 5: [B10.4] (BindTemporary) +// CHECK: Predecessors (1): B12 +// CHECK: Successors (1): B9 +// CHECK: [ B11 ] +// CHECK: 1: A() +// CHECK: 2: [B11.1] (BindTemporary) +// CHECK: 3: [B11.2] +// CHECK: 4: [B11.3] +// CHECK: 5: [B11.4] (BindTemporary) +// CHECK: Predecessors (1): B12 +// CHECK: Successors (1): B9 +// CHECK: [ B12 ] +// CHECK: 1: A() +// CHECK: 2: [B12.1] (BindTemporary) +// CHECK: 3: +// CHECK: 4: [B12.3].operator _Bool +// CHECK: 5: [B12.4]() +// CHECK: T: [B12.5] ? ... : ... +// CHECK: Predecessors (1): B13 +// CHECK: Successors (2): B10 B11 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A() +// CHECK: 2: [B1.1] (BindTemporary) +// CHECK: 3: [B1.2] +// CHECK: 4: [B1.3] +// CHECK: 5: A a = A(); +// CHECK: 6: ~A() (Temporary object destructor) +// CHECK: 7: int b; +// CHECK: 8: [B1.5].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A() +// CHECK: 2: [B1.1] (BindTemporary) +// CHECK: 3: [B1.2] +// CHECK: 4: [B1.3] +// CHECK: 5: const A &a = A(); +// CHECK: 6: A() +// CHECK: 7: [B1.6] (BindTemporary) +// CHECK: 8: [B1.7] +// CHECK: 9: [B1.8] +// CHECK: 10: foo +// CHECK: 11: [B1.10] +// CHECK: 12: [B1.11]([B1.9]) +// CHECK: 13: ~A() (Temporary object destructor) +// CHECK: 14: int b; +// CHECK: 15: [B1.5].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A::make +// CHECK: 2: [B1.1] +// CHECK: 3: [B1.2]() +// CHECK: 4: [B1.3] (BindTemporary) +// CHECK: 5: [B1.4] +// CHECK: 6: [B1.5] +// CHECK: 7: A a = A::make(); +// CHECK: 8: ~A() (Temporary object destructor) +// CHECK: 9: int b; +// CHECK: 10: [B1.7].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A::make +// CHECK: 2: [B1.1] +// CHECK: 3: [B1.2]() +// CHECK: 4: [B1.3] (BindTemporary) +// CHECK: 5: [B1.4] +// CHECK: 6: [B1.5] +// CHECK: 7: const A &a = A::make(); +// CHECK: 8: A::make +// CHECK: 9: [B1.8] +// CHECK: 10: [B1.9]() +// CHECK: 11: [B1.10] (BindTemporary) +// CHECK: 12: [B1.11] +// CHECK: 13: [B1.12] +// CHECK: 14: foo +// CHECK: 15: [B1.14] +// CHECK: 16: [B1.15]([B1.13]) +// CHECK: 17: ~A() (Temporary object destructor) +// CHECK: 18: int b; +// CHECK: 19: [B1.7].~A() (Implicit destructor) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: int a; +// CHECK: 2: A() +// CHECK: 3: [B1.2] (BindTemporary) +// CHECK: 4: [B1.3].operator int +// CHECK: 5: [B1.4]() +// CHECK: 6: a +// CHECK: 7: [B1.6] = [B1.5] +// CHECK: 8: ~A() (Temporary object destructor) +// CHECK: 9: int b; +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): +// CHECK: [ B2 (ENTRY) ] +// CHECK: Predecessors (0): +// CHECK: Successors (1): B1 +// CHECK: [ B1 ] +// CHECK: 1: A() +// CHECK: 2: [B1.1] (BindTemporary) +// CHECK: 3: [B1.2].operator int +// CHECK: 4: [B1.3]() +// CHECK: 5: [B1.4] +// CHECK: 6: int([B1.5]) +// CHECK: 7: B() +// CHECK: 8: [B1.7] (BindTemporary) +// CHECK: 9: [B1.8].operator int +// CHECK: 10: [B1.9]() +// CHECK: 11: [B1.10] +// CHECK: 12: int([B1.11]) +// CHECK: 13: [B1.6] + [B1.12] +// CHECK: 14: a([B1.13]) (Member initializer) +// CHECK: 15: ~B() (Temporary object destructor) +// CHECK: 16: ~A() (Temporary object destructor) +// CHECK: 17: /*implicit*/int() +// CHECK: 18: b([B1.17]) (Member initializer) +// CHECK: Predecessors (1): B2 +// CHECK: Successors (1): B0 +// CHECK: [ B0 (EXIT) ] +// CHECK: Predecessors (1): B1 +// CHECK: Successors (0): + diff --git a/test/Analysis/undef-buffers.c b/test/Analysis/undef-buffers.c index df124b10d10e..cfdd7f4e1a83 100644 --- a/test/Analysis/undef-buffers.c +++ b/test/Analysis/undef-buffers.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.experimental,core.uninitialized -analyzer-store=region -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.unix,core.uninitialized -analyzer-store=region -verify %s typedef __typeof(sizeof(int)) size_t; void *malloc(size_t); void free(void *); @@ -15,6 +15,17 @@ char stackBased2 () { return buf[0]; // expected-warning{{Undefined}} } +// Exercise the conditional visitor. Radar://10105448 +char stackBased3 (int *x) { + char buf[2]; + int *y; + buf[0] = 'a'; + if (!(y = x)) { + return buf[1]; // expected-warning{{Undefined}} + } + return buf[0]; +} + char heapBased1 () { char *buf = malloc(2); buf[0] = 'a'; diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m index 743d36ff56de..19fdf611c865 100644 --- a/test/Analysis/uninit-msg-expr.m +++ b/test/Analysis/uninit-msg-expr.m @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m index f4df91396a84..c18116f21ae5 100644 --- a/test/Analysis/uninit-ps-rdar6145427.m +++ b/test/Analysis/uninit-ps-rdar6145427.m @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=basic %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=region %s // Delta-Debugging reduced preamble. diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c index 915961aa11da..f3011570a85a 100644 --- a/test/Analysis/uninit-vals-ps.c +++ b/test/Analysis/uninit-vals-ps.c @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s struct FPRec { diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m index 4b7e6f42cf8f..4ba26f59b720 100644 --- a/test/Analysis/uninit-vals.m +++ b/test/Analysis/uninit-vals.m @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s typedef unsigned int NSUInteger; diff --git a/test/Analysis/unix-fns.c b/test/Analysis/unix-fns.c index 5df6b37bb91a..cf5ca810de33 100644 --- a/test/Analysis/unix-fns.c +++ b/test/Analysis/unix-fns.c @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=unix.API,osx.API %s -analyzer-store=region -fblocks -verify -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=unix.API,osx.API %s -analyzer-store=basic -fblocks -verify struct _opaque_pthread_once_t { long __sig; diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c index 7df52402e735..da14f4c010d6 100644 --- a/test/Analysis/unreachable-code-path.c +++ b/test/Analysis/unreachable-code-path.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.experimental.UnreachableCode -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.DeadStores,experimental.deadcode.UnreachableCode -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s extern void foo(int a); diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m index 931c84a3745a..42bde1004dcc 100644 --- a/test/Analysis/unused-ivars.m +++ b/test/Analysis/unused-ivars.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -analyze -analyzer-checker=osx.cocoa.UnusedIvars %s -verify +// RUN: %clang_cc1 -fblocks -analyze -analyzer-checker=osx.cocoa.UnusedIvars %s -verify //===--- BEGIN: Delta-debugging reduced headers. --------------------------===// @@ -97,7 +97,7 @@ int radar_7254495(RDar7254495 *a) { @end //===----------------------------------------------------------------------===// // <rdar://problem/8481311> Unused bitfield ivars trigger cause weird -// diagnostic: "Instance variable '' in class…" +// diagnostic: "Instance variable '' in class..." //===----------------------------------------------------------------------===// @interface RDar8481311 { diff --git a/test/Analysis/variadic-method-types.m b/test/Analysis/variadic-method-types.m index 03c309a5004a..caa0c59debba 100644 --- a/test/Analysis/variadic-method-types.m +++ b/test/Analysis/variadic-method-types.m @@ -1,4 +1,3 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.VariadicMethodTypes -analyzer-store=basic -fblocks -verify %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.VariadicMethodTypes -analyzer-store=region -fblocks -verify %s //===----------------------------------------------------------------------===// diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f00e5075a52..b7356c2de01a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,6 +2,7 @@ set(CLANG_TEST_DIRECTORIES "Analysis" "CodeCompletion" "CodeGen" + "CodeGenCUDA" "CodeGenCXX" "CodeGenObjC" "CodeGenOpenCL" @@ -88,7 +89,7 @@ if(PYTHONINTERP_FOUND) set_target_properties(clang-test PROPERTIES FOLDER "Clang tests") if( NOT CLANG_BUILT_STANDALONE ) - add_custom_target(check-all + add_custom_target(check-all COMMAND ${PYTHON_EXECUTABLE} ${LIT} --param build_config=${CMAKE_CFG_INTDIR} @@ -99,18 +100,19 @@ if(PYTHONINTERP_FOUND) COMMENT "Running Clang and LLVM regression tests") add_dependencies(check-all clang-test.deps) if ( LLVM_INCLUDE_TESTS ) - add_dependencies(clang-test.deps check.deps ClangUnitTests) + add_dependencies(clang-test.deps ClangUnitTests) + add_dependencies(check-all check.deps) endif ( LLVM_INCLUDE_TESTS ) add_dependencies(clang-test.deps - llvm-dis llc opt + llvm-dis llc opt FileCheck count not ) - set_target_properties(check-all PROPERTIES FOLDER "Clang tests") - endif() + set_target_properties(check-all PROPERTIES FOLDER "Clang tests") + endif() add_dependencies(clang-test clang-test.deps) add_dependencies(clang-test.deps - clang clang-headers c-index-test arcmt-test c-arcmt-test + clang clang-headers c-index-test diagtool arcmt-test c-arcmt-test ) endif() diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp index 3fde0daa96cf..c35af1def208 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp @@ -44,3 +44,21 @@ void resolves_to_different() { v.set<double>(3.2); } } + +namespace rdar9915664 { + struct A { + template<typename T> void a(); + }; + + struct B : A { }; + + struct C : A { }; + + struct D : B, C { + A &getA() { return static_cast<B&>(*this); } + + void test_a() { + getA().a<int>(); + } + }; +} diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp index 4a0b38737976..cd7e669527bc 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // C++0x [basic.lookup.classref]p3: -// If the unqualified-id is ∼type-name, the type-name is looked up in the +// If the unqualified-id is ~type-name, the type-name is looked up in the // context of the entire postfix-expression. If the type T of the object // expression is of a class type C, the type-name is also looked up in the // scope of class C. At least one of the lookups shall find a name that diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp index 355ac4a2ecad..c745c8451bc8 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // XFAIL: * // Our C++0x doesn't currently have specialized destructor name handling, // since the specification is still in flux. diff --git a/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp index d930f97ce791..cd51c78a5e9c 100644 --- a/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s void f() { int b; diff --git a/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp index 751c0df6b867..407a5f744e37 100644 --- a/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Classes. namespace Class { diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp new file mode 100644 index 000000000000..3b438d15f28b --- /dev/null +++ b/test/CXX/basic/basic.types/p10.cpp @@ -0,0 +1,127 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct NonLiteral { NonLiteral(); }; + +// A type is a literal type if it is: + +// - a scalar type +constexpr int f1(double); + +// - a reference type +struct S { S(); }; +constexpr int f2(S &); + +// - a class type that has all of the following properties: + +// - it has a trivial destructor +struct UserProvDtor { + constexpr UserProvDtor(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}} + ~UserProvDtor(); // expected-note {{has a user-provided destructor}} +}; +struct NonTrivDtor { + constexpr NonTrivDtor(); // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr members}} + virtual ~NonTrivDtor() = default; // expected-note {{has a non-trivial destructor}} +}; +struct NonTrivDtorBase { + ~NonTrivDtorBase(); +}; +template<typename T> +struct DerivedFromNonTrivDtor : T { // expected-note {{'DerivedFromNonTrivDtor<NonTrivDtorBase>' is not literal because it has base class 'NonTrivDtorBase' of non-literal type}} + constexpr DerivedFromNonTrivDtor(); +}; +constexpr int f(DerivedFromNonTrivDtor<NonTrivDtorBase>); // expected-error {{constexpr function's 1st parameter type 'DerivedFromNonTrivDtor<NonTrivDtorBase>' is not a literal type}} +struct TrivDtor { + constexpr TrivDtor(); +}; +// FIXME: when building DefinitionData we look at 'isUserProvided' before it's set up! +#if 0 +struct TrivDefaultedDtor { + constexpr TrivDefaultedDtor(); + ~TrivDefaultedDtor() = default; +}; +#endif + +// - it is an aggregate type or has at least one constexpr constructor or +// constexpr constructor template that is not a copy or move constructor +struct Agg { + int a; + char *b; +}; +constexpr int f3(Agg a) { return a.a; } +struct CtorTemplate { + template<typename T> constexpr CtorTemplate(T); +}; +struct CopyCtorOnly { // expected-note {{'CopyCtorOnly' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}} + constexpr CopyCtorOnly(CopyCtorOnly&); // expected-error {{non-literal type 'CopyCtorOnly' cannot have constexpr members}} +}; +struct MoveCtorOnly { // expected-note {{no constexpr constructors other than copy or move constructors}} + constexpr MoveCtorOnly(MoveCtorOnly&&); // expected-error {{non-literal type 'MoveCtorOnly' cannot have constexpr members}} +}; +template<typename T> +struct CtorArg { // expected-note {{no constexpr constructors other than copy or move constructors}} + constexpr CtorArg(T); // expected-note {{constructor template instantiation is not constexpr because 1st parameter type 'NonLiteral' is not a literal type}} +}; +constexpr int f(CtorArg<int>); +constexpr int f(CtorArg<NonLiteral>); // expected-error {{not a literal type}} +// We have a special-case diagnostic for classes with virtual base classes. +struct VBase {}; +struct HasVBase : virtual VBase {}; // expected-note 2{{virtual base class declared here}} +struct Derived : HasVBase { + constexpr Derived(); // expected-error {{constexpr constructor not allowed in struct with virtual base class}} +}; +template<typename T> struct DerivedFromVBase : T { // expected-note {{struct with virtual base class is not a literal type}} + constexpr DerivedFromVBase(); +}; +constexpr int f(DerivedFromVBase<HasVBase>); // expected-error {{constexpr function's 1st parameter type 'DerivedFromVBase<HasVBase>' is not a literal type}} + +// - it has all non-static data members and base classes of literal types +struct NonLitMember { + S s; // expected-note {{has data member 's' of non-literal type 'S'}} +}; +constexpr int f(NonLitMember); // expected-error {{1st parameter type 'NonLitMember' is not a literal type}} +struct NonLitBase : + S { // expected-note {{base class 'S' of non-literal type}} + constexpr NonLitBase(); // expected-error {{non-literal type 'NonLitBase' cannot have constexpr members}} +}; +struct LitMemBase : Agg { + Agg agg; +}; +template<typename T> +struct MemberType { + T t; // expected-note {{'MemberType<NonLiteral>' is not literal because it has data member 't' of non-literal type 'NonLiteral'}} + constexpr MemberType(); +}; +constexpr int f(MemberType<int>); +constexpr int f(MemberType<NonLiteral>); // expected-error {{not a literal type}} + +// - an array of literal type +struct ArrGood { + Agg agg[24]; + double d[12]; + TrivDtor td[3]; +}; +constexpr int f(ArrGood); + +struct ArrBad { + S s[3]; // expected-note {{data member 's' of non-literal type 'S [3]'}} +}; +constexpr int f(ArrBad); // expected-error {{1st parameter type 'ArrBad' is not a literal type}} + + +// As a non-conforming tweak to the standard, we do not allow a literal type to +// have any mutable data members. +namespace MutableMembers { + struct MM { + mutable int n; // expected-note {{'MM' is not literal because it has a mutable data member}} + }; + constexpr int f(MM); // expected-error {{not a literal type}} + + // Here's one reason why allowing this would be a disaster... + template<int n> struct Id { int k = n; }; + int f() { + // FIXME: correctly check whether the initializer is a constant expression. + constexpr MM m = { 0 }; // desired-error {{must be a constant expression}} + ++m.n; + return Id<m.n>().k; // expected-error {{not an integral constant expression}} + } +} diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp index 1668155c1819..68ff83fee83c 100644 --- a/test/CXX/class.access/class.friend/p1.cpp +++ b/test/CXX/class.access/class.friend/p1.cpp @@ -341,3 +341,16 @@ namespace test12 { void *var = static_cast<B*>(this)->mem; } } + +namespace PR9103 { + struct base { + protected: + static void foo(void) {} + }; + + struct cls: base { + friend void bar(void) { + base::foo(); + } + }; +} diff --git a/test/CXX/class.access/class.friend/p2-cxx03.cpp b/test/CXX/class.access/class.friend/p2-cxx03.cpp index 82cddc2bad50..f8cabfd78a8f 100644 --- a/test/CXX/class.access/class.friend/p2-cxx03.cpp +++ b/test/CXX/class.access/class.friend/p2-cxx03.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s template<typename T> class X0 { - friend T; // expected-warning{{non-class friend type 'T' is a C++0x extension}} + friend T; // expected-warning{{non-class friend type 'T' is a C++11 extension}} }; class X1 { }; diff --git a/test/CXX/class.access/class.friend/p3-cxx0x.cpp b/test/CXX/class.access/class.friend/p3-cxx0x.cpp index 4f55e5339ab2..00fc0a33bef2 100644 --- a/test/CXX/class.access/class.friend/p3-cxx0x.cpp +++ b/test/CXX/class.access/class.friend/p3-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s template<typename T> class X0 { friend T; diff --git a/test/CXX/class.access/class.friend/p6.cpp b/test/CXX/class.access/class.friend/p6.cpp new file mode 100644 index 000000000000..7f7d90990328 --- /dev/null +++ b/test/CXX/class.access/class.friend/p6.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f1(); + +struct X { + void f2(); +}; + +struct Y { + friend void ::f1() { } // expected-error{{friend function definition cannot be qualified with '::'}} + friend void X::f2() { } // expected-error{{friend function definition cannot be qualified with 'X::'}} +}; + +void local() { + void f(); + + struct Local { + friend void f() { } // expected-error{{friend function cannot be defined in a local class}} + }; +} diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp index 8698fb1da8a5..79bb6cd67eab 100644 --- a/test/CXX/class.access/class.protected/p1.cpp +++ b/test/CXX/class.access/class.protected/p1.cpp @@ -423,7 +423,7 @@ namespace test12 { // This friendship is not considered because a public member of A is // inaccessible in C. namespace test13 { - class A { protected: int foo(); }; // expected-note {{declared protected here}} + class A { protected: int foo(); }; // expected-note {{object type 'test13::D' must derive from context type 'test13::C'}} class B : private virtual A {}; class C : private B { friend void test(); }; class D : public virtual A {}; diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp index fe3304a22253..932b4f42f2a3 100644 --- a/test/CXX/class.access/p6.cpp +++ b/test/CXX/class.access/p6.cpp @@ -168,3 +168,25 @@ namespace test7 { void foo(int arg[__builtin_offsetof(B, ins)]); } } + +// rdar://problem/10155256 +namespace test8 { + class A { + typedef void* (A::*UnspecifiedBoolType)() const; + operator UnspecifiedBoolType() const; // expected-note {{implicitly declared private here}} + }; + + void test(A &a) { + if (a) return; // expected-error {{'operator void *(class test8::A::*)(void) const' is a private member of 'test8::A'}} + } +} + +namespace test9 { + class A { + operator char*() const; // expected-note {{implicitly declared private here}} + }; + + void test(A &a) { + delete a; // expected-error {{'operator char *' is a private member of 'test9::A'}} + } +} diff --git a/test/CXX/class.derived/class.virtual/p3-0x.cpp b/test/CXX/class.derived/class.virtual/p3-0x.cpp index 4bd9efda1f6c..c4a401bb27c5 100644 --- a/test/CXX/class.derived/class.virtual/p3-0x.cpp +++ b/test/CXX/class.derived/class.virtual/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s namespace Test1 { diff --git a/test/CXX/class/class.bit/p2.cpp b/test/CXX/class/class.bit/p2.cpp new file mode 100644 index 000000000000..7962330d1612 --- /dev/null +++ b/test/CXX/class/class.bit/p2.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct A { +private: + int : 0; +}; + +A a = { }; +A a2 = { 1 }; // expected-error{{excess elements in struct initializer}} + +struct B { + const int : 0; +}; + +B b; + +void testB() { + B b2(b); + B b3(static_cast<B&&>(b2)); + b = b; + b = static_cast<B&&>(b); +} diff --git a/test/CXX/class/class.friend/p2.cpp b/test/CXX/class/class.friend/p2.cpp index 87b69c095fbd..fb3cd19b2b18 100644 --- a/test/CXX/class/class.friend/p2.cpp +++ b/test/CXX/class/class.friend/p2.cpp @@ -4,7 +4,7 @@ struct B0; class A { friend class B {}; // expected-error {{cannot define a type in a friend declaration}} - friend int; // expected-warning {{non-class friend type 'int' is a C++0x extension}} + friend int; // expected-warning {{non-class friend type 'int' is a C++11 extension}} friend B0; // expected-warning {{specify 'struct' to befriend 'B0'}} friend class C; // okay }; diff --git a/test/CXX/class/class.friend/p6.cpp b/test/CXX/class/class.friend/p6.cpp index bd4630e2aa9d..82a90ff82f20 100644 --- a/test/CXX/class/class.friend/p6.cpp +++ b/test/CXX/class/class.friend/p6.cpp @@ -3,7 +3,7 @@ class A { friend static class B; // expected-error {{'static' is invalid in friend declarations}} friend extern class C; // expected-error {{'extern' is invalid in friend declarations}} - friend auto class D; // expected-error {{'auto' is invalid in friend declarations}} + friend auto class D; // expected-warning {{incompatible with C++11}} expected-error {{'auto' is invalid in friend declarations}} friend register class E; // expected-error {{'register' is invalid in friend declarations}} friend mutable class F; // expected-error {{'mutable' is invalid in friend declarations}} friend typedef class G; // expected-error {{'typedef' is invalid in friend declarations}} diff --git a/test/CXX/class/class.mem/p5-0x.cpp b/test/CXX/class/class.mem/p5-0x.cpp index 78560e2d5daa..6061c4c20a67 100644 --- a/test/CXX/class/class.mem/p5-0x.cpp +++ b/test/CXX/class/class.mem/p5-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s int f(); diff --git a/test/CXX/class/class.mem/p8-0x.cpp b/test/CXX/class/class.mem/p8-0x.cpp index 836ebad48ee1..d2c3dc36075b 100644 --- a/test/CXX/class/class.mem/p8-0x.cpp +++ b/test/CXX/class/class.mem/p8-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s struct Base1 { virtual void g(); diff --git a/test/CXX/class/class.nest/p1-cxx0x.cpp b/test/CXX/class/class.nest/p1-cxx0x.cpp index f8b06ac5f7e3..0f12579ee4f8 100644 --- a/test/CXX/class/class.nest/p1-cxx0x.cpp +++ b/test/CXX/class/class.nest/p1-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s class Outer { int x; diff --git a/test/CXX/class/class.static/class.static.data/p3.cpp b/test/CXX/class/class.static/class.static.data/p3.cpp new file mode 100644 index 000000000000..007e416e6a49 --- /dev/null +++ b/test/CXX/class/class.static/class.static.data/p3.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct NonLit { + NonLit(); +}; + +struct S { + static constexpr int a = 0; + static constexpr int b; // expected-error {{declaration of constexpr variable 'b' requires an initializer}} + + static constexpr int c = 0; + static const int d; + static const int d2 = 0; + + static constexpr double e = 0.0; // ok + static const double f = 0.0; // expected-warning {{extension}} expected-note {{use 'constexpr' specifier}} + static char *const g = 0; // expected-error {{requires 'constexpr' specifier}} + static const NonLit h = NonLit(); // expected-error {{must be initialized out of line}} +}; + +constexpr int S::a; +constexpr int S::b = 0; + +const int S::c; +constexpr int S::d = 0; +constexpr int S::d2; diff --git a/test/CXX/class/p1-0x.cpp b/test/CXX/class/p1-0x.cpp index e677dec4caf1..be5fdffb43f4 100644 --- a/test/CXX/class/p1-0x.cpp +++ b/test/CXX/class/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 namespace Test1 { class A final { }; diff --git a/test/CXX/class/p2-0x.cpp b/test/CXX/class/p2-0x.cpp index 630aa7e70f90..dbb01e5ad528 100644 --- a/test/CXX/class/p2-0x.cpp +++ b/test/CXX/class/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 namespace Test1 { class A final { }; // expected-note {{'A' declared here}} diff --git a/test/CXX/class/p6-0x.cpp b/test/CXX/class/p6-0x.cpp index fc83e065fa6f..3384af09c788 100644 --- a/test/CXX/class/p6-0x.cpp +++ b/test/CXX/class/p6-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 class Trivial { int n; void f(); }; class NonTrivial1 { NonTrivial1(const NonTrivial1 &); }; diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp index e3d3d683ceb7..98d12f99a598 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace NIL {} // expected-note {{previous definition}} inline namespace NIL {} // expected-error {{cannot be reopened as inline}} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp index 7c4a21c35a7d..3bc485601ca5 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Fun things you can do with inline namespaces: diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp index 3f3bf4a2eccb..f61437ead6e4 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // C++0x N2914. struct B { diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp index cd71d55fc5ce..ed98c1e9c56d 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -// XFAIL: * +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct notlit { notlit() {} @@ -12,35 +11,82 @@ struct notlit2 { constexpr int i1 = 0; constexpr int f1() { return 0; } struct s1 { - constexpr static int mi = 0; + constexpr static int mi1 = 0; + const static int mi2; }; +constexpr int s1::mi2 = 0; // invalid declarations // not a definition of an object -constexpr extern int i2; // x +constexpr extern int i2; // expected-error {{constexpr variable declaration must be a definition}} // not a literal type -constexpr notlit nl1; // x +constexpr notlit nl1; // expected-error {{declaration of constexpr variable 'nl1' requires an initializer}} // function parameters -void f2(constexpr int i) {} // x +void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}} // non-static member struct s2 { - constexpr int mi; // x + constexpr int mi1; // expected-error {{non-static data member cannot be constexpr}} + static constexpr int mi2; // expected-error {{requires an initializer}} }; +// typedef +typedef constexpr int CI; // expected-error {{typedef cannot be constexpr}} +// tag +constexpr class C1 {}; // expected-error {{class cannot be marked constexpr}} +constexpr struct S1 {}; // expected-error {{struct cannot be marked constexpr}} +constexpr union U1 {}; // expected-error {{union cannot be marked constexpr}} +constexpr enum E1 {}; // expected-error {{enum cannot be marked constexpr}} +class C2 {} constexpr; // expected-error {{class cannot be marked constexpr}} +struct S2 {} constexpr; // expected-error {{struct cannot be marked constexpr}} +union U2 {} constexpr; // expected-error {{union cannot be marked constexpr}} +enum E2 {} constexpr; // expected-error {{enum cannot be marked constexpr}} +constexpr class C3 {} c3 = C3(); +constexpr struct S3 {} s3 = S3(); +constexpr union U3 {} u3 = {}; +constexpr enum E3 { V3 } e3 = V3; +class C4 {} constexpr c4 = C4(); +struct S4 {} constexpr s4 = S4(); +union U4 {} constexpr u4 = {}; +enum E4 { V4 } constexpr e4 = V4; +constexpr int; // expected-error {{constexpr can only be used in variable and function declarations}} // redeclaration mismatch -constexpr int f3(); // n -int f3(); // x -int f4(); // n -constexpr int f4(); // x +constexpr int f3(); // expected-note {{previous declaration is here}} +int f3(); // expected-error {{non-constexpr declaration of 'f3' follows constexpr declaration}} +int f4(); // expected-note {{previous declaration is here}} +constexpr int f4(); // expected-error {{constexpr declaration of 'f4' follows non-constexpr declaration}} +template<typename T> constexpr T f5(T); +template<typename T> constexpr T f5(T); // expected-note {{previous}} +template<typename T> T f5(T); // expected-error {{non-constexpr declaration of 'f5' follows constexpr declaration}} +template<typename T> T f6(T); // expected-note {{here}} +template<typename T> constexpr T f6(T); // expected-error {{constexpr declaration of 'f6' follows non-constexpr declaration}} +// destructor +struct ConstexprDtor { + constexpr ~ConstexprDtor() = default; // expected-error {{destructor cannot be marked constexpr}} +}; // template stuff -template <typename T> -constexpr T ft(T t) { return t; } +template <typename T> constexpr T ft(T t) { return t; } +template <typename T> T gt(T t) { return t; } +struct S { + template<typename T> constexpr T f(); + template<typename T> T g() const; +}; -// specialization can differ in constepxr -template <> -notlit ft(notlit nl) { return nl; } +// explicit specialization can differ in constepxr +// FIXME: When checking the explicit specialization, we implicitly instantiate +// the primary template then claim a constexpr mismatch. +template <> notlit ft(notlit nl) { return nl; } +template <> char ft(char c) { return c; } // desired-note {{previous}} unexpected-error {{follows constexpr declaration}} unexpected-note {{here}} +template <> constexpr char ft(char nl); // desired-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}} +template <> constexpr int gt(int nl) { return nl; } // unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}} +template <> notlit S::f() const { return notlit(); } +template <> constexpr int S::g() { return 0; } // desired-note {{previous}} unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}} +template <> int S::g() const; // desired-error {{non-constexpr declaration of 'g<int>' follows constexpr declaration}} +// specializations can drop the 'constexpr' but not the implied 'const'. +template <> char S::g() { return 0; } // expected-error {{no function template matches}} +template <> double S::g() const { return 0; } // ok -constexpr int i3 = ft(1); +// FIXME: The initializer is a constant expression. +constexpr int i3 = ft(1); // unexpected-error {{must be initialized by a constant expression}} void test() { // ignore constexpr when instantiating with non-literal @@ -52,7 +98,7 @@ void test() { constexpr int square(int x); constexpr int bufsz = 1024; -constexpr struct pixel { // x +constexpr struct pixel { // expected-error {{struct cannot be marked constexpr}} int x; int y; constexpr pixel(int); @@ -62,17 +108,17 @@ constexpr pixel::pixel(int a) : x(square(a)), y(square(a)) { } -constexpr pixel small(2); // x (no definition of square(int) yet, so can't - // constexpr-eval pixel(int)) +constexpr pixel small(2); // expected-error {{must be initialized by a constant expression}} constexpr int square(int x) { return x * x; } -constexpr pixel large(4); // now valid +// FIXME: The initializer is a constant expression. +constexpr pixel large(4); // unexpected-error {{must be initialized by a constant expression}} -int next(constexpr int x) { // x +int next(constexpr int x) { // expected-error {{function parameter cannot be constexpr}} return x + 1; } -extern constexpr int memsz; // x +extern constexpr int memsz; // expected-error {{constexpr variable declaration must be a definition}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp new file mode 100644 index 000000000000..001a086a008b --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - | FileCheck %s + +// constexpr functions and constexpr constructors are implicitly inline. +struct S { + constexpr S(int n); + constexpr int g(); + int n; +}; + +constexpr S::S(int n) : n(n) {} + +constexpr S f(S s) { + return s.n * 2; +} + +constexpr int S::g() { + return f(*this).n; +} + +// CHECK: define linkonce_odr {{.*}} @_Z1f1S( +// CHECK: define linkonce_odr {{.*}} @_ZN1SC1Ei( +// CHECK: define linkonce_odr {{.*}} @_ZNK1S1gEv( + +int g() { + return f(42).g(); +} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp new file mode 100644 index 000000000000..03406dbf918a --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp @@ -0,0 +1,125 @@ +// RUN: %clang_cc1 -verify -std=c++11 %s + +namespace N { + typedef char C; +} + +namespace M { + typedef double D; +} + +struct NonLiteral { // expected-note 4{{no constexpr constructors}} + NonLiteral() {} + NonLiteral(int) {} +}; +struct Literal { + constexpr Literal() {} + operator int() const { return 0; } +}; + +struct S { + virtual int ImplicitlyVirtual() const = 0; // expected-note {{overridden virtual function}} +}; +struct SS : S { + int ImplicitlyVirtual() const; +}; + +// Note, the wording applies constraints to the definition of constexpr +// functions, but we intentionally apply all that we can to the declaration +// instead. See DR1360. + +// The definition of a constexpr function shall satisfy the following +// constraints: +struct T : SS { // expected-note {{base class 'SS' of non-literal type}} + constexpr T(); // expected-error {{non-literal type 'T' cannot have constexpr members}} + + // - it shall not be virtual; + virtual constexpr int ExplicitlyVirtual(); // expected-error {{virtual function cannot be constexpr}} + + constexpr int ImplicitlyVirtual(); // expected-error {{virtual function cannot be constexpr}} + + // - its return type shall be a literal type; + constexpr NonLiteral NonLiteralReturn(); // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}} + constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}} + typedef NonLiteral F(); + constexpr F NonLiteralReturn2; // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}} + + // - each of its parameter types shall be a literal type; + constexpr int NonLiteralParam(NonLiteral); // expected-error {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}} + typedef int G(NonLiteral); + constexpr G NonLiteralParam2; // expected-error {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}} + + // - its function-body shall be = delete, = default, + constexpr int Deleted() = delete; + // It's not possible for the function-body to legally be "= default" here. + // Other than constructors, only the copy- and move-assignment operators and + // destructor can be defaulted. Destructors can't be constexpr since they + // don't have a literal return type. Defaulted assignment operators can't be + // constexpr since they can't be const. + constexpr T &operator=(const T&) = default; // expected-error {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}} +}; +struct U { + constexpr U SelfReturn(); + constexpr int SelfParam(U); +}; + +// or a compound-statememt that contains only +constexpr int AllowedStmts() { + // - null statements + ; + + // - static_assert-declarations + static_assert(true, "the impossible happened!"); + + // - typedef declarations and alias-declarations that do not define classes + // or enumerations + typedef int I; + typedef struct S T; + using J = int; + using K = int[sizeof(I) + sizeof(J)]; + // Note, the standard requires we reject this. + struct U; + + // - using-declarations + using N::C; + + // - using-directives + using namespace N; + + // - and exactly one return statement + return sizeof(K) + sizeof(C) + sizeof(K); +} +constexpr int ForStmt() { + for (int n = 0; n < 10; ++n) // expected-error {{statement not allowed in constexpr function}} + return 0; +} +constexpr int VarDecl() { + constexpr int a = 0; // expected-error {{variables cannot be declared in a constexpr function}} + return 0; +} +constexpr int FuncDecl() { + constexpr int ForwardDecl(int); // expected-error {{statement not allowed in constexpr function}} + return ForwardDecl(42); +} +constexpr int ClassDecl1() { + typedef struct { } S1; // expected-error {{types cannot be defined in a constexpr function}} + return 0; +} +constexpr int ClassDecl2() { + using S2 = struct { }; // expected-error {{types cannot be defined in a constexpr function}} + return 0; +} +constexpr int ClassDecl3() { + struct S3 { }; // expected-error {{types cannot be defined in a constexpr function}} + return 0; +} +constexpr int NoReturn() {} // expected-error {{no return statement in constexpr function}} +constexpr int MultiReturn() { + return 0; // expected-note {{return statement}} + return 0; // expected-error {{multiple return statements in constexpr function}} +} + +// - every constructor call and implicit conversion used in initializing the +// return value shall be one of those allowed in a constant expression. +// +// We implement the proposed resolution of DR1364 and ignore this bullet. diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp new file mode 100644 index 000000000000..9218bcf45bb4 --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp @@ -0,0 +1,226 @@ +// RUN: %clang_cc1 -verify -std=c++11 -fcxx-exceptions %s + +namespace N { + typedef char C; +} + +namespace M { + typedef double D; +} + +struct NonLiteral { // expected-note 2{{no constexpr constructors}} + NonLiteral() {} + NonLiteral(int) {} +}; +struct Literal { + constexpr Literal() {} + operator int() const { return 0; } +}; + +// Note, the wording applies constraints to the definition of constexpr +// constructors, but we intentionally apply all that we can to the declaration +// instead. See DR1360. + +// In the definition of a constexpr constructor, each of the parameter types +// shall be a literal type. +struct S { + constexpr S(int, N::C); + constexpr S(int, NonLiteral, N::C); // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}} + constexpr S(int, NonLiteral = 42); // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}} + + // In addition, either its function-body shall be = delete or = default + constexpr S() = default; + constexpr S(Literal) = delete; +}; + +// or it shall satisfy the following constraints: + +// - the class shall not have any virtual base classes; +struct T : virtual S { // expected-note {{here}} + constexpr T(); // expected-error {{constexpr constructor not allowed in struct with virtual base classes}} +}; +namespace IndirectVBase { + struct A {}; + struct B : virtual A {}; // expected-note {{here}} + class C : public B { + public: + constexpr C(); // expected-error {{constexpr constructor not allowed in class with virtual base classes}} + }; +} + +// - its function-body shall not be a function-try-block; +struct U { + constexpr U() + try // expected-error {{function try block not allowed in constexpr constructor}} + : u() { + } catch (...) { + throw; + } + int u; +}; + +// - the compound-statememt of its function-body shall contain only +struct V { + constexpr V() { + // - null statements, + ; + + // - static_assert-declarations, + static_assert(true, "the impossible happened!"); + + // - typedef declarations and alias-declarations that do not define classes + // or enumerations, + typedef int I; + typedef struct S T; + using J = int; + using K = int[sizeof(I) + sizeof(J)]; + // Note, the standard requires we reject this. + struct U; + + // - using-declarations, + using N::C; + + // - and using-directives; + using namespace N; + } + + constexpr V(int(&)[1]) { + for (int n = 0; n < 10; ++n) // expected-error {{statement not allowed in constexpr constructor}} + /**/; + } + constexpr V(int(&)[2]) { + constexpr int a = 0; // expected-error {{variables cannot be declared in a constexpr constructor}} + } + constexpr V(int(&)[3]) { + constexpr int ForwardDecl(int); // expected-error {{statement not allowed in constexpr constructor}} + } + constexpr V(int(&)[4]) { + typedef struct { } S1; // expected-error {{types cannot be defined in a constexpr constructor}} + } + constexpr V(int(&)[5]) { + using S2 = struct { }; // expected-error {{types cannot be defined in a constexpr constructor}} + } + constexpr V(int(&)[6]) { + struct S3 { }; // expected-error {{types cannot be defined in a constexpr constructor}} + } + constexpr V(int(&)[7]) { + return; // expected-error {{statement not allowed in constexpr constructor}} + } +}; + +// - every non-static data member and base class sub-object shall be initialized +struct W { + int n; // expected-note {{member not initialized by constructor}} + constexpr W() {} // expected-error {{constexpr constructor must initialize all members}} +}; +struct AnonMembers { + int a; // expected-note {{member not initialized by constructor}} + union { // expected-note 2{{member not initialized by constructor}} + char b; + struct { + double c; + long d; // expected-note {{member not initialized by constructor}} + }; + union { + char e; + void *f; + }; + }; + struct { // expected-note {{member not initialized by constructor}} + long long g; + struct { + int h; // expected-note {{member not initialized by constructor}} + double i; // expected-note {{member not initialized by constructor}} + }; + union { // expected-note 2{{member not initialized by constructor}} + char *j; + AnonMembers *k; + }; + }; + + constexpr AnonMembers(int(&)[1]) : a(), b(), g(), h(), i(), j() {} // ok + // missing d, i, j/k union + constexpr AnonMembers(int(&)[2]) : a(), c(), g(), h() {} // expected-error {{constexpr constructor must initialize all members}} + constexpr AnonMembers(int(&)[3]) : a(), e(), g(), h(), i(), k() {} // ok + // missing h, j/k union + constexpr AnonMembers(int(&)[4]) : a(), c(), d(), g(), i() {} // expected-error {{constexpr constructor must initialize all members}} + // missing b/c/d/e/f union + constexpr AnonMembers(int(&)[5]) : a(), g(), h(), i(), k() {} // expected-error {{constexpr constructor must initialize all members}} + // missing a, b/c/d/e/f union, g/h/i/j/k struct + constexpr AnonMembers(int(&)[6]) {} // expected-error {{constexpr constructor must initialize all members}} +}; + +template<typename T> using Int = int; +template<typename T> +struct TemplateInit { + T a; + int b; // desired-note {{not initialized}} + Int<T> c; // desired-note {{not initialized}} + struct { + T d; + int e; // desired-note {{not initialized}} + Int<T> f; // desired-note {{not initialized}} + }; + struct { + Literal l; + Literal m; + Literal n[3]; + }; + union { // desired-note {{not initialized}} + T g; + T h; + }; + // FIXME: This is ill-formed (no diagnostic required). We should diagnose it. + constexpr TemplateInit() {} // desired-error {{must initialize all members}} +}; +template<typename T> struct TemplateInit2 { + Literal l; + constexpr TemplateInit2() {} // ok +}; + +template<typename T> struct weak_ptr { + constexpr weak_ptr() : p(0) {} + T *p; +}; +template<typename T> struct enable_shared_from_this { + weak_ptr<T> weak_this; + constexpr enable_shared_from_this() {} // ok +}; +constexpr int f(enable_shared_from_this<int>); + +// - every constructor involved in initializing non-static data members and base +// class sub-objects shall be a constexpr constructor. +// +// FIXME: Implement this as part of the 'must be able to produce a constant +// expression' rules. + +// - every assignment-expression that is an initializer-caluse appearing +// directly or indirectly within a brace-or-equal-initializer for a non-static +// data member that is not named by a mem-initializer-id shall be a constant +// expression; and +// +// Note, we deliberately do not implement this bullet, so that we can allow the +// following example. (See N3308). +struct X { + int a = 0; + int b = 2 * a + 1; // ok, not a constant expression. + + constexpr X() {} + constexpr X(int c) : a(c) {} // ok, b initialized by 2 * c + 1 +}; + +// - every implicit conversion used in converting a constructor argument to the +// corresponding parameter type and converting a full-expression to the +// corresponding member type shall be one of those allowed in a constant +// expression. +// +// We implement the proposed resolution of DR1364 and ignore this bullet. + + +namespace StdExample { + struct Length { + explicit constexpr Length(int i = 0) : val(i) { } + private: + int val; + }; +} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp new file mode 100644 index 000000000000..e383bc09226c --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp @@ -0,0 +1,74 @@ +// RUN: %clang_cc1 -verify -std=c++11 %s + +namespace N { + typedef char C; +} + +namespace M { + typedef double D; +} + +struct NonLiteral { + NonLiteral() {} + NonLiteral(int) {} + operator int() const { return 0; } +}; +struct Literal { + constexpr Literal() {} + operator int() const { return 0; } +}; + +struct S { + virtual int ImplicitlyVirtual(); +}; +struct T {}; + +template<typename T> struct ImplicitVirtualFromDependentBase : T { + constexpr int ImplicitlyVirtual() { return 0; } +}; + +// FIXME: Can't test this until we have function invocation substitution +#if 0 +constexpr int a = ImplicitVirtualFromDependentBase<S>().ImplicitlyVirtual(); // desired-error {{not a constant expression}} +constexpr int b = ImplicitVirtualFromDependentBase<T>().ImplicitlyVirtual(); // ok +#endif + +template<typename R> struct ConstexprMember { + constexpr R F() { return 0; } +}; +// FIXME: Can't test this until we have function invocation substitution +#if 0 +constexpr int c = ConstexprMember<int>().F(); // ok +constexpr int d = ConstexprMember<NonLiteral>().F(); // desired-error {{not a constant expression}} +#endif + +template<typename ...P> struct ConstexprCtor { // expected-note 2{{no constexpr constructors}} + constexpr ConstexprCtor(P...); // expected-note {{constructor template instantiation is not constexpr because 1st parameter type 'NonLiteral' is not a literal type}} \ + expected-note {{constructor template instantiation is not constexpr because 2nd parameter type 'NonLiteral' is not a literal type}} +}; +constexpr ConstexprCtor<> f1(); // ok +constexpr ConstexprCtor<int> f2(); // ok +constexpr ConstexprCtor<NonLiteral> f3(); // expected-error {{not a literal type}} +constexpr ConstexprCtor<int, NonLiteral> f4(); // expected-error {{not a literal type}} + +struct VirtBase : virtual S {}; // expected-note {{here}} + +namespace TemplateVBase { + template<typename T> struct T1 : virtual Literal { // expected-note {{here}} + constexpr T1(); // expected-error {{constexpr constructor not allowed in struct with virtual base class}} + }; + + template<typename T> struct T2 : virtual T { // expected-note {{struct with virtual base class is not a literal type}} expected-note {{here}} + // FIXME: This is ill-formed (no diagnostic required). + // We should diagnose it now rather than waiting until instantiation. + constexpr T2(); // desired-error {{constexpr constructor not allowed in class with virtual base classes}} + }; + constexpr T2<Literal> g2(); // expected-error {{not a literal type}} + + template<typename T> class T3 : public T { // expected-note {{class with virtual base class is not a literal type}} + public: + constexpr T3() {} + }; + constexpr T3<Literal> g3(); // ok + constexpr T3<VirtBase> g4(); // expected-error {{not a literal type}} +} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp new file mode 100644 index 000000000000..f7da24dfc20a --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct S { + constexpr void f(); + constexpr void g() const; +}; + +void f(const S &s) { + s.f(); + s.g(); +} + +namespace std_example { + + class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}} + public: + explicit debug_flag(bool); + constexpr bool is_on(); // expected-error {{non-literal type 'std_example::debug_flag' cannot have constexpr members}} + private: + bool flag; + }; + + constexpr int bar(int x, int y) // expected-note {{here}} + { return x + y + x*y; } + int bar(int x, int y) // expected-error {{non-constexpr declaration of 'bar' follows constexpr declaration}} + { return x * 2 + 3 * y; } + +} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp new file mode 100644 index 000000000000..53d232d8a90a --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +// A constexpr specifier used in an object declaration declares the object as +// const. +constexpr int a = 0; +extern const int a; + +int i; +constexpr int *b = &i; +extern int *const b; + +constexpr int &c = i; +extern int &c; + +constexpr int (*d)(int) = 0; +extern int (*const d)(int); + +// A variable declaration which uses the constexpr specifier shall have an +// initializer and shall be initialized by a constant expression. +constexpr int ni1; // expected-error {{declaration of constexpr variable 'ni1' requires an initializer}} +constexpr struct C { C(); } ni2; // expected-error {{declaration of constexpr variable 'ni2' requires an initializer}} +constexpr double &ni3; // expected-error {{declaration of constexpr variable 'ni3' requires an initializer}} + +constexpr int nc1 = i; // expected-error {{constexpr variable 'nc1' must be initialized by a constant expression}} +constexpr C nc2 = C(); // expected-error {{constexpr variable 'nc2' must be initialized by a constant expression}} +int &f(); +constexpr int &nc3 = f(); // expected-error {{constexpr variable 'nc3' must be initialized by a constant expression}} +constexpr int nc4(i); // expected-error {{constexpr variable 'nc4' must be initialized by a constant expression}} +constexpr C nc5((C())); // expected-error {{constexpr variable 'nc5' must be initialized by a constant expression}} +int &f(); +constexpr int &nc6(f()); // expected-error {{constexpr variable 'nc6' must be initialized by a constant expression}} + +struct pixel { + int x, y; +}; +constexpr pixel ur = { 1294, 1024 }; // ok +constexpr pixel origin; // expected-error {{requires an initializer}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp index fcc1334b1506..ee870d960161 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp @@ -4,7 +4,7 @@ class A { public: explicit A(); - explicit operator int(); // expected-warning {{explicit conversion functions are a C++0x extension}} + explicit operator int(); // expected-warning {{explicit conversion functions are a C++11 extension}} explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}} @@ -12,5 +12,5 @@ public: }; explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}} -explicit A::operator bool() { return false; } // expected-warning {{explicit conversion functions are a C++0x extension}}\ +explicit A::operator bool() { return false; } // expected-warning {{explicit conversion functions are a C++11 extension}}\ // expected-error {{'explicit' can only be specified inside the class definition}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp index 1b1f11a660b5..7b5577520d42 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11 struct S { virtual ~S(); diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp index b675fb8013e3..682ee9f7e4ec 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions void f() { auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}} auto *b = b; // expected-error{{variable 'b' declared with 'auto' type cannot appear in its own initializer}} @@ -39,10 +40,12 @@ void p3example() { auto x = 5; const auto *v = &x, u = 6; static auto y = 0.0; - auto int r; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}} - - same<decltype(x), int> xHasTypeInt; - same<decltype(v), const int*> vHasTypeConstIntPtr; - same<decltype(u), const int> uHasTypeConstInt; - same<decltype(y), double> yHasTypeDouble; + // In C++98: 'auto' storage class specifier is redundant and incompatible with C++0x + // In C++0x: 'auto' storage class specifier is not permitted in C++0x, and will not be supported in future releases + auto int r; // expected-warning {{'auto' storage class specifier}} + + same<__typeof(x), int> xHasTypeInt; + same<__typeof(v), const int*> vHasTypeConstIntPtr; + same<__typeof(u), const int> uHasTypeConstInt; + same<__typeof(y), double> yHasTypeDouble; } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp index 8a68e4bcd795..095c031a1a0e 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions template<typename T> struct only { diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp index 54da854dab55..a52ef41504ac 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11 struct S { virtual ~S(); diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp index 8b4b70398471..7ed4daec5dec 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions template<typename T> struct only { @@ -82,4 +83,21 @@ struct S { } }; +namespace PR10939 { + struct X { + int method(int); + int method(float); + }; + + template<typename T> T g(T); + + void f(X *x) { + auto value = x->method; // expected-error{{variable 'value' with type 'auto' has incompatible initializer of type '<bound member function type>'}} + if (value) { } + + auto funcptr = &g<int>; + int (*funcptr2)(int) = funcptr; + } +} + // TODO: if the initializer is a braced-init-list, deduce auto as std::initializer_list<T>. diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp index de87a93a2bc1..4f230cfb8d40 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions void f() { auto a = 0, b = 0, c = 0; auto d = 0, e = 0.0; // expected-error {{'int' in declaration of 'd' and deduced as 'double' in declaration of 'e'}} @@ -18,6 +19,14 @@ void f() { } void g() { - auto a = 0, (*b)() -> void, c = 0; - auto d = 0, (*e)() -> void, f = 0.0; // expected-error {{'auto' deduced as 'int' in declaration of 'd' and deduced as 'double' in declaration of 'f'}} + auto a = 0, +#if __has_feature(cxx_trailing_return) + (*b)() -> void, +#endif + c = 0; + auto d = 0, // expected-error {{'auto' deduced as 'int' in declaration of 'd' and deduced as 'double' in declaration of 'f'}} +#if __has_feature(cxx_trailing_return) + (*e)() -> void, +#endif + f = 0.0; } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp index 81204d89a697..027104151ac6 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct A { typedef int type; }; template<typename T> using X = A; // expected-note {{declared here}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp index 19159e159a0c..bc60b5e55a33 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s template<typename T, typename U> struct is_same { diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp index b93e8e35b139..e32774a2ee0f 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s using X = struct { // ok }; @@ -7,8 +7,9 @@ template<typename T> using Y = struct { // expected-error {{can not be defined i class K { virtual ~K(); - // FIXME: the diagnostic here is really bad - operator struct S {} (); // expected-error 2{{}} expected-note {{}} + // FIXME: Diagnostic could use some work + operator struct S {} (); // expected-error{{ 'operator S' cannot be the name of a variable or data member}} \ + // expected-error{{expected ';' at end of declaration list}} }; void f() { @@ -33,8 +34,7 @@ void f() { void g() throw (struct Ex {}) { // expected-error {{'Ex' can not be defined in a type specifier}} } -// FIXME: this currently gives a strange error because alignas is not recognised as a keyword yet. -int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a parameter type}} expected-error {{expected function body}} +int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a type specifier}} int a = sizeof(struct So {}); // expected-error {{'So' can not be defined in a type specifier}} int b = alignof(struct Ao {}); // expected-error {{'Ao' can not be defined in a type specifier}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp index a51cfbfffcce..0ff40bccef9f 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify -std=c++0x %s +// RUN: %clang_cc1 -verify -std=c++11 %s namespace RedeclAliasTypedef { typedef int T; diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp index 9b92340fa457..b8c1e18a2e13 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // An aggregate is an array or a class... struct Aggr { @@ -18,11 +18,10 @@ struct NonAggr1a { NonAggr1a(int, int); int k; }; -// In C++03, this is {{non-aggregate type 'NonAggr1a'}}. // In C++0x, 'user-provided' is only defined for special member functions, so -// this type is considered to be an aggregate. This is probably a langauge -// defect. -NonAggr1a na1a = { 42 }; +// this type is considered to be an aggregate. This is considered to be +// a language defect. +NonAggr1a na1a = { 42 }; // expected-error {{non-aggregate type 'NonAggr1a'}} struct NonAggr1b { NonAggr1b(const NonAggr1b &); diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp index c38bd292efdb..104157115335 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp @@ -15,4 +15,4 @@ void tf() { } // Allowed by GNU extension -int a4[] = {}; // expected-warning {{zero size arrays}} +int a4[] = {}; // expected-error {{zero size arrays}} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp new file mode 100644 index 000000000000..dc49deabdea4 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -fsyntax-only -Wc++0x-compat -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s + +// Verify that the appropriate fixits are emitted for narrowing conversions in +// initializer lists. + +typedef short int16_t; + +void fixits() { + int x = 999; + struct {char c;} c2 = {x}; + // CHECK: warning:{{.*}} cannot be narrowed + // CHECK: fix-it:{{.*}}:26}:"static_cast<char>(" + // CHECK: fix-it:{{.*}}:27}:")" + struct {int16_t i;} i16 = {70000}; + // CHECK: warning:{{.*}} cannot be narrowed + // CHECK: fix-it:{{.*}}:30}:"static_cast<int16_t>(" + // CHECK: fix-it:{{.*}}:35}:")" +} + +template<typename T> +void maybe_shrink_int(T t) { + struct {T t;} t2 = {700}; +} + +void test_template() { + maybe_shrink_int((char)3); + // CHECK: warning:{{.*}} cannot be narrowed + // CHECK: note:{{.*}} in instantiation + // CHECK: note:{{.*}} override + // FIXME: This should be static_cast<T>. + // CHECK: fix-it:{{.*}}"static_cast<char>(" + // CHECK: fix-it:{{.*}}")" +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp new file mode 100644 index 000000000000..2294a4eb0894 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp @@ -0,0 +1,175 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -triple x86_64-apple-macosx10.6.7 -verify %s + +// Verify that narrowing conversions in initializer lists cause errors in C++0x +// mode. + +void std_example() { + int x = 999; // x is not a constant expression + const int y = 999; + const int z = 99; + char c1 = x; // OK, though it might narrow (in this case, it does narrow) + char c2{x}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + char c3{y}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}} + char c4{z}; // OK: no narrowing needed + unsigned char uc1 = {5}; // OK: no narrowing needed + unsigned char uc2 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + unsigned int ui1 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + signed int si1 = + { (unsigned int)-1 }; // expected-error {{ cannot be narrowed }} expected-note {{override}} + int ii = {2.0}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + float f1 { x }; // expected-error {{ cannot be narrowed }} expected-note {{override}} + float f2 { 7 }; // OK: 7 can be exactly represented as a float + int f(int); + int a[] = + { 2, f(2), f(2.0) }; // OK: the double-to-int conversion is not at the top level +} + +// Test each rule individually. + +template<typename T> +struct Agg { + T t; +}; + +// C++0x [dcl.init.list]p7: A narrowing conversion is an implicit conversion +// +// * from a floating-point type to an integer type, or + +void float_to_int() { + Agg<char> a1 = {1.0F}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<char> a2 = {1.0}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<char> a3 = {1.0L}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + + float f = 1.0; + double d = 1.0; + long double ld = 1.0; + Agg<char> a4 = {f}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<char> a5 = {d}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<char> a6 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}} +} + +// * from long double to double or float, or from double to float, except where +// the source is a constant expression and the actual value after conversion +// is within the range of values that can be represented (even if it cannot be +// represented exactly), or + +void shrink_float() { + // These aren't constant expressions. + float f = 1.0; + double d = 1.0; + long double ld = 1.0; + + // Variables. + Agg<float> f1 = {f}; // OK (no-op) + Agg<float> f2 = {d}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<float> f3 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + // Exact constants. + Agg<float> f4 = {1.0}; // OK (double constant represented exactly) + Agg<float> f5 = {1.0L}; // OK (long double constant represented exactly) + // Inexact but in-range constants. + Agg<float> f6 = {0.1}; // OK (double constant in range but rounded) + Agg<float> f7 = {0.1L}; // OK (long double constant in range but rounded) + // Out of range constants. + Agg<float> f8 = {1E50}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<float> f9 = {1E50L}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + // More complex constant expression. + constexpr long double e40 = 1E40L, e30 = 1E30L, e39 = 1E39L; + Agg<float> f10 = {e40 - 5 * e39 + e30 - 5 * e39}; // OK + + // Variables. + Agg<double> d1 = {f}; // OK (widening) + Agg<double> d2 = {d}; // OK (no-op) + Agg<double> d3 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + // Exact constant. + Agg<double> d4 = {1.0L}; // OK (long double constant represented exactly) + // Inexact but in-range constant. + Agg<double> d5 = {0.1L}; // OK (long double constant in range but rounded) + // Out of range constant. + Agg<double> d6 = {1E315L}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + // More complex constant expression. + constexpr long double e315 = 1E315L, e305 = 1E305L, e314 = 1E314L; + Agg<double> d7 = {e315 - 5 * e314 + e305 - 5 * e314}; // OK +} + +// * from an integer type or unscoped enumeration type to a floating-point type, +// except where the source is a constant expression and the actual value after +// conversion will fit into the target type and will produce the original +// value when converted back to the original type, or +void int_to_float() { + // Not a constant expression. + char c = 1; + + // Variables. Yes, even though all char's will fit into any floating type. + Agg<float> f1 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<double> f2 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<long double> f3 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + + // Constants. + Agg<float> f4 = {12345678}; // OK (exactly fits in a float) + Agg<float> f5 = {123456789}; // expected-error {{ cannot be narrowed }} expected-note {{override}} +} + +// * from an integer type or unscoped enumeration type to an integer type that +// cannot represent all the values of the original type, except where the +// source is a constant expression and the actual value after conversion will +// fit into the target type and will produce the original value when converted +// back to the original type. +void shrink_int() { + // Not a constant expression. + short s = 1; + unsigned short us = 1; + Agg<char> c1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<unsigned short> s1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<short> s2 = {us}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + + // "that cannot represent all the values of the original type" means that the + // validity of the program depends on the relative sizes of integral types. + // This test compiles with -m64, so sizeof(int)<sizeof(long)==sizeof(long + // long). + long l1 = 1; + Agg<int> i1 = {l1}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + long long ll = 1; + Agg<long> l2 = {ll}; // OK + + // Constants. + Agg<char> c2 = {127}; // OK + Agg<char> c3 = {300}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}} + + Agg<int> i2 = {0x7FFFFFFFU}; // OK + Agg<int> i3 = {0x80000000U}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<unsigned int> i4 = {-0x80000000L}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + + // Bool is also an integer type, but conversions to it are a different AST + // node. + Agg<bool> b1 = {0}; // OK + Agg<bool> b2 = {1}; // OK + Agg<bool> b3 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + + // Conversions from pointers to booleans aren't narrowing conversions. + Agg<bool> b = {&b1}; // OK +} + +// Be sure that type- and value-dependent expressions in templates get the error +// too. + +template<int I, typename T> +void maybe_shrink_int(T t) { + Agg<short> s1 = {t}; // expected-error {{ cannot be narrowed }} expected-note {{override}} + Agg<short> s2 = {I}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}} + Agg<T> t2 = {700}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}} +} + +void test_template() { + maybe_shrink_int<15>((int)3); // expected-note {{in instantiation}} + maybe_shrink_int<70000>((char)3); // expected-note {{in instantiation}} +} + + +// We don't want qualifiers on the types in the diagnostic. + +void test_qualifiers(int i) { + const int j = i; + struct {const unsigned char c;} c1 = {j}; // expected-error {{from type 'int' to 'unsigned char' in}} expected-note {{override}} + // Template arguments make it harder to avoid printing qualifiers: + Agg<const unsigned char> c2 = {j}; // expected-error {{from type 'int' to 'const unsigned char' in}} expected-note {{override}} +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp index bd08ab5423b0..20c059eab6f3 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s int g(int); void f() { int i; diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp index 7b0fb9c52ba4..95cc56cbab53 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s // Test the C++0x-specific reference initialization rules, e.g., the // rules for rvalue references. @@ -17,7 +17,7 @@ int f(int); template<typename T> struct ConvertsTo { - operator T(); // expected-note 4{{candidate function}} + operator T(); // expected-note 2{{candidate function}} }; void test_rvalue_refs() { @@ -132,7 +132,9 @@ namespace std_example_2 { namespace argument_passing { void base_rvalue_ref(Base&&); - void int_rvalue_ref(int&&); // expected-note 2{{passing argument to parameter here}} + void int_rvalue_ref(int&&); // expected-note{{candidate function not viable: no known conversion from 'ConvertsTo<int &>' to 'int &&' for 1st argument}} \ + // expected-note{{candidate function not viable: no known conversion from 'ConvertsTo<float &>' to 'int &&' for 1st argument}} + void array_rvalue_ref(int (&&)[5]); void function_rvalue_ref(int (&&)(int)); @@ -157,8 +159,36 @@ namespace argument_passing { function_rvalue_ref(ConvertsTo<int(&)(int)>()); - int_rvalue_ref(ConvertsTo<int&>()); // expected-error{{no viable conversion from 'ConvertsTo<int &>' to 'int'}} - int_rvalue_ref(ConvertsTo<float&>()); // expected-error{{no viable conversion from 'ConvertsTo<float &>' to 'int'}} + int_rvalue_ref(ConvertsTo<int&>()); // expected-error{{no matching function for call to 'int_rvalue_ref'}} + int_rvalue_ref(ConvertsTo<float&>()); // expected-error{{no matching function for call to 'int_rvalue_ref'}} } } + +namespace pr10644 { + struct string { + string(const char* __s); + }; + class map { + int& operator[](const string& __k); + public: + int& operator[](const string&& __k); + }; + void foo() { + static map key_map; + key_map["line"]; + } +} + +namespace PR11003 { + class Value { + }; + struct MoveRef { + operator Value &() const ; + }; + MoveRef Move(int); + void growTo() { + Value x = Move(0); + Value y(Move(0)); + } +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp index 5cfb11a1fc1b..27eb6d1c078f 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // C++03 requires that we check for a copy constructor when binding a // reference to a reference-compatible rvalue, since we are allowed to diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp new file mode 100644 index 000000000000..07a5cef30478 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +char x1[]("hello"); +extern char x1[6]; + +char x2[] = "hello"; +extern char x2[6]; diff --git a/test/CXX/dcl.decl/dcl.init/p14-0x.cpp b/test/CXX/dcl.decl/dcl.init/p14-0x.cpp index e5b58899545c..419f2bff1282 100644 --- a/test/CXX/dcl.decl/dcl.init/p14-0x.cpp +++ b/test/CXX/dcl.decl/dcl.init/p14-0x.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct NoDefault { NoDefault() = delete; // expected-note {{here}} NoDefault(int); }; -struct Explicit { // expected-note {{candidate}} expected-note {{here}} +struct Explicit { // expected-note 2 {{candidate}} expected-note {{here}} explicit Explicit(int); }; struct NoCopy { diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp index b0575b8236bb..102746c3db29 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 void f() { int b[5]; diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp index 9d26561ca8de..385e45dadfae 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp @@ -5,7 +5,7 @@ struct A { }; struct B : public A { - void f(int a); + void f(int a); // expected-note{{'f' declared here}} }; void m() { diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp index b2129b259bb3..f3dec52f63b3 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp @@ -41,7 +41,7 @@ namespace N1 { void m() { - void f(int, int); + void f(int, int); // expected-note{{'f' declared here}} f(4); // expected-error{{too few arguments to function call}} void f(int, int = 5); // expected-note{{previous definition}} f(4); // okay diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp new file mode 100644 index 000000000000..a87982906631 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp @@ -0,0 +1,62 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +// FIXME: test with non-std qualifiers + +namespace move { + struct Const { + Const(const Const&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be const}} + Const& operator=(const Const&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be const}} + }; + + struct Volatile { + Volatile(volatile Volatile&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be volatile}} + Volatile& operator=(volatile Volatile&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be volatile}} + }; + + struct AssignmentRet1 { + AssignmentRet1&& operator=(AssignmentRet1&&) = default; // expected-error {{an explicitly-defaulted move assignment operator must return an unqualified lvalue reference to its class type}} + }; + + struct AssignmentRet2 { + const AssignmentRet2& operator=(AssignmentRet2&&) = default; // expected-error {{an explicitly-defaulted move assignment operator must return an unqualified lvalue reference to its class type}} + }; + + struct ConstAssignment { + ConstAssignment& operator=(ConstAssignment&&) const = default; // expected-error {{an explicitly-defaulted move assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}} + }; +} + +namespace copy { + struct Volatile { + Volatile(const volatile Volatile&) = default; // expected-error {{the parameter for an explicitly-defaulted copy constructor may not be volatile}} + Volatile& operator=(const volatile Volatile&) = default; // expected-error {{the parameter for an explicitly-defaulted copy assignment operator may not be volatile}} + }; + + struct Const { + Const(const Const&) = default; + Const& operator=(const Const&) = default; + }; + + struct NonConst { + NonConst(NonConst&) = default; + NonConst& operator=(NonConst&) = default; + }; + + struct BadConst { + NonConst nc; // makes implicit copy non-const + BadConst(const BadConst&) = default; // expected-error {{is const, but}} + BadConst& operator=(const BadConst&) = default; // expected-error {{is const, but}} + }; + + struct AssignmentRet1 { + AssignmentRet1&& operator=(const AssignmentRet1&) = default; // expected-error {{an explicitly-defaulted copy assignment operator must return an unqualified lvalue reference to its class type}} + }; + + struct AssignmentRet2 { + const AssignmentRet2& operator=(const AssignmentRet2&) = default; // expected-error {{an explicitly-defaulted copy assignment operator must return an unqualified lvalue reference to its class type}} + }; + + struct ConstAssignment { + ConstAssignment& operator=(const ConstAssignment&) const = default; // expected-error {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}} + }; +} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp index 868d009003ee..19a5f23e3f17 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fcxx-exceptions -fexceptions -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -fexceptions -verify %s // When it is part of a parameter-declaration-clause, the parameter // pack is a function parameter pack. diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp index 1293a067576a..0e69521fbdfc 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> struct identity; template<typename ...Types> struct tuple; diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp index 70c9aeb48819..6b1f3e438d8f 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s auto a() -> int; // ok const auto b() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto const'}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp index c81c844f3448..ce0a082462a2 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s void f0() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} void f1() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp index 21efbfff1ab9..11926f1bd6cb 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s auto f() -> int[32]; // expected-error{{function cannot return array}} auto g() -> int(int); // expected-error{{function cannot return function}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp index ca4701554be4..4d71a8e4b4c6 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp @@ -1,3 +1,3 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s auto j() -> enum { e3 }; // expected-error{{can not be defined in a type specifier}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp index 789cde75241a..4ce80bc35ac9 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T, typename U> struct is_same { diff --git a/test/CXX/dcl.decl/p4-0x.cpp b/test/CXX/dcl.decl/p4-0x.cpp index 9fa2ea19d411..98c33b25f4d2 100644 --- a/test/CXX/dcl.decl/p4-0x.cpp +++ b/test/CXX/dcl.decl/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct X { void f() &; diff --git a/test/CXX/except/except.spec/canonical.cpp b/test/CXX/except/except.spec/canonical.cpp index 9bc26de14440..81ca2ae0a20e 100644 --- a/test/CXX/except/except.spec/canonical.cpp +++ b/test/CXX/except/except.spec/canonical.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // PR10087: Make sure that we don't conflate exception specifications // from different functions in the canonical type system. diff --git a/test/CXX/except/except.spec/p1.cpp b/test/CXX/except/except.spec/p1.cpp index 86924bb49d75..a6e785024778 100644 --- a/test/CXX/except/except.spec/p1.cpp +++ b/test/CXX/except/except.spec/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Simple parser tests, dynamic specification. @@ -60,14 +60,22 @@ namespace noex { } namespace noexcept_unevaluated { - template<typename T> void f(T) { + template<typename T> bool f(T) { T* x = 1; } template<typename T> - void g(T x) noexcept((f(x), sizeof(T) == 4)) { } + void g(T x) noexcept((sizeof(T) == sizeof(int)) || f(x)) { } void h() { g(1); } } + +namespace PR11084 { + template<int X> struct A { + static int f() noexcept(1/X) { return 10; } // expected-error{{argument to noexcept specifier must be a constant expression}} + }; + + void g() { A<0>::f(); } // expected-note{{in instantiation of template class 'PR11084::A<0>' requested here}} +} diff --git a/test/CXX/except/except.spec/p11.cpp b/test/CXX/except/except.spec/p11.cpp index 268b53ad79d0..0e4fad53e350 100644 --- a/test/CXX/except/except.spec/p11.cpp +++ b/test/CXX/except/except.spec/p11.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // This is the "let the user shoot himself in the foot" clause. void f() noexcept { diff --git a/test/CXX/except/except.spec/p14.cpp b/test/CXX/except/except.spec/p14.cpp index f42fbe907ffe..8763a7028195 100644 --- a/test/CXX/except/except.spec/p14.cpp +++ b/test/CXX/except/except.spec/p14.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify -std=c++0x %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify -std=c++11 %s struct A { }; struct B { }; struct C { }; diff --git a/test/CXX/except/except.spec/p15.cpp b/test/CXX/except/except.spec/p15.cpp index 2dae9623e0cc..110ec3fa0300 100644 --- a/test/CXX/except/except.spec/p15.cpp +++ b/test/CXX/except/except.spec/p15.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Deallocation functions are implicitly noexcept. // Thus, explicit specs aren't allowed to conflict. diff --git a/test/CXX/except/except.spec/p2-places.cpp b/test/CXX/except/except.spec/p2-places.cpp index db1ee77463fb..67647fb043a9 100644 --- a/test/CXX/except/except.spec/p2-places.cpp +++ b/test/CXX/except/except.spec/p2-places.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Tests where specs are allowed and where they aren't. diff --git a/test/CXX/except/except.spec/p3.cpp b/test/CXX/except/except.spec/p3.cpp index 5df5f26a8f8f..d77aea40602c 100644 --- a/test/CXX/except/except.spec/p3.cpp +++ b/test/CXX/except/except.spec/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Exception specification compatibility. // We test function pointers, because functions have an extra rule in p4. diff --git a/test/CXX/except/except.spec/p5-pointers.cpp b/test/CXX/except/except.spec/p5-pointers.cpp index 171afff22b5b..dd3c0600ce92 100644 --- a/test/CXX/except/except.spec/p5-pointers.cpp +++ b/test/CXX/except/except.spec/p5-pointers.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Assignment of function pointers. diff --git a/test/CXX/except/except.spec/p5-virtual.cpp b/test/CXX/except/except.spec/p5-virtual.cpp index ceea9f8f2500..69daec6ee533 100644 --- a/test/CXX/except/except.spec/p5-virtual.cpp +++ b/test/CXX/except/except.spec/p5-virtual.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // Compatibility of virtual functions. diff --git a/test/CXX/except/except.spec/p9-dynamic.cpp b/test/CXX/except/except.spec/p9-dynamic.cpp index 3f496f25c9ba..4559e0d467b1 100644 --- a/test/CXX/except/except.spec/p9-dynamic.cpp +++ b/test/CXX/except/except.spec/p9-dynamic.cpp @@ -7,5 +7,6 @@ void target() throw(int) // CHECK: invoke void @_Z8externalv() external(); } -// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* bitcast (i8** @_ZTIi to i8*)) nounwind -// CHECK: call void @__cxa_call_unexpected +// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK-NEXT: filter [1 x i8*] [i8* bitcast (i8** @_ZTIi to i8*)] +// CHECK: call void @__cxa_call_unexpected diff --git a/test/CXX/except/except.spec/p9-noexcept.cpp b/test/CXX/except/except.spec/p9-noexcept.cpp index 76ac66c841b9..7c8d0ef1fb44 100644 --- a/test/CXX/except/except.spec/p9-noexcept.cpp +++ b/test/CXX/except/except.spec/p9-noexcept.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -std=c++0x -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s +// RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s void external(); @@ -7,7 +7,8 @@ void target() noexcept // CHECK: invoke void @_Z8externalv() external(); } -// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* null) nounwind +// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK-NEXT: catch i8* null // CHECK-NEXT: call void @_ZSt9terminatev() noreturn nounwind // CHECK-NEXT: unreachable diff --git a/test/CXX/except/except.spec/template.cpp b/test/CXX/except/except.spec/template.cpp index f8b7270344a7..805a604db588 100644 --- a/test/CXX/except/except.spec/template.cpp +++ b/test/CXX/except/except.spec/template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s // We use pointer assignment compatibility to test instantiation. diff --git a/test/CXX/expr/expr.cast/p4-0x.cpp b/test/CXX/expr/expr.cast/p4-0x.cpp index 5824cd21f1e7..96bf5f91196b 100644 --- a/test/CXX/expr/expr.cast/p4-0x.cpp +++ b/test/CXX/expr/expr.cast/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct X { }; struct Y : X { }; diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp index 1b38cf19b42e..2c6a46b3beaf 100644 --- a/test/CXX/expr/expr.const/p2-0x.cpp +++ b/test/CXX/expr/expr.const/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // PR9999 template<bool v> diff --git a/test/CXX/expr/expr.mptr.oper/p6-0x.cpp b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp index d5dc7d2cbe58..917b2dab7c32 100644 --- a/test/CXX/expr/expr.mptr.oper/p6-0x.cpp +++ b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct X { }; diff --git a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp index bb4726dd3309..d51ba09835d2 100644 --- a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp +++ b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct X1 { X1(); @@ -15,3 +15,16 @@ void f(X1 x1, X2 x2) { vararg(x1); // okay vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}} } + + +namespace PR11131 { + struct S; + + S &getS(); + + void f(...); + + void g() { + (void)sizeof(f(getS())); + } +} diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp index d46488107ba6..6ba8d519346e 100644 --- a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // The result of the expression const_cast<T>(v) is of type T. If T is // an lvalue reference to object type, the result is an lvalue; if T diff --git a/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp index 3b448a80db2b..cddd5cf25e3b 100644 --- a/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp +++ b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct X { virtual ~X(); }; struct Y : public X { }; diff --git a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp index e80082a0408a..22892a63ab16 100644 --- a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp +++ b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // If T is an lvalue reference type or an rvalue reference to function // type, the result is an lvalue; if T is an rvalue reference to diff --git a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp index c10335183e21..9ef15e6642b1 100644 --- a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp +++ b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // A glvalue of type "cv1 T1" can be cast to type "rvalue reference to // cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1" (8.5.3). diff --git a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp index 4acafb89acaf..731c50844428 100644 --- a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp +++ b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s enum class EC { ec1 }; diff --git a/test/CXX/expr/expr.prim/p12-0x.cpp b/test/CXX/expr/expr.prim/p12-0x.cpp index 0ff29a18825b..aec62ddd97a7 100644 --- a/test/CXX/expr/expr.prim/p12-0x.cpp +++ b/test/CXX/expr/expr.prim/p12-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct S { int *j = &nonexistent; // expected-error {{use of undeclared identifier 'nonexistent'}} diff --git a/test/CXX/expr/expr.prim/p4-0x.cpp b/test/CXX/expr/expr.prim/p4-0x.cpp index 13735fab4a9d..143ba897ae95 100644 --- a/test/CXX/expr/expr.prim/p4-0x.cpp +++ b/test/CXX/expr/expr.prim/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct S { S *p = this; // ok diff --git a/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp index c9a8887d2644..4ebbfce289ea 100644 --- a/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp +++ b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 template<typename T> struct only { diff --git a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp index 4c924b137ccd..eca1ec790199 100644 --- a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp +++ b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -fexceptions %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -fexceptions %s typedef __SIZE_TYPE__ size_t; struct S { diff --git a/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp index 382461541546..afd8ef05302f 100644 --- a/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp +++ b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Test parsing + semantic analysis template<typename ...Types> struct count_types { diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp index 67d853a287f8..5c1029f1a3ff 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include %S/ser.h %s -o - | FileCheck %s -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++0x -x c++ %S/ser.h -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include-pch %t-ser.pch %s -o - | FileCheck %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include %S/ser.h %s -o - | FileCheck %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++11 -x c++ %S/ser.h +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include-pch %t-ser.pch %s -o - | FileCheck %s struct D { ~D() throw(); diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp index 6d1e523b51bf..b5de1a7f8fee 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -fms-extensions %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -fms-extensions %s #define P(e) static_assert(noexcept(e), "expected nothrow") #define N(e) static_assert(!noexcept(e), "expected throw") diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp index 30f8c5491951..ac11940c80da 100644 --- a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp @@ -29,8 +29,7 @@ bool b8 = !S(); //expected-error {{invalid argument type 'S'}} namespace PR8181 { - void f() { } // expected-note{{candidate function}} - void f(char) { } // expected-note{{candidate function}} - bool b = !&f; //expected-error {{cannot resolve overloaded function 'f' from context}} - + bool f() { } // expected-note{{possible target for call}} + void f(char) { } // expected-note{{possible target for call}} + bool b = !&f; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} } diff --git a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp index 7b65f7ee8320..5342153b63ba 100644 --- a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp +++ b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Check types of char literals extern char a; @@ -7,3 +8,9 @@ extern int b; extern __typeof('asdf') b; extern wchar_t c; extern __typeof(L'a') c; +#if __cplusplus >= 201103L +extern char16_t d; +extern __typeof(u'a') d; +extern char32_t e; +extern __typeof(U'a') e; +#endif diff --git a/test/CXX/lex/lex.literal/lex.ext/p1.cpp b/test/CXX/lex/lex.literal/lex.ext/p1.cpp new file mode 100644 index 000000000000..39812280c090 --- /dev/null +++ b/test/CXX/lex/lex.literal/lex.ext/p1.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +int * operator "" p31(long double); // expected-warning{{user-defined literal with suffix 'p31' is preempted by C99 hexfloat extension}} +long double operator "" _p31(long double); +long double operator "" pi(long double); // expected-warning{{user-defined literals not starting with '_' are reserved by the implementation}} + +float hexfloat = 0x1p31; // allow hexfloats diff --git a/test/CXX/lex/lex.pptoken/p3-0x.cpp b/test/CXX/lex/lex.pptoken/p3-0x.cpp index 4ae867c2095e..3d56ac17bd5b 100644 --- a/test/CXX/lex/lex.pptoken/p3-0x.cpp +++ b/test/CXX/lex/lex.pptoken/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s int a<::> = { 1, 2, 3 }; int b = a<:::a<:0:>:>; diff --git a/test/CXX/over/over.built/p23.cpp b/test/CXX/over/over.built/p23.cpp new file mode 100644 index 000000000000..41255214ec6a --- /dev/null +++ b/test/CXX/over/over.built/p23.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +struct Variant { + template <typename T> operator T(); +}; + +Variant getValue(); + +void testVariant() { + bool ret1 = getValue() || getValue(); + bool ret2 = getValue() && getValue(); + bool ret3 = !getValue(); +} + +struct ExplicitVariant { + template <typename T> explicit operator T(); +}; + +ExplicitVariant getExplicitValue(); + +void testExplicitVariant() { + bool ret1 = getExplicitValue() || getExplicitValue(); + bool ret2 = getExplicitValue() && getExplicitValue(); + bool ret3 = !getExplicitValue(); +} diff --git a/test/CXX/over/over.built/p25.cpp b/test/CXX/over/over.built/p25.cpp index c185fb4fb96d..aea3854a420e 100644 --- a/test/CXX/over/over.built/p25.cpp +++ b/test/CXX/over/over.built/p25.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s enum class Color { Red, Green, Blue }; diff --git a/test/CXX/over/over.load/p2-0x.cpp b/test/CXX/over/over.load/p2-0x.cpp index f0ace9044a2d..cf38741056ab 100644 --- a/test/CXX/over/over.load/p2-0x.cpp +++ b/test/CXX/over/over.load/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Member function declarations with the same name and the same // parameter-type-list as well as mem- ber function template diff --git a/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp index d9e0ff88bd8d..1c71468e453d 100644 --- a/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp +++ b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s namespace PR6285 { template<typename T> struct identity diff --git a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp index ab171bc3f6f4..3971acc58169 100644 --- a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp +++ b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s namespace std_example { int i; int f1(); diff --git a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp index 8ccc5b6204d0..3845af09d14c 100644 --- a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp +++ b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> T &lvalue(); template<typename T> T &&xvalue(); diff --git a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp index 544a66d9e39a..d2a23ce96df2 100644 --- a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp +++ b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp @@ -27,26 +27,26 @@ namespace DontAllowUnresolvedOverloadedExpressionInAnUnusedExpression void one() { } template<class T> void oneT() { } - void two() { } //expected-note 2{{candidate}} - void two(int) { } //expected-note 2{{candidate}} - template<class T> void twoT() { } //expected-note 2{{candidate}} - template<class T> void twoT(T) { } //expected-note 2{{candidate}} + void two() { } // expected-note 2 {{possible target for call}} + void two(int) { } // expected-note 2 {{possible target for call}} + template<class T> void twoT() { } // expected-note 2 {{possible target for call}} + template<class T> void twoT(T) { } // expected-note 2 {{possible target for call}} void check() { one; // expected-warning {{expression result unused}} - two; // expected-error{{cannot resolve overloaded function 'two' from context}} + two; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} oneT<int>; // expected-warning {{expression result unused}} - twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}} + twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} } // check the template function case template<class T> void check() { one; // expected-warning {{expression result unused}} - two; // expected-error{{cannot resolve overloaded function 'two' from context}} + two; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} oneT<int>; // expected-warning {{expression result unused}} - twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}} + twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} } @@ -128,8 +128,8 @@ namespace member_pointers { template <typename T> bool f(T) { return false; } template <typename T> static bool g(T) { return false; } - template <typename T> bool h(T) { return false; } - template <int N> static bool h(int) { return false; } + template <typename T> bool h(T) { return false; } // expected-note 3 {{possible target for call}} + template <int N> static bool h(int) { return false; } // expected-note 3 {{possible target for call}} }; void test(S s) { @@ -137,8 +137,8 @@ namespace member_pointers { if (S::f<int>) return; // expected-error {{call to non-static member function without an object argument}} if (&S::f<char>) return; if (&S::f<int>) return; - if (s.f<char>) return; // expected-error {{a bound member function may only be called}} - if (s.f<int>) return; // expected-error {{a bound member function may only be called}} + if (s.f<char>) return; // expected-error {{reference to non-static member function must be called}} + if (s.f<int>) return; // expected-error {{reference to non-static member function must be called}} if (&s.f<char>) return; // expected-error {{cannot create a non-constant pointer to member function}} if (&s.f<int>) return; // expected-error {{cannot create a non-constant pointer to member function}} @@ -152,13 +152,13 @@ namespace member_pointers { if (&s.g<int>) return; if (S::h<42>) return; - if (S::h<int>) return; // expected-error {{a bound member function may only be called}} + if (S::h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} if (&S::h<42>) return; if (&S::h<int>) return; if (s.h<42>) return; - if (s.h<int>) return; // expected-error {{a bound member function may only be called}} + if (s.h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} if (&s.h<42>) return; - if (&s.h<int>) return; // expected-error {{a bound member function may only be called}} + if (&s.h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} { bool b = S::f<char>; } // expected-error {{call to non-static member function without an object argument}} { bool b = S::f<int>; } // expected-error {{call to non-static member function without an object argument}} diff --git a/test/CXX/special/class.copy/implicit-move-def.cpp b/test/CXX/special/class.copy/implicit-move-def.cpp new file mode 100644 index 000000000000..94023cbc1d7b --- /dev/null +++ b/test/CXX/special/class.copy/implicit-move-def.cpp @@ -0,0 +1,116 @@ +// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-ASSIGN %s +// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-CTOR %s + +// construct + +struct E { + E(); + E(E&&); +}; + +struct F { + F(); + F(F&&); +}; + +struct G { + E e; +}; + +struct H : G { + F l; + E m; + F ar[2]; +}; + +void f() { + H s; + // CHECK: call void @_ZN1HC1EOS_ + H t(static_cast<H&&>(s)); +} + + +// assign + +struct A { + A &operator =(A&&); +}; + +struct B { + B &operator =(B&&); +}; + +struct C { + A a; +}; + +struct D : C { + A a; + B b; + A ar[2]; +}; + +void g() { + D d; + // CHECK: call {{.*}} @_ZN1DaSEOS_ + d = D(); +} + +// PR10822 +struct I { + unsigned var[1]; +}; + +// CHECK: define void @_Z1hv() nounwind { +void h() { + I i; + // CHECK: call void @llvm.memcpy. + i = I(); + // CHECK-NEXT: ret void +} + +// PR10860 +struct Empty { }; +struct VirtualWithEmptyBase : Empty { + virtual void f(); +}; + +// CHECK: define void @_Z25move_VirtualWithEmptyBaseR20VirtualWithEmptyBaseS0_ +void move_VirtualWithEmptyBase(VirtualWithEmptyBase &x, VirtualWithEmptyBase &y) { + // CHECK: call {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_ + x = static_cast<VirtualWithEmptyBase&&>(y); + // CHECK-NEXT: ret void +} + +// move assignment ops + +// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_ +// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_ +// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_ +// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_ +// array loop +// CHECK-ASSIGN: br i1 +// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_ + +// VirtualWithEmptyBase move assignment operatpr +// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_ +// CHECK-ASSIGN: store +// CHECK-ASSIGN-NEXT: store +// CHECK-NOT: call +// CHECK: ret + +// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_ +// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_ + +// move ctors + +// CHECK-CTOR: define linkonce_odr void @_ZN1HC2EOS_ +// CHECK-CTOR: call void @_ZN1GC2EOS_ +// CHECK-CTOR: call void @_ZN1FC1EOS_ +// CHECK-CTOR: call void @_ZN1EC1EOS_ +// array loop +// CHECK-CTOR: br i1 +// CHECK-CTOR: call void @_ZN1FC1EOS_ + +// CHECK-CTOR: define linkonce_odr void @_ZN1GC2EOS_ +// CHECK-CTOR: call void @_ZN1EC1EOS_ diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp new file mode 100644 index 000000000000..74f7eee9ee89 --- /dev/null +++ b/test/CXX/special/class.copy/implicit-move.cpp @@ -0,0 +1,164 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +// Tests for implicit (non-)declaration of move constructor and +// assignment: p9, p11, p20, p23. + +// This class, used as a member, allows to distinguish move from copy because +// move operations are no-throw, copy operations aren't. +struct ThrowingCopy { + ThrowingCopy() noexcept; + ThrowingCopy(ThrowingCopy &&) noexcept; + ThrowingCopy(const ThrowingCopy &) noexcept(false); + ThrowingCopy & operator =(ThrowingCopy &&) noexcept; + ThrowingCopy & operator =(const ThrowingCopy &) noexcept(false); +}; + +struct HasCopyConstructor { + ThrowingCopy tc; + HasCopyConstructor() noexcept; + HasCopyConstructor(const HasCopyConstructor &) noexcept(false); +}; + +struct HasCopyAssignment { + ThrowingCopy tc; + HasCopyAssignment() noexcept; + HasCopyAssignment & operator =(const HasCopyAssignment &) noexcept(false); +}; + +struct HasMoveConstructor { // expected-note {{implicit copy assignment}} + ThrowingCopy tc; + HasMoveConstructor() noexcept; + HasMoveConstructor(HasMoveConstructor &&) noexcept; +}; + +struct HasMoveAssignment { // expected-note {{implicit copy constructor}} + ThrowingCopy tc; + HasMoveAssignment() noexcept; + HasMoveAssignment & operator =(HasMoveAssignment &&) noexcept; +}; + +struct HasDestructor { + ThrowingCopy tc; + HasDestructor() noexcept; + ~HasDestructor() noexcept; +}; + +void test_basic_exclusion() { + static_assert(!noexcept(HasCopyConstructor((HasCopyConstructor()))), ""); + HasCopyConstructor hcc; + static_assert(!noexcept(hcc = HasCopyConstructor()), ""); + + static_assert(!noexcept(HasCopyAssignment((HasCopyAssignment()))), ""); + HasCopyAssignment hca; + static_assert(!noexcept(hca = HasCopyAssignment()), ""); + + static_assert(noexcept(HasMoveConstructor((HasMoveConstructor()))), ""); + HasMoveConstructor hmc; + hmc = HasMoveConstructor(); // expected-error {{selected deleted operator}} + + (HasMoveAssignment(HasMoveAssignment())); // expected-error {{uses deleted function}} + HasMoveAssignment hma; + static_assert(noexcept(hma = HasMoveAssignment()), ""); + + static_assert(!noexcept(HasDestructor((HasDestructor()))), ""); + HasDestructor hd; + static_assert(!noexcept(hd = HasDestructor()), ""); +} + +struct PrivateMove { + PrivateMove() noexcept; + PrivateMove(const PrivateMove &) noexcept(false); + PrivateMove & operator =(const PrivateMove &) noexcept(false); +private: + PrivateMove(PrivateMove &&) noexcept; + PrivateMove & operator =(PrivateMove &&) noexcept; +}; + +struct InheritsPrivateMove : PrivateMove {}; +struct ContainsPrivateMove { + PrivateMove pm; +}; + +struct PrivateDestructor { + PrivateDestructor() noexcept; + PrivateDestructor(const PrivateDestructor &) noexcept(false); + PrivateDestructor(PrivateDestructor &&) noexcept; +private: + ~PrivateDestructor() noexcept; +}; + +struct InheritsPrivateDestructor : PrivateDestructor {}; // expected-note {{explicitly marked deleted}} +struct ContainsPrivateDestructor { // expected-note {{explicitly marked deleted}} + PrivateDestructor pd; +}; + +struct NonTrivialCopyOnly { + NonTrivialCopyOnly() noexcept; + NonTrivialCopyOnly(const NonTrivialCopyOnly &) noexcept(false); + NonTrivialCopyOnly & operator =(const NonTrivialCopyOnly &) noexcept(false); +}; + +struct InheritsNonTrivialCopyOnly : NonTrivialCopyOnly {}; +struct ContainsNonTrivialCopyOnly { + NonTrivialCopyOnly ntco; +}; + +struct ContainsConst { + const int i; + ContainsConst() noexcept; + ContainsConst & operator =(ContainsConst &); // expected-note {{not viable}} +}; + +struct ContainsRef { + int &i; + ContainsRef() noexcept; + ContainsRef & operator =(ContainsRef &); // expected-note {{not viable}} +}; + +struct Base { + Base & operator =(Base &); +}; +struct DirectVirtualBase : virtual Base {}; // expected-note {{copy assignment operator) not viable}} +struct IndirectVirtualBase : DirectVirtualBase {}; // expected-note {{copy assignment operator) not viable}} + +void test_deletion_exclusion() { + // FIXME: How to test the union thing? + + static_assert(!noexcept(InheritsPrivateMove(InheritsPrivateMove())), ""); + static_assert(!noexcept(ContainsPrivateMove(ContainsPrivateMove())), ""); + InheritsPrivateMove ipm; + static_assert(!noexcept(ipm = InheritsPrivateMove()), ""); + ContainsPrivateMove cpm; + static_assert(!noexcept(cpm = ContainsPrivateMove()), ""); + + (InheritsPrivateDestructor(InheritsPrivateDestructor())); // expected-error {{call to deleted constructor}} + (ContainsPrivateDestructor(ContainsPrivateDestructor())); // expected-error {{call to deleted constructor}} + + static_assert(!noexcept(InheritsNonTrivialCopyOnly(InheritsNonTrivialCopyOnly())), ""); + static_assert(!noexcept(ContainsNonTrivialCopyOnly(ContainsNonTrivialCopyOnly())), ""); + InheritsNonTrivialCopyOnly intco; + static_assert(!noexcept(intco = InheritsNonTrivialCopyOnly()), ""); + ContainsNonTrivialCopyOnly cntco; + static_assert(!noexcept(cntco = ContainsNonTrivialCopyOnly()), ""); + + ContainsConst cc; + cc = ContainsConst(); // expected-error {{no viable}} + + ContainsRef cr; + cr = ContainsRef(); // expected-error {{no viable}} + + DirectVirtualBase dvb; + dvb = DirectVirtualBase(); // expected-error {{no viable}} + + IndirectVirtualBase ivb; + ivb = IndirectVirtualBase(); // expected-error {{no viable}} +} + +struct ContainsRValueRef { + int&& ri; + ContainsRValueRef() noexcept; +}; + +void test_contains_rref() { + (ContainsRValueRef(ContainsRValueRef())); +} diff --git a/test/CXX/special/class.copy/p11.0x.copy.cpp b/test/CXX/special/class.copy/p11.0x.copy.cpp new file mode 100644 index 000000000000..752872adb9f5 --- /dev/null +++ b/test/CXX/special/class.copy/p11.0x.copy.cpp @@ -0,0 +1,90 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +struct NonTrivial { + NonTrivial(const NonTrivial&); +}; + +union DeletedNTVariant { // expected-note{{here}} + NonTrivial NT; + DeletedNTVariant(); +}; +DeletedNTVariant DVa; +DeletedNTVariant DVb(DVa); // expected-error{{call to deleted constructor}} + +struct DeletedNTVariant2 { // expected-note{{here}} + union { + NonTrivial NT; + }; + DeletedNTVariant2(); +}; +DeletedNTVariant2 DV2a; +DeletedNTVariant2 DV2b(DV2a); // expected-error{{call to deleted constructor}} + +struct NoAccess { + NoAccess() = default; +private: + NoAccess(const NoAccess&); + + friend struct HasAccess; +}; + +struct HasNoAccess { // expected-note{{here}} + NoAccess NA; +}; +HasNoAccess HNAa; +HasNoAccess HNAb(HNAa); // expected-error{{call to deleted constructor}} + +struct HasAccess { + NoAccess NA; +}; + +HasAccess HAa; +HasAccess HAb(HAa); + +struct NonConst { + NonConst(NonConst&); +}; +struct Ambiguity { + Ambiguity(const Ambiguity&); + Ambiguity(volatile Ambiguity&); +}; + +struct IsAmbiguous { // expected-note{{here}} + NonConst NC; + Ambiguity A; + IsAmbiguous(); +}; +IsAmbiguous IAa; +IsAmbiguous IAb(IAa); // expected-error{{call to deleted constructor}} + +struct Deleted { // expected-note{{here}} + IsAmbiguous IA; +}; +Deleted Da; +Deleted Db(Da); // expected-error{{call to deleted constructor}} + +struct NoAccessDtor { +private: + ~NoAccessDtor(); + friend struct HasAccessDtor; +}; + +struct HasNoAccessDtor { // expected-note{{here}} + NoAccessDtor NAD; + HasNoAccessDtor(); + ~HasNoAccessDtor(); +}; +HasNoAccessDtor HNADa; +HasNoAccessDtor HNADb(HNADa); // expected-error{{call to deleted constructor}} + +struct HasAccessDtor { + NoAccessDtor NAD; +}; +HasAccessDtor HADa; +HasAccessDtor HADb(HADa); + +struct RValue { // expected-note{{here}} + int && ri = 1; +}; +RValue RVa; +RValue RVb(RVa); // expected-error{{call to deleted constructor}} diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp new file mode 100644 index 000000000000..402bc31d5eec --- /dev/null +++ b/test/CXX/special/class.copy/p11.0x.move.cpp @@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +struct NonTrivial { + NonTrivial(NonTrivial&&); +}; + +union DeletedNTVariant { + NonTrivial NT; + DeletedNTVariant(DeletedNTVariant&&); +}; +DeletedNTVariant::DeletedNTVariant(DeletedNTVariant&&) = default; // expected-error{{would delete}} + +struct DeletedNTVariant2 { + union { + NonTrivial NT; + }; + DeletedNTVariant2(DeletedNTVariant2&&); +}; +DeletedNTVariant2::DeletedNTVariant2(DeletedNTVariant2&&) = default; // expected-error{{would delete}} + +struct NoAccess { + NoAccess() = default; +private: + NoAccess(NoAccess&&); + + friend struct HasAccess; +}; + +struct HasNoAccess { + NoAccess NA; + HasNoAccess(HasNoAccess&&); +}; +HasNoAccess::HasNoAccess(HasNoAccess&&) = default; // expected-error{{would delete}} + +struct HasAccess { + NoAccess NA; + HasAccess(HasAccess&&); +}; +HasAccess::HasAccess(HasAccess&&) = default; + +struct NoAccessDtor { + NoAccessDtor(NoAccessDtor&&); +private: + ~NoAccessDtor(); + friend struct HasAccessDtor; +}; + +struct HasNoAccessDtor { + NoAccessDtor NAD; + HasNoAccessDtor(HasNoAccessDtor&&); +}; +HasNoAccessDtor::HasNoAccessDtor(HasNoAccessDtor&&) = default; // expected-error{{would delete}} + +struct HasAccessDtor { + NoAccessDtor NAD; + HasAccessDtor(HasAccessDtor&&); +}; +HasAccessDtor::HasAccessDtor(HasAccessDtor&&) = default; + +struct RValue { + int &&ri = 1; + RValue(RValue&&); +}; +RValue::RValue(RValue&&) = default; + +struct CopyOnly { + CopyOnly(const CopyOnly&); +}; + +struct NonMove { + CopyOnly CO; + NonMove(NonMove&&); +}; +NonMove::NonMove(NonMove&&) = default; // expected-error{{would delete}} + +struct Moveable { + Moveable(); + Moveable(Moveable&&); +}; + +struct HasMove { + Moveable M; + HasMove(HasMove&&); +}; +HasMove::HasMove(HasMove&&) = default; diff --git a/test/CXX/special/class.copy/p15-0x.cpp b/test/CXX/special/class.copy/p15-0x.cpp new file mode 100644 index 000000000000..32b2714fd702 --- /dev/null +++ b/test/CXX/special/class.copy/p15-0x.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +namespace PR10622 { + struct foo { + const int first; + foo(const foo&) = default; + }; + void find_or_insert(const foo& __obj) { + foo x(__obj); + } + + struct bar : foo { + bar(const bar&) = default; + }; + void test_bar(const bar &obj) { + bar obj2(obj); + } +} diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp index b196865c8225..b66e19ab4c4f 100644 --- a/test/CXX/special/class.copy/p33-0x.cpp +++ b/test/CXX/special/class.copy/p33-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fsyntax-only -verify %s class X { X(const X&); diff --git a/test/CXX/special/class.ctor/p4-0x.cpp b/test/CXX/special/class.ctor/p4-0x.cpp index e3508e2e8c47..509beb490302 100644 --- a/test/CXX/special/class.ctor/p4-0x.cpp +++ b/test/CXX/special/class.ctor/p4-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // A constructor shall not be declared with a ref-qualifier. struct X { diff --git a/test/CXX/special/class.ctor/p5-0x.cpp b/test/CXX/special/class.ctor/p5-0x.cpp index 2123d1662358..de2dea5be16b 100644 --- a/test/CXX/special/class.ctor/p5-0x.cpp +++ b/test/CXX/special/class.ctor/p5-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct DefaultedDefCtor1 {}; struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; }; @@ -23,10 +23,6 @@ int n; // default constructor, union Deleted1a { UserProvidedDefCtor u; }; // expected-note {{deleted here}} Deleted1a d1a; // expected-error {{deleted constructor}} -// FIXME: treating this as having a deleted default constructor is probably a -// bug in the standard. -union Deleted1b { UserProvidedDefCtor u = UserProvidedDefCtor(); }; // expected-note {{deleted here}} -Deleted1b d1b; // expected-error {{deleted constructor}} union NotDeleted1a { DefaultedDefCtor1 nu; }; NotDeleted1a nd1a; // FIXME: clang implements the pre-FDIS rule, under which DefaultedDefCtor2's diff --git a/test/CXX/special/class.dtor/p2-0x.cpp b/test/CXX/special/class.dtor/p2-0x.cpp index 53a2e033efc1..c7b1b586fbcb 100644 --- a/test/CXX/special/class.dtor/p2-0x.cpp +++ b/test/CXX/special/class.dtor/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // A destructor shall not be declared with a ref-qualifier. struct X { diff --git a/test/CXX/special/class.dtor/p3-0x.cpp b/test/CXX/special/class.dtor/p3-0x.cpp index 6cdd167983bc..44bf5aa01978 100644 --- a/test/CXX/special/class.dtor/p3-0x.cpp +++ b/test/CXX/special/class.dtor/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s struct A { ~A(); diff --git a/test/CXX/special/class.inhctor/elsewhere.cpp b/test/CXX/special/class.inhctor/elsewhere.cpp index 82944d65dfd1..60cfff80889e 100644 --- a/test/CXX/special/class.inhctor/elsewhere.cpp +++ b/test/CXX/special/class.inhctor/elsewhere.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Tests related to constructor inheriting, but not specified in [class.inhctor] diff --git a/test/CXX/special/class.inhctor/p3.cpp b/test/CXX/special/class.inhctor/p3.cpp index 021f701ab495..989c17c8b462 100644 --- a/test/CXX/special/class.inhctor/p3.cpp +++ b/test/CXX/special/class.inhctor/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct B1 { B1(int); @@ -14,7 +14,7 @@ D1 fd1() { return 1; } struct B2 { explicit B2(int, int = 0, int = 0); }; -struct D2 : B2 { // expected-note {{candidate constructor}} +struct D2 : B2 { // expected-note 2 {{candidate constructor}} using B2::B2; }; D2 d2a(1), d2b(1, 1), d2c(1, 1, 1); @@ -24,7 +24,7 @@ D2 fd2() { return 1; } // expected-error {{no viable conversion}} struct B3 { B3(void*); // expected-note {{inherited from here}} }; -struct D3 : B3 { // expected-note {{candidate constructor}} +struct D3 : B3 { // expected-note 2 {{candidate constructor}} using B3::B3; // expected-note {{candidate constructor (inherited)}} }; D3 fd3() { return 1; } // expected-error {{no viable conversion}} diff --git a/test/CXX/special/class.inhctor/p7.cpp b/test/CXX/special/class.inhctor/p7.cpp index 3ad761f08baa..736754d8a3e3 100644 --- a/test/CXX/special/class.inhctor/p7.cpp +++ b/test/CXX/special/class.inhctor/p7.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Straight from the standard struct B1 { diff --git a/test/CXX/special/class.init/class.base.init/p8-0x.cpp b/test/CXX/special/class.init/class.base.init/p8-0x.cpp index 8512a9f7bb3a..3e26e4992d0d 100644 --- a/test/CXX/special/class.init/class.base.init/p8-0x.cpp +++ b/test/CXX/special/class.init/class.base.init/p8-0x.cpp @@ -1,15 +1,19 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s int n; struct S { int &a; // expected-note 2{{here}} int &b = n; + union { + const int k = 42; + }; + S() {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}} S(int) : a(n) {} // ok S(char) : b(n) {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}} S(double) : a(n), b(n) {} // ok -}; +} s(0); union U { int a = 0; @@ -21,3 +25,35 @@ union U { U(char) : b('y') {} // desired-error {{at most one member of a union may be initialized}} U(double) : a(1), b('y') {} // desired-error {{at most one member of a union may be initialized}} }; + +// PR10954: variant members do not acquire an implicit initializer. +namespace VariantMembers { + struct NoDefaultCtor { + NoDefaultCtor(int); + }; + union V { + NoDefaultCtor ndc; + int n; + + V() {} + V(int n) : n(n) {} + V(int n, bool) : ndc(n) {} + }; + struct K { + union { + NoDefaultCtor ndc; + int n; + }; + K() {} + K(int n) : n(n) {} + K(int n, bool) : ndc(n) {} + }; + struct Nested { + Nested() {} + union { + struct { + NoDefaultCtor ndc; + }; + }; + }; +} diff --git a/test/CXX/special/class.init/class.base.init/p9-0x.cpp b/test/CXX/special/class.init/class.base.init/p9-0x.cpp index 039b1c271a3d..ca5e8072d82f 100644 --- a/test/CXX/special/class.init/class.base.init/p9-0x.cpp +++ b/test/CXX/special/class.init/class.base.init/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++0x %s -O1 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++11 %s -O1 -emit-llvm -o - | FileCheck %s struct S { int n = 10; diff --git a/test/CXX/special/class.temporary/p1.cpp b/test/CXX/special/class.temporary/p1.cpp new file mode 100644 index 000000000000..384b1f89fda8 --- /dev/null +++ b/test/CXX/special/class.temporary/p1.cpp @@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +namespace test0 { + struct A { + A() = default; + int x; + int y; + + A(const A&) = delete; // expected-note {{function has been explicitly marked deleted here}} + }; + + void foo(...); + + void test() { + A a; + foo(a); // expected-error {{call to deleted constructor of 'test0::A'}} + } +} + +namespace test1 { + struct A { + A() = default; + int x; + int y; + + private: + A(const A&) = default; // expected-note {{declared private here}} + }; + + void foo(...); + + void test() { + A a; + // FIXME: this error about variadics is bogus + foo(a); // expected-error {{calling a private constructor of class 'test1::A'}} expected-error {{cannot pass object of non-trivial type 'test1::A' through variadic function}} + } +} + +// Don't enforce this in an unevaluated context. +namespace test2 { + struct A { + A(const A&) = delete; // expected-note {{marked deleted here}} + }; + + typedef char one[1]; + typedef char two[2]; + + one &meta(bool); + two &meta(...); + + void a(A &a) { + char check[sizeof(meta(a)) == 2 ? 1 : -1]; + } + + void b(A &a) { + meta(a); // expected-error {{call to deleted constructor}} + } +} diff --git a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp index 40b4c23841c8..574cb40c4670 100644 --- a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp +++ b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // PR10034 struct X {}; diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp index 0c92f62582cf..b157fd4b0f92 100644 --- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp +++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s namespace std { template<typename T> @@ -21,7 +21,7 @@ namespace std { using namespace inner; } -struct A { // expected-note {{candidate constructor}} +struct A { // expected-note 2 {{candidate constructor}} A(); int *begin(); // expected-note 3{{selected 'begin' function with iterator type 'int *'}} expected-note {{'begin' declared here}} int *end(); @@ -100,8 +100,7 @@ void g() { for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'extern'}} for (static int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'static'}} for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} - // FIXME: when clang supports constexpr, this should be rejected. - for (constexpr int a : A()) {} // desired-error {{loop variable 'a' may not be declared 'constexpr'}} + for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}} struct NoBeginADL { null_t alt_end(); diff --git a/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp index 794a0502582b..1c13bffa212f 100644 --- a/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp +++ b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template <class T> struct eval; // expected-note 3{{template is declared here}} diff --git a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp index 6f6286f71078..b03ed46e92f0 100644 --- a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp +++ b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // C++03 imposed restrictions in this paragraph that were lifted with 0x, so we // just test that the example given now parses cleanly. diff --git a/test/CXX/temp/temp.decls/p3.cpp b/test/CXX/temp/temp.decls/p3.cpp index 54800e4061ee..41811ff16531 100644 --- a/test/CXX/temp/temp.decls/p3.cpp +++ b/test/CXX/temp/temp.decls/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> using A = int; template<typename T> using A<T*> = char; // expected-error {{partial specialization of alias templates is not permitted}} diff --git a/test/CXX/temp/temp.decls/temp.alias/p1.cpp b/test/CXX/temp/temp.decls/temp.alias/p1.cpp index 80079b33a53b..966e3c10e5de 100644 --- a/test/CXX/temp/temp.decls/temp.alias/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.alias/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> using U = T; diff --git a/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/test/CXX/temp/temp.decls/temp.alias/p2.cpp index e145727a8dd7..a5b39fe5c51f 100644 --- a/test/CXX/temp/temp.decls/temp.alias/p2.cpp +++ b/test/CXX/temp/temp.decls/temp.alias/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> using U = T; diff --git a/test/CXX/temp/temp.decls/temp.alias/p3.cpp b/test/CXX/temp/temp.decls/temp.alias/p3.cpp index 2e9e55cdcb6b..afd9b4b0de30 100644 --- a/test/CXX/temp/temp.decls/temp.alias/p3.cpp +++ b/test/CXX/temp/temp.decls/temp.alias/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // The example given in the standard (this is rejected for other reasons anyway). template<class T> struct A; diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp index 14152cf339a8..aa1e2d443fdd 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<int ...Values> struct X1; diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp index d8e07b83e1be..b754368600aa 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // -- The argument list of the specialization shall not be identical // to the implicit argument list of the primary template. diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp index 11ec28918e42..63909fb7cdbd 100644 --- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Core DR 532. namespace PR8130 { diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp index 578de2952d94..63f569be0861 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -332,3 +332,27 @@ namespace test15 { template class B<int>; // expected-note {{in instantiation}} } + +namespace PR10913 { + template<class T> class X; + + template<class T> void f(X<T> *x) { + x->member = 0; + } + + template<class U, class T> void f2(X<T> *x) { + x->member = 0; // expected-error{{'member' is a protected member of 'PR10913::X<int>'}} + } + + template<class T> class X { + friend void f<T>(X<T> *x); + friend void f2<T>(X<int> *x); + + protected: + int member; // expected-note{{declared protected here}} + }; + + template void f(X<int> *); + template void f2<int>(X<int> *); + template void f2<float>(X<int> *); // expected-note{{in instantiation of function template specialization 'PR10913::f2<float, int>' requested here}} +} diff --git a/test/CXX/temp/temp.decls/temp.mem/p5.cpp b/test/CXX/temp/temp.decls/temp.mem/p5.cpp index a188f05d535e..8bcd773ee98b 100644 --- a/test/CXX/temp/temp.decls/temp.mem/p5.cpp +++ b/test/CXX/temp/temp.decls/temp.mem/p5.cpp @@ -63,7 +63,8 @@ struct X0 { template<typename T> operator const T*() const { T x = T(); - return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}} + return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}} \ + // expected-error{{cannot initialize return object of type 'const int *' with an lvalue of type 'int'}} } }; @@ -72,7 +73,7 @@ template X0::operator const int*(); // expected-note{{'X0::operator const int *< template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template}} void test_X0(X0 x0, const X0 &x0c) { - x0.operator const int*(); + x0.operator const int*(); // expected-note{{in instantiation of function template specialization}} x0.operator float *(); x0c.operator const char*(); } diff --git a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp index 383e268054b6..fec8060955e3 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s namespace DeductionForInstantiation { template<unsigned I, typename ...Types> diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp index 83db1719b769..db28eea98a54 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Example bind implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp index b3d010c88d95..e15203abc615 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Example function implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp index 3b4bd7777d55..9de5fa84b48a 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Example tuple implementation from the variadic templates proposal, // ISO C++ committee document number N2080. diff --git a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp index 7375f98ec9c3..6d9d8c50af68 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fblocks -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fblocks -fsyntax-only -verify %s // Tests the use of blocks with variadic templates. template<typename ...Args> diff --git a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp index a76ef8067dfd..b5786acf82a2 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Check for declaration matching with out-of-line declarations and // variadic templates, which involves proper computation of the diff --git a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp index d80182c1b657..73cbd0749cbd 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // This is a collection of various template metafunctions involving // variadic templates, which are meant to exercise common use cases. diff --git a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp index cda9ac8b045c..21aa24fb522d 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T, T ...Values> struct value_tuple {}; template<typename...> struct tuple { }; @@ -234,3 +234,18 @@ namespace ExpandingFunctionParameters { x1.f(17, 3.14159); } } + +namespace PR10230 { + template<typename> + struct s + { + template<typename... Args> + auto f() -> int(&)[sizeof...(Args)]; + }; + + void main() + { + int (&ir1)[1] = s<int>().f<int>(); + int (&ir3)[3] = s<int>().f<int, float, double>(); + } +} diff --git a/test/CXX/temp/temp.decls/temp.variadic/p1.cpp b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp index 02f4c59b760b..daff9d189690 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<class ...Types> struct Tuple; diff --git a/test/CXX/temp/temp.decls/temp.variadic/p2.cpp b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp index 100ae2c52f9a..ce19582c2282 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/p2.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<class ... Types> void f(Types ... args); diff --git a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp index 71839727e0d1..05e492167cbe 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -fcxx-exceptions -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s template<typename... Types> struct tuple; template<int I> struct int_c; @@ -52,6 +52,7 @@ struct HasMixins : public Mixins... { }; struct A { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const A' for 1st argument}} \ +// expected-note{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'A' for 1st argument}} \ // expected-note{{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}} struct B { }; struct C { }; diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp index 25338e3bae67..0f409e709e98 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fblocks -fms-extensions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify %s template<typename T, typename U> struct pair; template<typename ...> struct tuple; diff --git a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp index 989ff9f6d9f5..79340c3741a8 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Check for template type parameter pack (mis-)matches with template // type parameters. diff --git a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp index 372317838e74..71bd6aa8eb52 100644 --- a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp +++ b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Various tests related to partial ordering of variadic templates. template<typename ...Types> struct tuple; diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp index 46d70b671f6e..4d29b740d803 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s namespace ParameterPacksWithFunctions { template<typename ...> struct count; diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp index 1140aaee6c17..de3b44f1b513 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp @@ -29,8 +29,8 @@ struct is_same<T, T> { int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1]; int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1]; -template <typename T> void g(T); // expected-note{{candidate function}} -template <typename T> void g(T, T); // expected-note{{candidate function}} +template <typename T> void g(T); // expected-note{{possible target for call}} +template <typename T> void g(T, T); // expected-note{{possible target for call}} int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \ - // expected-error{{cannot resolve overloaded function 'g' from context}} + // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp index b38cc2760937..81addfe4bdcd 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Metafunction to extract the Nth type from a set of types. template<unsigned N, typename ...Types> struct get_nth_type; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp index d3af0d4b9132..c14b063ab746 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s #if !__has_feature(cxx_access_control_sfinae) # error No support for access control as part of SFINAE? diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp index 8933b63ee6df..8b192fa547b2 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Metafunction to extract the Nth type from a set of types. template<unsigned N, typename ...Types> struct get_nth_type; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp index f18a74a1e4ef..e470dd016644 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // If P is an rvalue reference to a cv-unqualified template parameter diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp new file mode 100644 index 000000000000..9236efce2b83 --- /dev/null +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace PR8598 { + template<class T> struct identity { typedef T type; }; + + template<class T, class C> + void f(T C::*, typename identity<T>::type*){} + + struct X { void f() {}; }; + + void g() { (f)(&X::f, 0); } +} diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp index 116810082d9f..b96530056b2c 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Note: Partial ordering of function templates containing template // parameter packs is independent of the number of deduced arguments diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp index 46ea4db779ce..f204caf57abd 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> int &f0(T&); template<typename T> float &f0(T&&); diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp index 9d342c8f8ed6..8183061a8ab4 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> void f(T&&); template<> void f(int&) { } void (*fp)(int&) = &f; diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp index 198f11fe5298..5b031c24ed71 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // If type deduction cannot be done for any P/A pair, or if for any // pair the deduction leads to more than one possible set of deduced diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp index 247b98113ae5..4e98a6d15e1a 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Note: Template argument deduction involving parameter packs // (14.5.3) can deduce zero or more arguments for each parameter pack. diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp index 4326a691cb2e..fcc6cf7ec732 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // If the original function parameter associated with A is a function // parameter pack and the function parameter associated with P is not diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp index cf68a01a3593..c819d973a941 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // FIXME: More bullets to go! diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp index a9173fd6be86..a6b1172afccc 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // Deductions specific to C++0x. diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp index 508722437c39..7774b5c77fa8 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename ...Types> struct tuple; template<unsigned> struct unsigned_c; diff --git a/test/CXX/temp/temp.param/p10-0x.cpp b/test/CXX/temp/temp.param/p10-0x.cpp index bc7e616fb13d..37bb284a36eb 100644 --- a/test/CXX/temp/temp.param/p10-0x.cpp +++ b/test/CXX/temp/temp.param/p10-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<typename> struct Y1; template<typename, int> struct Y2; diff --git a/test/CXX/temp/temp.param/p11-0x.cpp b/test/CXX/temp/temp.param/p11-0x.cpp index 10a44380c8d1..1971aa10c2c7 100644 --- a/test/CXX/temp/temp.param/p11-0x.cpp +++ b/test/CXX/temp/temp.param/p11-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // If a template-parameter of a class template or alias template has a default // template-argument, each subsequent template-parameter shall either have a diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp index f4be5b960b6c..5fc57a43f541 100644 --- a/test/CXX/temp/temp.param/p15-cxx0x.cpp +++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s template<typename T> struct X; template<int I> struct Y; diff --git a/test/CXX/temp/temp.param/p15.cpp b/test/CXX/temp/temp.param/p15.cpp index 13087791a3db..ee572e986b93 100644 --- a/test/CXX/temp/temp.param/p15.cpp +++ b/test/CXX/temp/temp.param/p15.cpp @@ -9,4 +9,4 @@ X<X<X<X<int>> // expected-error{{a space is required between consecutive right a >> *x3; // expected-error{{a space is required between consecutive right angle brackets (use '> >')}} Y<(1 >> 2)> *y1; -Y<1 >> 2> *y2; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}} +Y<1 >> 2> *y2; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++11}} diff --git a/test/CXX/temp/temp.param/p9-0x.cpp b/test/CXX/temp/temp.param/p9-0x.cpp index 1dc6640fe266..29a7549a8f1a 100644 --- a/test/CXX/temp/temp.param/p9-0x.cpp +++ b/test/CXX/temp/temp.param/p9-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // A default template-argument may be specified for any kind of // template-parameter that is not a template parameter pack. diff --git a/test/CXX/temp/temp.param/p9.cpp b/test/CXX/temp/temp.param/p9.cpp index 62af522cd2c9..b2318c275e44 100644 --- a/test/CXX/temp/temp.param/p9.cpp +++ b/test/CXX/temp/temp.param/p9.cpp @@ -2,9 +2,9 @@ // A default template-argument shall not be specified in a function // template declaration or a function template definition -template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}} +template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}} void foo0(T); -template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}} +template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}} void foo1(T) { } // [...] nor in the template-parameter-list of the definition of a diff --git a/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp b/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp index 1d1d350cf337..81b070f040ee 100644 --- a/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp +++ b/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Examples from CWG1056. namespace Example1 { diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp index 4a17ceca7cb6..acfbb46447de 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // This test creates cases where implicit instantiations of various entities // would cause a diagnostic, but provides expliict specializations for those diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp index a4caceae4954..97e78fd791fa 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp @@ -1,10 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s template<typename T> struct X { void f() {} }; -template inline void X<int>::f(); // expected-error{{'inline'}} +template inline void X<int>::f(); // expected-error{{explicit instantiation cannot be 'inline'}} -// FIXME: test constexpr +template<typename T> +struct Y { + constexpr int f() { return 0; } +}; + +template constexpr int Y<int>::f(); // expected-error{{explicit instantiation cannot be 'constexpr'}} diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp index fdb922abcf9b..1028830abe75 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -verify %s +// RUN: %clang_cc1 -std=c++11 -verify %s // If the name declared in the explicit instantiation is an // unqualified name, the explicit instantiation shall appear in the diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp index 57b012f9a946..04e7df5741e2 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -O1 -emit-llvm -std=c++0x -o - %s | FileCheck %s +// RUN: %clang_cc1 -O1 -emit-llvm -std=c++11 -o - %s | FileCheck %s template<typename T> struct X0 { diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp index ad973bb7c589..86490175f0c3 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s template<typename T> struct X0 { diff --git a/test/CXX/temp/temp.type/p1-0x.cpp b/test/CXX/temp/temp.type/p1-0x.cpp index c22af22f9865..35d00c2fab20 100644 --- a/test/CXX/temp/temp.type/p1-0x.cpp +++ b/test/CXX/temp/temp.type/p1-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace Old { template<template<class> class TT> struct X { }; diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c index 1b446b7d92ca..473e85847e56 100644 --- a/test/CodeCompletion/truncation.c +++ b/test/CodeCompletion/truncation.c @@ -1,18 +1,15 @@ #include "truncation.c.h" -struct - /* foo */ +struct + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s // CHECK-CC1: X // CHECK-CC1-NEXT: Y -// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:8 -o - %s | FileCheck -check-prefix=CC2 %s // CHECK-CC2: X // CHECK-CC2: Xa // CHECK-CC2: Y -// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:3 -o - %s | FileCheck -check-prefix=CC3 %s -// CHECK-CC3: X -// CHECK-CC3: Xa -// CHECK-CC3: Y +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:3:3 -o - %s diff --git a/test/CodeGen/2002-01-23-LoadQISIReloadFailure.c b/test/CodeGen/2002-01-23-LoadQISIReloadFailure.c new file mode 100644 index 000000000000..ec454c826835 --- /dev/null +++ b/test/CodeGen/2002-01-23-LoadQISIReloadFailure.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* Regression test. Just compile .c -> .ll to test */ +int foo(void) { + unsigned char *pp; + unsigned w_cnt; + + w_cnt += *pp; + + return w_cnt; +} diff --git a/test/CodeGen/2002-01-24-ComplexSpaceInType.c b/test/CodeGen/2002-01-24-ComplexSpaceInType.c new file mode 100644 index 000000000000..9af533dfa414 --- /dev/null +++ b/test/CodeGen/2002-01-24-ComplexSpaceInType.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// This caused generation of the following type name: +// %Array = uninitialized global [10 x %complex int] +// +// which caused problems because of the space int the complex int type +// + +struct { int X, Y; } Array[10]; + +void foo() {} diff --git a/test/CodeGen/2002-01-24-HandleCallInsnSEGV.c b/test/CodeGen/2002-01-24-HandleCallInsnSEGV.c new file mode 100644 index 000000000000..739a841bbdff --- /dev/null +++ b/test/CodeGen/2002-01-24-HandleCallInsnSEGV.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void *dlclose(void*); + +void ap_os_dso_unload(void *handle) +{ + dlclose(handle); + return; /* This return triggers the bug: Weird */ +} diff --git a/test/CodeGen/2002-02-13-ConditionalInCall.c b/test/CodeGen/2002-02-13-ConditionalInCall.c new file mode 100644 index 000000000000..d389371dd323 --- /dev/null +++ b/test/CodeGen/2002-02-13-ConditionalInCall.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* Test problem where bad code was generated with a ?: statement was + in a function call argument */ + +void foo(int, double, float); + +void bar(int x) { + foo(x, x ? 1.0 : 12.5, 1.0f); +} + diff --git a/test/CodeGen/2002-02-13-ReloadProblem.c b/test/CodeGen/2002-02-13-ReloadProblem.c new file mode 100644 index 000000000000..da7f5e4fe00c --- /dev/null +++ b/test/CodeGen/2002-02-13-ReloadProblem.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* This triggered a problem in reload, fixed by disabling most of the + * steps of compilation in GCC. Before this change, the code went through + * the entire backend of GCC, even though it was unnecessary for LLVM output + * now it is skipped entirely, and since reload doesn't run, it can't cause + * a problem. + */ + +extern int tolower(int); + +const char *rangematch(const char *pattern, int test, int c) { + + if ((c <= test) | (tolower(c) <= tolower((unsigned char)test))) + return 0; + + return pattern; +} diff --git a/test/CodeGen/2002-02-13-TypeVarNameCollision.c b/test/CodeGen/2002-02-13-TypeVarNameCollision.c new file mode 100644 index 000000000000..c76aef05109f --- /dev/null +++ b/test/CodeGen/2002-02-13-TypeVarNameCollision.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* This testcase causes a symbol table collision. Type names and variable + * names should be in distinct namespaces + */ + +typedef struct foo { + int X, Y; +} FOO; + +static FOO foo[100]; + +int test() { + return foo[4].Y; +} + diff --git a/test/CodeGen/2002-02-13-UnnamedLocal.c b/test/CodeGen/2002-02-13-UnnamedLocal.c new file mode 100644 index 000000000000..58a9f5ab1c0b --- /dev/null +++ b/test/CodeGen/2002-02-13-UnnamedLocal.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* Testcase for a problem where GCC allocated xqic to a register, + * and did not have a VAR_DECL that explained the stack slot to LLVM. + * Now the LLVM code synthesizes a stack slot if one is presented that + * has not been previously recognized. This is where alloca's named + * 'local' come from now. + */ + +typedef struct { + short x; +} foostruct; + +int foo(foostruct ic); + +void test() { + foostruct xqic; + foo(xqic); +} + + diff --git a/test/CodeGen/2002-02-14-EntryNodePreds.c b/test/CodeGen/2002-02-14-EntryNodePreds.c new file mode 100644 index 000000000000..60d1104f9667 --- /dev/null +++ b/test/CodeGen/2002-02-14-EntryNodePreds.c @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC Used to generate code that contained a branch to the entry node of + * the do_merge function. This is illegal LLVM code. To fix this, GCC now + * inserts an entry node regardless of whether or not it has to insert allocas. + */ + +struct edge_rec +{ + struct VERTEX *v; + struct edge_rec *next; + int wasseen; + int more_data; +}; + +typedef struct edge_rec *QUAD_EDGE; + +typedef struct { + QUAD_EDGE left, right; +} EDGE_PAIR; + +struct EDGE_STACK { + int ptr; + QUAD_EDGE *elts; + int stack_size; +}; + +int do_merge(QUAD_EDGE ldo, QUAD_EDGE rdo) { + int lvalid; + QUAD_EDGE basel,rcand; + while (1) { + if (!lvalid) { + return (int)basel->next; + } + } +} + diff --git a/test/CodeGen/2002-02-16-RenamingTest.c b/test/CodeGen/2002-02-16-RenamingTest.c new file mode 100644 index 000000000000..bb23e680f25a --- /dev/null +++ b/test/CodeGen/2002-02-16-RenamingTest.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* test that locals are renamed with . notation */ + +void abc(void *); + +void Test5(double X) { + abc(&X); + { + int X; + abc(&X); + { + float X; + abc(&X); + } + } +} + diff --git a/test/CodeGen/2002-02-17-ArgumentAddress.c b/test/CodeGen/2002-02-17-ArgumentAddress.c new file mode 100644 index 000000000000..d1ad6a885ee1 --- /dev/null +++ b/test/CodeGen/2002-02-17-ArgumentAddress.c @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int test(int X) { + return X; +} + +void abc(int *X); +int def(int Y, int Z) { + abc(&Z); + return Y; +} + +struct Test { short X, x; int Y, Z; }; + +int Testing(struct Test *A) { + return A->X+A->Y; +} + +int Test2(int X, struct Test A, int Y) { + return X+Y+A.X+A.Y; +} +int Test3(struct Test A, struct Test B) { + return A.X+A.Y+B.Y+B.Z; +} + +struct Test Test4(struct Test A) { + return A; +} + +int Test6() { + int B[200]; + return B[4]; +} + +struct STest2 { int X; short Y[4]; double Z; }; + +struct STest2 Test7(struct STest2 X) { + return X; +} diff --git a/test/CodeGen/2002-02-18-64bitConstant.c b/test/CodeGen/2002-02-18-64bitConstant.c new file mode 100644 index 000000000000..95da72dc30a3 --- /dev/null +++ b/test/CodeGen/2002-02-18-64bitConstant.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC wasn't handling 64 bit constants right fixed */ + +int printf(const char * restrict format, ...); + +int main() { + long long Var = 123455678902ll; + printf("%lld\n", Var); +} diff --git a/test/CodeGen/2002-02-18-StaticData.c b/test/CodeGen/2002-02-18-StaticData.c new file mode 100644 index 000000000000..d0cf52477252 --- /dev/null +++ b/test/CodeGen/2002-02-18-StaticData.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +double FOO = 17; +double BAR = 12.0; +float XX = 12.0f; + +static char *procnames[] = { + "EXIT" +}; + +void *Data[] = { &FOO, &BAR, &XX }; + diff --git a/test/CodeGen/2002-03-11-LargeCharInString.c b/test/CodeGen/2002-03-11-LargeCharInString.c new file mode 100644 index 000000000000..927087349bcb --- /dev/null +++ b/test/CodeGen/2002-03-11-LargeCharInString.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int strcmp(const char *s1, const char *s2); + +int test(char *X) { + /* LLVM-GCC used to emit: + %.LC0 = internal global [3 x sbyte] c"\1F\FFFFFF8B\00" + */ + return strcmp(X, "\037\213"); +} diff --git a/test/CodeGen/2002-03-12-ArrayInitialization.c b/test/CodeGen/2002-03-12-ArrayInitialization.c new file mode 100644 index 000000000000..f05b83861bab --- /dev/null +++ b/test/CodeGen/2002-03-12-ArrayInitialization.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC would generate bad code if not enough initializers are + specified for an array. + */ + +int a[10] = { 0, 2}; + +char str[10] = "x"; + +void *Arr[5] = { 0, 0 }; + +float F[12] = { 1.23f, 34.7f }; + +struct Test { int X; double Y; }; + +struct Test Array[10] = { { 2, 12.0 }, { 3, 24.0 } }; + +int B[4][4] = { { 1, 2, 3, 4}, { 5, 6, 7 }, { 8, 9 } }; diff --git a/test/CodeGen/2002-03-12-StructInitialize.c b/test/CodeGen/2002-03-12-StructInitialize.c new file mode 100644 index 000000000000..1316fbbd0e4a --- /dev/null +++ b/test/CodeGen/2002-03-12-StructInitialize.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +typedef struct Connection_Type { + long to; + char type[10]; + long length; +} Connection; + +Connection link[3] += { {1, "link1", 10}, + {2, "link2", 20}, + {3, "link3", 30} }; + diff --git a/test/CodeGen/2002-03-12-StructInitializer.c b/test/CodeGen/2002-03-12-StructInitializer.c new file mode 100644 index 000000000000..a65675b13786 --- /dev/null +++ b/test/CodeGen/2002-03-12-StructInitializer.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC was not emitting string constants of the correct length when + * embedded into a structure field like this. It thought the strlength + * was -1. + */ + +typedef struct Connection_Type { + long to; + char type[10]; + long length; +} Connection; + +Connection link[3] += { {1, "link1", 10}, + {2, "link2", 20}, + {3, "link3", 30} }; + diff --git a/test/CodeGen/2002-03-14-BrokenPHINode.c b/test/CodeGen/2002-03-14-BrokenPHINode.c new file mode 100644 index 000000000000..eb058598c505 --- /dev/null +++ b/test/CodeGen/2002-03-14-BrokenPHINode.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC was generating PHI nodes with an arity < #pred of the basic block the + * PHI node lived in. This was breaking LLVM because the number of entries + * in a PHI node must equal the number of predecessors for a basic block. + */ + +int trys(char *s, int x) +{ + int asa; + double Val; + int LLS; + if (x) { + asa = LLS + asa; + } else { + } + return asa+(int)Val; +} + diff --git a/test/CodeGen/2002-03-14-BrokenSSA.c b/test/CodeGen/2002-03-14-BrokenSSA.c new file mode 100644 index 000000000000..65e5cfad815e --- /dev/null +++ b/test/CodeGen/2002-03-14-BrokenSSA.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* This code used to break GCC's SSA computation code. It would create + uses of B & C that are not dominated by their definitions. See: + http://gcc.gnu.org/ml/gcc/2002-03/msg00697.html + */ +int bar(); +int foo() +{ + int a,b,c; + + a = b + c; + b = bar(); + c = bar(); + return a + b + c; +} + diff --git a/test/CodeGen/2002-03-14-QuotesInStrConst.c b/test/CodeGen/2002-03-14-QuotesInStrConst.c new file mode 100644 index 000000000000..de4bdd658078 --- /dev/null +++ b/test/CodeGen/2002-03-14-QuotesInStrConst.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC was not escaping quotes in string constants correctly, so this would + * get emitted: + * %.LC1 = internal global [32 x sbyte] c"*** Word "%s" on line %d is not\00" + */ + +const char *Foo() { + return "*** Word \"%s\" on line %d is not"; +} diff --git a/test/CodeGen/2002-04-07-SwitchStmt.c b/test/CodeGen/2002-04-07-SwitchStmt.c new file mode 100644 index 000000000000..cf1ec79b08a5 --- /dev/null +++ b/test/CodeGen/2002-04-07-SwitchStmt.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int printf(const char *, ...); +int foo(); + +int main() { + while (foo()) { + switch (foo()) { + case 0: + case 1: + case 2: + case 3: + printf("3"); + case 4: printf("4"); + case 5: + case 6: + default: + break; + } + } + return 0; +} diff --git a/test/CodeGen/2002-04-08-LocalArray.c b/test/CodeGen/2002-04-08-LocalArray.c new file mode 100644 index 000000000000..9b5ef7921456 --- /dev/null +++ b/test/CodeGen/2002-04-08-LocalArray.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* GCC is not outputting the static array to the LLVM backend, so bad things + * happen. Note that if this is defined static, everything seems fine. + */ +double test(unsigned X) { + double student_t[30]={0.0 , 12.706 , 4.303 , 3.182 , 2.776 , 2.571 , + 2.447 , 2.365 , 2.306 , 2.262 , 2.228 , + 2.201 , 2.179 , 2.160 , 2.145 , 2.131 , + 2.120 , 2.110 , 2.101 , 2.093 , 2.086 , + 2.080 , 2.074 , 2.069 , 2.064 , 2.060 , + 2.056 , 2.052 , 2.048 , 2.045 }; + return student_t[X]; +} diff --git a/test/CodeGen/2002-04-09-StructRetVal.c b/test/CodeGen/2002-04-09-StructRetVal.c new file mode 100644 index 000000000000..f043ab721095 --- /dev/null +++ b/test/CodeGen/2002-04-09-StructRetVal.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct S { + int i; + short s1, s2; +}; + +struct S func_returning_struct(void); + +void loop(void) { + func_returning_struct(); +} diff --git a/test/CodeGen/2002-04-10-StructParameters.c b/test/CodeGen/2002-04-10-StructParameters.c new file mode 100644 index 000000000000..72cebc64481f --- /dev/null +++ b/test/CodeGen/2002-04-10-StructParameters.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +typedef struct { + char p; + short q; + char r; + int X; + short Y, Z; + int Q; +} foo; + +int test(foo X, float); +int testE(char,short,char,int,int,float); +void test3(foo *X) { + X->q = 1; +} + +void test2(foo Y) { + testE(Y.p, Y.q, Y.r, Y.X, Y.Y, 0.1f); + test(Y, 0.1f); + test2(Y); + test3(&Y); +} + diff --git a/test/CodeGen/2002-05-23-StaticValues.c b/test/CodeGen/2002-05-23-StaticValues.c new file mode 100644 index 000000000000..b8c25b73c71f --- /dev/null +++ b/test/CodeGen/2002-05-23-StaticValues.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* Make sure the frontend is correctly marking static stuff as internal! */ + +int X; +static int Y = 12; + +static void foo(int Z) { + Y = Z; +} + +void *test() { + foo(12); + return &Y; +} diff --git a/test/CodeGen/2002-05-23-TypeNameCollision.c b/test/CodeGen/2002-05-23-TypeNameCollision.c new file mode 100644 index 000000000000..c15c952e7797 --- /dev/null +++ b/test/CodeGen/2002-05-23-TypeNameCollision.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* Testcase for when struct tag conflicts with typedef name... grr */ + +typedef struct foo { + struct foo *X; + int Y; +} * foo; + +foo F1; +struct foo *F2; + +enum bar { test1, test2 }; + +typedef float bar; + +enum bar B1; +bar B2; + diff --git a/test/CodeGen/2002-05-24-Alloca.c b/test/CodeGen/2002-05-24-Alloca.c new file mode 100644 index 000000000000..30ba8bb8e218 --- /dev/null +++ b/test/CodeGen/2002-05-24-Alloca.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef __SIZE_TYPE__ size_t; +void *alloca(size_t size); +char *strcpy(char *restrict s1, const char *restrict s2); +int puts(const char *s); +int main(int argc, char **argv) { + char *C = (char*)alloca(argc); + strcpy(C, argv[0]); + puts(C); +} diff --git a/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c b/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c new file mode 100644 index 000000000000..24c67d1520a1 --- /dev/null +++ b/test/CodeGen/2002-06-25-FWriteInterfaceFailure.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct _IO_FILE FILE; +extern FILE *stderr; +int fprintf(FILE * restrict stream, const char * restrict format, ...); + +void test() { + fprintf(stderr, "testing\n"); +} diff --git a/test/CodeGen/2002-07-14-MiscListTests.c b/test/CodeGen/2002-07-14-MiscListTests.c new file mode 100644 index 000000000000..901701a17654 --- /dev/null +++ b/test/CodeGen/2002-07-14-MiscListTests.c @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// Test list stuff + +void *malloc(unsigned); + +// Test opaque structure support. the list type is defined later +struct list; + +struct list *PassThroughList(struct list *L) { + return L; +} + + +// Recursive data structure tests... + +typedef struct list { + int Data; + struct list *Next; +} list; + +list *Data; + +void foo() { + static int Foo = 0; // Test static local variable + Foo += 1; // Increment static variable + + Data = (list*)malloc(12); // This is not a proper list allocation +} + +extern list ListNode1; +list ListNode3 = { 4, 0 }; +list ListNode2 = { 3, &ListNode3 }; +list ListNode0 = { 1, &ListNode1 }; +list ListNode1 = { 2, &ListNode2 }; + + +list ListArray[10]; + +// Iterative insert fn +void InsertIntoListTail(list **L, int Data) { + while (*L) + L = &(*L)->Next; + *L = (list*)malloc(sizeof(list)); + (*L)->Data = Data; + (*L)->Next = 0; +} + +// Recursive list search fn +list *FindData(list *L, int Data) { + if (L == 0) return 0; + if (L->Data == Data) return L; + return FindData(L->Next, Data); +} + +void foundIt(void); + +// Driver fn... +void DoListStuff() { + list *MyList = 0; + InsertIntoListTail(&MyList, 100); + InsertIntoListTail(&MyList, 12); + InsertIntoListTail(&MyList, 42); + InsertIntoListTail(&MyList, 1123); + InsertIntoListTail(&MyList, 1213); + + if (FindData(MyList, 75)) foundIt(); + if (FindData(MyList, 42)) foundIt(); + if (FindData(MyList, 700)) foundIt(); +} + diff --git a/test/CodeGen/2002-07-14-MiscTests.c b/test/CodeGen/2002-07-14-MiscTests.c new file mode 100644 index 000000000000..2a651248b55c --- /dev/null +++ b/test/CodeGen/2002-07-14-MiscTests.c @@ -0,0 +1,57 @@ +// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null + +/* These are random tests that I used when working on the GCC frontend + originally. */ + +// test floating point comparison! +int floatcomptest(double *X, double *Y, float *x, float *y) { + return *X < *Y || *x < *y; +} + +extern void *malloc(unsigned); + +// Exposed a bug +void *memset_impl(void *dstpp, int c, unsigned len) { + long long int dstp = (long long int) dstpp; + + while (dstp % 4 != 0) + { + ((unsigned char *) dstp)[0] = c; + dstp += 1; + len -= 1; + } + return dstpp; +} + +// TEST problem with signed/unsigned versions of the same constants being shared +// incorrectly! +// +static char *temp; +static int remaining; +static char *localmalloc(int size) { + char *blah; + + if (size>remaining) + { + temp = (char *) malloc(32768); + remaining = 32768; + return temp; + } + return 0; +} + +typedef struct { double X; double Y; int Z; } PBVTest; + +PBVTest testRetStruct(float X, double Y, int Z) { + PBVTest T = { X, Y, Z }; + return T; +} +PBVTest testRetStruct2(void); // external func no inlining + + +double CallRetStruct(float X, double Y, int Z) { + PBVTest T = testRetStruct2(); + return T.X+X+Y+Z; +} + + diff --git a/test/CodeGen/2002-07-14-MiscTests2.c b/test/CodeGen/2002-07-14-MiscTests2.c new file mode 100644 index 000000000000..ad1301766d3a --- /dev/null +++ b/test/CodeGen/2002-07-14-MiscTests2.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +// Test ?: in function calls +extern fp(int, char*); +char *Ext; +void +__bb_exit_func (void) +{ + fp (12, Ext ? Ext : "<none>"); +} + + diff --git a/test/CodeGen/2002-07-14-MiscTests3.c b/test/CodeGen/2002-07-14-MiscTests3.c new file mode 100644 index 000000000000..f7ded4e720de --- /dev/null +++ b/test/CodeGen/2002-07-14-MiscTests3.c @@ -0,0 +1,182 @@ +// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null + +void *malloc(unsigned); +int puts(const char *s); + +struct FunStructTest { + int Test1; + char *Pointer; + int Array[12]; +}; + +struct SubStruct { + short X, Y; +}; + +struct Quad { + int w; + struct SubStruct SS; + struct SubStruct *SSP; + char c; + int y; +}; + +struct Quad GlobalQuad = { 4, {1, 2}, 0, 3, 156 }; + +typedef int (*FuncPtr)(int); + +unsigned PtrFunc(int (*Func)(int), int X) { + return Func(X); +} + +char PtrFunc2(FuncPtr FuncTab[30], int Num) { + return FuncTab[Num]('b'); +} + +extern char SmallArgs2(char w, char x, long long Zrrk, char y, char z); +extern int SomeFunc(void); +char SmallArgs(char w, char x, char y, char z) { + SomeFunc(); + return SmallArgs2(w-1, x+1, y, z, w); +} + +static int F0(struct Quad Q, int i) { /* Pass Q by value */ + struct Quad R; + if (i) R.SS = Q.SS; + Q.SSP = &R.SS; + Q.w = Q.y = Q.c = 1; + return Q.SS.Y + i + R.y - Q.c; +} + +int F1(struct Quad *Q, int i) { /* Pass Q by address */ + struct Quad R; +#if 0 + if (i) R.SS = Q->SS; +#else + if (i) R = *Q; +#endif + Q->w = Q->y = Q->c = 1; + return Q->SS.Y+i+R.y-Q->c; +} + + +int BadFunc(float Val) { + int Result; + if (Val > 12.345) Result = 4; + return Result; /* Test use of undefined value */ +} + +int RealFunc(void) { + return SomeUndefinedFunction(1, 4, 5); +} + +extern int EF1(int *, char *, int *); + +int Func(int Param, long long Param2) { + int Result = Param; + + {{{{ + char c; int X; + EF1(&Result, &c, &X); + }}} + + { // c & X are duplicate names! + char c; int X; + EF1(&Result, &c, &X); + } + + } + return Result; +} + + +short FunFunc(long long x, char z) { + return x+z; +} + +unsigned castTest(int X) { return X; } + +double TestAdd(double X, float Y) { + return X+Y+.5; +} + +int func(int i, int j) { + while (i != 20) + i += 2; + + j += func(2, i); + return (i * 3 + j*2)*j; +} + +int SumArray(int Array[], int Num) { + int i, Result = 0; + for (i = 0; i < Num; ++i) + Result += Array[i]; + + return Result; +} + +int ArrayParam(int Values[100]) { + return EF1((int*)Values[50], (char*)1, &Values[50]); +} + +int ArrayToSum(void) { + int A[100], i; + for (i = 0; i < 100; ++i) + A[i] = i*4; + + return A[A[0]]; //SumArray(A, 100); +} + + +int ExternFunc(long long, unsigned*, short, unsigned char); + +int main(int argc, char *argv[]) { + unsigned i; + puts("Hello world!\n"); + + ExternFunc(-1, 0, (short)argc, 2); + //func(argc, argc); + + for (i = 0; i < 10; i++) + puts(argv[3]); + return 0; +} + +double MathFunc(double X, double Y, double Z, + double AA, double BB, double CC, double DD, + double EE, double FF, double GG, double HH, + double aAA, double aBB, double aCC, double aDD, + double aEE, double aFF) { + return X + Y + Z + AA + BB + CC + DD + EE + FF + GG + HH + + aAA + aBB + aCC + aDD + aEE + aFF; +} + + + +void strcpy(char *s1, char *s2) { + while (*s1++ = *s2++); +} + +void strcat(char *s1, char *s2) { + while (*s1++); + s1--; + while (*s1++ = *s2++); +} + +int strcmp(char *s1, char *s2) { + while (*s1++ == *s2++); + if (*s1 == 0) { + if (*s2 == 0) { + return 0; + } else { + return -1; + } + } else { + if (*s2 == 0) { + return 1; + } else { + return (*(--s1) - *(--s2)); + } + } +} diff --git a/test/CodeGen/2002-07-16-HardStringInit.c b/test/CodeGen/2002-07-16-HardStringInit.c new file mode 100644 index 000000000000..b307359b0fc9 --- /dev/null +++ b/test/CodeGen/2002-07-16-HardStringInit.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + char auto_kibitz_list[100][20] = { + {"diepx"}, + {"ferret"}, + {"knightc"}, + {"knightcap"}}; + diff --git a/test/CodeGen/2002-07-17-StringConstant.c b/test/CodeGen/2002-07-17-StringConstant.c new file mode 100644 index 000000000000..5b86a5b7dff6 --- /dev/null +++ b/test/CodeGen/2002-07-17-StringConstant.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +char * foo() { return "\\begin{"; } diff --git a/test/CodeGen/2002-07-30-SubregSetAssertion.c b/test/CodeGen/2002-07-30-SubregSetAssertion.c new file mode 100644 index 000000000000..39e97b3b4aec --- /dev/null +++ b/test/CodeGen/2002-07-30-SubregSetAssertion.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +union X { + void *B; +}; + +union X foo() { + union X A; + A.B = (void*)123; + return A; +} diff --git a/test/CodeGen/2002-07-30-UnionTest.c b/test/CodeGen/2002-07-30-UnionTest.c new file mode 100644 index 000000000000..d5b92e710657 --- /dev/null +++ b/test/CodeGen/2002-07-30-UnionTest.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +union X; +struct Empty {}; +union F {}; +union Q { union Q *X; }; +union X { + char C; + int A, Z; + long long B; + void *b1; + struct { int A; long long Z; } Q; +}; + +union X foo(union X A) { + A.C = 123; + A.A = 39249; + //A.B = (void*)123040123321; + A.B = 12301230123123LL; + A.Z = 1; + return A; +} diff --git a/test/CodeGen/2002-07-30-VarArgsCallFailure.c b/test/CodeGen/2002-07-30-VarArgsCallFailure.c new file mode 100644 index 000000000000..784305d6d3b6 --- /dev/null +++ b/test/CodeGen/2002-07-30-VarArgsCallFailure.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int tcount; +void test(char *, const char*, int); +void foo() { + char Buf[10]; + test(Buf, "n%%%d", tcount++); +} diff --git a/test/CodeGen/2002-07-31-BadAssert.c b/test/CodeGen/2002-07-31-BadAssert.c new file mode 100644 index 000000000000..512a63a09a29 --- /dev/null +++ b/test/CodeGen/2002-07-31-BadAssert.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct +{ + unsigned char type; /* Indicates, NORMAL, SUBNORMAL, etc. */ +} InternalFPF; + + +static void SetInternalFPFZero(InternalFPF *dest) { + dest->type=0; +} + +void denormalize(InternalFPF *ptr) { + SetInternalFPFZero(ptr); +} + diff --git a/test/CodeGen/2002-07-31-SubregFailure.c b/test/CodeGen/2002-07-31-SubregFailure.c new file mode 100644 index 000000000000..5c7f38f00579 --- /dev/null +++ b/test/CodeGen/2002-07-31-SubregFailure.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +typedef union { + long (*ap)[4]; +} ptrs; + +void DoAssignIteration() { + ptrs abase; + abase.ap+=27; + Assignment(*abase.ap); +} + + diff --git a/test/CodeGen/2002-08-02-UnionTest.c b/test/CodeGen/2002-08-02-UnionTest.c new file mode 100644 index 000000000000..2be149909be5 --- /dev/null +++ b/test/CodeGen/2002-08-02-UnionTest.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* In this testcase, the return value of foo() is being promoted to a register + * which breaks stuff + */ +int printf(const char * restrict format, ...); + +union X { char X; void *B; int a, b, c, d;}; + +union X foo() { + union X Global; + Global.B = (void*)123; /* Interesting part */ + return Global; +} + +int main() { + union X test = foo(); + printf("0x%p", test.B); +} diff --git a/test/CodeGen/2002-08-19-RecursiveLocals.c b/test/CodeGen/2002-08-19-RecursiveLocals.c new file mode 100644 index 000000000000..89c67bad663a --- /dev/null +++ b/test/CodeGen/2002-08-19-RecursiveLocals.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* This testcase doesn't actually test a bug, it's just the result of me + * figuring out the syntax for forward declaring a static variable. */ +struct list { + int x; + struct list *Next; +}; + +static struct list B; /* Forward declare static */ +static struct list A = { 7, &B }; +static struct list B = { 8, &A }; + +extern struct list D; /* forward declare normal var */ + +struct list C = { 7, &D }; +struct list D = { 8, &C }; + diff --git a/test/CodeGen/2002-09-08-PointerShifts.c b/test/CodeGen/2002-09-08-PointerShifts.c new file mode 100644 index 000000000000..7d1ba6e90fe4 --- /dev/null +++ b/test/CodeGen/2002-09-08-PointerShifts.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +int foo(int *A, unsigned X) { + return A[X]; +} diff --git a/test/CodeGen/2002-09-18-UnionProblem.c b/test/CodeGen/2002-09-18-UnionProblem.c new file mode 100644 index 000000000000..d299c19009ca --- /dev/null +++ b/test/CodeGen/2002-09-18-UnionProblem.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +struct DWstruct { + char high, low; +}; + +typedef union { + struct DWstruct s; + short ll; +} DWunion; + +short __udivmodhi4 (char n1, char bm) { + DWunion rr; + + if (bm == 0) + { + rr.s.high = n1; + } + else + { + rr.s.high = bm; + } + + return rr.ll; +} diff --git a/test/CodeGen/2002-09-19-StarInLabel.c b/test/CodeGen/2002-09-19-StarInLabel.c new file mode 100644 index 000000000000..e046e2b00297 --- /dev/null +++ b/test/CodeGen/2002-09-19-StarInLabel.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +extern void start() __asm__("start"); +extern void _start() __asm__("_start"); +extern void __start() __asm__("__start"); +void start() {} +void _start() {} +void __start() {} + diff --git a/test/CodeGen/2002-10-12-TooManyArguments.c b/test/CodeGen/2002-10-12-TooManyArguments.c new file mode 100644 index 000000000000..2324c2aa4662 --- /dev/null +++ b/test/CodeGen/2002-10-12-TooManyArguments.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +void foo() {} + +void bar() { + foo(1, 2, 3); /* Too many arguments passed */ +} diff --git a/test/CodeGen/2002-12-15-GlobalBoolTest.c b/test/CodeGen/2002-12-15-GlobalBoolTest.c new file mode 100644 index 000000000000..3c4133f4be73 --- /dev/null +++ b/test/CodeGen/2002-12-15-GlobalBoolTest.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +_Bool X = 0; + diff --git a/test/CodeGen/2002-12-15-GlobalConstantTest.c b/test/CodeGen/2002-12-15-GlobalConstantTest.c new file mode 100644 index 000000000000..8203f569625d --- /dev/null +++ b/test/CodeGen/2002-12-15-GlobalConstantTest.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +const char *W = "foo"; +const int X = 7; +int Y = 8; +const char * const Z = "bar"; + diff --git a/test/CodeGen/2002-12-15-GlobalRedefinition.c b/test/CodeGen/2002-12-15-GlobalRedefinition.c new file mode 100644 index 000000000000..646e91ec3dfa --- /dev/null +++ b/test/CodeGen/2002-12-15-GlobalRedefinition.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +extern char algbrfile[9]; +char algbrfile[9] = "abcdefgh"; + diff --git a/test/CodeGen/2002-12-15-StructParameters.c b/test/CodeGen/2002-12-15-StructParameters.c new file mode 100644 index 000000000000..f6b59de7f0a6 --- /dev/null +++ b/test/CodeGen/2002-12-15-StructParameters.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct +{ + void *stack; + unsigned size; + unsigned avail; +} compile_stack_type; + +void foo(void*); +void bar(compile_stack_type T, unsigned); + +void test() { + compile_stack_type CST; + foo(&CST); + + bar(CST, 12); +} diff --git a/test/CodeGen/2003-01-30-UnionInit.c b/test/CodeGen/2003-01-30-UnionInit.c new file mode 100644 index 000000000000..98aee727b4ec --- /dev/null +++ b/test/CodeGen/2003-01-30-UnionInit.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +union foo { + struct { char A, B; } X; + int C; +}; + +union foo V = { {1, 2} }; diff --git a/test/CodeGen/2003-03-03-DeferredType.c b/test/CodeGen/2003-03-03-DeferredType.c new file mode 100644 index 000000000000..a7a4ce38e635 --- /dev/null +++ b/test/CodeGen/2003-03-03-DeferredType.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + + + +struct foo A; + +struct foo { + int x; +double D; +}; + diff --git a/test/CodeGen/2003-06-22-UnionCrash.c b/test/CodeGen/2003-06-22-UnionCrash.c new file mode 100644 index 000000000000..eb5014c37e7d --- /dev/null +++ b/test/CodeGen/2003-06-22-UnionCrash.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct Blend_Map_Entry { + union { + float Colour[5]; + double Point_Slope[2]; + } Vals; +}; + +void test(struct Blend_Map_Entry* Foo) +{ +} + diff --git a/test/CodeGen/2003-06-23-GCC-fold-infinite-recursion.c b/test/CodeGen/2003-06-23-GCC-fold-infinite-recursion.c new file mode 100644 index 000000000000..51d4824681a8 --- /dev/null +++ b/test/CodeGen/2003-06-23-GCC-fold-infinite-recursion.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +double Test(double A, double B, double C, double D) { + return -(A-B) - (C-D); +} + diff --git a/test/CodeGen/2003-06-26-CFECrash.c b/test/CodeGen/2003-06-26-CFECrash.c new file mode 100644 index 000000000000..dd874b7b4547 --- /dev/null +++ b/test/CodeGen/2003-06-26-CFECrash.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct min_info { + long offset; + unsigned file_attr; +} min_info; + +typedef struct Globals { + char answerbuf; + min_info info[1]; + min_info *pInfo; +} Uz_Globs; + +extern Uz_Globs G; + +int extract_or_test_files() { + G.pInfo = G.info; +} + diff --git a/test/CodeGen/2003-06-29-MultipleFunctionDefinition.c b/test/CodeGen/2003-06-29-MultipleFunctionDefinition.c new file mode 100644 index 000000000000..99b3a7f5ba36 --- /dev/null +++ b/test/CodeGen/2003-06-29-MultipleFunctionDefinition.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=gnu89 -emit-llvm %s -o /dev/null + +/* This is apparently legal C. + */ +extern __inline__ void test() { } + +void test() { +} diff --git a/test/CodeGen/2003-07-22-ArrayAccessTypeSafety.c b/test/CodeGen/2003-07-22-ArrayAccessTypeSafety.c new file mode 100644 index 000000000000..d0703ef5e914 --- /dev/null +++ b/test/CodeGen/2003-07-22-ArrayAccessTypeSafety.c @@ -0,0 +1,7 @@ +/* RUN: %clang_cc1 %s -emit-llvm -o - | grep -v alloca | not grep bitcast + */ + +void test(int* array, long long N) { + array[N] = N[array] = 33; +} + diff --git a/test/CodeGen/2003-08-06-BuiltinSetjmpLongjmp.c b/test/CodeGen/2003-08-06-BuiltinSetjmpLongjmp.c new file mode 100644 index 000000000000..12bce268cfac --- /dev/null +++ b/test/CodeGen/2003-08-06-BuiltinSetjmpLongjmp.c @@ -0,0 +1,14 @@ +/* RUN: %clang_cc1 %s -emit-llvm -o - | not grep __builtin_ + * + * __builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp + * just like explicit setjmp/longjmp calls are. + */ + +void jumpaway(int *ptr) { + __builtin_longjmp(ptr,1); +} + +int main(void) { + __builtin_setjmp(0); + jumpaway(0); +} diff --git a/test/CodeGen/2003-08-17-DeadCodeShortCircuit.c b/test/CodeGen/2003-08-17-DeadCodeShortCircuit.c new file mode 100644 index 000000000000..031b530672a3 --- /dev/null +++ b/test/CodeGen/2003-08-17-DeadCodeShortCircuit.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -x c %s -emit-llvm -o /dev/null + +int test(_Bool pos, _Bool color) { + return 0; + return (pos && color); +} diff --git a/test/CodeGen/2003-08-18-SigSetJmp.c b/test/CodeGen/2003-08-18-SigSetJmp.c new file mode 100644 index 000000000000..1b1b18f6eecc --- /dev/null +++ b/test/CodeGen/2003-08-18-SigSetJmp.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o /dev/null + +#define _JBLEN ((9 * 2) + 3 + 16) +typedef int sigjmp_buf[_JBLEN + 1]; +int sigsetjmp(sigjmp_buf env, int savemask); +sigjmp_buf B; +int foo() { + sigsetjmp(B, 1); + bar(); +} diff --git a/test/CodeGen/2003-08-18-StructAsValue.c b/test/CodeGen/2003-08-18-StructAsValue.c new file mode 100644 index 000000000000..9b8b5a2b1c19 --- /dev/null +++ b/test/CodeGen/2003-08-18-StructAsValue.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +typedef struct { + int op; +} event_t; + +event_t test(int X) { + event_t foo = { 1 }, bar = { 2 }; + return X ? foo : bar; +} diff --git a/test/CodeGen/2003-08-20-BadBitfieldRef.c b/test/CodeGen/2003-08-20-BadBitfieldRef.c new file mode 100644 index 000000000000..a001546fb55d --- /dev/null +++ b/test/CodeGen/2003-08-20-BadBitfieldRef.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void foo() +{ + char *ap; + ap[1] == '-' && ap[2] == 0; +} + diff --git a/test/CodeGen/2003-08-20-PrototypeMismatch.c b/test/CodeGen/2003-08-20-PrototypeMismatch.c new file mode 100644 index 000000000000..fa42ca581a0a --- /dev/null +++ b/test/CodeGen/2003-08-20-PrototypeMismatch.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + + +static int foo(int); + +static int foo(C) +char C; +{ + return C; +} + +void test() { + foo(7); +} diff --git a/test/CodeGen/2003-08-20-vfork-bug.c b/test/CodeGen/2003-08-20-vfork-bug.c new file mode 100644 index 000000000000..7ec0048828c1 --- /dev/null +++ b/test/CodeGen/2003-08-20-vfork-bug.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +extern int vfork(void); +test() { + vfork(); +} diff --git a/test/CodeGen/2003-08-21-BinOp-Type-Mismatch.c b/test/CodeGen/2003-08-21-BinOp-Type-Mismatch.c new file mode 100644 index 000000000000..d86b0244e17b --- /dev/null +++ b/test/CodeGen/2003-08-21-BinOp-Type-Mismatch.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct bar; + +void foo() +{ + unsigned int frame, focus; + (struct bar *) focus == (focus ? ((struct bar *) frame) : 0); +} + diff --git a/test/CodeGen/2003-08-21-StmtExpr.c b/test/CodeGen/2003-08-21-StmtExpr.c new file mode 100644 index 000000000000..39db694400d8 --- /dev/null +++ b/test/CodeGen/2003-08-21-StmtExpr.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +typedef struct { + unsigned long val; +} structty; + +void bar(structty new_mask); +static void foo() { + bar(({ structty mask; mask; })); +} + diff --git a/test/CodeGen/2003-08-21-WideString.c b/test/CodeGen/2003-08-21-WideString.c new file mode 100644 index 000000000000..4071d17c7970 --- /dev/null +++ b/test/CodeGen/2003-08-21-WideString.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include. +typedef __WCHAR_TYPE__ wchar_t; +#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \ + || defined(_M_X64) || defined(SHORT_WCHAR) + #define WCHAR_T_TYPE unsigned short +#elif defined(__sun) || defined(__AuroraUX__) + #define WCHAR_T_TYPE long +#else /* Solaris or AuroraUX. */ + #define WCHAR_T_TYPE int +#endif + +struct { + wchar_t *name; +} syms = { L"NUL" }; diff --git a/test/CodeGen/2003-08-23-LocalUnionTest.c b/test/CodeGen/2003-08-23-LocalUnionTest.c new file mode 100644 index 000000000000..50b01e425878 --- /dev/null +++ b/test/CodeGen/2003-08-23-LocalUnionTest.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + + +union foo { int X; }; + +int test(union foo* F) { + { + union foo { float X; } A; + } +} diff --git a/test/CodeGen/2003-08-29-BitFieldStruct.c b/test/CodeGen/2003-08-29-BitFieldStruct.c new file mode 100644 index 000000000000..d8995eab3df9 --- /dev/null +++ b/test/CodeGen/2003-08-29-BitFieldStruct.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct Word { + short bar; + short baz; + int final:1; + short quux; +} *word_limit; + +void foo () +{ + word_limit->final = (word_limit->final && word_limit->final); +} diff --git a/test/CodeGen/2003-08-29-HugeCharConst.c b/test/CodeGen/2003-08-29-HugeCharConst.c new file mode 100644 index 000000000000..cd3eb54b31d4 --- /dev/null +++ b/test/CodeGen/2003-08-29-HugeCharConst.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void foo() { + unsigned char int_latin1[] = "f\200\372b\200\343\200\340"; +} diff --git a/test/CodeGen/2003-08-29-StructLayoutBug.c b/test/CodeGen/2003-08-29-StructLayoutBug.c new file mode 100644 index 000000000000..0f45fc94e340 --- /dev/null +++ b/test/CodeGen/2003-08-29-StructLayoutBug.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct foo { + unsigned int I:1; + unsigned char J[1]; + unsigned int K:1; + }; + +void test(struct foo *X) {} + diff --git a/test/CodeGen/2003-08-30-AggregateInitializer.c b/test/CodeGen/2003-08-30-AggregateInitializer.c new file mode 100644 index 000000000000..5beb14e5f8f0 --- /dev/null +++ b/test/CodeGen/2003-08-30-AggregateInitializer.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct istruct { + unsigned char C; +}; + +struct foo { + unsigned int I:1; + struct istruct J; + unsigned char L[1]; + unsigned int K:1; +}; + +struct foo F = { 1, { 7 }, { 123 } , 1 }; + + diff --git a/test/CodeGen/2003-08-30-LargeIntegerBitfieldMember.c b/test/CodeGen/2003-08-30-LargeIntegerBitfieldMember.c new file mode 100644 index 000000000000..483cb668a28b --- /dev/null +++ b/test/CodeGen/2003-08-30-LargeIntegerBitfieldMember.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct foo { + unsigned int I:1; + unsigned char J[1][123]; + unsigned int K:1; + }; + +struct foo F; diff --git a/test/CodeGen/2003-09-18-BitfieldTests.c b/test/CodeGen/2003-09-18-BitfieldTests.c new file mode 100644 index 000000000000..6807f5a1fa4d --- /dev/null +++ b/test/CodeGen/2003-09-18-BitfieldTests.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null + + +typedef struct BF { + int A : 1; + char B; + int C : 13; +} BF; + +char *test1(BF *b) { + return &b->B; // Must be able to address non-bitfield +} + +void test2(BF *b) { // Increment and decrement operators + b->A++; + --b->C; +} + +void test3(BF *b) { + b->C = 12345; // Store +} + +int test4(BF *b) { + return b->C; // Load +} + +void test5(BF *b, int i) { // array ref + b[i].C = 12345; +} + diff --git a/test/CodeGen/2003-09-30-StructLayout.c b/test/CodeGen/2003-09-30-StructLayout.c new file mode 100644 index 000000000000..45ef69ce60f8 --- /dev/null +++ b/test/CodeGen/2003-09-30-StructLayout.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +enum En { + ENUM_VAL +}; + +struct St { + unsigned char A; + enum En B; + unsigned char C; + enum En D; + float E; +}; + + +void func(struct St* A) { + A->D = ENUM_VAL; +} diff --git a/test/CodeGen/2003-10-02-UnionLValueError.c b/test/CodeGen/2003-10-02-UnionLValueError.c new file mode 100644 index 000000000000..180eb1080be9 --- /dev/null +++ b/test/CodeGen/2003-10-02-UnionLValueError.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int sprintf(char * restrict str, const char * restrict format, ...); +union U{ + int i[8]; + char s[80]; +}; + +void format_message(char *buffer, union U *u) { + sprintf(buffer, u->s); +} diff --git a/test/CodeGen/2003-10-06-NegateExprType.c b/test/CodeGen/2003-10-06-NegateExprType.c new file mode 100644 index 000000000000..6d692c1323de --- /dev/null +++ b/test/CodeGen/2003-10-06-NegateExprType.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +extern int A[10]; +void Func(int *B) { + B - &A[5]; +} + diff --git a/test/CodeGen/2003-10-09-UnionInitializerBug.c b/test/CodeGen/2003-10-09-UnionInitializerBug.c new file mode 100644 index 000000000000..a14fd084c699 --- /dev/null +++ b/test/CodeGen/2003-10-09-UnionInitializerBug.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct Foo { + unsigned a; + unsigned b; + unsigned c; +}; + +struct Bar { + union { + void **a; + struct Foo b; + }u; +}; + +struct Bar test = {0}; + diff --git a/test/CodeGen/2003-10-28-ident.c b/test/CodeGen/2003-10-28-ident.c new file mode 100644 index 000000000000..d1e54476b9ad --- /dev/null +++ b/test/CodeGen/2003-10-28-ident.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +#ident "foo" diff --git a/test/CodeGen/2003-10-29-AsmRename.c b/test/CodeGen/2003-10-29-AsmRename.c new file mode 100644 index 000000000000..d0f19af32276 --- /dev/null +++ b/test/CodeGen/2003-10-29-AsmRename.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-apple-darwin -o /dev/null + + +struct foo { int X; }; +struct bar { int Y; }; + +extern int Func(struct foo*) __asm__("Func64"); +extern int Func64(struct bar*); + +int Func(struct foo *F) { + return 1; +} + +int Func64(struct bar* B) { + return 0; +} + + +int test() { + Func(0); /* should be renamed to call Func64 */ + Func64(0); +} diff --git a/test/CodeGen/2003-11-01-C99-CompoundLiteral.c b/test/CodeGen/2003-11-01-C99-CompoundLiteral.c new file mode 100644 index 000000000000..f4d3824fa647 --- /dev/null +++ b/test/CodeGen/2003-11-01-C99-CompoundLiteral.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct { int foo; } spinlock_t; +typedef struct wait_queue_head_t { spinlock_t lock; } wait_queue_head_t; +void call_usermodehelper(void) { + struct wait_queue_head_t work = { lock: (spinlock_t) { 0 }, }; +} + diff --git a/test/CodeGen/2003-11-01-EmptyStructCrash.c b/test/CodeGen/2003-11-01-EmptyStructCrash.c new file mode 100644 index 000000000000..e0f231af5994 --- /dev/null +++ b/test/CodeGen/2003-11-01-EmptyStructCrash.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct { } the_coolest_struct_in_the_world; +extern the_coolest_struct_in_the_world xyzzy; +void *foo() { return &xyzzy; } + diff --git a/test/CodeGen/2003-11-01-GlobalUnionInit.c b/test/CodeGen/2003-11-01-GlobalUnionInit.c new file mode 100644 index 000000000000..8290379494b6 --- /dev/null +++ b/test/CodeGen/2003-11-01-GlobalUnionInit.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +union bdflush_param { + struct { int x; } b_un; + int y[1]; +} bdf_prm = {{30}}; + diff --git a/test/CodeGen/2003-11-03-AddrArrayElement.c b/test/CodeGen/2003-11-03-AddrArrayElement.c new file mode 100644 index 000000000000..50e81d6fd86a --- /dev/null +++ b/test/CodeGen/2003-11-03-AddrArrayElement.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// This should be turned into a tasty getelementptr instruction, not a nasty +// series of casts and address arithmetic. + +char Global[100]; + +char *test1(unsigned i) { + // CHECK: getelementptr + return &Global[i]; +} diff --git a/test/CodeGen/2003-11-04-EmptyStruct.c b/test/CodeGen/2003-11-04-EmptyStruct.c new file mode 100644 index 000000000000..e771b8830070 --- /dev/null +++ b/test/CodeGen/2003-11-04-EmptyStruct.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct { } rwlock_t; +struct fs_struct { rwlock_t lock; int umask; }; +void __copy_fs_struct(struct fs_struct *fs) { fs->lock = (rwlock_t) { }; } + diff --git a/test/CodeGen/2003-11-04-OutOfMemory.c b/test/CodeGen/2003-11-04-OutOfMemory.c new file mode 100644 index 000000000000..579c93daae58 --- /dev/null +++ b/test/CodeGen/2003-11-04-OutOfMemory.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void schedule_timeout(signed long timeout) +{ + switch (timeout) + { + case ((long)(~0UL>>1)): break; + } +} diff --git a/test/CodeGen/2003-11-08-PointerSubNotGetelementptr.c b/test/CodeGen/2003-11-08-PointerSubNotGetelementptr.c new file mode 100644 index 000000000000..9a9c642f11a5 --- /dev/null +++ b/test/CodeGen/2003-11-08-PointerSubNotGetelementptr.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +char *test(char* C) { + // CHECK: getelementptr + return C-1; // Should turn into a GEP +} + +int *test2(int* I) { + return I-1; +} diff --git a/test/CodeGen/2003-11-12-VoidString.c b/test/CodeGen/2003-11-12-VoidString.c new file mode 100644 index 000000000000..d22e9f45cbd1 --- /dev/null +++ b/test/CodeGen/2003-11-12-VoidString.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void query_newnamebuf(void) { ((void)"query_newnamebuf"); } + diff --git a/test/CodeGen/2003-11-13-TypeSafety.c b/test/CodeGen/2003-11-13-TypeSafety.c new file mode 100644 index 000000000000..b9add6c175a3 --- /dev/null +++ b/test/CodeGen/2003-11-13-TypeSafety.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep getelementptr + +int *test(int *X, int Y) { + return X + Y; +} diff --git a/test/CodeGen/2003-11-16-StaticArrayInit.c b/test/CodeGen/2003-11-16-StaticArrayInit.c new file mode 100644 index 000000000000..8a11c05d08db --- /dev/null +++ b/test/CodeGen/2003-11-16-StaticArrayInit.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void bar () { + static char x[10]; + static char *xend = x + 10; +} + + diff --git a/test/CodeGen/2003-11-18-CondExprLValue.c b/test/CodeGen/2003-11-18-CondExprLValue.c new file mode 100644 index 000000000000..62968e5fbfc9 --- /dev/null +++ b/test/CodeGen/2003-11-18-CondExprLValue.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +typedef struct { unsigned long pgprot; } pgprot_t; + +void split_large_page(unsigned long addr, pgprot_t prot) +{ + (addr ? prot : ((pgprot_t) { 0x001 } )).pgprot; +} + diff --git a/test/CodeGen/2003-11-19-AddressOfRegister.c b/test/CodeGen/2003-11-19-AddressOfRegister.c new file mode 100644 index 000000000000..e80ff654cff2 --- /dev/null +++ b/test/CodeGen/2003-11-19-AddressOfRegister.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +struct item { + short delta[4]; +}; + +int TEST(int nt) { + register struct item *aa; + aa[nt].delta; + return 1; +} diff --git a/test/CodeGen/2003-11-19-BitFieldArray.c b/test/CodeGen/2003-11-19-BitFieldArray.c new file mode 100644 index 000000000000..841156306193 --- /dev/null +++ b/test/CodeGen/2003-11-19-BitFieldArray.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct _GIOChannel { + int write_buf; + char partial_write_buf[6]; + int d :1; +}; + +void g_io_channel_init (struct _GIOChannel *channel) { + channel->partial_write_buf[0]; +} + diff --git a/test/CodeGen/2003-11-20-Bitfields.c b/test/CodeGen/2003-11-20-Bitfields.c new file mode 100644 index 000000000000..5284cde4a946 --- /dev/null +++ b/test/CodeGen/2003-11-20-Bitfields.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct face_cachel { + unsigned int reverse :1; + unsigned char font_specified[1]; +}; + +void +ensure_face_cachel_contains_charset (struct face_cachel *cachel) { + cachel->font_specified[0] = 0; +} + diff --git a/test/CodeGen/2003-11-20-ComplexDivision.c b/test/CodeGen/2003-11-20-ComplexDivision.c new file mode 100644 index 000000000000..ecd780b9b3f8 --- /dev/null +++ b/test/CodeGen/2003-11-20-ComplexDivision.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int test() { + __complex__ double C; + double D; + C / D; +} diff --git a/test/CodeGen/2003-11-20-UnionBitfield.c b/test/CodeGen/2003-11-20-UnionBitfield.c new file mode 100644 index 000000000000..6ffe76a17197 --- /dev/null +++ b/test/CodeGen/2003-11-20-UnionBitfield.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct printf_spec { + unsigned int minus_flag:1; + char converter; +}; + +void parse_doprnt_spec () { + struct printf_spec spec; + spec.minus_flag = 1; +} + diff --git a/test/CodeGen/2003-11-26-PointerShift.c b/test/CodeGen/2003-11-26-PointerShift.c new file mode 100644 index 000000000000..530759eb0c10 --- /dev/null +++ b/test/CodeGen/2003-11-26-PointerShift.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +unsigned long do_csum(const unsigned char *buff, int len, unsigned long result) { + if (2 & (unsigned long) buff) result += 1; + return result; +} diff --git a/test/CodeGen/2003-11-27-ConstructorCast.c b/test/CodeGen/2003-11-27-ConstructorCast.c new file mode 100644 index 000000000000..f04fa213b94a --- /dev/null +++ b/test/CodeGen/2003-11-27-ConstructorCast.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct i387_soft_struct { + long cwd; +}; +union i387_union { + struct i387_soft_struct soft; +}; +struct thread_struct { + union i387_union i387; +}; +void _init_task_union(void) { + struct thread_struct thread = (struct thread_struct) { {{0}} }; +} diff --git a/test/CodeGen/2003-11-27-UnionCtorInitialization.c b/test/CodeGen/2003-11-27-UnionCtorInitialization.c new file mode 100644 index 000000000000..ca80173bfdc7 --- /dev/null +++ b/test/CodeGen/2003-11-27-UnionCtorInitialization.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct i387_soft_struct { + long cwd; + long twd; + long fip; +}; +union i387_union { + struct i387_soft_struct soft; +}; +struct thread_struct { + union i387_union i387; +}; +void _init_task_union(void) { + struct thread_struct thread = (struct thread_struct) { {{0}} }; +} diff --git a/test/CodeGen/2003-12-14-ExternInlineSupport.c b/test/CodeGen/2003-12-14-ExternInlineSupport.c new file mode 100644 index 000000000000..eb3859c38092 --- /dev/null +++ b/test/CodeGen/2003-12-14-ExternInlineSupport.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -std=gnu89 %s -emit-llvm -o - | not grep dead_function + +extern __inline__ void dead_function() {} diff --git a/test/CodeGen/2004-01-01-UnknownInitSize.c b/test/CodeGen/2004-01-01-UnknownInitSize.c new file mode 100644 index 000000000000..25ddebddccb0 --- /dev/null +++ b/test/CodeGen/2004-01-01-UnknownInitSize.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +/* + * This regression test ensures that the C front end can compile initializers + * even when it cannot determine the size (as below). +*/ +struct one +{ + int a; + int values []; +}; + +struct one hobbit = {5, {1, 2, 3}}; + diff --git a/test/CodeGen/2004-01-08-ExternInlineRedefine.c b/test/CodeGen/2004-01-08-ExternInlineRedefine.c new file mode 100644 index 000000000000..358a9c28f775 --- /dev/null +++ b/test/CodeGen/2004-01-08-ExternInlineRedefine.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=gnu89 -emit-llvm %s -o /dev/null + + +extern __inline long int +__strtol_l (int a) +{ + return 0; +} + +long int +__strtol_l (int a) +{ + return 0; +} diff --git a/test/CodeGen/2004-02-12-LargeAggregateCopy.c b/test/CodeGen/2004-02-12-LargeAggregateCopy.c new file mode 100644 index 000000000000..811ee8e3f641 --- /dev/null +++ b/test/CodeGen/2004-02-12-LargeAggregateCopy.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +struct X { int V[10000]; }; +struct X Global1, Global2; +void test() { + // CHECK: llvm.memcpy + Global2 = Global1; +} diff --git a/test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c b/test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c new file mode 100644 index 000000000000..8c0b7ba8fff0 --- /dev/null +++ b/test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +void *test1() { + // CHECK: call i8* @llvm.returnaddress + return __builtin_return_address(1); +} +void *test2() { + // CHECK: call i8* @llvm.frameaddress + return __builtin_frame_address(0); +} diff --git a/test/CodeGen/2004-02-13-IllegalVararg.c b/test/CodeGen/2004-02-13-IllegalVararg.c new file mode 100644 index 000000000000..cbc9151ec631 --- /dev/null +++ b/test/CodeGen/2004-02-13-IllegalVararg.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -w -emit-llvm -o - + +float test(int X, ...) { + __builtin_va_list ap; + float F; + __builtin_va_start(ap, X); + F = __builtin_va_arg(ap, float); + return F; +} diff --git a/test/CodeGen/2004-02-13-Memset.c b/test/CodeGen/2004-02-13-Memset.c new file mode 100644 index 000000000000..23a4d3b99a45 --- /dev/null +++ b/test/CodeGen/2004-02-13-Memset.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.memset | count 3 + +typedef __SIZE_TYPE__ size_t; +void *memset(void*, int, size_t); +void bzero(void*, size_t); + +void test(int* X, char *Y) { + // CHECK: call i8* llvm.memset + memset(X, 4, 1000); + // CHECK: call void bzero + bzero(Y, 100); +} diff --git a/test/CodeGen/2004-02-14-ZeroInitializer.c b/test/CodeGen/2004-02-14-ZeroInitializer.c new file mode 100644 index 000000000000..3379a06c6284 --- /dev/null +++ b/test/CodeGen/2004-02-14-ZeroInitializer.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: zeroinitializer +int X[1000]; diff --git a/test/CodeGen/2004-02-20-Builtins.c b/test/CodeGen/2004-02-20-Builtins.c new file mode 100644 index 000000000000..9be0523b4afd --- /dev/null +++ b/test/CodeGen/2004-02-20-Builtins.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | not grep builtin +double sqrt(double x); +void zsqrtxxx(float num) { + num = sqrt(num); +} diff --git a/test/CodeGen/2004-03-07-ComplexDivEquals.c b/test/CodeGen/2004-03-07-ComplexDivEquals.c new file mode 100644 index 000000000000..e2cd539a80ab --- /dev/null +++ b/test/CodeGen/2004-03-07-ComplexDivEquals.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +void test(__complex__ double D, double X) { + D /= X; +} diff --git a/test/CodeGen/2004-03-07-ExternalConstant.c b/test/CodeGen/2004-03-07-ExternalConstant.c new file mode 100644 index 000000000000..2de3a69bd679 --- /dev/null +++ b/test/CodeGen/2004-03-07-ExternalConstant.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: @a = external constan +extern const int a[]; // 'a' should be marked constant even though it's external! +int foo () { + return a[0]; +} diff --git a/test/CodeGen/2004-03-09-LargeArrayInitializers.c b/test/CodeGen/2004-03-09-LargeArrayInitializers.c new file mode 100644 index 000000000000..b34af0d29907 --- /dev/null +++ b/test/CodeGen/2004-03-09-LargeArrayInitializers.c @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// Test that these initializers are handled efficiently + +int test(int x) { + const int XX[1000] = { 0, 0 }; + const char S [1000] = "foo"; + + const int array[] = { + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + }; + return array[x]; +} diff --git a/test/CodeGen/2004-03-15-SimpleIndirectGoto.c b/test/CodeGen/2004-03-15-SimpleIndirectGoto.c new file mode 100644 index 000000000000..93fb59ff142e --- /dev/null +++ b/test/CodeGen/2004-03-15-SimpleIndirectGoto.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int code[]={0,0,0,0,1}; +void foo(int x) { + volatile int b; + b = 0xffffffff; +} +void bar(int *pc) { + static const void *l[] = {&&lab0, &&end}; + + foo(0); + goto *l[*pc]; + lab0: + foo(0); + pc++; + goto *l[*pc]; + end: + return; +} +int main() { + bar(code); + return 0; +} diff --git a/test/CodeGen/2004-03-16-AsmRegisterCrash.c b/test/CodeGen/2004-03-16-AsmRegisterCrash.c new file mode 100644 index 000000000000..515d2436b1a8 --- /dev/null +++ b/test/CodeGen/2004-03-16-AsmRegisterCrash.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// XFAIL: * +// XTARGET: arm, i386, i686, x86_64 + +int foo() { +#ifdef __arm__ + register int X __asm__("r1"); +#else + register int X __asm__("ebx"); +#endif + return X; +} diff --git a/test/CodeGen/2004-05-07-VarArrays.c b/test/CodeGen/2004-05-07-VarArrays.c new file mode 100644 index 000000000000..1ef5cf32e0b7 --- /dev/null +++ b/test/CodeGen/2004-05-07-VarArrays.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +int foo(int len, char arr[][len], int X) { + return arr[X][0]; +} diff --git a/test/CodeGen/2004-05-21-IncompleteEnum.c b/test/CodeGen/2004-05-21-IncompleteEnum.c new file mode 100644 index 000000000000..41652d11a4fe --- /dev/null +++ b/test/CodeGen/2004-05-21-IncompleteEnum.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null + +void test(enum foo *X) { +} + diff --git a/test/CodeGen/2004-06-08-OpaqueStructArg.c b/test/CodeGen/2004-06-08-OpaqueStructArg.c new file mode 100644 index 000000000000..cec44591f398 --- /dev/null +++ b/test/CodeGen/2004-06-08-OpaqueStructArg.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + struct fu; + void foo(struct fu); + void bar() { + foo; + } diff --git a/test/CodeGen/2004-06-17-UnorderedBuiltins.c b/test/CodeGen/2004-06-17-UnorderedBuiltins.c new file mode 100644 index 000000000000..90360c4b58c0 --- /dev/null +++ b/test/CodeGen/2004-06-17-UnorderedBuiltins.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +_Bool A, B, C, D, E, F, G, H; +void TestF(float X, float Y) { + A = __builtin_isgreater(X, Y); + B = __builtin_isgreaterequal(X, Y); + C = __builtin_isless(X, Y); + D = __builtin_islessequal(X, Y); + E = __builtin_islessgreater(X, Y); + F = __builtin_isunordered(X, Y); + //G = __builtin_isordered(X, Y); // Our current snapshot of GCC doesn't include this builtin + H = __builtin_isunordered(X, Y); +} +void TestD(double X, double Y) { + A = __builtin_isgreater(X, Y); + B = __builtin_isgreaterequal(X, Y); + C = __builtin_isless(X, Y); + D = __builtin_islessequal(X, Y); + E = __builtin_islessgreater(X, Y); + F = __builtin_isunordered(X, Y); + //G = __builtin_isordered(X, Y); // Our current snapshot doesn't include this builtin. FIXME + H = __builtin_isunordered(X, Y); +} diff --git a/test/CodeGen/2004-06-17-UnorderedCompares.c b/test/CodeGen/2004-06-17-UnorderedCompares.c new file mode 100644 index 000000000000..7d2ba9614741 --- /dev/null +++ b/test/CodeGen/2004-06-17-UnorderedCompares.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | grep -v llvm.isunordered | not grep call + +_Bool A, B, C, D, E, F; +void TestF(float X, float Y) { + A = __builtin_isgreater(X, Y); + B = __builtin_isgreaterequal(X, Y); + C = __builtin_isless(X, Y); + D = __builtin_islessequal(X, Y); + E = __builtin_islessgreater(X, Y); + F = __builtin_isunordered(X, Y); +} +void TestD(double X, double Y) { + A = __builtin_isgreater(X, Y); + B = __builtin_isgreaterequal(X, Y); + C = __builtin_isless(X, Y); + D = __builtin_islessequal(X, Y); + E = __builtin_islessgreater(X, Y); + F = __builtin_isunordered(X, Y); +} diff --git a/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c b/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c new file mode 100644 index 000000000000..abf78fb09556 --- /dev/null +++ b/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +struct S { }; + +int xxxx(int a) { + struct S comps[a]; + comps[0]; +} + diff --git a/test/CodeGen/2004-07-06-FunctionCast.c b/test/CodeGen/2004-07-06-FunctionCast.c new file mode 100644 index 000000000000..32931e2fce71 --- /dev/null +++ b/test/CodeGen/2004-07-06-FunctionCast.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +static int unused_func(void) { + return 1; +} + +int foo(void) { + (void)unused_func; /* avoid compiler warning */ + return 2; +} diff --git a/test/CodeGen/2004-08-06-LargeStructTest.c b/test/CodeGen/2004-08-06-LargeStructTest.c new file mode 100644 index 000000000000..ee57f0b5af80 --- /dev/null +++ b/test/CodeGen/2004-08-06-LargeStructTest.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + + +#define A(X) int X; +#define B(X) A(X##0) A(X##1) A(X##2) A(X##3) A(X##4) A(X##5) A(X##6) A(X##7) \ + A(X##8) A(X##9) A(X##A) A(X##B) A(X##C) A(X##D) A(X##E) A(X##F) +#define C(X) B(X##0) B(X##1) B(X##2) B(X##3) B(X##4) B(X##5) B(X##6) B(X##7) \ + B(X##8) B(X##9) B(X##A) B(X##B) B(X##C) B(X##D) B(X##E) B(X##F) + +struct foo { + C(x); // 256 + C(y); // 256 + C(z); +}; + + +int test(struct foo *F) { + return F->xA1 + F->yFF + F->zC4; +} diff --git a/test/CodeGen/2004-11-25-UnnamedBitfieldPadding.c b/test/CodeGen/2004-11-25-UnnamedBitfieldPadding.c new file mode 100644 index 000000000000..a6af2a574411 --- /dev/null +++ b/test/CodeGen/2004-11-25-UnnamedBitfieldPadding.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// This is a testcase for PR461 +typedef struct { + unsigned min_align: 1; + unsigned : 1; +} addr_diff_vec_flags; + +addr_diff_vec_flags X; diff --git a/test/CodeGen/2004-11-27-InvalidConstantExpr.c b/test/CodeGen/2004-11-27-InvalidConstantExpr.c new file mode 100644 index 000000000000..431dccffc1a1 --- /dev/null +++ b/test/CodeGen/2004-11-27-InvalidConstantExpr.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | not grep {foo\\* sub} +// This should not produce a subtrace constantexpr of a pointer +struct foo { + int Y; + char X[100]; +} F; + +int test(char *Y) { + return Y - F.X; +} diff --git a/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c b/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c new file mode 100644 index 000000000000..55efa86865de --- /dev/null +++ b/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | \ +// RUN: opt -std-compile-opts -emit-llvm | not grep {declare i32.*func} + +// There should not be an unresolved reference to func here. Believe it or not, +// the "expected result" is a function named 'func' which is internal and +// referenced by bar(). + +// This is PR244 + +static int func(); +void bar() { + int func(); + foo(func); +} +static int func(char** A, char ** B) {} diff --git a/test/CodeGen/2005-01-02-ConstantInits.c b/test/CodeGen/2005-01-02-ConstantInits.c new file mode 100644 index 000000000000..d85f5198650d --- /dev/null +++ b/test/CodeGen/2005-01-02-ConstantInits.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +// This tests all kinds of hard cases with initializers and +// array subscripts. This corresponds to PR487. + +struct X { int a[2]; }; + +int test() { + static int i23 = (int) &(((struct X *)0)->a[1]); + return i23; +} + +int i = (int) &( ((struct X *)0) -> a[1]); + +int Arr[100]; + +int foo(int i) { return bar(&Arr[49])+bar(&Arr[i]); } +int foo2(int i) { + static const int *X = &Arr[49]; + static int i23 = (int) &( ((struct X *)0) -> a[0]); + int *P = Arr; + ++P; + return bar(Arr+i); +} diff --git a/test/CodeGen/2005-01-02-PointerDifference.c b/test/CodeGen/2005-01-02-PointerDifference.c new file mode 100644 index 000000000000..1114ef5c25de --- /dev/null +++ b/test/CodeGen/2005-01-02-PointerDifference.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: sdiv exact +int Diff(int *P, int *Q) { return P-Q; } diff --git a/test/CodeGen/2005-01-02-VAArgError-ICE.c b/test/CodeGen/2005-01-02-VAArgError-ICE.c new file mode 100644 index 000000000000..06377c23d2aa --- /dev/null +++ b/test/CodeGen/2005-01-02-VAArgError-ICE.c @@ -0,0 +1,9 @@ +// This file is erroneous, but should not cause the compiler to ICE. +// PR481 +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +int flags(int a, int b, ...) { + __builtin_va_list args; + __builtin_va_start(args,a); // not the last named arg + foo(args); +} diff --git a/test/CodeGen/2005-02-20-AggregateSAVEEXPR.c b/test/CodeGen/2005-02-20-AggregateSAVEEXPR.c new file mode 100644 index 000000000000..99efb1bf79f3 --- /dev/null +++ b/test/CodeGen/2005-02-20-AggregateSAVEEXPR.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -o /dev/null -emit-llvm + +int foo(__complex float c) { + return creal(c); +} diff --git a/test/CodeGen/2005-02-27-MarkGlobalConstant.c b/test/CodeGen/2005-02-27-MarkGlobalConstant.c new file mode 100644 index 000000000000..dc2cdbfa726f --- /dev/null +++ b/test/CodeGen/2005-02-27-MarkGlobalConstant.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// PR10414 + +// The synthetic global made by the CFE for big initializer should be marked +// constant. + +void bar(); +void foo() { + // CHECK: private unnamed_addr constant + char Blah[] = "asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd"; + bar(Blah); +} diff --git a/test/CodeGen/2005-03-05-OffsetOfHack.c b/test/CodeGen/2005-03-05-OffsetOfHack.c new file mode 100644 index 000000000000..442098107504 --- /dev/null +++ b/test/CodeGen/2005-03-05-OffsetOfHack.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct s { + unsigned long int field[0]; +}; + +#define OFFS \ + (((char *) &((struct s *) 0)->field[0]) - (char *) 0) + +int foo[OFFS]; + + diff --git a/test/CodeGen/2005-03-06-OffsetOfStructCrash.c b/test/CodeGen/2005-03-06-OffsetOfStructCrash.c new file mode 100644 index 000000000000..46968bb8db64 --- /dev/null +++ b/test/CodeGen/2005-03-06-OffsetOfStructCrash.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct Y {}; +struct XXX { + struct Y F; +}; + +void test1() { + (int)&((struct XXX*)(((void *)0)))->F; +} + +void test2() { + &((struct XXX*)(((void *)0)))->F; +} diff --git a/test/CodeGen/2005-03-11-Prefetch.c b/test/CodeGen/2005-03-11-Prefetch.c new file mode 100644 index 000000000000..8d7d12edcbd2 --- /dev/null +++ b/test/CodeGen/2005-03-11-Prefetch.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +void foo(int *P) { + // CHECK: llvm.prefetch + __builtin_prefetch(P); + __builtin_prefetch(P, 1); +} diff --git a/test/CodeGen/2005-04-09-ComplexOps.c b/test/CodeGen/2005-04-09-ComplexOps.c new file mode 100644 index 000000000000..23716d362c9a --- /dev/null +++ b/test/CodeGen/2005-04-09-ComplexOps.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +#define I 1.0iF + +double __complex test(double X) { return ~-(X*I); } + +_Bool EQ(double __complex A, double __complex B) { return A == B; } +_Bool NE(double __complex A, double __complex B) { return A != B; } diff --git a/test/CodeGen/2005-05-06-CountBuiltins.c b/test/CodeGen/2005-05-06-CountBuiltins.c new file mode 100644 index 000000000000..4c12100dc50c --- /dev/null +++ b/test/CodeGen/2005-05-06-CountBuiltins.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -emit-llvm -o %t +// RUN: not grep call*__builtin %t + +int G, H, I; +void foo(int P) { + G = __builtin_clz(P); + H = __builtin_ctz(P); + I = __builtin_popcount(P); +} + +long long g, h, i; +void fooll(float P) { + g = __builtin_clzll(P); + g = __builtin_clzll(P); + h = __builtin_ctzll(P); + i = __builtin_popcountll(P); +} diff --git a/test/CodeGen/2005-05-10-GlobalUnionInit.c b/test/CodeGen/2005-05-10-GlobalUnionInit.c new file mode 100644 index 000000000000..ddd7f5e92475 --- /dev/null +++ b/test/CodeGen/2005-05-10-GlobalUnionInit.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +union A { // { uint } + union B { double *C; } D; +} E = { { (double*)12312 } }; + diff --git a/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c b/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c new file mode 100644 index 000000000000..dd1acc54bc1d --- /dev/null +++ b/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | \ +// RUN: opt -std-compile-opts -disable-output +// PR580 + +int X, Y; +int foo() { + int i; + for (i=0; i<100; i++ ) + { + break; + i = ( X || Y ) ; + } +} + diff --git a/test/CodeGen/2005-07-20-SqrtNoErrno.c b/test/CodeGen/2005-07-20-SqrtNoErrno.c new file mode 100644 index 000000000000..f40f61d27f31 --- /dev/null +++ b/test/CodeGen/2005-07-20-SqrtNoErrno.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// llvm.sqrt has undefined behavior on negative inputs, so it is +// inappropriate to translate C/C++ sqrt to this. +float sqrtf(float x); +float foo(float X) { + // CHECK: foo + // CHECK: call float @sqrtf(float % + // Check that this is marked readonly when errno is ignored. + return sqrtf(X); +} diff --git a/test/CodeGen/2005-07-26-UnionInitCrash.c b/test/CodeGen/2005-07-26-UnionInitCrash.c new file mode 100644 index 000000000000..557224018123 --- /dev/null +++ b/test/CodeGen/2005-07-26-UnionInitCrash.c @@ -0,0 +1,3 @@ +// PR607 +// RUN: %clang_cc1 %s -emit-llvm -o - +union { char bytes[8]; double alignment; }EQ1 = {0,0,0,0,0,0,0,0}; diff --git a/test/CodeGen/2005-07-28-IncorrectWeakGlobal.c b/test/CodeGen/2005-07-28-IncorrectWeakGlobal.c new file mode 100644 index 000000000000..cbacf2253911 --- /dev/null +++ b/test/CodeGen/2005-07-28-IncorrectWeakGlobal.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep TheGlobal | not grep weak + +extern int TheGlobal; +int foo() { return TheGlobal; } +int TheGlobal = 1; diff --git a/test/CodeGen/2005-09-20-ComplexConstants.c b/test/CodeGen/2005-09-20-ComplexConstants.c new file mode 100644 index 000000000000..a23ccee0de2e --- /dev/null +++ b/test/CodeGen/2005-09-20-ComplexConstants.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +const double _Complex x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + diff --git a/test/CodeGen/2005-09-24-AsmUserPrefix.c b/test/CodeGen/2005-09-24-AsmUserPrefix.c new file mode 100644 index 000000000000..16283130beb0 --- /dev/null +++ b/test/CodeGen/2005-09-24-AsmUserPrefix.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | opt -std-compile-opts | llc | \ +// RUN: not grep _foo2 + +void foo() __asm__("foo2"); + +void bar() { + foo(); +} diff --git a/test/CodeGen/2005-09-24-BitFieldCrash.c b/test/CodeGen/2005-09-24-BitFieldCrash.c new file mode 100644 index 000000000000..d687d2f39d26 --- /dev/null +++ b/test/CodeGen/2005-09-24-BitFieldCrash.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct tree_common {}; + +struct tree_int_cst { + struct tree_common common; + struct tree_int_cst_lowhi { + unsigned long long low; + long long high; + } int_cst; +}; + +enum XXX { yyy }; + +struct tree_function_decl { + struct tree_common common; + long long locus, y; + __extension__ enum XXX built_in_class : 2; + +}; + + +union tree_node { + struct tree_int_cst int_cst; + struct tree_function_decl function_decl; +}; + + +void foo (union tree_node * decl) { + decl->function_decl.built_in_class != 0; +} + + diff --git a/test/CodeGen/2005-12-04-AttributeUsed.c b/test/CodeGen/2005-12-04-AttributeUsed.c new file mode 100644 index 000000000000..4be6b798fd43 --- /dev/null +++ b/test/CodeGen/2005-12-04-AttributeUsed.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: @llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* @foo to i8*), i8* bitcast (i32* @X to i8*)], section "llvm.metadata" +int X __attribute__((used)); +int Y; + +__attribute__((used)) void foo() {} diff --git a/test/CodeGen/2005-12-04-DeclarationLineNumbers.c b/test/CodeGen/2005-12-04-DeclarationLineNumbers.c new file mode 100644 index 000000000000..596d3eed24fc --- /dev/null +++ b/test/CodeGen/2005-12-04-DeclarationLineNumbers.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -emit-llvm -g -o - | grep DW_TAG_compile_unit | count 1 +// PR664: ensure that line #'s are emitted for declarations + + +short test(short br_data_0, +short br_data_1, +short br_data_2, +short br_data_3, +short br_data_4, +short br_data_5, +short br_data_6, +short br_data_7) { + +short sm07 = br_data_0 + br_data_7; +short sm16 = br_data_1 + br_data_6; +short sm25 = br_data_2 + br_data_5; +short sm34 = br_data_3 + br_data_4; +short s0734 = sm07 + sm34; +short s1625 = sm16 + sm25; + +return s0734 + s1625; +} + diff --git a/test/CodeGen/2006-01-13-Includes.c b/test/CodeGen/2006-01-13-Includes.c new file mode 100644 index 000000000000..9cc45cec55ef --- /dev/null +++ b/test/CodeGen/2006-01-13-Includes.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -g -emit-llvm -o - | FileCheck %s +// PR676 + +int printf(const char * restrict format, ...); + +void test() { + printf("Hello World\n"); +} + +// CHECK: test{{[\\/]}}CodeGen diff --git a/test/CodeGen/2006-01-13-StackSave.c b/test/CodeGen/2006-01-13-StackSave.c new file mode 100644 index 000000000000..7c506b31f2a0 --- /dev/null +++ b/test/CodeGen/2006-01-13-StackSave.c @@ -0,0 +1,11 @@ +// PR691 +// RUN: %clang_cc1 %s -emit-llvm -o - | opt -std-compile-opts | \ +// RUN: llvm-dis | grep llvm.stacksave + +void test(int N) { + int i; + for (i = 0; i < N; ++i) { + int VLA[i]; + external(VLA); + } +} diff --git a/test/CodeGen/2006-01-16-BitCountIntrinsicsUnsigned.c b/test/CodeGen/2006-01-16-BitCountIntrinsicsUnsigned.c new file mode 100644 index 000000000000..ba7820a0db6c --- /dev/null +++ b/test/CodeGen/2006-01-16-BitCountIntrinsicsUnsigned.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +unsigned t2(unsigned X) { + // CHECK: t2 + // CHECK: llvm.ctlz.i32 + return __builtin_clz(X); +} +int t1(int X) { + // CHECK: t1 + // CHECK: llvm.ctlz.i32 + return __builtin_clz(X); +} diff --git a/test/CodeGen/2006-01-23-FileScopeAsm.c b/test/CodeGen/2006-01-23-FileScopeAsm.c new file mode 100644 index 000000000000..472b46496710 --- /dev/null +++ b/test/CodeGen/2006-01-23-FileScopeAsm.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: module asm "foo1" +__asm__ ("foo1"); +// CHECK: module asm "foo2" +__asm__ ("foo2"); +// CHECK: module asm "foo3" +__asm__ ("foo3"); +// CHECK: module asm "foo4" +__asm__ ("foo4"); +// CHECK: module asm "foo5" +__asm__ ("foo5"); diff --git a/test/CodeGen/2006-03-03-MissingInitializer.c b/test/CodeGen/2006-03-03-MissingInitializer.c new file mode 100644 index 000000000000..d2317d3acc41 --- /dev/null +++ b/test/CodeGen/2006-03-03-MissingInitializer.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +struct X { int *XX; int Y;}; + +void foo() { + // CHECK: @foo.nate = internal global i32 0 + static int nate = 0; + struct X bob = { &nate, 14 }; + bar(&bob); +} diff --git a/test/CodeGen/2006-03-16-VectorCtor.c b/test/CodeGen/2006-03-16-VectorCtor.c new file mode 100644 index 000000000000..c04d4b977a2e --- /dev/null +++ b/test/CodeGen/2006-03-16-VectorCtor.c @@ -0,0 +1,10 @@ +// Test that basic generic vector support works +// RUN: %clang_cc1 %s -emit-llvm -o - + +typedef int v4si __attribute__ ((__vector_size__ (16))); +void test(v4si *P, v4si *Q, float X) { + *P = (v4si){ X, X, X, X } * *Q; +} + +v4si G = (v4si){ 0.1, 1.2, 4.2, 17.2 }; + diff --git a/test/CodeGen/2006-03-17-KnRMismatch.c b/test/CodeGen/2006-03-17-KnRMismatch.c new file mode 100644 index 000000000000..f678e9f11d81 --- /dev/null +++ b/test/CodeGen/2006-03-17-KnRMismatch.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +void regnode(int op); + +void regnode(op) +char op; +{ +} diff --git a/test/CodeGen/2006-05-19-SingleEltReturn.c b/test/CodeGen/2006-05-19-SingleEltReturn.c new file mode 100644 index 000000000000..819237ce53be --- /dev/null +++ b/test/CodeGen/2006-05-19-SingleEltReturn.c @@ -0,0 +1,23 @@ +// Test returning a single element aggregate value containing a double. +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct X { + double D; +}; + +struct Y { + struct X x; +}; + +struct Y bar(); + +void foo(struct Y *P) { + *P = bar(); +} + +struct Y bar() { + struct Y a; + a.x.D = 0; + return a; +} + diff --git a/test/CodeGen/2006-07-31-PR854.c b/test/CodeGen/2006-07-31-PR854.c new file mode 100644 index 000000000000..b3b4d8eb616c --- /dev/null +++ b/test/CodeGen/2006-07-31-PR854.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple i686-linux-gnu -w %s -emit-llvm -o - + +// PR854 + struct kernel_symbol { + unsigned long value; + }; + unsigned long loops_per_jiffy = (1<<12); + static const char __kstrtab_loops_per_jiffy[] +__attribute__((section("__ksymtab_strings"))) = "loops_per_jiffy"; + static const struct kernel_symbol __ksymtab_loops_per_jiffy +__attribute__((__used__)) __attribute__((section("__ksymtab"))) = { (unsigned +long)&loops_per_jiffy, __kstrtab_loops_per_jiffy }; diff --git a/test/CodeGen/2006-09-11-BitfieldRefCrash.c b/test/CodeGen/2006-09-11-BitfieldRefCrash.c new file mode 100644 index 000000000000..3d45d8bfd202 --- /dev/null +++ b/test/CodeGen/2006-09-11-BitfieldRefCrash.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +// PR906 + +struct state_struct { + unsigned long long phys_frame: 50; + unsigned valid : 2; +} s; + +int mem_access(struct state_struct *p) { + return p->valid; +} + diff --git a/test/CodeGen/2006-09-18-fwrite-cast-crash.c b/test/CodeGen/2006-09-18-fwrite-cast-crash.c new file mode 100644 index 000000000000..a12fd0befe11 --- /dev/null +++ b/test/CodeGen/2006-09-18-fwrite-cast-crash.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null +// PR910 + +struct l_struct_2E_FILE { char x; }; +unsigned fwrite(signed char *, unsigned , unsigned , signed char *); +static signed char str301[39]; +static void Usage(signed char *ltmp_611_6) { + struct l_struct_2E_FILE *ltmp_6202_16; + unsigned ltmp_6203_92; + ltmp_6203_92 = /*tail*/ ((unsigned (*) (signed char *, unsigned , unsigned , +struct l_struct_2E_FILE *))(void*)fwrite)((&(str301[0u])), 38u, 1u, ltmp_6202_16); +} diff --git a/test/CodeGen/2006-09-21-IncompleteElementType.c b/test/CodeGen/2006-09-21-IncompleteElementType.c new file mode 100644 index 000000000000..1c71ea1ee9fa --- /dev/null +++ b/test/CodeGen/2006-09-21-IncompleteElementType.c @@ -0,0 +1,3 @@ +// RUN: not %clang_cc1 %s -emit-llvm -o /dev/null + +struct A X[(927 - 37) / sizeof(struct A)]; diff --git a/test/CodeGen/2006-09-25-DebugFilename.c b/test/CodeGen/2006-09-25-DebugFilename.c new file mode 100644 index 000000000000..2edb63f84dd8 --- /dev/null +++ b/test/CodeGen/2006-09-25-DebugFilename.c @@ -0,0 +1,4 @@ +// RUN: not %clang_cc1 %s -emit-llvm -o /dev/null +#include "2006-09-25-DebugFilename.h" +int func1() { return hfunc1(); } +int func2() { fluffy; return hfunc1(); } // expected-error {{use of undeclared identifier 'fluffy'}} diff --git a/test/CodeGen/2006-09-25-DebugFilename.h b/test/CodeGen/2006-09-25-DebugFilename.h new file mode 100644 index 000000000000..9b03666b3c27 --- /dev/null +++ b/test/CodeGen/2006-09-25-DebugFilename.h @@ -0,0 +1,6 @@ +extern int exfunc(int a); + +static inline int hfunc1() +{ + return exfunc(1); +} diff --git a/test/CodeGen/2006-09-28-SimpleAsm.c b/test/CodeGen/2006-09-28-SimpleAsm.c new file mode 100644 index 000000000000..c3983af5c98d --- /dev/null +++ b/test/CodeGen/2006-09-28-SimpleAsm.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// PR924 + +void bar() { + // Extended asm + // CHECK: call void asm sideeffect "ext: xorl %eax, eax; movl eax, fs; movl eax, gs %blah + asm volatile ("ext: xorl %%eax, eax; movl eax, fs; movl eax, gs %%blah %= %\ +% " : : "r"(1)); + // CHECK: call void asm sideeffect "nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs %%blah %= %% + // Non-extended asm. + asm volatile ("nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs %%blah %= %% "); +} diff --git a/test/CodeGen/2006-10-30-ArrayCrash.c b/test/CodeGen/2006-10-30-ArrayCrash.c new file mode 100644 index 000000000000..67446fd0567b --- /dev/null +++ b/test/CodeGen/2006-10-30-ArrayCrash.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -O3 -emit-llvm -o - %s +// PR954, PR911 + +extern void foo(); + +struct S { + short f1[3]; + unsigned int f2 : 1; +}; + +void bar() +{ + struct S *A; + + if (A->f2) + foo(); +} diff --git a/test/CodeGen/2006-12-14-ordered_expr.c b/test/CodeGen/2006-12-14-ordered_expr.c new file mode 100644 index 000000000000..c46ba8578941 --- /dev/null +++ b/test/CodeGen/2006-12-14-ordered_expr.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -O3 -emit-llvm %s -o - | FileCheck %s + +int test2(float X, float Y) { + // CHECK: fcmp ord float %X, %Y + return !__builtin_isunordered(X, Y); +} diff --git a/test/CodeGen/2007-01-06-KNR-Proto.c b/test/CodeGen/2007-01-06-KNR-Proto.c new file mode 100644 index 000000000000..d56a786fce53 --- /dev/null +++ b/test/CodeGen/2007-01-06-KNR-Proto.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s +// PR1083 + +int svc_register (void (*dispatch) (int)); + +int svc_register (dispatch) + void (*dispatch) (); +{ +} + diff --git a/test/CodeGen/2007-01-20-VectorICE.c b/test/CodeGen/2007-01-20-VectorICE.c new file mode 100644 index 000000000000..286b8a1b3de0 --- /dev/null +++ b/test/CodeGen/2007-01-20-VectorICE.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +typedef float __m128 __attribute__((__vector_size__(16))); +typedef long long __v2di __attribute__((__vector_size__(16))); +typedef int __v4si __attribute__((__vector_size__(16))); + +__v2di bar(void); +void foo(int X, __v4si *P) { + *P = X == 2 ? bar() : bar(); +} + diff --git a/test/CodeGen/2007-01-24-InlineAsmCModifier.c b/test/CodeGen/2007-01-24-InlineAsmCModifier.c new file mode 100644 index 000000000000..5158898f5dc8 --- /dev/null +++ b/test/CodeGen/2007-01-24-InlineAsmCModifier.c @@ -0,0 +1,12 @@ +// Verify that the %c modifier works and strips off any prefixes from +// immediates. +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +void foo() { + // CHECK: i32 789514 + __asm__ volatile("/* " "pickANumber" ": %c0 */"::"i"(0xC0C0A)); + + // Check that non-c modifiers work also + // CHECK: i32 123 + __asm__ volatile("/* " "pickANumber2 " ": %0 */"::"i"(123)); +} diff --git a/test/CodeGen/2007-02-04-AddrLValue-2.c b/test/CodeGen/2007-02-04-AddrLValue-2.c new file mode 100644 index 000000000000..bc44d1465f47 --- /dev/null +++ b/test/CodeGen/2007-02-04-AddrLValue-2.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -O3 -emit-llvm -o - +// PR1173 + +struct S { char s; }; +struct T { struct S t; }; + +struct S *const p = &((struct T * const) (0x4000))->t; + +void +foo (void) +{ + p->s = 0; +} diff --git a/test/CodeGen/2007-02-04-AddrLValue.c b/test/CodeGen/2007-02-04-AddrLValue.c new file mode 100644 index 000000000000..400dcb60a73c --- /dev/null +++ b/test/CodeGen/2007-02-04-AddrLValue.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -O3 -emit-llvm -o - +// PR1176 + +typedef struct +{ + char *key; + char *value; +} T1; + +typedef struct +{ + long type; + char *value; +} T3; + +T1 a[] = +{ + { + "", + ((char *)&((T3) {1, (char *) 1})) + } +}; + diff --git a/test/CodeGen/2007-02-04-EmptyStruct.c b/test/CodeGen/2007-02-04-EmptyStruct.c new file mode 100644 index 000000000000..2b2896f6d11a --- /dev/null +++ b/test/CodeGen/2007-02-04-EmptyStruct.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -O3 -emit-llvm -o - +// PR1175 + +struct empty { }; + +void foo(struct empty *p) { + p++; +} + diff --git a/test/CodeGen/2007-02-07-AddrLabel.c b/test/CodeGen/2007-02-07-AddrLabel.c new file mode 100644 index 000000000000..25eb89433679 --- /dev/null +++ b/test/CodeGen/2007-02-07-AddrLabel.c @@ -0,0 +1,10 @@ +// PR947 +// RUN: %clang_cc1 %s -emit-llvm -o - + +void foo() { + void *ptr; + label: + ptr = &&label; + + goto *ptr; + } diff --git a/test/CodeGen/2007-02-16-VoidPtrDiff.c b/test/CodeGen/2007-02-16-VoidPtrDiff.c new file mode 100644 index 000000000000..c9f6714c253c --- /dev/null +++ b/test/CodeGen/2007-02-16-VoidPtrDiff.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +void foo(void *ptr, int test) { + (ptr - ((void *) test + 0x2000)); +} diff --git a/test/CodeGen/2007-02-25-C-DotDotDot.c b/test/CodeGen/2007-02-25-C-DotDotDot.c new file mode 100644 index 000000000000..7b2e418f4918 --- /dev/null +++ b/test/CodeGen/2007-02-25-C-DotDotDot.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -O0 %s -emit-llvm -o - | FileCheck %s + +// Make sure the call to foo is compiled as: +// call float @foo() +// not +// call float (...)* bitcast (float ()* @foo to float (...)*)( ) + +static float foo() { return 0.0; } +// CHECK: call float @foo +float bar() { return foo()*10.0;} diff --git a/test/CodeGen/2007-03-01-VarSizeArrayIdx.c b/test/CodeGen/2007-03-01-VarSizeArrayIdx.c new file mode 100644 index 000000000000..7a9f89a66e26 --- /dev/null +++ b/test/CodeGen/2007-03-01-VarSizeArrayIdx.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -O3 -emit-llvm -o - | grep mul +// PR1233 + +float foo(int w, float A[][w], int g, int h) { + return A[g][0]; +} + diff --git a/test/CodeGen/2007-03-05-DataLayout.c b/test/CodeGen/2007-03-05-DataLayout.c new file mode 100644 index 000000000000..751962457379 --- /dev/null +++ b/test/CodeGen/2007-03-05-DataLayout.c @@ -0,0 +1,55 @@ +// Testcase for PR1242 +// RUN: %clang_cc1 -emit-llvm %s -o - | grep datalayout | \ +// RUN: not grep {"\[Ee\]-p:\[36\]\[24\]:\[36\]\[24\]"} +// END. + +typedef __SIZE_TYPE__ size_t; +void * malloc(size_t size); +#define NDIM 3 +#define BODY 01 +typedef double vector[NDIM]; +typedef struct bnode* bodyptr; +// { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x +// double], double, \2 *, \2 * } +struct bnode { + short int type; + double mass; + vector pos; + int proc; + int new_proc; + vector vel; + vector acc; + vector new_acc; + double phi; + bodyptr next; + bodyptr proc_next; +} body; + +#define Type(x) ((x)->type) +#define Mass(x) ((x)->mass) +#define Pos(x) ((x)->pos) +#define Proc(x) ((x)->proc) +#define New_Proc(x) ((x)->new_proc) +#define Vel(x) ((x)->vel) +#define Acc(x) ((x)->acc) +#define New_Acc(x) ((x)->new_acc) +#define Phi(x) ((x)->phi) +#define Next(x) ((x)->next) +#define Proc_Next(x) ((x)->proc_next) + +bodyptr ubody_alloc(int p) +{ + register bodyptr tmp; + tmp = (bodyptr)malloc(sizeof(body)); + + Type(tmp) = BODY; + Proc(tmp) = p; + Proc_Next(tmp) = NULL; + New_Proc(tmp) = p; + return tmp; +} + +int main(int argc, char** argv) { + bodyptr b = ubody_alloc(17); + return 0; +} diff --git a/test/CodeGen/2007-03-26-BitfieldAfterZeroWidth.c b/test/CodeGen/2007-03-26-BitfieldAfterZeroWidth.c new file mode 100644 index 000000000000..b4a42d989294 --- /dev/null +++ b/test/CodeGen/2007-03-26-BitfieldAfterZeroWidth.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +struct W {}; +struct Y { + struct W w; + int i:1; +} __attribute__ ((packed)) y; diff --git a/test/CodeGen/2007-03-26-ZeroWidthBitfield.c b/test/CodeGen/2007-03-26-ZeroWidthBitfield.c new file mode 100644 index 000000000000..0bf42ad4f954 --- /dev/null +++ b/test/CodeGen/2007-03-26-ZeroWidthBitfield.c @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +struct Z { int :0; } z; diff --git a/test/CodeGen/2007-03-27-VarLengthArray.c b/test/CodeGen/2007-03-27-VarLengthArray.c new file mode 100644 index 000000000000..ec11f55e6725 --- /dev/null +++ b/test/CodeGen/2007-03-27-VarLengthArray.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// CHECK: getelementptr inbounds i32* %{{vla|[0-9]}} +extern void f(int *); +int e(int m, int n) { + int x[n]; + f(x); + return x[m]; +} diff --git a/test/CodeGen/2007-04-05-PackedBitFields-2.c b/test/CodeGen/2007-04-05-PackedBitFields-2.c new file mode 100644 index 000000000000..41e6b7def91e --- /dev/null +++ b/test/CodeGen/2007-04-05-PackedBitFields-2.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +# define pck __attribute__((packed)) + + +struct pck F { + unsigned long long i : 12, + j : 23, + k : 27, + l; +}; +struct F f1; + +void foo() { + f1.l = 5; +} diff --git a/test/CodeGen/2007-04-05-PackedBitFields.c b/test/CodeGen/2007-04-05-PackedBitFields.c new file mode 100644 index 000000000000..5c824a3e08f1 --- /dev/null +++ b/test/CodeGen/2007-04-05-PackedBitFields.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +# define pck __attribute__((packed)) + + +struct pck E { + unsigned long long l, + i : 12, + j : 23, + k : 29; }; + +struct E e1; + +void foo() { + e1.k = 5; +} diff --git a/test/CodeGen/2007-04-05-PackedStruct.c b/test/CodeGen/2007-04-05-PackedStruct.c new file mode 100644 index 000000000000..1e9171e4235e --- /dev/null +++ b/test/CodeGen/2007-04-05-PackedStruct.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +#pragma pack(push, 2) + +enum { + tA = 0, + tB = 1 +}; + +struct MyStruct { + unsigned long A; + char C; + void * B; +}; + +void bar(){ +struct MyStruct MS = { tB, 0 }; +} diff --git a/test/CodeGen/2007-04-05-PadBeforeZeroLengthField.c b/test/CodeGen/2007-04-05-PadBeforeZeroLengthField.c new file mode 100644 index 000000000000..f3005b5adaac --- /dev/null +++ b/test/CodeGen/2007-04-05-PadBeforeZeroLengthField.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +struct c__ { unsigned int type:4; }; +union A { struct c__ c; } __attribute__((aligned(8))); +struct B { + unsigned int retainCount; + union A objects[]; +}; +void foo(union A * objects, struct B *array, unsigned long k) +{ array->objects[k] = objects[k]; } diff --git a/test/CodeGen/2007-04-05-UnPackedStruct.c b/test/CodeGen/2007-04-05-UnPackedStruct.c new file mode 100644 index 000000000000..e7a8df623947 --- /dev/null +++ b/test/CodeGen/2007-04-05-UnPackedStruct.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + + +enum { + tA = 0, + tB = 1 +}; + +struct MyStruct { + unsigned long A; + void * B; +}; + +void bar(){ +struct MyStruct MS = { tB, 0 }; +} diff --git a/test/CodeGen/2007-04-11-InlineAsmStruct.c b/test/CodeGen/2007-04-11-InlineAsmStruct.c new file mode 100644 index 000000000000..d617feeed9f9 --- /dev/null +++ b/test/CodeGen/2007-04-11-InlineAsmStruct.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct V { short X, Y; }; +int bar() { + struct V bar; + __asm__ volatile("foo %0\n" : "=r"(bar)); + return bar.X; +} diff --git a/test/CodeGen/2007-04-11-InlineAsmUnion.c b/test/CodeGen/2007-04-11-InlineAsmUnion.c new file mode 100644 index 000000000000..6d24d938abb3 --- /dev/null +++ b/test/CodeGen/2007-04-11-InlineAsmUnion.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +union U { int x; float p; }; +void foo() { + union U bar; + __asm__ volatile("foo %0\n" : "=r"(bar)); +} diff --git a/test/CodeGen/2007-04-11-PR1321.c b/test/CodeGen/2007-04-11-PR1321.c new file mode 100644 index 000000000000..6207ecc1161f --- /dev/null +++ b/test/CodeGen/2007-04-11-PR1321.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +struct X { + unsigned int e0 : 17; + unsigned int e1 : 17; + unsigned int e2 : 17; + unsigned int e3 : 17; + unsigned int e4 : 17; + unsigned int e5 : 17; + unsigned int e6 : 17; + unsigned int e7 : 17; +} __attribute__((packed)) x; diff --git a/test/CodeGen/2007-04-13-InlineAsmStruct2.c b/test/CodeGen/2007-04-13-InlineAsmStruct2.c new file mode 100644 index 000000000000..c9a87ffd55fb --- /dev/null +++ b/test/CodeGen/2007-04-13-InlineAsmStruct2.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +struct V { short X, Y; }; +int bar() { + struct V bar; + // CHECK: call void asm + __asm__ volatile("foo %0\n" :: "r"(bar)); + return bar.X; +} diff --git a/test/CodeGen/2007-04-13-InlineAsmUnion2.c b/test/CodeGen/2007-04-13-InlineAsmUnion2.c new file mode 100644 index 000000000000..a8983b61d71f --- /dev/null +++ b/test/CodeGen/2007-04-13-InlineAsmUnion2.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +union U { int x; char* p; }; +void foo() { + union U bar; + // CHECK: call void asm + __asm__ volatile("foo %0\n" :: "r"(bar)); +} diff --git a/test/CodeGen/2007-04-14-FNoBuiltin.c b/test/CodeGen/2007-04-14-FNoBuiltin.c new file mode 100644 index 000000000000..a5fda6306f28 --- /dev/null +++ b/test/CodeGen/2007-04-14-FNoBuiltin.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -O2 -fno-builtin -o - | grep call.*printf +// Check that -fno-builtin is honored. + +extern int printf(const char*, ...); +void foo(const char *msg) { + printf("%s\n",msg); +} diff --git a/test/CodeGen/2007-04-17-ZeroSizeBitFields.c b/test/CodeGen/2007-04-17-ZeroSizeBitFields.c new file mode 100644 index 000000000000..91b45828dbb6 --- /dev/null +++ b/test/CodeGen/2007-04-17-ZeroSizeBitFields.c @@ -0,0 +1,4 @@ +// PR 1332 +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +struct Z { int a:1; int :0; int c:1; } z; diff --git a/test/CodeGen/2007-04-24-VolatileStructCopy.c b/test/CodeGen/2007-04-24-VolatileStructCopy.c new file mode 100644 index 000000000000..5eeecce99d29 --- /dev/null +++ b/test/CodeGen/2007-04-24-VolatileStructCopy.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// PR1352 + +struct foo { + int x; +}; + +void copy(volatile struct foo *p, struct foo *q) { + // CHECK: call void @llvm.memcpy + *p = *q; +} diff --git a/test/CodeGen/2007-04-24-bit-not-expr.c b/test/CodeGen/2007-04-24-bit-not-expr.c new file mode 100644 index 000000000000..9d99caffb536 --- /dev/null +++ b/test/CodeGen/2007-04-24-bit-not-expr.c @@ -0,0 +1,7 @@ +// PR 1346 +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +extern bar(void *); + +void f(void *cd) { + bar(((void *)((unsigned long)(cd) ^ -1))); +} diff --git a/test/CodeGen/2007-04-24-str-const.c b/test/CodeGen/2007-04-24-str-const.c new file mode 100644 index 000000000000..1d86d1c251d3 --- /dev/null +++ b/test/CodeGen/2007-04-24-str-const.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +static char *str; + +static const struct { + const char *name; + unsigned type; +} scan_special[] = { + {"shift", 1}, + {0, 0} +}; + +static void +sb(void) +{ + while (*str == ' ' || *str == '\t') + str++; +} diff --git a/test/CodeGen/2007-05-07-PaddingElements.c b/test/CodeGen/2007-05-07-PaddingElements.c new file mode 100644 index 000000000000..574a37760a38 --- /dev/null +++ b/test/CodeGen/2007-05-07-PaddingElements.c @@ -0,0 +1,12 @@ +// PR 1278 +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | grep {struct.s} | not grep "4 x i8] zeroinitializer" +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | not grep "i32 0, i32 2" +struct s { + double d1; + int s1; +}; + +struct s foo(void) { + struct s S = {1.1, 2}; + return S; +} diff --git a/test/CodeGen/2007-05-08-PCH.c b/test/CodeGen/2007-05-08-PCH.c new file mode 100644 index 000000000000..c45d57c42f6f --- /dev/null +++ b/test/CodeGen/2007-05-08-PCH.c @@ -0,0 +1,7 @@ +// PR 1400 +// RUN: %clang_cc1 -x c-header %s -o /dev/null + +int main() { + return 0; +} + diff --git a/test/CodeGen/2007-05-11-str-const.c b/test/CodeGen/2007-05-11-str-const.c new file mode 100644 index 000000000000..731496d34686 --- /dev/null +++ b/test/CodeGen/2007-05-11-str-const.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o /dev/null + +static unsigned char out[]={0,1}; +static const unsigned char str1[]="1"; + diff --git a/test/CodeGen/2007-05-15-PaddingElement.c b/test/CodeGen/2007-05-15-PaddingElement.c new file mode 100644 index 000000000000..5aa4f2e091ce --- /dev/null +++ b/test/CodeGen/2007-05-15-PaddingElement.c @@ -0,0 +1,23 @@ +// PR 1419 + +// RUN: %clang_cc1 -O2 %s -emit-llvm -o - | grep "ret i32 1" +struct A { + short x; + long long :0; +}; + +struct B { + char a; + char b; + unsigned char i; +}; + +union X { struct A a; struct B b; }; + +int check(void) { + union X x, y; + + y.b.i = 0xff; + x = y; + return (x.b.i == 0xff); +} diff --git a/test/CodeGen/2007-05-16-EmptyStruct.c b/test/CodeGen/2007-05-16-EmptyStruct.c new file mode 100644 index 000000000000..14aaff007ebd --- /dev/null +++ b/test/CodeGen/2007-05-16-EmptyStruct.c @@ -0,0 +1,5 @@ +// PR 1417 +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: global %struct.anon* null +struct { } *X; diff --git a/test/CodeGen/2007-05-29-UnionCopy.c b/test/CodeGen/2007-05-29-UnionCopy.c new file mode 100644 index 000000000000..9f71687b40a5 --- /dev/null +++ b/test/CodeGen/2007-05-29-UnionCopy.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | grep memcpy +// PR1421 + +struct A { + char c; + int i; +}; + +struct B { + int c; + unsigned char x; +}; + +union U { struct A a; struct B b; }; + +void check(union U *u, union U *v) { + *u = *v; +} diff --git a/test/CodeGen/2007-06-05-NoInlineAttribute.c b/test/CodeGen/2007-06-05-NoInlineAttribute.c new file mode 100644 index 000000000000..26aad88e8146 --- /dev/null +++ b/test/CodeGen/2007-06-05-NoInlineAttribute.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | grep call + +static int bar(int x, int y) __attribute__((noinline)); + +static int bar(int x, int y) +{ + return x + y; +} + +int foo(int a, int b) { + return bar(b, a); +} + diff --git a/test/CodeGen/2007-06-15-AnnotateAttribute.c b/test/CodeGen/2007-06-15-AnnotateAttribute.c new file mode 100644 index 000000000000..de34866783ba --- /dev/null +++ b/test/CodeGen/2007-06-15-AnnotateAttribute.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.global.annotations +// RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.var.annotation | count 3 + +/* Global variable with attribute */ +int X __attribute__((annotate("GlobalValAnnotation"))); + +/* Function with attribute */ +int foo(int y) __attribute__((annotate("GlobalValAnnotation"))) + __attribute__((noinline)); + +int foo(int y __attribute__((annotate("LocalValAnnotation")))) { + int x __attribute__((annotate("LocalValAnnotation"))); + x = 34; + return y + x; +} + +int main() { + static int a __attribute__((annotate("GlobalValAnnotation"))); + a = foo(2); + return 0; +} diff --git a/test/CodeGen/2007-06-18-SextAttrAggregate.c b/test/CodeGen/2007-06-18-SextAttrAggregate.c new file mode 100644 index 000000000000..27ae6a9b76a6 --- /dev/null +++ b/test/CodeGen/2007-06-18-SextAttrAggregate.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -o - -emit-llvm | FileCheck %s +// PR1513 + +struct s{ +long a; +long b; +}; + +void f(struct s a, char *b, signed char C) { + // CHECK: i8 signext + +} diff --git a/test/CodeGen/2007-07-29-RestrictPtrArg.c b/test/CodeGen/2007-07-29-RestrictPtrArg.c new file mode 100644 index 000000000000..b6d61a714a69 --- /dev/null +++ b/test/CodeGen/2007-07-29-RestrictPtrArg.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | grep noalias + +void foo(int * __restrict myptr1, int * myptr2) { + myptr1[0] = 0; + myptr2[0] = 0; +} diff --git a/test/CodeGen/2007-08-01-LoadStoreAlign.c b/test/CodeGen/2007-08-01-LoadStoreAlign.c new file mode 100644 index 000000000000..87cf163d4d9b --- /dev/null +++ b/test/CodeGen/2007-08-01-LoadStoreAlign.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +struct p { + char a; + int b; +} __attribute__ ((packed)); + +struct p t = { 1, 10 }; +struct p u; + +int main () { + // CHECK: align 1 + // CHECK: align 1 + int tmp = t.b; + u.b = tmp; + return tmp; + +} diff --git a/test/CodeGen/2007-08-21-ComplexCst.c b/test/CodeGen/2007-08-21-ComplexCst.c new file mode 100644 index 000000000000..cd9ceb198baa --- /dev/null +++ b/test/CodeGen/2007-08-21-ComplexCst.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -O2 -emit-llvm %s -o /dev/null +void f(_Complex float z); +void g() { f(1.0i); } diff --git a/test/CodeGen/2007-08-22-CTTZ.c b/test/CodeGen/2007-08-22-CTTZ.c new file mode 100644 index 000000000000..9067c5a767e3 --- /dev/null +++ b/test/CodeGen/2007-08-22-CTTZ.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +int bork(unsigned long long x) { + // CHECK: llvm.cttz.i64 + // CHECK: llvm.cttz.i64 + // CHECK-NOT: lshr + return __builtin_ctzll(x); +} diff --git a/test/CodeGen/2007-09-05-ConstCtor.c b/test/CodeGen/2007-09-05-ConstCtor.c new file mode 100644 index 000000000000..138b81887560 --- /dev/null +++ b/test/CodeGen/2007-09-05-ConstCtor.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -Os -emit-llvm %s -o /dev/null +// PR1641 + +struct A { + unsigned long l; +}; + +void bar(struct A *a); + +void bork() { + const unsigned long vcgt = 1234; + struct A a = { vcgt }; + bar(&a); +} diff --git a/test/CodeGen/2007-09-12-PragmaPack.c b/test/CodeGen/2007-09-12-PragmaPack.c new file mode 100644 index 000000000000..71c7537e9dca --- /dev/null +++ b/test/CodeGen/2007-09-12-PragmaPack.c @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +#pragma pack(push, 1) +typedef struct +{ + uint32_t a; +} foo; + +typedef struct { + uint8_t major; + uint8_t minor; + uint16_t build; +} VERSION; + +typedef struct { + uint8_t a[5]; + VERSION version; + uint8_t b; + foo d; + uint32_t guard; +} bar; +#pragma pack(pop) + + +unsigned barsize(void) { + // CHECK: ret i32 18 + return sizeof(bar); +} diff --git a/test/CodeGen/2007-09-14-NegatePointer.c b/test/CodeGen/2007-09-14-NegatePointer.c new file mode 100644 index 000000000000..52367e6c667b --- /dev/null +++ b/test/CodeGen/2007-09-14-NegatePointer.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR1662 + +int foo(unsigned char *test) { + return 0U - (unsigned int )test; +} + diff --git a/test/CodeGen/2007-09-17-WeakRef.c b/test/CodeGen/2007-09-17-WeakRef.c new file mode 100644 index 000000000000..3047b7f954ef --- /dev/null +++ b/test/CodeGen/2007-09-17-WeakRef.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -O1 -emit-llvm %s -o - | grep icmp +// PR1678 + +extern void B (void); +static __typeof(B) A __attribute__ ((__weakref__("B"))); +int active (void) +{ + static void *const p = __extension__ (void *) &A; + return p != 0; +} diff --git a/test/CodeGen/2007-09-26-Alignment.c b/test/CodeGen/2007-09-26-Alignment.c new file mode 100644 index 000000000000..8ab130b0a708 --- /dev/null +++ b/test/CodeGen/2007-09-26-Alignment.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +extern p(int *); +int q(void) { + // CHECK: alloca i32, align 16 + int x __attribute__ ((aligned (16))); + p(&x); + return x; +} diff --git a/test/CodeGen/2007-09-27-ComplexIntCompare.c b/test/CodeGen/2007-09-27-ComplexIntCompare.c new file mode 100644 index 000000000000..d07aa0cf7c36 --- /dev/null +++ b/test/CodeGen/2007-09-27-ComplexIntCompare.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR1708 + +void __attribute__((noreturn)) abort(void); + +struct s { _Complex unsigned short x; }; +struct s gs = { 100 + 200i }; +struct s __attribute__((noinline)) foo (void) { return gs; } + +int main () +{ + if (foo ().x != gs.x) + abort (); + exit (0); +} diff --git a/test/CodeGen/2007-09-28-PackedUnionMember.c b/test/CodeGen/2007-09-28-PackedUnionMember.c new file mode 100644 index 000000000000..943480e4d882 --- /dev/null +++ b/test/CodeGen/2007-09-28-PackedUnionMember.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +#pragma pack(push, 2) +struct H { + unsigned long f1; + unsigned long f2; + union { + struct opaque1 *f3; + struct opaque2 *f4; + struct { + struct opaque3 *f5; + unsigned short f6; + } f7; + } f8; +}; +#pragma pack(pop) + +struct E { + unsigned long f1; + unsigned long f2; +}; + +typedef long (*FuncPtr) (); + +extern long bork(FuncPtr handler, const struct E *list); + +static long hndlr() +{ + struct H cmd = { 4, 412 }; + return 0; +} +void foo(void *inWindow) { + static const struct E events[] = { + { 123124, 1 } + }; + bork(hndlr, events); +} + diff --git a/test/CodeGen/2007-10-02-VolatileArray.c b/test/CodeGen/2007-10-02-VolatileArray.c new file mode 100644 index 000000000000..b1dcb7ea7d0b --- /dev/null +++ b/test/CodeGen/2007-10-02-VolatileArray.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | grep volatile +// PR1647 + +void foo(volatile int *p) +{ +p[0] = 0; +} diff --git a/test/CodeGen/2007-10-15-VoidPtr.c b/test/CodeGen/2007-10-15-VoidPtr.c new file mode 100644 index 000000000000..0bbff3da318d --- /dev/null +++ b/test/CodeGen/2007-10-15-VoidPtr.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +void bork(void **data) { + (*(unsigned short *) (&(data[37])[927]) = 0); +} diff --git a/test/CodeGen/2007-10-30-Volatile.c b/test/CodeGen/2007-10-30-Volatile.c new file mode 100644 index 000000000000..17aac1a987c2 --- /dev/null +++ b/test/CodeGen/2007-10-30-Volatile.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -Wall -Werror +void bork() { + char * volatile p = 0; + volatile int cc = 0; + p += cc; +} diff --git a/test/CodeGen/2007-11-07-AlignedMemcpy.c b/test/CodeGen/2007-11-07-AlignedMemcpy.c new file mode 100644 index 000000000000..829b60cb0ef0 --- /dev/null +++ b/test/CodeGen/2007-11-07-AlignedMemcpy.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +void bork() { + int Qux[33] = {0}; +} diff --git a/test/CodeGen/2007-11-07-CopyAggregateAlign.c b/test/CodeGen/2007-11-07-CopyAggregateAlign.c new file mode 100644 index 000000000000..08d97702e69a --- /dev/null +++ b/test/CodeGen/2007-11-07-CopyAggregateAlign.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +struct A { char s, t, u, v; short a; }; +// CHECK: %a = alloca %struct.A, align 2 +// CHECK: %b = alloca %struct.A, align 2 +// CHECK: call void @llvm.memcpy.p0i8.p0i8.{{.*}}, i32 2, i1 false) + +void q() { struct A a, b; a = b; } diff --git a/test/CodeGen/2007-11-07-ZeroAggregateAlign.c b/test/CodeGen/2007-11-07-ZeroAggregateAlign.c new file mode 100644 index 000000000000..b059607ba586 --- /dev/null +++ b/test/CodeGen/2007-11-07-ZeroAggregateAlign.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +struct A { short s; short t; int i; }; +// CHECK: %a = alloca %struct.A, align 4 +// CHECK: call void @llvm.memset.p0i8.{{.*}}i32 4, i1 false) +void q() { struct A a = {0}; } diff --git a/test/CodeGen/2007-11-28-GlobalInitializer.c b/test/CodeGen/2007-11-28-GlobalInitializer.c new file mode 100644 index 000000000000..a79ccddbe9e4 --- /dev/null +++ b/test/CodeGen/2007-11-28-GlobalInitializer.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR1744 +typedef struct foo { int x; char *p; } FOO; +extern FOO yy[]; + +int *y = &((yy + 1)->x); +void *z = &((yy + 1)->x); + diff --git a/test/CodeGen/2007-12-16-AsmNoUnwind.c b/test/CodeGen/2007-12-16-AsmNoUnwind.c new file mode 100644 index 000000000000..de078a28dd48 --- /dev/null +++ b/test/CodeGen/2007-12-16-AsmNoUnwind.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep nounwind + +void bar() { asm (""); } diff --git a/test/CodeGen/2008-01-04-WideBitfield.c b/test/CodeGen/2008-01-04-WideBitfield.c new file mode 100644 index 000000000000..e1c7a38a12e6 --- /dev/null +++ b/test/CodeGen/2008-01-04-WideBitfield.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s +// PR1386 +typedef unsigned long long uint64_t; +struct X { + unsigned char pad : 4; + uint64_t a : 64; +} __attribute__((packed)) x; + +uint64_t f(void) +{ + return x.a; +} diff --git a/test/CodeGen/2008-01-07-UnusualIntSize.c b/test/CodeGen/2008-01-07-UnusualIntSize.c new file mode 100644 index 000000000000..bf0ca5575a6a --- /dev/null +++ b/test/CodeGen/2008-01-07-UnusualIntSize.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// PR1721 + +struct s { + unsigned long long u33: 33; +} a, b; + +// This should have %0 and %1 truncated to 33 bits before any operation. +// This can be done using i33 or an explicit and. +_Bool test(void) { + // CHECK: and i64 %[[TMP1:[0-9]+]], 8589934591 + // CHECK-NOT: and i64 [[TMP1]], 8589934591 + // CHECK: and i64 %{{[0-9]}}, 8589934591 + return a.u33 + b.u33 != 0; +} diff --git a/test/CodeGen/2008-01-11-ChainConsistency.c b/test/CodeGen/2008-01-11-ChainConsistency.c new file mode 100644 index 000000000000..9ae021f6da58 --- /dev/null +++ b/test/CodeGen/2008-01-11-ChainConsistency.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -fnested-functions | not grep nest + +void n1(void) { void a(void) { a(); } a(); } diff --git a/test/CodeGen/2008-01-21-PackedBitFields.c b/test/CodeGen/2008-01-21-PackedBitFields.c new file mode 100644 index 000000000000..a649475e8df2 --- /dev/null +++ b/test/CodeGen/2008-01-21-PackedBitFields.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +typedef double Al1Double __attribute__((aligned(1))); +struct x { int a:23; Al1Double v; }; +struct x X = { 5, 3.0 }; +double foo() { return X.v; } + diff --git a/test/CodeGen/2008-01-21-PackedStructField.c b/test/CodeGen/2008-01-21-PackedStructField.c new file mode 100644 index 000000000000..aa1bee4abbe1 --- /dev/null +++ b/test/CodeGen/2008-01-21-PackedStructField.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct X { long double b; unsigned char c; double __attribute__((packed)) d; }; +struct X x = { 3.0L, 5, 3.0 }; + + +struct S2504 { + int e:17; + __attribute__((packed)) unsigned long long int f; +} ; +int fails; + extern struct S2504 s2504; +void check2504va (int z) { + struct S2504 arg, *p; + long long int i = 0; + arg.f = i; +} + diff --git a/test/CodeGen/2008-01-24-StructAlignAndBitFields.c b/test/CodeGen/2008-01-24-StructAlignAndBitFields.c new file mode 100644 index 000000000000..eae48b3cad90 --- /dev/null +++ b/test/CodeGen/2008-01-24-StructAlignAndBitFields.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +struct U { char a; short b; int c:25; char d; } u; + diff --git a/test/CodeGen/2008-01-25-ByValReadNone.c b/test/CodeGen/2008-01-25-ByValReadNone.c new file mode 100644 index 000000000000..06ad1eef00f1 --- /dev/null +++ b/test/CodeGen/2008-01-25-ByValReadNone.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | not grep readonly +// RUN: %clang_cc1 -emit-llvm -o - %s | not grep readnone + +// XFAIL: arm + +// The struct being passed byval means that we cannot mark the +// function readnone. Readnone would allow stores to the arg to +// be deleted in the caller. We also don't allow readonly since +// the callee might write to the byval parameter. The inliner +// would have to assume the worse and introduce an explicit +// temporary when inlining such a function, which is costly for +// the common case in which the byval argument is not written. +struct S { int A[1000]; }; +int __attribute__ ((const)) f(struct S x) { x.A[1] = 0; return x.A[0]; } +int g(struct S x) __attribute__ ((pure)); +int h(struct S x) { return g(x); } diff --git a/test/CodeGen/2008-01-25-ZeroSizedAggregate.c b/test/CodeGen/2008-01-25-ZeroSizedAggregate.c new file mode 100644 index 000000000000..d9059856254f --- /dev/null +++ b/test/CodeGen/2008-01-25-ZeroSizedAggregate.c @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +// Aggregates of size zero should be dropped from argument list. +typedef long int Tlong; +struct S2411 { + __attribute__((aligned)) Tlong:0; +}; + +extern struct S2411 a2411[5]; +extern void checkx2411(struct S2411); +void test2411(void) { + checkx2411(a2411[0]); +} + +// Proper handling of zero sized fields during type conversion. +typedef unsigned long long int Tal2ullong __attribute__((aligned(2))); +struct S2525 { + Tal2ullong: 0; + struct { + } e; +}; +struct S2525 s2525; + +struct { + signed char f; + char :0; + struct{}h; + char * i[5]; +} data; + +// Taking address of a zero sized field. +struct Z {}; +struct Y { + int i; + struct Z z; +}; +void *f(struct Y *y) { + return &y->z; +} diff --git a/test/CodeGen/2008-01-28-PragmaMark.c b/test/CodeGen/2008-01-28-PragmaMark.c new file mode 100644 index 000000000000..399af958fcf1 --- /dev/null +++ b/test/CodeGen/2008-01-28-PragmaMark.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -Werror -emit-llvm %s -o /dev/null +#pragma mark LLVM's world +#ifdef DO_ERROR +#error LLVM's world +#endif +int i; diff --git a/test/CodeGen/2008-01-28-UnionSize.c b/test/CodeGen/2008-01-28-UnionSize.c new file mode 100644 index 000000000000..14f363dbc05c --- /dev/null +++ b/test/CodeGen/2008-01-28-UnionSize.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +// PR 1861 + +typedef unsigned char __u8; +typedef unsigned int __u32; +typedef unsigned short u16; +typedef __u32 __le32; +struct bcm43xx_plcp_hdr6 { + union { + __le32 data; + __u8 raw[6]; + } + __attribute__((__packed__)); +} + __attribute__((__packed__)); +struct bcm43xx_txhdr { + union { + struct { + struct bcm43xx_plcp_hdr6 plcp; + }; + }; +} + __attribute__((__packed__)); +static void bcm43xx_generate_rts(struct bcm43xx_txhdr *txhdr ) { } diff --git a/test/CodeGen/2008-03-03-CtorAttrType.c b/test/CodeGen/2008-03-03-CtorAttrType.c new file mode 100644 index 000000000000..dbd7bc0a7270 --- /dev/null +++ b/test/CodeGen/2008-03-03-CtorAttrType.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.global_ctors +int __attribute__((constructor)) foo(void) { + return 0; +} +void __attribute__((constructor)) bar(void) {} + diff --git a/test/CodeGen/2008-03-05-syncPtr.c b/test/CodeGen/2008-03-05-syncPtr.c new file mode 100644 index 000000000000..784295ce6890 --- /dev/null +++ b/test/CodeGen/2008-03-05-syncPtr.c @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +int* foo(int** a, int* b, int* c) { +return __sync_val_compare_and_swap (a, b, c); +} +// CHECK: define i32* @foo +// CHECK: cmpxchg + +int foo2(int** a, int* b, int* c) { +return __sync_bool_compare_and_swap (a, b, c); +} +// CHECK: define i32 @foo2 +// CHECK: cmpxchg + +int* foo3(int** a, int b) { + return __sync_fetch_and_add (a, b); +} +// CHECK: define i32* @foo3 +// CHECK: atomicrmw add + + +int* foo4(int** a, int b) { + return __sync_fetch_and_sub (a, b); +} +// CHECK: define i32* @foo4 +// CHECK: atomicrmw sub + + +int* foo5(int** a, int* b) { + return __sync_lock_test_and_set (a, b); +} +// CHECK: define i32* @foo5 +// CHECK: atomicrmw xchg + + +int* foo6(int** a, int*** b) { + return __sync_lock_test_and_set (a, b); +} +// CHECK: define i32* @foo6 +// CHECK: atomicrmw xchg diff --git a/test/CodeGen/2008-03-24-BitField-And-Alloca.c b/test/CodeGen/2008-03-24-BitField-And-Alloca.c new file mode 100644 index 000000000000..cb80d76e0596 --- /dev/null +++ b/test/CodeGen/2008-03-24-BitField-And-Alloca.c @@ -0,0 +1,89 @@ +// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | not grep alloca +// RUN: %clang_cc1 -m32 -O2 -emit-llvm %s -o - | not grep {store } + +enum { + PP_C, + PP_D, + PP_R, + PP_2D, + PP_1D, + PP_SR, + PP_S2D, + PP_S1D, + PP_SC +}; + +enum { + G_VP, + G_FP, + G_VS, + G_GS, + G_FS +}; + +enum { + G_NONE, + G_B, + G_R +}; + +typedef union _Key { + struct { + unsigned int count : 2; + unsigned int Aconst : 1; + unsigned int Bconst : 1; + unsigned int Cconst : 1; + unsigned int Xused : 1; + unsigned int Yused : 1; + unsigned int Zused : 1; + unsigned int Wused : 1; + unsigned int ttype : 3; + unsigned int scalar : 1; + unsigned int AType : 4; + unsigned int BType : 4; + unsigned int CType : 4; + unsigned int RType : 4; + unsigned int Size : 2; + unsigned int prec : 1; + + unsigned int ASize : 2; + unsigned int BSize : 2; + unsigned int CSize : 2; + unsigned int tTex : 4; + unsigned int proj : 1; + unsigned int lod : 2; + unsigned int dvts : 1; + unsigned int uipad : 18; + } key_io; + struct { + unsigned int key0; + unsigned int key1; + } key; + unsigned long long lkey; +} Key; + +static void foo(const Key iospec, int* ret) +{ + *ret=0; + if(((iospec.key_io.lod == G_B) && + (iospec.key_io.ttype != G_VS) && + (iospec.key_io.ttype != G_GS) && + (iospec.key_io.ttype != G_FS)) || + + (((iospec.key_io.tTex == PP_C) || + (iospec.key_io.tTex == PP_SC)) && + ((iospec.key_io.tTex == PP_SR) || + (iospec.key_io.tTex == PP_S2D) || + (iospec.key_io.tTex == PP_S1D) || + (iospec.key_io.tTex == PP_SC)))) + *ret=1; +} + + +extern int bar(unsigned long long key_token2) +{ + int ret; + __attribute__ ((unused)) Key iospec = (Key) key_token2; + foo(iospec, &ret); + return ret; +} diff --git a/test/CodeGen/2008-03-26-PackedBitFields.c b/test/CodeGen/2008-03-26-PackedBitFields.c new file mode 100644 index 000000000000..72e5cb17de2e --- /dev/null +++ b/test/CodeGen/2008-03-26-PackedBitFields.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + + +struct S1757 { + long double c; + long int __attribute__((packed)) e:28; +} x; diff --git a/test/CodeGen/2008-04-08-NoExceptions.c b/test/CodeGen/2008-04-08-NoExceptions.c new file mode 100644 index 000000000000..6d5d20ff8541 --- /dev/null +++ b/test/CodeGen/2008-04-08-NoExceptions.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +void f(void); +void g(void) { + // CHECK: define void @g() nounwind + // CHECK-NOT: call void @f() nounwind + f(); +} + +// CHECK-NOT: declare void @f() nounwind diff --git a/test/CodeGen/2008-05-06-CFECrash.c b/test/CodeGen/2008-05-06-CFECrash.c new file mode 100644 index 000000000000..11775673a7cc --- /dev/null +++ b/test/CodeGen/2008-05-06-CFECrash.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm -O2 %s -o /dev/null +// PR2292. +__inline__ __attribute__ ((__pure__)) int g (void) {} +void f (int k) { k = g (); } diff --git a/test/CodeGen/2008-05-12-TempUsedBeforeDef.c b/test/CodeGen/2008-05-12-TempUsedBeforeDef.c new file mode 100644 index 000000000000..bc2886effc20 --- /dev/null +++ b/test/CodeGen/2008-05-12-TempUsedBeforeDef.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -w -emit-llvm -o /dev/null %s +// PR2264. +unsigned foo = 8L; +unsigned bar = 0L; +volatile unsigned char baz = 6L; +int test() { + char qux = 1L; + for (; baz >= -29; baz--) + bork(bar && foo, qux); +} diff --git a/test/CodeGen/2008-05-19-AlwaysInline.c b/test/CodeGen/2008-05-19-AlwaysInline.c new file mode 100644 index 000000000000..73a7691aed76 --- /dev/null +++ b/test/CodeGen/2008-05-19-AlwaysInline.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -fno-unit-at-a-time -O0 -o - | not grep sabrina +// RUN: %clang_cc1 %s -emit-llvm -funit-at-a-time -O0 -o - | not grep sabrina + +static inline int sabrina (void) __attribute__((always_inline)); +static inline int sabrina (void) +{ + return 13; +} +int bar (void) +{ + return sabrina () + 68; +} diff --git a/test/CodeGen/2008-08-07-AlignPadding1.c b/test/CodeGen/2008-08-07-AlignPadding1.c new file mode 100644 index 000000000000..2bb2e61be0db --- /dev/null +++ b/test/CodeGen/2008-08-07-AlignPadding1.c @@ -0,0 +1,32 @@ +/* RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s + +The FE must generate padding here both at the end of each PyG_Head and +between array elements. Reduced from Python. */ + +typedef union _gc_head { + struct { + union _gc_head *gc_next; + union _gc_head *gc_prev; + long gc_refs; + } gc; + int dummy __attribute__((aligned(16))); +} PyGC_Head; + +struct gc_generation { + PyGC_Head head; + int threshold; + int count; +}; + +#define GEN_HEAD(n) (&generations[n].head) + +// The idea is that there are 6 undefs in this structure initializer to cover +// the padding between elements. +// CHECK: @generations = global [3 x %struct.gc_generation] [%struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* getelementptr inbounds ([3 x %struct.gc_generation]* @generations, i32 0, i32 0, i32 0), %union._gc_head* getelementptr inbounds ([3 x %struct.gc_generation]* @generations, i32 0, i32 0, i32 0), i64 0 }, [8 x i8] undef }, i32 700, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* bitcast (i8* getelementptr (i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 48) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 48) to %union._gc_head*), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* bitcast (i8* getelementptr (i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 96) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 96) to %union._gc_head*), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }] +/* linked lists of container objects */ +struct gc_generation generations[3] = { + /* PyGC_Head, threshold, count */ + {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, + {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, + {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, +}; diff --git a/test/CodeGen/2008-08-07-AlignPadding2.c b/test/CodeGen/2008-08-07-AlignPadding2.c new file mode 100644 index 000000000000..ecf28dd72de0 --- /dev/null +++ b/test/CodeGen/2008-08-07-AlignPadding2.c @@ -0,0 +1,18 @@ +/* RUN: %clang_cc1 %s -emit-llvm -o - -O0 | grep zeroinitializer | count 1 + +The FE must not generate padding here between array elements. PR 2533. */ + +typedef struct { + const char *name; + int flags; + union { + int x; + } u; +} OptionDef; + +const OptionDef options[] = { + /* main options */ + { "a", 0, {3} }, + { "b", 0, {4} }, + { 0, }, +}; diff --git a/test/CodeGen/2008-08-07-GEPIntToPtr.c b/test/CodeGen/2008-08-07-GEPIntToPtr.c new file mode 100644 index 000000000000..6892be033a98 --- /dev/null +++ b/test/CodeGen/2008-08-07-GEPIntToPtr.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// PR2603 + +struct A { + char num_fields; +}; + +struct B { + char a, b[1]; +}; + +const struct A Foo = { + // CHECK: i8 1 + (char *)(&( (struct B *)(16) )->b[0]) - (char *)(16) +}; diff --git a/test/CodeGen/2008-09-03-WeakAlias.c b/test/CodeGen/2008-09-03-WeakAlias.c new file mode 100644 index 000000000000..4712a0138cb6 --- /dev/null +++ b/test/CodeGen/2008-09-03-WeakAlias.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm -O1 -o - %s | grep icmp +// PR1678 +extern void B (void); +static __typeof(B) A __attribute__ ((__weakref__("B"))); +int active (void) +{ + static void *const p = __extension__ (void *) &A; + return p != 0; +} diff --git a/test/CodeGen/2008-10-13-FrontendCrash.c b/test/CodeGen/2008-10-13-FrontendCrash.c new file mode 100644 index 000000000000..cdd122970583 --- /dev/null +++ b/test/CodeGen/2008-10-13-FrontendCrash.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +// PR2797 + +unsigned int +func_48 (signed char p_49) +{ + signed char l_340; + func_44 (1&((1 ^ 1 == (lshift_u_s (1)) != (l_340 < 1)) & 1L)); +} diff --git a/test/CodeGen/2008-10-30-ZeroPlacement.c b/test/CodeGen/2008-10-30-ZeroPlacement.c new file mode 100644 index 000000000000..f3806d499d52 --- /dev/null +++ b/test/CodeGen/2008-10-30-ZeroPlacement.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR2987 +struct S2045 +{ + unsigned short int a; + union { } b; + union __attribute__ ((aligned (4))) { } c[0]; +}; +struct S2045 s2045; diff --git a/test/CodeGen/2008-11-02-WeakAlias.c b/test/CodeGen/2008-11-02-WeakAlias.c new file mode 100644 index 000000000000..63fd4e15eac9 --- /dev/null +++ b/test/CodeGen/2008-11-02-WeakAlias.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple=i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s +// PR2691 + +// CHECK: weak +void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); +void native_init_IRQ(void) {} diff --git a/test/CodeGen/2008-11-08-InstCombineSelect.c b/test/CodeGen/2008-11-08-InstCombineSelect.c new file mode 100644 index 000000000000..3f4428e572ee --- /dev/null +++ b/test/CodeGen/2008-11-08-InstCombineSelect.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -emit-llvm -O2 -o - +// PR3028 + +int g_187; +int g_204; +int g_434; + +int func_89 (void) +{ + return 1; +} + +void func_20 (int p_22) +{ + if (1 & p_22 | g_204 & (1 < g_187) - func_89 ()) + g_434 = 1; +} diff --git a/test/CodeGen/2008-12-23-AsmIntPointerTie.c b/test/CodeGen/2008-12-23-AsmIntPointerTie.c new file mode 100644 index 000000000000..df646b7801f7 --- /dev/null +++ b/test/CodeGen/2008-12-23-AsmIntPointerTie.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - + +typedef long intptr_t; +int test(void *b) { + intptr_t a; + __asm__ __volatile__ ("%0 %1 " : "=r" (a): "0" (b)); + return a; +} diff --git a/test/CodeGen/2009-01-05-BlockInlining.c b/test/CodeGen/2009-01-05-BlockInlining.c new file mode 100644 index 000000000000..2ae9b70bb8fd --- /dev/null +++ b/test/CodeGen/2009-01-05-BlockInlining.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -emit-llvm -fblocks -o - | FileCheck %s +// rdar://5865221 + +// These will be inlined by the optimizers provided the block descriptors +// and block literals are internal constants. +// CHECK: @__block_descriptor_tmp = internal constant +// CHECK: @__block_literal_global = internal constant +// CHECK: @__block_descriptor_tmp1 = internal constant +// CHECK: @__block_literal_global2 = internal constant +static int fun(int x) { + return x+1; +} + +static int block(int x) { + return (^(int x){return x+1;})(x); +} + +static void print(int result) { + printf("%d\n", result); +} + +int main (int argc, const char * argv[]) { + int x = argc-1; + print(fun(x)); + print(block(x)); + int (^block_inline)(int) = ^(int x){return x+1;}; + print(block_inline(x)); + return 0; +} diff --git a/test/CodeGen/2009-01-21-InvalidIterator.c b/test/CodeGen/2009-01-21-InvalidIterator.c new file mode 100644 index 000000000000..f857b4d8bd00 --- /dev/null +++ b/test/CodeGen/2009-01-21-InvalidIterator.c @@ -0,0 +1,74 @@ +// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null + +typedef long unsigned int size_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; +typedef uint16_t Elf64_Half; +typedef uint32_t Elf64_Word; +typedef uint64_t Elf64_Xword; +typedef uint64_t Elf64_Addr; +typedef uint64_t Elf64_Off; +typedef struct +{ + Elf64_Word p_type; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Xword p_align; +} +Elf64_Phdr; +struct dl_phdr_info +{ + const char *dlpi_name; + const Elf64_Phdr *dlpi_phdr; + Elf64_Half dlpi_phnum; + unsigned long long int dlpi_adds; +}; +typedef unsigned _Unwind_Ptr; +struct object +{ + union + { + const struct dwarf_fde *single; + struct dwarf_fde **array; + struct fde_vector *sort; + } + u; + union + { + struct + { + } + b; + } + s; + struct object *next; +}; +typedef int sword; +typedef unsigned int uword; +struct dwarf_fde +{ + uword length; + sword CIE_delta; + unsigned char pc_begin[]; +}; +typedef struct dwarf_fde fde; +struct unw_eh_callback_data +{ + const fde *ret; + struct frame_hdr_cache_element *link; +} +frame_hdr_cache[8]; + +_Unwind_Ptr +base_from_cb_data (struct unw_eh_callback_data *data) +{ +} + +void +_Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr) +{ + const unsigned char *p; + const struct unw_eh_frame_hdr *hdr; + struct object ob; +} diff --git a/test/CodeGen/2009-02-13-zerosize-union-field-ppc.c b/test/CodeGen/2009-02-13-zerosize-union-field-ppc.c new file mode 100644 index 000000000000..21b47052813e --- /dev/null +++ b/test/CodeGen/2009-02-13-zerosize-union-field-ppc.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -m32 -emit-llvm -o - | grep {i32 32} | count 3 +// XFAIL: * +// XTARGET: powerpc +// Every printf has 'i32 0' for the GEP of the string; no point counting those. +typedef unsigned int Foo __attribute__((aligned(32))); +typedef union{Foo:0;}a; +typedef union{int x; Foo:0;}b; +extern int printf(const char*, ...); +main() { + printf("%ld\n", sizeof(a)); + printf("%ld\n", __alignof__(a)); + printf("%ld\n", sizeof(b)); + printf("%ld\n", __alignof__(b)); +} diff --git a/test/CodeGen/2009-02-13-zerosize-union-field.c b/test/CodeGen/2009-02-13-zerosize-union-field.c new file mode 100644 index 000000000000..b39a231c65e1 --- /dev/null +++ b/test/CodeGen/2009-02-13-zerosize-union-field.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -triple i686-apple-darwin -emit-llvm -o - | FileCheck %s +// Every printf has 'i32 0' for the GEP of the string; no point counting those. +typedef unsigned int Foo __attribute__((aligned(32))); +typedef union{Foo:0;}a; +typedef union{int x; Foo:0;}b; +extern int printf(const char*, ...); +int main() { + // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 0 + printf("%ld\n", sizeof(a)); + // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 1 + printf("%ld\n", __alignof__(a)); + // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4 + printf("%ld\n", sizeof(b)); + // CHECK: getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), i32 4 + printf("%ld\n", __alignof__(b)); +} diff --git a/test/CodeGen/2009-03-01-MallocNoAlias.c b/test/CodeGen/2009-03-01-MallocNoAlias.c new file mode 100644 index 000000000000..1c4878a8189c --- /dev/null +++ b/test/CodeGen/2009-03-01-MallocNoAlias.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep noalias + +void * __attribute__ ((malloc)) foo (void) { return 0; } diff --git a/test/CodeGen/2009-03-08-ZeroEltStructCrash.c b/test/CodeGen/2009-03-08-ZeroEltStructCrash.c new file mode 100644 index 000000000000..b530eb7ce1e5 --- /dev/null +++ b/test/CodeGen/2009-03-08-ZeroEltStructCrash.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR3744 +struct Empty {}; +struct Union { + union { + int zero_arr[0]; + } contents; +}; +static inline void Foo(struct Union *u) { + int *array = u->contents.zero_arr; +} +static void Bar(struct Union *u) { + Foo(u); +} diff --git a/test/CodeGen/2009-03-13-dbg.c b/test/CodeGen/2009-03-13-dbg.c new file mode 100644 index 000000000000..8f48830e8e2f --- /dev/null +++ b/test/CodeGen/2009-03-13-dbg.c @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null +void foo() {} diff --git a/test/CodeGen/2009-04-28-UnionArrayCrash.c b/test/CodeGen/2009-04-28-UnionArrayCrash.c new file mode 100644 index 000000000000..4296b918cbcc --- /dev/null +++ b/test/CodeGen/2009-04-28-UnionArrayCrash.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR4082 +union U { + int I; + double F; +}; + +union U arr[] = { { .I = 4 }, { .F = 123.} }; +union U *P = &arr[0]; + + diff --git a/test/CodeGen/2009-05-04-EnumInreg.c b/test/CodeGen/2009-05-04-EnumInreg.c new file mode 100644 index 000000000000..2abc747caf27 --- /dev/null +++ b/test/CodeGen/2009-05-04-EnumInreg.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin -mregparm 3 %s -o - | FileCheck %s +// PR3967 + +enum kobject_action { + KOBJ_ADD, + KOBJ_REMOVE, + KOBJ_CHANGE, + KOBJ_MOVE, + KOBJ_ONLINE, + KOBJ_OFFLINE, + KOBJ_MAX +}; + +struct kobject; + +// CHECK: i32 inreg %action +int kobject_uevent(struct kobject *kobj, enum kobject_action action) {} diff --git a/test/CodeGen/2009-06-14-HighlyAligned.c b/test/CodeGen/2009-06-14-HighlyAligned.c new file mode 100644 index 000000000000..b5a7f5e733ff --- /dev/null +++ b/test/CodeGen/2009-06-14-HighlyAligned.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null +// PR4332 + +static int highly_aligned __attribute__((aligned(4096))); + +int f() { + return highly_aligned; +} diff --git a/test/CodeGen/2009-06-18-StaticInitTailPadPack.c b/test/CodeGen/2009-06-18-StaticInitTailPadPack.c new file mode 100644 index 000000000000..be103ec8e347 --- /dev/null +++ b/test/CodeGen/2009-06-18-StaticInitTailPadPack.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +// rdar://6983634 + + typedef struct A *Foo; +#pragma pack(push, 2) + struct Bar { + Foo f1; + unsigned short f2; + float f3; + }; + struct Baz { + struct Bar f1; + struct Bar f2; + }; + struct Qux { + unsigned long f1; + struct Baz f2; + }; +extern const struct Qux Bork; +const struct Qux Bork = { + 0, + { + {0}, + {0} + } +}; diff --git a/test/CodeGen/2009-07-14-VoidPtr.c b/test/CodeGen/2009-07-14-VoidPtr.c new file mode 100644 index 000000000000..5e8b23d3aab6 --- /dev/null +++ b/test/CodeGen/2009-07-14-VoidPtr.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR4556 + +extern void foo; +void *bar = &foo; + diff --git a/test/CodeGen/2009-07-15-pad-wchar_t-array.c b/test/CodeGen/2009-07-15-pad-wchar_t-array.c new file mode 100644 index 000000000000..df12cae90ea0 --- /dev/null +++ b/test/CodeGen/2009-07-15-pad-wchar_t-array.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include. +typedef __WCHAR_TYPE__ wchar_t; +#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \ + || defined(_M_X64) || defined(SHORT_WCHAR) + #define WCHAR_T_TYPE unsigned short +#elif defined(__sun) || defined(__AuroraUX__) + #define WCHAR_T_TYPE long +#else /* Solaris or AuroraUX. */ + #define WCHAR_T_TYPE int +#endif + +signed short _iodbcdm_sqlerror( ) +{ + wchar_t _sqlState[6] = { L"\0" }; +} diff --git a/test/CodeGen/2009-07-22-StructLayout.c b/test/CodeGen/2009-07-22-StructLayout.c new file mode 100644 index 000000000000..7b7b82c40a5f --- /dev/null +++ b/test/CodeGen/2009-07-22-StructLayout.c @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 %s -triple i686-pc-linux-gnu -emit-llvm -o /dev/null +// PR4590 + +typedef unsigned char __u8; +typedef unsigned int __le32; +typedef unsigned int __u32; +typedef unsigned short __le16; +typedef unsigned short __u16; + +struct usb_cdc_ether_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __u8 iMACAddress; + __le32 bmEthernetStatistics; + __le16 wMaxSegmentSize; + __le16 wNumberMCFilters; + __u8 bNumberPowerFilters; +} __attribute__ ((packed)); + + +static struct usb_cdc_ether_desc ecm_desc __attribute__ ((__section__(".init.data"))) = { + .bLength = sizeof ecm_desc, + .bDescriptorType = ((0x01 << 5) | 0x04), + .bDescriptorSubType = 0x0f, + + + + .bmEthernetStatistics = (( __le32)(__u32)(0)), + .wMaxSegmentSize = (( __le16)(__u16)(1514)), + .wNumberMCFilters = (( __le16)(__u16)(0)), + .bNumberPowerFilters = 0, +}; diff --git a/test/CodeGen/2009-09-24-SqrtErrno.c b/test/CodeGen/2009-09-24-SqrtErrno.c new file mode 100644 index 000000000000..b4a04ff6b6ab --- /dev/null +++ b/test/CodeGen/2009-09-24-SqrtErrno.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -fmath-errno | FileCheck %s +// llvm.sqrt has undefined behavior on negative inputs, so it is +// inappropriate to translate C/C++ sqrt to this. + +float sqrtf(float x); +float foo(float X) { +// CHECK: foo +// CHECK-NOT: readonly +// CHECK: call float @sqrtf + // Check that this is not marked readonly when errno is used. + return sqrtf(X); +} diff --git a/test/CodeGen/2009-12-07-BitFieldAlignment.c b/test/CodeGen/2009-12-07-BitFieldAlignment.c new file mode 100644 index 000000000000..72c30e13c955 --- /dev/null +++ b/test/CodeGen/2009-12-07-BitFieldAlignment.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple i686-apple-darwin %s -emit-llvm -o - | FileCheck %s +// Set alignment on bitfield accesses. + +struct S { + int a, b; + void *c; + unsigned d : 8; + unsigned e : 8; +}; + +void f0(struct S *a) { +// CHECK: load {{.*}}, align 4 +// CHECK: store {{.*}}, align 4 + a->e = 0; +} diff --git a/test/CodeGen/2010-01-13-MemBarrier.c b/test/CodeGen/2010-01-13-MemBarrier.c new file mode 100644 index 000000000000..c2b0acdab3cb --- /dev/null +++ b/test/CodeGen/2010-01-13-MemBarrier.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// XFAIL: sparc +// rdar://7536390 + +typedef unsigned __INT32_TYPE__ uint32_t; + +unsigned t(uint32_t *ptr, uint32_t val) { + // CHECK: @t + // CHECK: atomicrmw xchg i32* {{.*}} seq_cst + return __sync_lock_test_and_set(ptr, val); +} diff --git a/test/CodeGen/2010-01-14-FnType-DebugInfo.c b/test/CodeGen/2010-01-14-FnType-DebugInfo.c new file mode 100644 index 000000000000..964c031d27c0 --- /dev/null +++ b/test/CodeGen/2010-01-14-FnType-DebugInfo.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -g -o /dev/null +typedef void (*sigcatch_t)( struct sigcontext *); +sigcatch_t sigcatch[50] = {(sigcatch_t) 0}; + diff --git a/test/CodeGen/2010-01-18-Inlined-Debug.c b/test/CodeGen/2010-01-18-Inlined-Debug.c new file mode 100644 index 000000000000..cf00be7752cf --- /dev/null +++ b/test/CodeGen/2010-01-18-Inlined-Debug.c @@ -0,0 +1,12 @@ +// PR: 6058 +// RUN: %clang_cc1 -g -emit-llvm %s -O0 -o /dev/null + +static inline int foo(double) __attribute__ ((always_inline)); +static inline int foo(double __x) { return __x; } + +void bar(double x) { + foo(x); +} + + + diff --git a/test/CodeGen/2010-02-10-PointerName.c b/test/CodeGen/2010-02-10-PointerName.c new file mode 100644 index 000000000000..910dd30fc603 --- /dev/null +++ b/test/CodeGen/2010-02-10-PointerName.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -g -o - | grep DW_TAG_pointer_type | grep -v char + +char i = 1; +void foo() { + char *cp = &i; +} + diff --git a/test/CodeGen/2010-02-15-DbgStaticVar.c b/test/CodeGen/2010-02-15-DbgStaticVar.c new file mode 100644 index 000000000000..facd14e03ee6 --- /dev/null +++ b/test/CodeGen/2010-02-15-DbgStaticVar.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -g -emit-llvm %s -o - | grep "metadata ..b., metadata ..b., metadata ...," +// Test to check intentionally empty linkage name for a static variable. +// Radar 7651244. +static int foo(int a) +{ + static int b = 1; + return b+a; +} + +int main() { + int j = foo(1); + return 0; +} diff --git a/test/CodeGen/2010-03-5-LexicalScope.c b/test/CodeGen/2010-03-5-LexicalScope.c new file mode 100644 index 000000000000..0f63ff6914b2 --- /dev/null +++ b/test/CodeGen/2010-03-5-LexicalScope.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -O0 -g %s -o - | grep DW_TAG_lexical_block | count 3 +int foo(int i) { + if (i) { + int j = 2; + } + else { + int j = 3; + } + return i; +} diff --git a/test/CodeGen/2010-05-26-AsmSideEffect.c b/test/CodeGen/2010-05-26-AsmSideEffect.c new file mode 100644 index 000000000000..7dd86aeb54d7 --- /dev/null +++ b/test/CodeGen/2010-05-26-AsmSideEffect.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple arm-apple-darwin -o - | FileCheck %s +// Radar 8026855 + +int test (void *src) { + register int w0 asm ("0"); + // CHECK: call i32 asm "ldr $0, [$1]", "={r0}{{.*}}(i8* + asm ("ldr %0, [%1]": "=r" (w0): "r" (src)); + return w0; +} diff --git a/test/CodeGen/2010-06-11-SaveExpr.c b/test/CodeGen/2010-06-11-SaveExpr.c new file mode 100644 index 000000000000..bfe0f35e269c --- /dev/null +++ b/test/CodeGen/2010-06-11-SaveExpr.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// Test case by Eric Postpischil! +void foo(void) +{ + char a[1]; + int t = 1; + ((char (*)[t]) a)[0][0] = 0; +} diff --git a/test/CodeGen/2010-06-17-asmcrash.c b/test/CodeGen/2010-06-17-asmcrash.c new file mode 100644 index 000000000000..8e9485bba9b8 --- /dev/null +++ b/test/CodeGen/2010-06-17-asmcrash.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | llc -mtriple=x86_64-apple-darwin | FileCheck %s +// XFAIL: * +// XTARGET: x86,i386,i686 + +typedef long long int64_t; +typedef unsigned char uint8_t; +typedef int64_t x86_reg; + +void avg_pixels8_mmx2(uint8_t *block, const uint8_t *pixels, int line_size, int h) +{ + __asm__ volatile("# %0 %1 %2 %3" + :"+g"(h), "+S"(pixels), "+D"(block) + :"r" ((x86_reg)line_size) + :"%""rax", "memory"); +// CHECK: # %ecx %rsi %rdi %rdx + } diff --git a/test/CodeGen/2010-07-08-DeclDebugLineNo.c b/test/CodeGen/2010-07-08-DeclDebugLineNo.c new file mode 100644 index 000000000000..1637a4936747 --- /dev/null +++ b/test/CodeGen/2010-07-08-DeclDebugLineNo.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -O0 -g %s -o - | FileCheck %s +// Insure that dbg.declare lines for locals refer to correct line number records. +// Radar 8152866. +void foo() { + int l = 0; // line #4: CHECK: {{call.*llvm.dbg.declare.*%l.*\!dbg }}[[variable_l:![0-9]+]] + int p = 0; // line #5: CHECK: {{call.*llvm.dbg.declare.*%p.*\!dbg }}[[variable_p:![0-9]+]] +} +// Now match the line number records: +// CHECK: {{^}}[[variable_l]]{{ = metadata ![{]i32 5,}} +// CHECK: {{^}}[[variable_p]]{{ = metadata ![{]i32 6,}} diff --git a/test/CodeGen/2010-07-14-overconservative-align.c b/test/CodeGen/2010-07-14-overconservative-align.c new file mode 100644 index 000000000000..5c8c05645178 --- /dev/null +++ b/test/CodeGen/2010-07-14-overconservative-align.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s +// PR 5995 +struct s { + int word; + struct { + int filler __attribute__ ((aligned (8))); + }; +}; + +void func (struct s *s) +{ + // CHECK: load %struct.s**{{.*}}align 8 + s->word = 0; +} diff --git a/test/CodeGen/2010-07-14-ref-off-end.c b/test/CodeGen/2010-07-14-ref-off-end.c new file mode 100644 index 000000000000..580ae889d8f2 --- /dev/null +++ b/test/CodeGen/2010-07-14-ref-off-end.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple i386-apple-darwin -o - | FileCheck %s +extern void abort(); +extern void exit(int); +struct T +{ +unsigned i:8; +unsigned c:24; +}; +f(struct T t) +{ +struct T s[1]; +s[0]=t; +return(char)s->c; +} +main() +{ +// CHECK: getelementptr inbounds [1 x %struct.T]* %s, i32 0, i32 0 +// CHECK: getelementptr inbounds [1 x %struct.T]* %s, i32 0, i32 0 +struct T t; +t.i=0xff; +t.c=0xffff11; +if(f(t)!=0x11)abort(); +exit(0); +} diff --git a/test/CodeGen/2010-08-12-asm-aggr-arg.c b/test/CodeGen/2010-08-12-asm-aggr-arg.c new file mode 100644 index 000000000000..5ddc4122d60f --- /dev/null +++ b/test/CodeGen/2010-08-12-asm-aggr-arg.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | FileCheck %s +// Radar 8288710: A small aggregate can be passed as an integer. Make sure +// we don't get an error with "input constraint with a matching output +// constraint of incompatible type!" + +struct wrapper { + int i; +}; + +// CHECK: xyz +int test(int i) { + struct wrapper w; + w.i = i; + __asm__("xyz" : "=r" (w) : "0" (w)); + return w.i; +} diff --git a/test/CodeGen/2010-12-01-CommonGlobal.c b/test/CodeGen/2010-12-01-CommonGlobal.c new file mode 100644 index 000000000000..5eadbae6e3a6 --- /dev/null +++ b/test/CodeGen/2010-12-01-CommonGlobal.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// Don't crash on a common-linkage constant global. +extern const int kABSourceTypeProperty; +int foo(void) { + return kABSourceTypeProperty; +} +const int kABSourceTypeProperty; diff --git a/test/CodeGen/2011-02-21-DATA-common.c b/test/CodeGen/2011-02-21-DATA-common.c new file mode 100644 index 000000000000..5079561c868c --- /dev/null +++ b/test/CodeGen/2011-02-21-DATA-common.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +struct rtxc_snapshot { + int a, b, c, d; +}; +__attribute__ ((section("__DATA, __common"))) static struct rtxc_snapshot rtxc_log_A[4]; diff --git a/test/CodeGen/2011-03-02-UnionInitializer.c b/test/CodeGen/2011-03-02-UnionInitializer.c new file mode 100644 index 000000000000..3c112e0a47f0 --- /dev/null +++ b/test/CodeGen/2011-03-02-UnionInitializer.c @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +union { int :3; double f; } u17_017 = {17.17}; diff --git a/test/CodeGen/2011-03-08-ZeroFieldUnionInitializer.c b/test/CodeGen/2011-03-08-ZeroFieldUnionInitializer.c new file mode 100644 index 000000000000..ff570d8abb42 --- /dev/null +++ b/test/CodeGen/2011-03-08-ZeroFieldUnionInitializer.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +typedef struct { + union { + struct { } __attribute((packed)); + }; +} fenv_t; +const fenv_t _FE_DFL_ENV = {{{ 0, 0, 0, 0 }}}; diff --git a/test/CodeGen/2011-03-31-ArrayRefFolding.c b/test/CodeGen/2011-03-31-ArrayRefFolding.c new file mode 100644 index 000000000000..31c0a681a4dc --- /dev/null +++ b/test/CodeGen/2011-03-31-ArrayRefFolding.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple i386-apple-darwin %s | FileCheck %s +// PR9571 + +struct t { + int x; +}; + +extern struct t *cfun; + +int f(void) { + if (!(cfun + 0)) + // CHECK: icmp ne %struct.t* + return 0; + return cfun->x; +} diff --git a/test/CodeGen/Atomics.c b/test/CodeGen/Atomics.c new file mode 100644 index 000000000000..c440b6c1909e --- /dev/null +++ b/test/CodeGen/Atomics.c @@ -0,0 +1,203 @@ +// Test frontend handling of __sync builtins. +// Modified from a gcc testcase. +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long long sll; +unsigned long long ull; + +void test_op_ignore (void) // CHECK: define void @test_op_ignore +{ + (void) __sync_fetch_and_add (&sc, 1); // CHECK: atomicrmw add i8 + (void) __sync_fetch_and_add (&uc, 1); // CHECK: atomicrmw add i8 + (void) __sync_fetch_and_add (&ss, 1); // CHECK: atomicrmw add i16 + (void) __sync_fetch_and_add (&us, 1); // CHECK: atomicrmw add i16 + (void) __sync_fetch_and_add (&si, 1); // CHECK: atomicrmw add i32 + (void) __sync_fetch_and_add (&ui, 1); // CHECK: atomicrmw add i32 + (void) __sync_fetch_and_add (&sll, 1); // CHECK: atomicrmw add i64 + (void) __sync_fetch_and_add (&ull, 1); // CHECK: atomicrmw add i64 + + (void) __sync_fetch_and_sub (&sc, 1); // CHECK: atomicrmw sub i8 + (void) __sync_fetch_and_sub (&uc, 1); // CHECK: atomicrmw sub i8 + (void) __sync_fetch_and_sub (&ss, 1); // CHECK: atomicrmw sub i16 + (void) __sync_fetch_and_sub (&us, 1); // CHECK: atomicrmw sub i16 + (void) __sync_fetch_and_sub (&si, 1); // CHECK: atomicrmw sub i32 + (void) __sync_fetch_and_sub (&ui, 1); // CHECK: atomicrmw sub i32 + (void) __sync_fetch_and_sub (&sll, 1); // CHECK: atomicrmw sub i64 + (void) __sync_fetch_and_sub (&ull, 1); // CHECK: atomicrmw sub i64 + + (void) __sync_fetch_and_or (&sc, 1); // CHECK: atomicrmw or i8 + (void) __sync_fetch_and_or (&uc, 1); // CHECK: atomicrmw or i8 + (void) __sync_fetch_and_or (&ss, 1); // CHECK: atomicrmw or i16 + (void) __sync_fetch_and_or (&us, 1); // CHECK: atomicrmw or i16 + (void) __sync_fetch_and_or (&si, 1); // CHECK: atomicrmw or i32 + (void) __sync_fetch_and_or (&ui, 1); // CHECK: atomicrmw or i32 + (void) __sync_fetch_and_or (&sll, 1); // CHECK: atomicrmw or i64 + (void) __sync_fetch_and_or (&ull, 1); // CHECK: atomicrmw or i64 + + (void) __sync_fetch_and_xor (&sc, 1); // CHECK: atomicrmw xor i8 + (void) __sync_fetch_and_xor (&uc, 1); // CHECK: atomicrmw xor i8 + (void) __sync_fetch_and_xor (&ss, 1); // CHECK: atomicrmw xor i16 + (void) __sync_fetch_and_xor (&us, 1); // CHECK: atomicrmw xor i16 + (void) __sync_fetch_and_xor (&si, 1); // CHECK: atomicrmw xor i32 + (void) __sync_fetch_and_xor (&ui, 1); // CHECK: atomicrmw xor i32 + (void) __sync_fetch_and_xor (&sll, 1); // CHECK: atomicrmw xor i64 + (void) __sync_fetch_and_xor (&ull, 1); // CHECK: atomicrmw xor i64 + + (void) __sync_fetch_and_and (&sc, 1); // CHECK: atomicrmw and i8 + (void) __sync_fetch_and_and (&uc, 1); // CHECK: atomicrmw and i8 + (void) __sync_fetch_and_and (&ss, 1); // CHECK: atomicrmw and i16 + (void) __sync_fetch_and_and (&us, 1); // CHECK: atomicrmw and i16 + (void) __sync_fetch_and_and (&si, 1); // CHECK: atomicrmw and i32 + (void) __sync_fetch_and_and (&ui, 1); // CHECK: atomicrmw and i32 + (void) __sync_fetch_and_and (&sll, 1); // CHECK: atomicrmw and i64 + (void) __sync_fetch_and_and (&ull, 1); // CHECK: atomicrmw and i64 + +} + +void test_fetch_and_op (void) // CHECK: define void @test_fetch_and_op +{ + sc = __sync_fetch_and_add (&sc, 11); // CHECK: atomicrmw add + uc = __sync_fetch_and_add (&uc, 11); // CHECK: atomicrmw add + ss = __sync_fetch_and_add (&ss, 11); // CHECK: atomicrmw add + us = __sync_fetch_and_add (&us, 11); // CHECK: atomicrmw add + si = __sync_fetch_and_add (&si, 11); // CHECK: atomicrmw add + ui = __sync_fetch_and_add (&ui, 11); // CHECK: atomicrmw add + sll = __sync_fetch_and_add (&sll, 11); // CHECK: atomicrmw add + ull = __sync_fetch_and_add (&ull, 11); // CHECK: atomicrmw add + + sc = __sync_fetch_and_sub (&sc, 11); // CHECK: atomicrmw sub + uc = __sync_fetch_and_sub (&uc, 11); // CHECK: atomicrmw sub + ss = __sync_fetch_and_sub (&ss, 11); // CHECK: atomicrmw sub + us = __sync_fetch_and_sub (&us, 11); // CHECK: atomicrmw sub + si = __sync_fetch_and_sub (&si, 11); // CHECK: atomicrmw sub + ui = __sync_fetch_and_sub (&ui, 11); // CHECK: atomicrmw sub + sll = __sync_fetch_and_sub (&sll, 11); // CHECK: atomicrmw sub + ull = __sync_fetch_and_sub (&ull, 11); // CHECK: atomicrmw sub + + sc = __sync_fetch_and_or (&sc, 11); // CHECK: atomicrmw or + uc = __sync_fetch_and_or (&uc, 11); // CHECK: atomicrmw or + ss = __sync_fetch_and_or (&ss, 11); // CHECK: atomicrmw or + us = __sync_fetch_and_or (&us, 11); // CHECK: atomicrmw or + si = __sync_fetch_and_or (&si, 11); // CHECK: atomicrmw or + ui = __sync_fetch_and_or (&ui, 11); // CHECK: atomicrmw or + sll = __sync_fetch_and_or (&sll, 11); // CHECK: atomicrmw or + ull = __sync_fetch_and_or (&ull, 11); // CHECK: atomicrmw or + + sc = __sync_fetch_and_xor (&sc, 11); // CHECK: atomicrmw xor + uc = __sync_fetch_and_xor (&uc, 11); // CHECK: atomicrmw xor + ss = __sync_fetch_and_xor (&ss, 11); // CHECK: atomicrmw xor + us = __sync_fetch_and_xor (&us, 11); // CHECK: atomicrmw xor + si = __sync_fetch_and_xor (&si, 11); // CHECK: atomicrmw xor + ui = __sync_fetch_and_xor (&ui, 11); // CHECK: atomicrmw xor + sll = __sync_fetch_and_xor (&sll, 11); // CHECK: atomicrmw xor + ull = __sync_fetch_and_xor (&ull, 11); // CHECK: atomicrmw xor + + sc = __sync_fetch_and_and (&sc, 11); // CHECK: atomicrmw and + uc = __sync_fetch_and_and (&uc, 11); // CHECK: atomicrmw and + ss = __sync_fetch_and_and (&ss, 11); // CHECK: atomicrmw and + us = __sync_fetch_and_and (&us, 11); // CHECK: atomicrmw and + si = __sync_fetch_and_and (&si, 11); // CHECK: atomicrmw and + ui = __sync_fetch_and_and (&ui, 11); // CHECK: atomicrmw and + sll = __sync_fetch_and_and (&sll, 11); // CHECK: atomicrmw and + ull = __sync_fetch_and_and (&ull, 11); // CHECK: atomicrmw and + +} + +void test_op_and_fetch (void) +{ + sc = __sync_add_and_fetch (&sc, uc); // CHECK: atomicrmw add + uc = __sync_add_and_fetch (&uc, uc); // CHECK: atomicrmw add + ss = __sync_add_and_fetch (&ss, uc); // CHECK: atomicrmw add + us = __sync_add_and_fetch (&us, uc); // CHECK: atomicrmw add + si = __sync_add_and_fetch (&si, uc); // CHECK: atomicrmw add + ui = __sync_add_and_fetch (&ui, uc); // CHECK: atomicrmw add + sll = __sync_add_and_fetch (&sll, uc); // CHECK: atomicrmw add + ull = __sync_add_and_fetch (&ull, uc); // CHECK: atomicrmw add + + sc = __sync_sub_and_fetch (&sc, uc); // CHECK: atomicrmw sub + uc = __sync_sub_and_fetch (&uc, uc); // CHECK: atomicrmw sub + ss = __sync_sub_and_fetch (&ss, uc); // CHECK: atomicrmw sub + us = __sync_sub_and_fetch (&us, uc); // CHECK: atomicrmw sub + si = __sync_sub_and_fetch (&si, uc); // CHECK: atomicrmw sub + ui = __sync_sub_and_fetch (&ui, uc); // CHECK: atomicrmw sub + sll = __sync_sub_and_fetch (&sll, uc); // CHECK: atomicrmw sub + ull = __sync_sub_and_fetch (&ull, uc); // CHECK: atomicrmw sub + + sc = __sync_or_and_fetch (&sc, uc); // CHECK: atomicrmw or + uc = __sync_or_and_fetch (&uc, uc); // CHECK: atomicrmw or + ss = __sync_or_and_fetch (&ss, uc); // CHECK: atomicrmw or + us = __sync_or_and_fetch (&us, uc); // CHECK: atomicrmw or + si = __sync_or_and_fetch (&si, uc); // CHECK: atomicrmw or + ui = __sync_or_and_fetch (&ui, uc); // CHECK: atomicrmw or + sll = __sync_or_and_fetch (&sll, uc); // CHECK: atomicrmw or + ull = __sync_or_and_fetch (&ull, uc); // CHECK: atomicrmw or + + sc = __sync_xor_and_fetch (&sc, uc); // CHECK: atomicrmw xor + uc = __sync_xor_and_fetch (&uc, uc); // CHECK: atomicrmw xor + ss = __sync_xor_and_fetch (&ss, uc); // CHECK: atomicrmw xor + us = __sync_xor_and_fetch (&us, uc); // CHECK: atomicrmw xor + si = __sync_xor_and_fetch (&si, uc); // CHECK: atomicrmw xor + ui = __sync_xor_and_fetch (&ui, uc); // CHECK: atomicrmw xor + sll = __sync_xor_and_fetch (&sll, uc); // CHECK: atomicrmw xor + ull = __sync_xor_and_fetch (&ull, uc); // CHECK: atomicrmw xor + + sc = __sync_and_and_fetch (&sc, uc); // CHECK: atomicrmw and + uc = __sync_and_and_fetch (&uc, uc); // CHECK: atomicrmw and + ss = __sync_and_and_fetch (&ss, uc); // CHECK: atomicrmw and + us = __sync_and_and_fetch (&us, uc); // CHECK: atomicrmw and + si = __sync_and_and_fetch (&si, uc); // CHECK: atomicrmw and + ui = __sync_and_and_fetch (&ui, uc); // CHECK: atomicrmw and + sll = __sync_and_and_fetch (&sll, uc); // CHECK: atomicrmw and + ull = __sync_and_and_fetch (&ull, uc); // CHECK: atomicrmw and + +} + +void test_compare_and_swap (void) +{ + sc = __sync_val_compare_and_swap (&sc, uc, sc); // CHECK: cmpxchg i8 + uc = __sync_val_compare_and_swap (&uc, uc, sc); // CHECK: cmpxchg i8 + ss = __sync_val_compare_and_swap (&ss, uc, sc); // CHECK: cmpxchg i16 + us = __sync_val_compare_and_swap (&us, uc, sc); // CHECK: cmpxchg i16 + si = __sync_val_compare_and_swap (&si, uc, sc); // CHECK: cmpxchg i32 + ui = __sync_val_compare_and_swap (&ui, uc, sc); // CHECK: cmpxchg i32 + sll = __sync_val_compare_and_swap (&sll, uc, sc); // CHECK: cmpxchg i64 + ull = __sync_val_compare_and_swap (&ull, uc, sc); // CHECK: cmpxchg i64 + + ui = __sync_bool_compare_and_swap (&sc, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&uc, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&ss, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&us, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&si, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&ui, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&sll, uc, sc); // CHECK: cmpxchg + ui = __sync_bool_compare_and_swap (&ull, uc, sc); // CHECK: cmpxchg +} + +void test_lock (void) +{ + sc = __sync_lock_test_and_set (&sc, 1); // CHECK: atomicrmw xchg i8 + uc = __sync_lock_test_and_set (&uc, 1); // CHECK: atomicrmw xchg i8 + ss = __sync_lock_test_and_set (&ss, 1); // CHECK: atomicrmw xchg i16 + us = __sync_lock_test_and_set (&us, 1); // CHECK: atomicrmw xchg i16 + si = __sync_lock_test_and_set (&si, 1); // CHECK: atomicrmw xchg i32 + ui = __sync_lock_test_and_set (&ui, 1); // CHECK: atomicrmw xchg i32 + sll = __sync_lock_test_and_set (&sll, 1); // CHECK: atomicrmw xchg i64 + ull = __sync_lock_test_and_set (&ull, 1); // CHECK: atomicrmw xchg i64 + + __sync_synchronize (); // CHECK: fence seq_cst + + __sync_lock_release (&sc); // CHECK: store atomic {{.*}} release, align 1 + __sync_lock_release (&uc); // CHECK: store atomic {{.*}} release, align 1 + __sync_lock_release (&ss); // CHECK: store atomic {{.*}} release, align 2 + __sync_lock_release (&us); /// CHECK: store atomic {{.*}} release, align 2 + __sync_lock_release (&si); // CHECK: store atomic {{.*}} release, align 4 + __sync_lock_release (&ui); // CHECK: store atomic {{.*}} release, align 4 + __sync_lock_release (&sll); // CHECK: store atomic {{.*}} release, align 8 + __sync_lock_release (&ull); // CHECK: store atomic {{.*}} release, align 8 +} diff --git a/test/CodeGen/BasicInstrs.c b/test/CodeGen/BasicInstrs.c new file mode 100644 index 000000000000..2b8a6f67981a --- /dev/null +++ b/test/CodeGen/BasicInstrs.c @@ -0,0 +1,25 @@ +// This file can be used to see what a native C compiler is generating for a +// variety of interesting operations. +// +// RUN: %clang_cc1 -emit-llvm %s -o - + +unsigned int udiv(unsigned int X, unsigned int Y) { + return X/Y; +} +int sdiv(int X, int Y) { + return X/Y; +} +unsigned int urem(unsigned int X, unsigned int Y) { + return X%Y; +} +int srem(int X, int Y) { + return X%Y; +} + +_Bool setlt(int X, int Y) { + return X < Y; +} + +_Bool setgt(int X, int Y) { + return X > Y; +} diff --git a/test/CodeGen/always-inline.c b/test/CodeGen/always-inline.c new file mode 100644 index 000000000000..dc74be5e8c21 --- /dev/null +++ b/test/CodeGen/always-inline.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | grep call | not grep foo + +void bar() { +} + +inline void __attribute__((__always_inline__)) foo() { + bar(); +} + +void i_want_bar() { + foo(); +} diff --git a/test/CodeGen/annotate.c b/test/CodeGen/annotate.c deleted file mode 100644 index 9ed187d1d170..000000000000 --- a/test/CodeGen/annotate.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s - -__attribute((annotate("foo"))) char foo; -void a(char *a) { - __attribute__((annotate("bar"))) static char bar; -} - -// CHECK: private unnamed_addr global -// CHECK: private unnamed_addr global -// CHECK: @llvm.global.annotations = appending global [2 x { i8*, i8*, i8*, i32 }] diff --git a/test/CodeGen/annotations-builtin.c b/test/CodeGen/annotations-builtin.c new file mode 100644 index 000000000000..42421a0a5200 --- /dev/null +++ b/test/CodeGen/annotations-builtin.c @@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// END. + +static long long llfoo; +static int intfoo; +static short shortfoo; +static char charfoo; + +// CHECK: private unnamed_addr constant [13 x i8] {{.*}}annotation_a{{.*}} section "llvm.metadata" +// CHECK-NOT: {{.*}}annotation_a{{.*}} + +static int foo(int a) { + return a + 1; +} + +int main(int argc, char **argv) { + char barray[16]; + char *b = (char *) __builtin_annotation((int)barray, "annotation_a"); +// CHECK: ptrtoint i8* {{.*}} to i32 +// CHECK-NEXT: call i32 @llvm.annotation.i32 +// CHECK: inttoptr {{.*}} to i8* + + int call = __builtin_annotation(foo(argc), "annotation_a"); +// CHECK: call {{.*}} @foo +// CHECK: call i32 @llvm.annotation.i32 + + long long lla = __builtin_annotation(llfoo, "annotation_a"); +// CHECK: trunc i64 {{.*}} to i32 +// CHECK-NEXT: call i32 @llvm.annotation.i32 +// CHECK-NEXT: zext i32 {{.*}} to i64 + + int inta = __builtin_annotation(intfoo, "annotation_a"); +// CHECK: load i32* @intfoo +// CHECK-NEXT: call i32 @llvm.annotation.i32 +// CHECK-NEXT: store + + short shorta = __builtin_annotation(shortfoo, "annotation_a"); +// CHECK: sext i16 {{.*}} to i32 +// CHECK-NEXT: call i32 @llvm.annotation.i32 +// CHECK-NEXT: trunc i32 {{.*}} to i16 + + char chara = __builtin_annotation(charfoo, "annotation_a"); +// CHECK: sext i8 {{.*}} to i32 +// CHECK-NEXT: call i32 @llvm.annotation.i32 +// CHECK-NEXT: trunc i32 {{.*}} to i8 +// + char **arg = (char**) __builtin_annotation((int) argv, "annotation_a"); +// CHECK: ptrtoint i8** {{.*}} to +// CHECK: call i32 @llvm.annotation.i32 +// CHECK: inttoptr {{.*}} to i8** + return 0; +} diff --git a/test/CodeGen/annotations-field.c b/test/CodeGen/annotations-field.c new file mode 100644 index 000000000000..6b443675850c --- /dev/null +++ b/test/CodeGen/annotations-field.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// END. + +// CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata" +// CHECK: private unnamed_addr constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata" + +struct foo { + int v __attribute__((annotate("v_ann_0"))) __attribute__((annotate("v_ann_1"))); +}; + +static struct foo gf; + +int main(int argc, char **argv) { + struct foo f; + f.v = argc; +// CHECK: getelementptr inbounds %struct.foo* %f, i32 0, i32 0 +// CHECK-NEXT: bitcast i32* {{.*}} to i8* +// CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8) +// CHECK-NEXT: bitcast i8* {{.*}} to i32* +// CHECK-NEXT: bitcast i32* {{.*}} to i8* +// CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8) +// CHECK-NEXT: bitcast i8* {{.*}} to i32* + gf.v = argc; +// CHECK: bitcast i32* getelementptr inbounds (%struct.foo* @gf, i32 0, i32 0) to i8* +// CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8) + return 0; +} diff --git a/test/CodeGen/annotations-global.c b/test/CodeGen/annotations-global.c new file mode 100644 index 000000000000..2782525ed915 --- /dev/null +++ b/test/CodeGen/annotations-global.c @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 %s -emit-llvm -o %t1 +// RUN: FileCheck --check-prefix=FOO %s < %t1 +// RUN: FileCheck --check-prefix=A %s < %t1 +// RUN: FileCheck --check-prefix=BAR %s < %t1 +// RUN: FileCheck --check-prefix=FOOS %s < %t1 +// END. + +static __attribute((annotate("sfoo_0"))) __attribute((annotate("sfoo_1"))) char sfoo; +__attribute((annotate("foo_0"))) __attribute((annotate("foo_1"))) char foo; + +void __attribute((annotate("ann_a_0"))) __attribute((annotate("ann_a_1"))) __attribute((annotate("ann_a_2"))) __attribute((annotate("ann_a_3"))) a(char *a); +void __attribute((annotate("ann_a_0"))) __attribute((annotate("ann_a_1"))) a(char *a) { + __attribute__((annotate("bar_0"))) __attribute__((annotate("bar_1"))) static char bar; + sfoo = 0; +} + +// FOOS: target triple +// FOOS: private unnamed_addr constant [7 x i8] c"sfoo_{{.}}\00", section "llvm.metadata" +// FOOS: private unnamed_addr constant [7 x i8] c"sfoo_{{.}}\00", section "llvm.metadata" +// FOOS-NOT: sfoo_ +// FOOS: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 }] {{.*}}i8* @sfoo{{.*}}i8* @sfoo{{.*}}, section "llvm.metadata" + +// FOO: target triple +// FOO: private unnamed_addr constant [6 x i8] c"foo_{{.}}\00", section "llvm.metadata" +// FOO: private unnamed_addr constant [6 x i8] c"foo_{{.}}\00", section "llvm.metadata" +// FOO-NOT: foo_ +// FOO: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 }] {{.*}}i8* @foo{{.*}}i8* @foo{{.*}}, section "llvm.metadata" + +// A: target triple +// A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section "llvm.metadata" +// A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section "llvm.metadata" +// A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section "llvm.metadata" +// A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section "llvm.metadata" +// A-NOT: ann_a_ +// A: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 }] {{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}, section "llvm.metadata" + +// BAR: target triple +// BAR: private unnamed_addr constant [6 x i8] c"bar_{{.}}\00", section "llvm.metadata" +// BAR: private unnamed_addr constant [6 x i8] c"bar_{{.}}\00", section "llvm.metadata" +// BAR-NOT: bar_ +// BAR: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 }] {{.*}}i8* @a.bar{{.*}}i8* @a.bar{{.*}}, section "llvm.metadata" diff --git a/test/CodeGen/annotations-loc.c b/test/CodeGen/annotations-loc.c new file mode 100644 index 000000000000..4644f0e1d2ca --- /dev/null +++ b/test/CodeGen/annotations-loc.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// END. +# 1 "t.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "t.c" +int __attribute((annotate("foo"))) foo(void) { return 0; } + +// CHECK: private unnamed_addr constant [4 x i8] c"t.c\00" +// CHECK: @llvm.global.annotations = {{.*}}, i32 1 } diff --git a/test/CodeGen/annotations-var.c b/test/CodeGen/annotations-var.c new file mode 100644 index 000000000000..b8ada9fc0f3e --- /dev/null +++ b/test/CodeGen/annotations-var.c @@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t1 %s +// RUN: FileCheck --check-prefix=LOCAL %s < %t1 +// RUN: FileCheck --check-prefix=UNDEF %s < %t1 +// RUN: FileCheck --check-prefix=PARAM %s < %t1 +// END. + +// LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" +// LOCAL: private unnamed_addr constant [15 x i8] c"localvar_ann_{{.}}\00", section "llvm.metadata" + +// UNDEF: private unnamed_addr constant [15 x i8] c"undefvar_ann_0\00", section "llvm.metadata" + +// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" +// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" +// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" +// PARAM: private unnamed_addr constant [12 x i8] c"param_ann_{{.}}\00", section "llvm.metadata" + +int foo(int v __attribute__((annotate("param_ann_2"))) __attribute__((annotate("param_ann_3")))); +int foo(int v __attribute__((annotate("param_ann_0"))) __attribute__((annotate("param_ann_1")))) { + return v + 1; +// PARAM: define {{.*}}@foo +// PARAM: [[V:%.*]] = alloca i32 +// PARAM: bitcast i32* [[V]] to i8* +// PARAM-NEXT: call void @llvm.var.annotation( +// PARAM-NEXT: bitcast i32* [[V]] to i8* +// PARAM-NEXT: call void @llvm.var.annotation( +// PARAM-NEXT: bitcast i32* [[V]] to i8* +// PARAM-NEXT: call void @llvm.var.annotation( +// PARAM-NEXT: bitcast i32* [[V]] to i8* +// PARAM-NEXT: call void @llvm.var.annotation( +} + +void local(void) { + int localvar __attribute__((annotate("localvar_ann_0"))) __attribute__((annotate("localvar_ann_1"))) = 3; +// LOCAL: define void @local() +// LOCAL: [[LOCALVAR:%.*]] = alloca i32, +// LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* +// LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) +// LOCAL-NEXT: [[T0:%.*]] = bitcast i32* [[LOCALVAR]] to i8* +// LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33) +} + +void undef(void) { + int undefvar __attribute__((annotate("undefvar_ann_0"))); +// UNDEF: define void @undef() +// UNDEF: [[UNDEFVAR:%.*]] = alloca i32, +// UNDEF-NEXT: [[T0:%.*]] = bitcast i32* [[UNDEFVAR]] to i8* +// UNDEF-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 43) +} diff --git a/test/CodeGen/arm-aapcs-vfp.c b/test/CodeGen/arm-aapcs-vfp.c new file mode 100644 index 000000000000..20b8a742dd41 --- /dev/null +++ b/test/CodeGen/arm-aapcs-vfp.c @@ -0,0 +1,82 @@ +// RUN: %clang_cc1 -triple thumbv7-apple-darwin9 \ +// RUN: -target-abi aapcs \ +// RUN: -target-cpu cortex-a8 \ +// RUN: -mfloat-abi hard \ +// RUN: -ffreestanding \ +// RUN: -emit-llvm -w -o - %s | FileCheck %s + +#include <arm_neon.h> + +struct homogeneous_struct { + float f[2]; + float f3; + float f4; +}; +// CHECK: define arm_aapcs_vfpcc void @test_struct(float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}}) +extern void struct_callee(struct homogeneous_struct); +void test_struct(struct homogeneous_struct arg) { + struct_callee(arg); +} + +struct nested_array { + double d[4]; +}; +// CHECK: define arm_aapcs_vfpcc void @test_array(double %{{.*}}, double %{{.*}}, double %{{.*}}, double %{{.*}}) +extern void array_callee(struct nested_array); +void test_array(struct nested_array arg) { + array_callee(arg); +} + +extern void complex_callee(__complex__ double); +// CHECK: define arm_aapcs_vfpcc void @test_complex(double %{{.*}}, double %{{.*}}) +void test_complex(__complex__ double cd) { + complex_callee(cd); +} + +// Structs with more than 4 elements of the base type are not treated +// as homogeneous aggregates. Test that. + +struct big_struct { + float f1; + float f[2]; + float f3; + float f4; +}; +// CHECK: define arm_aapcs_vfpcc void @test_big([5 x i32] %{{.*}}) +extern void big_callee(struct big_struct); +void test_big(struct big_struct arg) { + big_callee(arg); +} + +// Make sure that aggregates with multiple base types are not treated as +// homogeneous aggregates. + +struct heterogeneous_struct { + float f1; + int i2; +}; +// CHECK: define arm_aapcs_vfpcc void @test_hetero([2 x i32] %{{.*}}) +extern void hetero_callee(struct heterogeneous_struct); +void test_hetero(struct heterogeneous_struct arg) { + hetero_callee(arg); +} + +// Neon multi-vector types are homogeneous aggregates. +// CHECK: define arm_aapcs_vfpcc <16 x i8> @f0(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) +int8x16_t f0(int8x16x4_t v4) { + return vaddq_s8(v4.val[0], v4.val[3]); +} + +// ...and it doesn't matter whether the vectors are exactly the same, as long +// as they have the same size. + +struct neon_struct { + int8x8x2_t v12; + int32x2_t v3; + int16x4_t v4; +}; +// CHECK: define arm_aapcs_vfpcc void @test_neon(<8 x i8> %{{.*}}, <8 x i8> %{{.*}}, <2 x i32> %{{.*}}, <4 x i16> %{{.*}}) +extern void neon_callee(struct neon_struct); +void test_neon(struct neon_struct arg) { + neon_callee(arg); +} diff --git a/test/CodeGen/arm-apcs-zerolength-bitfield.c b/test/CodeGen/arm-apcs-zerolength-bitfield.c new file mode 100644 index 000000000000..3f9452539408 --- /dev/null +++ b/test/CodeGen/arm-apcs-zerolength-bitfield.c @@ -0,0 +1,240 @@ +// RUN: %clang_cc1 -target-abi apcs-gnu -triple armv7-apple-darwin10 %s -verify +// +// Note: gcc forces the alignment to 4 bytes, regardless of the type of the +// zero length bitfield. +// rdar://9859156 + +#include <stddef.h> + +struct t1 +{ + int foo : 1; + char : 0; + char bar; +}; +static int arr1_offset[(offsetof(struct t1, bar) == 4) ? 0 : -1]; +static int arr1_sizeof[(sizeof(struct t1) == 8) ? 0 : -1]; + +struct t2 +{ + int foo : 1; + short : 0; + char bar; +}; +static int arr2_offset[(offsetof(struct t2, bar) == 4) ? 0 : -1]; +static int arr2_sizeof[(sizeof(struct t2) == 8) ? 0 : -1]; + +struct t3 +{ + int foo : 1; + int : 0; + char bar; +}; +static int arr3_offset[(offsetof(struct t3, bar) == 4) ? 0 : -1]; +static int arr3_sizeof[(sizeof(struct t3) == 8) ? 0 : -1]; + +struct t4 +{ + int foo : 1; + long : 0; + char bar; +}; +static int arr4_offset[(offsetof(struct t4, bar) == 4) ? 0 : -1]; +static int arr4_sizeof[(sizeof(struct t4) == 8) ? 0 : -1]; + +struct t5 +{ + int foo : 1; + long long : 0; + char bar; +}; +static int arr5_offset[(offsetof(struct t5, bar) == 4) ? 0 : -1]; +static int arr5_sizeof[(sizeof(struct t5) == 8) ? 0 : -1]; + +struct t6 +{ + int foo : 1; + char : 0; + char bar : 1; + char bar2; +}; +static int arr6_offset[(offsetof(struct t6, bar2) == 5) ? 0 : -1]; +static int arr6_sizeof[(sizeof(struct t6) == 8) ? 0 : -1]; + +struct t7 +{ + int foo : 1; + short : 0; + char bar1 : 1; + char bar2; +}; +static int arr7_offset[(offsetof(struct t7, bar2) == 5) ? 0 : -1]; +static int arr7_sizeof[(sizeof(struct t7) == 8) ? 0 : -1]; + +struct t8 +{ + int foo : 1; + int : 0; + char bar1 : 1; + char bar2; +}; +static int arr8_offset[(offsetof(struct t8, bar2) == 5) ? 0 : -1]; +static int arr8_sizeof[(sizeof(struct t8) == 8) ? 0 : -1]; + +struct t9 +{ + int foo : 1; + long : 0; + char bar1 : 1; + char bar2; +}; +static int arr9_offset[(offsetof(struct t9, bar2) == 5) ? 0 : -1]; +static int arr9_sizeof[(sizeof(struct t9) == 8) ? 0 : -1]; + +struct t10 +{ + int foo : 1; + long long : 0; + char bar1 : 1; + char bar2; +}; +static int arr10_offset[(offsetof(struct t10, bar2) == 5) ? 0 : -1]; +static int arr10_sizeof[(sizeof(struct t10) == 8) ? 0 : -1]; + +struct t11 +{ + int foo : 1; + long long : 0; + char : 0; + char bar1 : 1; + char bar2; +}; +static int arr11_offset[(offsetof(struct t11, bar2) == 5) ? 0 : -1]; +static int arr11_sizeof[(sizeof(struct t11) == 8) ? 0 : -1]; + +struct t12 +{ + int foo : 1; + char : 0; + long long : 0; + char : 0; + char bar; +}; +static int arr12_offset[(offsetof(struct t12, bar) == 4) ? 0 : -1]; +static int arr12_sizeof[(sizeof(struct t12) == 8) ? 0 : -1]; + +struct t13 +{ + char foo; + long : 0; + char bar; +}; +static int arr13_offset[(offsetof(struct t13, bar) == 4) ? 0 : -1]; +static int arr13_sizeof[(sizeof(struct t13) == 8) ? 0 : -1]; + +struct t14 +{ + char foo1; + int : 0; + char foo2 : 1; + short foo3 : 16; + char : 0; + short foo4 : 16; + char bar1; + int : 0; + char bar2; +}; +static int arr14_bar1_offset[(offsetof(struct t14, bar1) == 10) ? 0 : -1]; +static int arr14_bar2_offset[(offsetof(struct t14, bar2) == 12) ? 0 : -1]; +static int arr14_sizeof[(sizeof(struct t14) == 16) ? 0 : -1]; + +struct t15 +{ + char foo; + char : 0; + int : 0; + char bar; + long : 0; + char : 0; +}; +static int arr15_offset[(offsetof(struct t15, bar) == 4) ? 0 : -1]; +static int arr15_sizeof[(sizeof(struct t15) == 8) ? 0 : -1]; + +struct t16 +{ + long : 0; + char bar; +}; +static int arr16_offset[(offsetof(struct t16, bar) == 0) ? 0 : -1]; +static int arr16_sizeof[(sizeof(struct t16) == 4) ? 0 : -1]; + +struct t17 +{ + char foo; + long : 0; + long : 0; + char : 0; + char bar; +}; +static int arr17_offset[(offsetof(struct t17, bar) == 4) ? 0 : -1]; +static int arr17_sizeof[(sizeof(struct t17) == 8) ? 0 : -1]; + +struct t18 +{ + long : 0; + long : 0; + char : 0; +}; +static int arr18_sizeof[(sizeof(struct t18) == 0) ? 0 : -1]; + +struct t19 +{ + char foo1; + long foo2 : 1; + char : 0; + long foo3 : 32; + char bar; +}; +static int arr19_offset[(offsetof(struct t19, bar) == 8) ? 0 : -1]; +static int arr19_sizeof[(sizeof(struct t19) == 12) ? 0 : -1]; + +struct t20 +{ + short : 0; + int foo : 1; + long : 0; + char bar; +}; +static int arr20_offset[(offsetof(struct t20, bar) == 4) ? 0 : -1]; +static int arr20_sizeof[(sizeof(struct t20) == 8) ? 0 : -1]; + +struct t21 +{ + short : 0; + int foo1 : 1; + char : 0; + int foo2 : 16; + long : 0; + char bar1; + int bar2; + long bar3; + char foo3 : 8; + char : 0; + long : 0; + int foo4 : 32; + short foo5: 1; + long bar4; + short foo6: 16; + short foo7: 16; + short foo8: 16; +}; +static int arr21_bar1_offset[(offsetof(struct t21, bar1) == 8) ? 0 : -1]; +static int arr21_bar2_offset[(offsetof(struct t21, bar2) == 12) ? 0 : -1]; +static int arr21_bar3_offset[(offsetof(struct t21, bar3) == 16) ? 0 : -1]; +static int arr21_bar4_offset[(offsetof(struct t21, bar4) == 32) ? 0 : -1]; +static int arr21_sizeof[(sizeof(struct t21) == 44) ? 0 : -1]; + +int main() { + return 0; +} + diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c index 081bc89dcda7..3ae3b8ecd21f 100644 --- a/test/CodeGen/arm-arguments.c +++ b/test/CodeGen/arm-arguments.c @@ -28,13 +28,13 @@ struct s4 { struct s4_0 { int f0; } f0; }; struct s4 f4(void) {} // APCS-GNU: define void @f5( -// APCS-GNU: struct.s5* sret +// APCS-GNU: struct.s5* noalias sret // AAPCS: define arm_aapcscc i32 @f5() struct s5 { struct { } f0; int f1; }; struct s5 f5(void) {} // APCS-GNU: define void @f6( -// APCS-GNU: struct.s6* sret +// APCS-GNU: struct.s6* noalias sret // AAPCS: define arm_aapcscc i32 @f6() struct s6 { int f0[1]; }; struct s6 f6(void) {} @@ -45,7 +45,7 @@ struct s7 { struct { int : 0; } f0; }; struct s7 f7(void) {} // APCS-GNU: define void @f8( -// APCS-GNU: struct.s8* sret +// APCS-GNU: struct.s8* noalias sret // AAPCS: define arm_aapcscc void @f8() struct s8 { struct { int : 0; } f0[1]; }; struct s8 f8(void) {} @@ -61,7 +61,7 @@ struct s10 { int f0; int : 0; int : 0; }; struct s10 f10(void) {} // APCS-GNU: define void @f11( -// APCS-GNU: struct.s11* sret +// APCS-GNU: struct.s11* noalias sret // AAPCS: define arm_aapcscc i32 @f11() struct s11 { int : 0; int f0; }; struct s11 f11(void) {} @@ -72,7 +72,7 @@ union u12 { char f0; short f1; int f2; }; union u12 f12(void) {} // APCS-GNU: define void @f13( -// APCS-GNU: struct.s13* sret +// APCS-GNU: struct.s13* noalias sret // FIXME: This should return a float. // AAPCS-FIXME: darm_aapcscc efine float @f13() @@ -80,7 +80,7 @@ struct s13 { float f0; }; struct s13 f13(void) {} // APCS-GNU: define void @f14( -// APCS-GNU: union.u14* sret +// APCS-GNU: union.u14* noalias sret // AAPCS: define arm_aapcscc i32 @f14() union u14 { float f0; }; union u14 f14(void) {} @@ -104,13 +104,13 @@ struct s18 { short f0; char f1 : 4; }; struct s18 f18(void) {} // APCS-GNU: define void @f19( -// APCS-GNU: struct.s19* sret +// APCS-GNU: struct.s19* noalias sret // AAPCS: define arm_aapcscc i32 @f19() struct s19 { int f0; struct s8 f1; }; struct s19 f19(void) {} // APCS-GNU: define void @f20( -// APCS-GNU: struct.s20* sret +// APCS-GNU: struct.s20* noalias sret // AAPCS: define arm_aapcscc i32 @f20() struct s20 { struct s8 f1; int f0; }; struct s20 f20(void) {} @@ -128,10 +128,10 @@ struct s21 f21(void) {} // APCS-GNU: define i128 @f27() // AAPCS: define arm_aapcscc i16 @f22() // AAPCS: define arm_aapcscc i32 @f23() -// AAPCS: define arm_aapcscc void @f24({{.*}} sret -// AAPCS: define arm_aapcscc void @f25({{.*}} sret -// AAPCS: define arm_aapcscc void @f26({{.*}} sret -// AAPCS: define arm_aapcscc void @f27({{.*}} sret +// AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret +// AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret +// AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret +// AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret _Complex char f22(void) {} _Complex short f23(void) {} _Complex int f24(void) {} @@ -149,7 +149,7 @@ struct s28 f28() {} struct s29 { _Complex short f0; }; struct s29 f29() {} -// APCS-GNU: define void @f30({{.*}} sret -// AAPCS: define arm_aapcscc void @f30({{.*}} sret +// APCS-GNU: define void @f30({{.*}} noalias sret +// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret struct s30 { _Complex int f0; }; struct s30 f30() {} diff --git a/test/CodeGen/arm-inline-asm.c b/test/CodeGen/arm-inline-asm.c new file mode 100644 index 000000000000..0152b050fd7f --- /dev/null +++ b/test/CodeGen/arm-inline-asm.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s + +void t1 (void *f, int g) { + // CHECK: call void asm "str $1, $0", "=*Q,r" + asm("str %1, %0" : "=Q"(f) : "r"(g)); +} diff --git a/test/CodeGen/arm-vaarg-align.c b/test/CodeGen/arm-vaarg-align.c new file mode 100644 index 000000000000..1187c022914f --- /dev/null +++ b/test/CodeGen/arm-vaarg-align.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -triple arm -target-abi aapcs %s -emit-llvm -o - | FileCheck -check-prefix=AAPCS %s +// RUN: %clang_cc1 -triple arm -target-abi apcs-gnu %s -emit-llvm -o - | FileCheck -check-prefix=APCS-GNU %s +/* + * Check that va_arg accesses stack according to ABI alignment + * long long and double require 8-byte alignment under AAPCS + * however, they only require 4-byte alignment under APCS + */ +long long t1(int i, ...) { + // AAPCS: t1 + // APCS-GNU: t1 + __builtin_va_list ap; + __builtin_va_start(ap, i); + // AAPCS: add i32 %{{.*}} 7 + // AAPCS: and i32 %{{.*}} -8 + // APCS-GNU-NOT: add i32 %{{.*}} 7 + // APCS-GNU-NOT: and i32 %{{.*}} -8 + long long ll = __builtin_va_arg(ap, long long); + __builtin_va_end(ap); + return ll; +} +double t2(int i, ...) { + // AAPCS: t2 + // APCS-GNU: t2 + __builtin_va_list ap; + __builtin_va_start(ap, i); + // AAPCS: add i32 %{{.*}} 7 + // AAPCS: and i32 %{{.*}} -8 + // APCS-GNU-NOT: add i32 %{{.*}} 7 + // APCS-GNU-NOT: and i32 %{{.*}} -8 + double ll = __builtin_va_arg(ap, double); + __builtin_va_end(ap); + return ll; +} diff --git a/test/CodeGen/arm-vector-arguments.c b/test/CodeGen/arm-vector-arguments.c index c5ac0a7ad1b7..6bfb2f48a7f1 100644 --- a/test/CodeGen/arm-vector-arguments.c +++ b/test/CodeGen/arm-vector-arguments.c @@ -8,7 +8,7 @@ #include <arm_neon.h> -// CHECK: define void @f0(%struct.int8x16x2_t* sret %agg.result, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) +// CHECK: define void @f0(%struct.int8x16x2_t* noalias sret %agg.result, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) int8x16x2_t f0(int8x16_t a0, int8x16_t a1) { return vzipq_s8(a0, a1); } @@ -24,7 +24,7 @@ typedef float T_float32x16 __attribute__ ((__vector_size__ (64))); T_float32x2 f1_0(T_float32x2 a0) { return a0; } // CHECK: define <4 x float> @f1_1(<4 x float> %{{.*}}) T_float32x4 f1_1(T_float32x4 a0) { return a0; } -// CHECK: define void @f1_2(<8 x float>* sret %{{.*}}, <8 x float> %{{.*}}) +// CHECK: define void @f1_2(<8 x float>* noalias sret %{{.*}}, <8 x float> %{{.*}}) T_float32x8 f1_2(T_float32x8 a0) { return a0; } -// CHECK: define void @f1_3(<16 x float>* sret %{{.*}}, <16 x float> %{{.*}}) +// CHECK: define void @f1_3(<16 x float>* noalias sret %{{.*}}, <16 x float> %{{.*}}) T_float32x16 f1_3(T_float32x16 a0) { return a0; } diff --git a/test/CodeGen/arrayderef.c b/test/CodeGen/arrayderef.c new file mode 100644 index 000000000000..effc0a6de4a8 --- /dev/null +++ b/test/CodeGen/arrayderef.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - | FileCheck %s +// The load here was getting lost because this code was close +// enough to the traditional (wrong) implementation of offsetof +// to confuse the gcc FE. 8629268. + +struct foo { + int x; + int *y; +}; + +struct foo Foo[1]; + +int * bar(unsigned int ix) { +// CHECK: load + return &Foo->y[ix]; +} diff --git a/test/CodeGen/asm-reg-var-local.c b/test/CodeGen/asm-reg-var-local.c new file mode 100644 index 000000000000..9060e120ffc9 --- /dev/null +++ b/test/CodeGen/asm-reg-var-local.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s +// Exercise various use cases for local asm "register variables". + +int foo() { +// CHECK: [[A:%[a-zA-Z0-9]+]] = alloca i32 + + register int a asm("rsi")=5; +// CHECK: store i32 5, i32* [[A]] + + asm volatile("; %0 This asm defines rsi" : "=r"(a)); +// CHECK: [[Z:%[a-zA-Z0-9]+]] = call i32 asm sideeffect "; $0 This asm defines rsi", "={rsi},~{dirflag},~{fpsr},~{flags}"() +// CHECK: store i32 [[Z]], i32* [[A]] + + a = 42; +// CHECK: store i32 42, i32* [[A]] + + asm volatile("; %0 This asm uses rsi" : : "r"(a)); +// CHECK: [[TMP:%[a-zA-Z0-9]+]] = load i32* [[A]] +// CHECK: call void asm sideeffect "; $0 This asm uses rsi", "{rsi},~{dirflag},~{fpsr},~{flags}"(i32 [[TMP]]) + + return a; +// CHECK: [[TMP1:%[a-zA-Z0-9]+]] = load i32* [[A]] +// CHECK: ret i32 [[TMP1]] +} diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index 7199f09e1a3c..019eb9ca3e67 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -1,4 +1,13 @@ // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s + +// PR10415 +__asm__ ("foo1"); +__asm__ ("foo2"); +__asm__ ("foo3"); +// CHECK: module asm "foo1" +// CHECK-NEXT: module asm "foo2" +// CHECK-NEXT: module asm "foo3" + void t1(int len) { __asm__ volatile("" : "=&r"(len), "+&r"(len)); } @@ -191,6 +200,15 @@ unsigned char t23(unsigned char a, unsigned char b) { return res; } +void *t24(char c) { + void *addr; + // CHECK: @t24 + // CHECK: zext i8 {{.*}} to i32 + // CHECK-NEXT: call i8* asm "foobar" + __asm__ ("foobar" : "=a" (addr) : "0" (c)); + return addr; +} + // PR10299 - fpsr, fpcr void test(void) diff --git a/test/CodeGen/assign.c b/test/CodeGen/assign.c index 05141bb0bb60..fc008963c317 100644 --- a/test/CodeGen/assign.c +++ b/test/CodeGen/assign.c @@ -21,9 +21,9 @@ void f0() { // CHECK: define void @f1() // CHECK: [[x_1:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[y_1:%.*]] = alloca i32, align 4 -// CHECK-NEXT: volatile store i32 1, i32* [[x_1]] -// CHECK-NEXT: volatile store i32 1, i32* [[x_1]] -// CHECK-NEXT: volatile store i32 1, i32* [[y_1]] +// CHECK-NEXT: store volatile i32 1, i32* [[x_1]] +// CHECK-NEXT: store volatile i32 1, i32* [[x_1]] +// CHECK-NEXT: store volatile i32 1, i32* [[y_1]] // CHECK: } void f1() { volatile int x, y; diff --git a/test/CodeGen/atomic-ops.c b/test/CodeGen/atomic-ops.c new file mode 100644 index 000000000000..e2904cf10e81 --- /dev/null +++ b/test/CodeGen/atomic-ops.c @@ -0,0 +1,77 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s + +// Basic IRGen tests for __atomic_* + +// FIXME: Need to implement __atomic_is_lock_free + +typedef enum memory_order { + memory_order_relaxed, memory_order_consume, memory_order_acquire, + memory_order_release, memory_order_acq_rel, memory_order_seq_cst +} memory_order; + +int fi1(_Atomic(int) *i) { + // CHECK: @fi1 + // CHECK: load atomic i32* {{.*}} seq_cst + return __atomic_load(i, memory_order_seq_cst); +} + +void fi2(_Atomic(int) *i) { + // CHECK: @fi2 + // CHECK: store atomic i32 {{.*}} seq_cst + __atomic_store(i, 1, memory_order_seq_cst); +} + +void fi3(_Atomic(int) *i) { + // CHECK: @fi3 + // CHECK: atomicrmw and + __atomic_fetch_and(i, 1, memory_order_seq_cst); +} + +void fi4(_Atomic(int) *i) { + // CHECK: @fi4 + // CHECK: cmpxchg i32* + int cmp = 0; + __atomic_compare_exchange_strong(i, &cmp, 1, memory_order_acquire, memory_order_acquire); +} + +float ff1(_Atomic(float) *d) { + // CHECK: @ff1 + // CHECK: load atomic i32* {{.*}} monotonic + return __atomic_load(d, memory_order_relaxed); +} + +void ff2(_Atomic(float) *d) { + // CHECK: @ff2 + // CHECK: store atomic i32 {{.*}} release + __atomic_store(d, 1, memory_order_release); +} + +float ff3(_Atomic(float) *d) { + return __atomic_exchange(d, 2, memory_order_seq_cst); +} + +int* fp1(_Atomic(int*) *p) { + // CHECK: @fp1 + // CHECK: load atomic i32* {{.*}} seq_cst + return __atomic_load(p, memory_order_seq_cst); +} + +int* fp2(_Atomic(int*) *p) { + // CHECK: @fp2 + // CHECK: store i32 4 + // CHECK: atomicrmw add {{.*}} monotonic + return __atomic_fetch_add(p, 1, memory_order_relaxed); +} + +_Complex float fc(_Atomic(_Complex float) *c) { + // CHECK: @fc + // CHECK: atomicrmw xchg i64* + return __atomic_exchange(c, 2, memory_order_seq_cst); +} + +typedef struct X { int x; } X; +X fs(_Atomic(X) *c) { + // CHECK: @fs + // CHECK: atomicrmw xchg i32* + return __atomic_exchange(c, (X){2}, memory_order_seq_cst); +} diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c index 8ce2d96043f2..c8f4fd09bbc5 100644 --- a/test/CodeGen/atomic.c +++ b/test/CodeGen/atomic.c @@ -10,118 +10,75 @@ int atomic(void) { int cmp = 0; old = __sync_fetch_and_add(&val, 1); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.add.i32.p0i32(i32* %val, i32 1) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw add i32* %val, i32 1 seq_cst old = __sync_fetch_and_sub(&valc, 2); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i8 @llvm.atomic.load.sub.i8.p0i8(i8* %valc, i8 2) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw sub i8* %valc, i8 2 seq_cst old = __sync_fetch_and_min(&val, 3); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.min.i32.p0i32(i32* %val, i32 3) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw min i32* %val, i32 3 seq_cst old = __sync_fetch_and_max(&val, 4); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.max.i32.p0i32(i32* %val, i32 4) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw max i32* %val, i32 4 seq_cst old = __sync_fetch_and_umin(&uval, 5u); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.umin.i32.p0i32(i32* %uval, i32 5) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw umin i32* %uval, i32 5 seq_cst old = __sync_fetch_and_umax(&uval, 6u); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.umax.i32.p0i32(i32* %uval, i32 6) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw umax i32* %uval, i32 6 seq_cst old = __sync_lock_test_and_set(&val, 7); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.swap.i32.p0i32(i32* %val, i32 7) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw xchg i32* %val, i32 7 seq_cst old = __sync_swap(&val, 8); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.swap.i32.p0i32(i32* %val, i32 8) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw xchg i32* %val, i32 8 seq_cst old = __sync_val_compare_and_swap(&val, 4, 1976); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %val, i32 4, i32 1976) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: cmpxchg i32* %val, i32 4, i32 1976 seq_cst old = __sync_bool_compare_and_swap(&val, 4, 1976); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %val, i32 4, i32 1976) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: cmpxchg i32* %val, i32 4, i32 1976 seq_cst old = __sync_fetch_and_and(&val, 0x9); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.and.i32.p0i32(i32* %val, i32 9) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw and i32* %val, i32 9 seq_cst old = __sync_fetch_and_or(&val, 0xa); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.or.i32.p0i32(i32* %val, i32 10) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw or i32* %val, i32 10 seq_cst old = __sync_fetch_and_xor(&val, 0xb); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %val, i32 11) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw xor i32* %val, i32 11 seq_cst old = __sync_add_and_fetch(&val, 1); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.add.i32.p0i32(i32* %val, i32 1) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw add i32* %val, i32 1 seq_cst old = __sync_sub_and_fetch(&val, 2); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %val, i32 2) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw sub i32* %val, i32 2 seq_cst old = __sync_and_and_fetch(&valc, 3); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i8 @llvm.atomic.load.and.i8.p0i8(i8* %valc, i8 3) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw and i8* %valc, i8 3 seq_cst old = __sync_or_and_fetch(&valc, 4); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i8 @llvm.atomic.load.or.i8.p0i8(i8* %valc, i8 4) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: atomicrmw or i8* %valc, i8 4 seq_cst old = __sync_xor_and_fetch(&valc, 5); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i8 @llvm.atomic.load.xor.i8.p0i8(i8* %valc, i8 5) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - + // CHECK: atomicrmw xor i8* %valc, i8 5 seq_cst __sync_val_compare_and_swap((void **)0, (void *)0, (void *)0); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* null, i32 0, i32 0) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: cmpxchg i32* null, i32 0, i32 0 seq_cst if ( __sync_val_compare_and_swap(&valb, 0, 1)) { - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* %valb, i8 0, i8 1) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: cmpxchg i8* %valb, i8 0, i8 1 seq_cst old = 42; } __sync_bool_compare_and_swap((void **)0, (void *)0, (void *)0); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* null, i32 0, i32 0) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) + // CHECK: cmpxchg i32* null, i32 0, i32 0 seq_cst __sync_lock_release(&val); - // CHECK: volatile store i32 0, i32* + // CHECK: store atomic {{.*}} release, align 4 __sync_synchronize (); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false) + // CHECK: fence seq_cst return old; } @@ -130,7 +87,7 @@ int atomic(void) { void release_return(int *lock) { // Ensure this is actually returning void all the way through. return __sync_lock_release(lock); - // CHECK: volatile store i32 0, i32* + // CHECK: store atomic {{.*}} release, align 4 } @@ -138,21 +95,11 @@ void release_return(int *lock) { // CHECK: @addrspace void addrspace(int __attribute__((address_space(256))) * P) { __sync_bool_compare_and_swap(P, 0, 1); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p256i32(i32 addrspace(256)*{{.*}}, i32 0, i32 1) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - - + // CHECK: cmpxchg i32 addrspace(256)*{{.*}}, i32 0, i32 1 seq_cst + __sync_val_compare_and_swap(P, 0, 1); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p256i32(i32 addrspace(256)*{{.*}}, i32 0, i32 1) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - - + // CHECK: cmpxchg i32 addrspace(256)*{{.*}}, i32 0, i32 1 seq_cst + __sync_xor_and_fetch(P, 123); - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - // CHECK: call i32 @llvm.atomic.load.xor.i32.p256i32(i32 addrspace(256)* {{.*}}, i32 123) - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) - + // CHECK: atomicrmw xor i32 addrspace(256)*{{.*}}, i32 123 seq_cst } - diff --git a/test/CodeGen/attr-naked.c b/test/CodeGen/attr-naked.c index bccacc9916f1..2387d288eca8 100644 --- a/test/CodeGen/attr-naked.c +++ b/test/CodeGen/attr-naked.c @@ -1,9 +1,16 @@ -// RUN: %clang_cc1 -g -emit-llvm -o %t %s -// RUN: grep 'naked' %t +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s void t1() __attribute__((naked)); +// Basic functionality check +// (Note that naked needs to imply noinline to work properly.) +// CHECK: define void @t1() nounwind noinline naked { void t1() { } +// Make sure this doesn't explode in the verifier. +// (It doesn't really make sense, but it isn't invalid.) +// CHECK: define void @t2() nounwind noinline naked { +__attribute((naked, always_inline)) void t2() { +} diff --git a/test/CodeGen/attribute_constructor.c b/test/CodeGen/attribute_constructor.c new file mode 100644 index 000000000000..c82c263dda19 --- /dev/null +++ b/test/CodeGen/attribute_constructor.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.global_ctors + +void foo() __attribute__((constructor)); +void foo() { + bar(); +} diff --git a/test/CodeGen/avx-shuffle-builtins.c b/test/CodeGen/avx-shuffle-builtins.c new file mode 100644 index 000000000000..c11780a5e392 --- /dev/null +++ b/test/CodeGen/avx-shuffle-builtins.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +avx -emit-llvm -o - | FileCheck %s + +// Don't include mm_malloc.h, it's system specific. +#define __MM_MALLOC_H + +#include <immintrin.h> + +// +// Test LLVM IR codegen of shuffle instructions +// + +__m256 x(__m256 a, __m256 b) { + // Check if the mask is correct + // CHECK: shufflevector{{.*}}<i32 3, i32 2, i32 8, i32 11, i32 7, i32 6, i32 12, i32 15> + return _mm256_shuffle_ps(a, b, 203); +} diff --git a/test/CodeGen/block-3.c b/test/CodeGen/block-3.c new file mode 100644 index 000000000000..95cb6a735c73 --- /dev/null +++ b/test/CodeGen/block-3.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 +// rdar://10001085 + +int main() { + ^{ + __attribute__((__blocks__(byref))) int index = ({ int __a; int __b; __a < __b ? __b : __a; }); + }; +} diff --git a/test/CodeGen/block-copy.c b/test/CodeGen/block-copy.c new file mode 100644 index 000000000000..fba76ad21a14 --- /dev/null +++ b/test/CodeGen/block-copy.c @@ -0,0 +1,20 @@ +/* RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + + This should compile into a memcpy from a global, not 128 stores. */ + + + +void foo(); + +float bar() { + float lookupTable[] = {-1,-1,-1,0, -1,-1,0,-1, -1,-1,0,1, -1,-1,1,0, + -1,0,-1,-1, -1,0,-1,1, -1,0,1,-1, -1,0,1,1, + -1,1,-1,0, -1,1,0,-1, -1,1,0,1, -1,1,1,0, + 0,-1,-1,-1, 0,-1,-1,1, 0,-1,1,-1, 0,-1,1,1, + 1,-1,-1,0, 1,-1,0,-1, 1,-1,0,1, 1,-1,1,0, + 1,0,-1,-1, 1,0,-1,1, 1,0,1,-1, 1,0,1,1, + 1,1,-1,0, 1,1,0,-1, 1,1,0,1, 1,1,1,0, + 0,1,-1,-1, 0,1,-1,1, 0,1,1,-1, 0,1,1,1}; + // CHECK: memcpy + foo(lookupTable); +} diff --git a/test/CodeGen/block-decl-merging.c b/test/CodeGen/block-decl-merging.c deleted file mode 100644 index 1e7a9f4e92cb..000000000000 --- a/test/CodeGen/block-decl-merging.c +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -emit-llvm -o - %s | \ -// RUN: FileCheck %s - -// CHECK: @_NSConcreteGlobalBlock = extern_weak global -extern void * _NSConcreteStackBlock[32] __attribute__((weak_import)); -// CHECK: @_NSConcreteStackBlock = extern_weak global -extern void * _NSConcreteGlobalBlock[32] __attribute__((weak_import)); -extern void _Block_object_dispose(const void *, const int) __attribute__((weak_import)); -// CHECK: declare extern_weak void @_Block_object_assign -extern void _Block_object_assign(void *, const void *, const int) __attribute__((weak_import)); -// CHECK: declare extern_weak void @_Block_object_dispose - -void *x = ^(){}; - -void f1(void (^a0)(void)); - -void f0() { - __block int x; - f1(^(void){ x = 1; }); -} diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c index b7b6a2d505ef..bef44c369015 100644 --- a/test/CodeGen/blocks.c +++ b/test/CodeGen/blocks.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - -fblocks | FileCheck %s void (^f)(void) = ^{}; // rdar://6768379 @@ -12,7 +12,7 @@ struct s0 { int a[64]; }; -// RUN: grep 'internal void @__f2_block_invoke_0(.struct.s0\* sret .*, .*, .* byval .*)' %t +// CHECK: define internal void @__f2_block_invoke_0(%struct.s0* noalias sret {{%.*}}, i8* {{%.*}}, %struct.s0* byval align 4 {{.*}}) struct s0 f2(struct s0 a0) { return ^(struct s0 a1){ return a1; }(a0); } diff --git a/test/CodeGen/builtin-attributes.c b/test/CodeGen/builtin-attributes.c index 822b8eecf7d7..3781eba26694 100644 --- a/test/CodeGen/builtin-attributes.c +++ b/test/CodeGen/builtin-attributes.c @@ -15,3 +15,44 @@ void f1() { char* f2(char* a, char* b) { return __builtin_strstr(a, b); } + +// frexp is NOT readnone. It writes to its pointer argument. +// <rdar://problem/10070234> +// +// CHECK: f3 +// CHECK: call double @frexp(double % +// CHECK-NOT: readnone +// CHECK: call float @frexpf(float % +// CHECK-NOT: readnone +// CHECK: call double @frexpl(double % +// CHECK-NOT: readnone +// +// Same thing for modf and friends. +// +// CHECK: call double @modf(double % +// CHECK-NOT: readnone +// CHECK: call float @modff(float % +// CHECK-NOT: readnone +// CHECK: call double @modfl(double % +// CHECK-NOT: readnone +// +// CHECK: call double @remquo(double % +// CHECK-NOT: readnone +// CHECK: call float @remquof(float % +// CHECK-NOT: readnone +// CHECK: call double @remquol(double % +// CHECK-NOT: readnone +// CHECK: ret +int f3(double x) { + int e; + __builtin_frexp(x, &e); + __builtin_frexpf(x, &e); + __builtin_frexpl(x, &e); + __builtin_modf(x, &e); + __builtin_modff(x, &e); + __builtin_modfl(x, &e); + __builtin_remquo(x, x, &e); + __builtin_remquof(x, x, &e); + __builtin_remquol(x, x, &e); + return e; +} diff --git a/test/CodeGen/capture-complex-expr-in-block.c b/test/CodeGen/capture-complex-expr-in-block.c new file mode 100644 index 000000000000..9ce7570a4486 --- /dev/null +++ b/test/CodeGen/capture-complex-expr-in-block.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s +// rdar://10033986 + +typedef void (^BLOCK)(void); +int main () +{ + _Complex double c; + BLOCK b = ^() { + _Complex double z; + z = z + c; + }; + b(); +} + +// CHECK: define internal void @__main_block_invoke_0 +// CHECK: [[C1:%.*]] = alloca { double, double }, align 8 +// CHECK: [[RP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0 +// CHECK-NEXT: [[R:%.*]] = load double* [[RP]] +// CHECK-NEXT: [[IP:%.*]] = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1 +// CHECK-NEXT: [[I:%.*]] = load double* [[IP]] diff --git a/test/CodeGen/char-literal.c b/test/CodeGen/char-literal.c index 322041c0049a..5963ede392af 100644 --- a/test/CodeGen/char-literal.c +++ b/test/CodeGen/char-literal.c @@ -1,35 +1,93 @@ -// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// Runs in c++ mode so that wchar_t is available. +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -std=c++11 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CPP0X %s + +#include <stddef.h> int main() { - // CHECK: store i8 97 + // CHECK-C: store i8 97 + // CHECK-CPP0X: store i8 97 char a = 'a'; // Should pick second character. - // CHECK: store i8 98 + // CHECK-C: store i8 98 + // CHECK-CPP0X: store i8 98 char b = 'ab'; - // CHECK: store i32 97 + // CHECK-C: store i32 97 + // CHECK-CPP0X: store i32 97 wchar_t wa = L'a'; // Should pick second character. - // CHECK: store i32 98 + // CHECK-C: store i32 98 + // CHECK-CPP0X: store i32 98 wchar_t wb = L'ab'; +#if __cplusplus >= 201103L + // CHECK-CPP0X: store i16 97 + char16_t ua = u'a'; + + // Should pick second character. + // CHECK-CPP0X: store i16 98 + char16_t ub = u'ab'; + + // CHECK-CPP0X: store i32 97 + char32_t Ua = U'a'; + + // Should pick second character. + // CHECK-CPP0X: store i32 98 + char32_t Ub = U'ab'; +#endif + // Should pick last character and store its lowest byte. // This does not match gcc, which takes the last character, converts it to // utf8, and then picks the second-lowest byte of that (they probably store // the utf8 in uint16_ts internally and take the lower byte of that). - // CHECK: store i8 48 + // CHECK-C: store i8 48 + // CHECK-CPP0X: store i8 48 char c = '\u1120\u0220\U00102030'; - // CHECK: store i32 61451 + // CHECK-C: store i32 61451 + // CHECK-CPP0X: store i32 61451 wchar_t wc = L'\uF00B'; - // CHECK: store i32 1110027 +#if __cplusplus >= 201103L + // -4085 == 0xf00b + // CHECK-CPP0X: store i16 -4085 + char16_t uc = u'\uF00B'; + + // CHECK-CPP0X: store i32 61451 + char32_t Uc = U'\uF00B'; +#endif + + // CHECK-C: store i32 1110027 + // CHECK-CPP0X: store i32 1110027 wchar_t wd = L'\U0010F00B'; +#if __cplusplus >= 201103L + // Should take lower word of the 4byte UNC sequence. This does not match + // gcc. I don't understand what gcc does (it looks like it converts to utf16, + // then takes the second (!) utf16 word, swaps the lower two nibbles, and + // stores that?). + // CHECK-CPP0X: store i16 -4085 + char16_t ud = u'\U0010F00B'; // has utf16 encoding dbc8 dcb0 + + // CHECK-CPP0X: store i32 1110027 + char32_t Ud = U'\U0010F00B'; +#endif + // Should pick second character. - // CHECK: store i32 1110027 + // CHECK-C: store i32 1110027 + // CHECK-CPP0X: store i32 1110027 wchar_t we = L'\u1234\U0010F00B'; + +#if __cplusplus >= 201103L + // Should pick second character. + // CHECK-CPP0X: store i16 -4085 + char16_t ue = u'\u1234\U0010F00B'; + + // Should pick second character. + // CHECK-CPP0X: store i32 1110027 + char32_t Ue = U'\u1234\U0010F00B'; +#endif } diff --git a/test/CodeGen/complex-init-list.c b/test/CodeGen/complex-init-list.c new file mode 100644 index 000000000000..819d4f9432de --- /dev/null +++ b/test/CodeGen/complex-init-list.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s + +// This file tests the clang extension which allows initializing the components +// of a complex number individually using an initialization list. (There is a +// extensive description and test in test/Sema/complex-init-list.c.) + +_Complex float x = { 1.0f, 1.0f/0.0f }; +// CHECK: @x = global { float, float } { float 1.000000e+00, float 0x7FF0000000000000 }, align 4 + +_Complex float f(float x, float y) { _Complex float z = { x, y }; return z; } +// CHECK: define <2 x float> @f +// CHECK: alloca { float, float }
\ No newline at end of file diff --git a/test/CodeGen/debug-dead-local-var.c b/test/CodeGen/debug-dead-local-var.c new file mode 100644 index 000000000000..f9ca8f2f297d --- /dev/null +++ b/test/CodeGen/debug-dead-local-var.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -mllvm -asm-verbose -S -O2 -g %s -o - | FileCheck %s +// Radar 8122864 + +// Code is not generated for function foo, but preserve type information of +// local variable xyz. +static void foo() { +// CHECK: DW_TAG_structure_type + struct X { int a; int b; } xyz; +} + +int bar() { + foo(); + return 1; +} diff --git a/test/CodeGen/debug-info-iv.c b/test/CodeGen/debug-info-iv.c index 92654738cfc5..1d9bf32c2cda 100644 --- a/test/CodeGen/debug-info-iv.c +++ b/test/CodeGen/debug-info-iv.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-darwin-apple -Os -S -g -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -Os -S -g -o - %s | FileCheck %s int calculate(int); static void test_indvars(int *Array1, int Array2[100][200]) { @@ -14,22 +14,22 @@ static void test_indvars(int *Array1, int Array2[100][200]) { for (i = 13; i < 100; i++) for (j = 0; j < 100; j+=3) /* 2d array access */ Array2[i][j/3] = Array2[i][i]; -} +} int main() { int Array[100][200], i, j; double sum = 0.0; - + for (i=0; i < 100; i+=2) for (j=0; j < 200; j++) Array[i][j] = 0; test_indvars(Array[0], Array); -//CHECK: .loc 2 30 3 +//CHECK: .loc 2 30 8 for (i=0; i < 100; i+=2) for (j=0; j < 200; j++) sum += Array[i][j]; - + return calculate(sum); } diff --git a/test/CodeGen/debug-info-line.c b/test/CodeGen/debug-info-line.c index b255d90b34c8..9e6e9714aa47 100644 --- a/test/CodeGen/debug-info-line.c +++ b/test/CodeGen/debug-info-line.c @@ -1,8 +1,9 @@ -// RUN: %clang -emit-llvm -S -g %s -o %t -// RUN: grep DW_TAG_lexical_block %t | count 3 +// RUN: %clang -emit-llvm -S -g %s -o - | FileCheck %s // Radar 8396182 -// There are three lexical blocks in this test case. +// There is only one lexical block, but we need a DILexicalBlock and two +// DILexicalBlockFile to correctly represent file info. This means we have +// two lexical blocks shown as the latter is also tagged as a lexical block. int foo() { int i = 1; @@ -13,3 +14,10 @@ int foo() { # 5 "m.c" 2 return i + j; } + +// CHECK: DW_TAG_lexical_block +// CHECK: DW_TAG_lexical_block +// CHECK: !"m.h" +// CHECK: DW_TAG_lexical_block +// CHECK: !"m.c" +// CHECK-NOT: DW_TAG_lexical_block diff --git a/test/CodeGen/debug-info-line3.c b/test/CodeGen/debug-info-line3.c new file mode 100644 index 000000000000..645ffb9e7485 --- /dev/null +++ b/test/CodeGen/debug-info-line3.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -g -S -emit-llvm %s -o - | FileCheck %s + +void func(char c, char* d) +{ + *d = c + 1; + return; + + + + + + +} + +// CHECK: ret void, !dbg !19 +// CHECK: !19 = metadata !{i32 6, diff --git a/test/CodeGen/debug-info-member.c b/test/CodeGen/debug-info-member.c index 54066fa53060..43d26f858d2c 100644 --- a/test/CodeGen/debug-info-member.c +++ b/test/CodeGen/debug-info-member.c @@ -1,3 +1,3 @@ -// RUN: %clang_cc1 -emit-llvm -g < %s | grep DW_TAG_member | grep \!3 +// RUN: %clang_cc1 -emit-llvm -g < %s | grep DW_TAG_member struct A { int x; } a; diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c index 21b75797f0c3..2065e3364bcd 100644 --- a/test/CodeGen/decl.c +++ b/test/CodeGen/decl.c @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -w -emit-llvm < %s | FileCheck %s // CHECK: @test1.x = internal constant [12 x i32] [i32 1 -// CHECK: @test2.x = internal unnamed_addr constant [13 x i32] [i32 1, +// CHECK: @test2.x = private unnamed_addr constant [13 x i32] [i32 1, // CHECK: @test5w = global { i32, [4 x i8] } { i32 2, [4 x i8] undef } // CHECK: @test5y = global { double } { double 7.300000e+0{{[0]*}}1 } -// CHECK: @test6.x = internal unnamed_addr constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 } +// CHECK: @test6.x = private unnamed_addr constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 } // CHECK: @test7 = global [2 x %struct.test7s] [%struct.test7s { i32 1, i32 2 }, %struct.test7s { i32 4, i32 0 }] @@ -24,7 +24,7 @@ void test2() { // This should codegen as a "@test2.x" global + memcpy. int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 }; foo(x); - + // CHECK: @test2() // CHECK: %x = alloca [13 x i32] // CHECK: call void @llvm.memcpy @@ -36,7 +36,7 @@ void test3() { // This should codegen as a memset. int x[100] = { 0 }; foo(x); - + // CHECK: @test3() // CHECK: %x = alloca [100 x i32] // CHECK: call void @llvm.memset diff --git a/test/CodeGen/exact-div-expr.c b/test/CodeGen/exact-div-expr.c new file mode 100644 index 000000000000..a2c12a0b3f6e --- /dev/null +++ b/test/CodeGen/exact-div-expr.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -O1 | grep ashr +// RUN: %clang_cc1 -emit-llvm %s -o - -O1 | not grep sdiv + +long long test(int *A, int *B) { + return A-B; +} diff --git a/test/CodeGen/exceptions.c b/test/CodeGen/exceptions.c index 018b975395b9..20eb706a03b1 100644 --- a/test/CodeGen/exceptions.c +++ b/test/CodeGen/exceptions.c @@ -14,6 +14,8 @@ void test1() { // CHECK-ARM: invoke arm_aapcscc void @test1_helper( test1_helper(^(int v) { x = v; }); - // CHECK: call {{.*}} @llvm.eh.selector({{.*}}, i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) - // CHECK-ARM: call {{.*}} @llvm.eh.selector({{.*}}, i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-NEXT: cleanup + // CHECK-ARM: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) + // CHECK-ARM-NEXT: cleanup } diff --git a/test/CodeGen/extern-weak.c b/test/CodeGen/extern-weak.c new file mode 100644 index 000000000000..6a78a33af65a --- /dev/null +++ b/test/CodeGen/extern-weak.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -O3 -emit-llvm -o - %s | grep extern_weak +// RUN: %clang_cc1 -O3 -emit-llvm -o - %s | llc + +#if !defined(__linux__) && !defined(__FreeBSD__) && \ + !defined(__OpenBSD__) && !defined(__CYGWIN__) && !defined(__DragonFly__) +void foo() __attribute__((weak_import)); +#else +void foo() __attribute__((weak)); +#endif + +void bar() { foo(); } + diff --git a/test/CodeGen/fp16-ops.c b/test/CodeGen/fp16-ops.c new file mode 100644 index 000000000000..cbbfb884df50 --- /dev/null +++ b/test/CodeGen/fp16-ops.c @@ -0,0 +1,283 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s +typedef unsigned cond_t; + +volatile cond_t test; +volatile __fp16 h0 = 0.0, h1 = 1.0, h2; +volatile float f0, f1, f2; + +void foo(void) { + // CHECK: define void @foo() + + // Check unary ops + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK fptoi float + test = (h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une float + test = (!h1); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = -h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = +h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1++; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + ++h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + --h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1--; + + // Check binary ops with various operands + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = h0 * h2; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call i16 @llvm.convert.to.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = h0 * (__fp16) -2.0; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = h0 * f2; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = f0 * h2; + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h0 / h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h0 / (__fp16) -2.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h0 / f2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (f0 / h2); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h2 + h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = ((__fp16)-2.0 + h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h2 + f0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (f2 + h0); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h2 - h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = ((__fp16)-2.0 - h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h2 - f0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub float + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (f2 - h0); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp olt + test = (h2 < h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp olt + test = (h2 < (__fp16)42.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp olt + test = (h2 < f0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp olt + test = (f2 < h0); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ogt + test = (h0 > h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ogt + test = ((__fp16)42.0 > h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ogt + test = (h0 > f2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ogt + test = (f0 > h2); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ole + test = (h2 <= h0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ole + test = (h2 <= (__fp16)42.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ole + test = (h2 <= f0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp ole + test = (f2 <= h0); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oge + test = (h0 >= h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oge + test = (h0 >= (__fp16)-2.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oge + test = (h0 >= f2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oge + test = (f0 >= h2); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oeq + test = (h1 == h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oeq + test = (h1 == (__fp16)1.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oeq + test = (h1 == f1); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp oeq + test = (f1 == h1); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une + test = (h1 != h2); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une + test = (h1 != (__fp16)1.0); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une + test = (h1 != f1); + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une + test = (f1 != h1); + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fcmp une + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call i16 @llvm.convert.to.fp16 + h1 = (h1 ? h2 : h0); + // Check assignments (inc. compound) + h0 = h1; + // CHECK: call i16 @llvm.convert.to.fp16 + h0 = (__fp16)-2.0; + // CHECK: call i16 @llvm.convert.to.fp16 + h0 = f0; + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd float + // CHECK: call i16 @llvm.convert.to.fp16 + h0 += h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd + // CHECK: call i16 @llvm.convert.to.fp16 + h0 += (__fp16)1.0; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fadd + // CHECK: call i16 @llvm.convert.to.fp16 + h0 += f2; + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub + // CHECK: call i16 @llvm.convert.to.fp16 + h0 -= h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub + // CHECK: call i16 @llvm.convert.to.fp16 + h0 -= (__fp16)1.0; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fsub + // CHECK: call i16 @llvm.convert.to.fp16 + h0 -= f2; + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul + // CHECK: call i16 @llvm.convert.to.fp16 + h0 *= h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul + // CHECK: call i16 @llvm.convert.to.fp16 + h0 *= (__fp16)1.0; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fmul + // CHECK: call i16 @llvm.convert.to.fp16 + h0 *= f2; + + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv + // CHECK: call i16 @llvm.convert.to.fp16 + h0 /= h1; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv + // CHECK: call i16 @llvm.convert.to.fp16 + h0 /= (__fp16)1.0; + // CHECK: call float @llvm.convert.from.fp16 + // CHECK: fdiv + // CHECK: call i16 @llvm.convert.to.fp16 + h0 /= f2; +} diff --git a/test/CodeGen/func-aligned.c b/test/CodeGen/func-aligned.c new file mode 100644 index 000000000000..f8a4a29d9d2c --- /dev/null +++ b/test/CodeGen/func-aligned.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// rdar://7270273 +void foo() __attribute__((aligned (64))); +void foo() { +// CHECK: define void @foo() {{.*}} align 64 +} diff --git a/test/CodeGen/funccall.c b/test/CodeGen/funccall.c new file mode 100644 index 000000000000..9735e3470570 --- /dev/null +++ b/test/CodeGen/funccall.c @@ -0,0 +1,17 @@ + +static int q; + +void foo() { + int t = q; + q = t + 1; +} +int main() { + q = 0; + foo(); + q = q - 1; + + return q; +} + +// This is the source that corresponds to funccall.ll +// RUN: echo foo diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c index 3a1030a61b90..6cbf40ba220f 100644 --- a/test/CodeGen/function-attributes.c +++ b/test/CodeGen/function-attributes.c @@ -89,3 +89,25 @@ void f15(void) { void __attribute__((force_align_arg_pointer)) f16(void) { } +// PR11038 +// CHECK: define void @f18() +// CHECK: returns_twice +// CHECK: { +// CHECK: call void @f17() +// CHECK: returns_twice +// CHECK: ret void +__attribute__ ((returns_twice)) void f17(void); +__attribute__ ((returns_twice)) void f18(void) { + f17(); +} + +// CHECK: define void @f19() +// CHECK: { +// CHECK: call i32 @setjmp(i32* null) +// CHECK: returns_twice +// CHECK: ret void +typedef int jmp_buf[((9 * 2) + 3 + 16)]; +int setjmp(jmp_buf); +void f19(void) { + setjmp(0); +} diff --git a/test/CodeGen/functions.c b/test/CodeGen/functions.c index e51f93e57411..28e4bd0c8296 100644 --- a/test/CodeGen/functions.c +++ b/test/CodeGen/functions.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -verify | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify | FileCheck %s int g(); @@ -24,7 +24,7 @@ void f0() {} void f1(); void f2(void) { -// CHECK: call void @f1() +// CHECK: call void bitcast (void ()* @f1 to void (i32, i32, i32)*)(i32 1, i32 2, i32 3) f1(1, 2, 3); } // CHECK: define void @f1() diff --git a/test/CodeGen/hidden-visibility.c b/test/CodeGen/hidden-visibility.c new file mode 100644 index 000000000000..65e6616ef19f --- /dev/null +++ b/test/CodeGen/hidden-visibility.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: hidden global +int X __attribute__ ((__visibility__ ("hidden"))) = 123; diff --git a/test/CodeGen/implicit-arg.c b/test/CodeGen/implicit-arg.c new file mode 100644 index 000000000000..52ab58ec9801 --- /dev/null +++ b/test/CodeGen/implicit-arg.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - +// rdar://6518089 + +static int bar(); +void foo() { + int a = bar(); +} +int bar(unsigned a) { +} diff --git a/test/CodeGen/inline-asm-mrv.c b/test/CodeGen/inline-asm-mrv.c new file mode 100644 index 000000000000..929dd90fde60 --- /dev/null +++ b/test/CodeGen/inline-asm-mrv.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -O | not grep alloca +// PR2094 + +int sad16_sse2(void *v, unsigned char *blk2, unsigned char *blk1, + int stride, int h) { + int ret; + asm volatile( "%0 %1 %2 %3" + : "+r" (h), "+r" (blk1), "+r" (blk2) + : "r" ((long)stride)); + asm volatile("set %0 %1" : "=r"(ret) : "r"(blk1)); + return ret; +} diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c index 96f9c5c9d4bb..6bc583df8c96 100644 --- a/test/CodeGen/inline.c +++ b/test/CodeGen/inline.c @@ -12,9 +12,10 @@ // RUN: grep "define void @test3()" %t // RUN: grep "define available_externally i32 @test4" %t // RUN: grep "define available_externally i32 @test5" %t +// RUN: grep "define i32 @test6" %t // RUN: echo "\nC99 tests:" -// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=c99 +// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu99 // RUN: grep "define i32 @ei()" %t // RUN: grep "define available_externally i32 @foo()" %t // RUN: grep "define i32 @bar()" %t @@ -27,6 +28,8 @@ // RUN: grep "define void @test3" %t // RUN: grep "define available_externally i32 @test4" %t // RUN: grep "define available_externally i32 @test5" %t +// RUN: grep "define i32 @test6" %t +// RUN: grep "define available_externally i.. @strlcpy" %t // RUN: echo "\nC++ tests:" // RUN: %clang -x c++ %s -O1 -emit-llvm -S -o %t -std=c++98 @@ -84,3 +87,18 @@ extern __inline int __attribute__ ((__gnu_inline__)) test5(void) } void test_test5() { test5(); } + +// PR10233 + +__inline int test6() { return 0; } +extern int test6(); + + +// No PR#, but this once crashed clang in C99 mode due to buggy extern inline +// redeclaration detection. +void test7() { } +void test7(); + +// PR11062; the fact that the function is named strlcpy matters here. +inline __typeof(sizeof(int)) strlcpy(char *dest, const char *src, __typeof(sizeof(int)) size) { return 3; } +void test8() { strlcpy(0,0,0); } diff --git a/test/CodeGen/kr-call.c b/test/CodeGen/kr-call.c new file mode 100644 index 000000000000..ea4e3d3d70f0 --- /dev/null +++ b/test/CodeGen/kr-call.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple s390x-unknown-linux -emit-llvm -o - %s | FileCheck %s + +// Test that we don't crash. The s390x-unknown-linux target happens +// to need to set a sext argument attribute on this call, and we need +// to make sure that rewriting it correctly keeps that attribute. +void test0_helper(); +void test0() { + // CHECK: call void bitcast (void ()* @test0_helper to void (i32)*)(i32 signext 1) + test0_helper(1); +} +void test0_helper() {} + diff --git a/test/CodeGen/libcalls-d.c b/test/CodeGen/libcalls-d.c new file mode 100644 index 000000000000..b375f2bb83a6 --- /dev/null +++ b/test/CodeGen/libcalls-d.c @@ -0,0 +1,16 @@ +// llvm-gcc -O1+ should run simplify libcalls, O0 shouldn't +// and -fno-builtins shouldn't. +// -fno-math-errno should emit an llvm intrinsic, -fmath-errno should not. +// RUN: %clang_cc1 %s -emit-llvm -fno-math-errno -O0 -o - | grep {call.*exp2\\.f64} +// RUN: %clang_cc1 %s -emit-llvm -fmath-errno -O0 -o - | grep {call.*exp2} +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - | grep {call.*ldexp} +// RUN: %clang_cc1 %s -emit-llvm -O3 -fno-builtin -o - | grep {call.*exp2} + +// clang doesn't support this yet. +// XFAIL: * + +double exp2(double); + +double t4(unsigned char x) { + return exp2(x); +} diff --git a/test/CodeGen/libcalls-ld.c b/test/CodeGen/libcalls-ld.c new file mode 100644 index 000000000000..2758761b5ee1 --- /dev/null +++ b/test/CodeGen/libcalls-ld.c @@ -0,0 +1,19 @@ +// llvm-gcc -O1+ should run simplify libcalls, O0 shouldn't +// and -fno-builtins shouldn't. +// -fno-math-errno should emit an llvm intrinsic, -fmath-errno should not. +// RUN: %clang_cc1 %s -emit-llvm -fno-math-errno -O0 -o - | grep {call.*exp2\\..*f} +// RUN: %clang_cc1 %s -emit-llvm -fmath-errno -O0 -o - | grep {call.*exp2l} +// RUN: %clang_cc1 %s -emit-llvm -O1 -o - | grep {call.*ldexp} +// RUN: %clang_cc1 %s -emit-llvm -O3 -fno-builtin -o - | grep {call.*exp2l} + +// clang doesn't support this yet. +// XFAIL: * + +// If this fails for you because your target doesn't support long double, +// please xfail the test. + +long double exp2l(long double); + +long double t4(unsigned char x) { + return exp2l(x); +} diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c index 5ff684fd5b66..458c591837ff 100644 --- a/test/CodeGen/libcalls.c +++ b/test/CodeGen/libcalls.c @@ -24,9 +24,9 @@ void test_sqrt(float a0, double a1, long double a2) { // CHECK-YES: declare float @sqrtf(float) // CHECK-YES: declare double @sqrt(double) // CHECK-YES: declare x86_fp80 @sqrtl(x86_fp80) -// CHECK-NO: declare float @sqrtf(float) readnone -// CHECK-NO: declare double @sqrt(double) readnone -// CHECK-NO: declare x86_fp80 @sqrtl(x86_fp80) readnone +// CHECK-NO: declare float @sqrtf(float) nounwind readnone +// CHECK-NO: declare double @sqrt(double) nounwind readnone +// CHECK-NO: declare x86_fp80 @sqrtl(x86_fp80) nounwind readnone // CHECK-YES: define void @test_pow // CHECK-NO: define void @test_pow diff --git a/test/CodeGen/microsoft-call-conv.c b/test/CodeGen/microsoft-call-conv.c index 95f5fa3f83b5..390c3be05e61 100644 --- a/test/CodeGen/microsoft-call-conv.c +++ b/test/CodeGen/microsoft-call-conv.c @@ -46,5 +46,5 @@ int main(void) { void __stdcall f7(foo) int foo; {} void f8(void) { f7(0); - // CHECK: call x86_stdcallcc void (...)* bitcast + // CHECK: call x86_stdcallcc void @f7(i32 0) } diff --git a/test/CodeGen/misaligned-param.c b/test/CodeGen/misaligned-param.c new file mode 100644 index 000000000000..53f1f290f5c2 --- /dev/null +++ b/test/CodeGen/misaligned-param.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -triple i386-apple-darwin -emit-llvm -o - | FileCheck %s +// Misaligned parameter must be memcpy'd to correctly aligned temporary. + +struct s { int x; long double y; }; +long double foo(struct s x, int i, struct s y) { +// CHECK: foo +// CHECK: %x = alloca %struct.s, align 16 +// CHECK: %y = alloca %struct.s, align 16 +// CHECK: memcpy +// CHECK: memcpy +// CHECK: bar + return bar(&x, &y); +} diff --git a/test/CodeGen/mrtd.c b/test/CodeGen/mrtd.c index 2cc71bb0086f..d7729a525068 100644 --- a/test/CodeGen/mrtd.c +++ b/test/CodeGen/mrtd.c @@ -4,7 +4,7 @@ void baz(int arg); // CHECK: define x86_stdcallcc void @foo(i32 %arg) nounwind void foo(int arg) { -// CHECK: call x86_stdcallcc i32 (...)* @bar(i32 +// CHECK: call x86_stdcallcc i32 bitcast (i32 (...)* @bar to i32 (i32)*)( bar(arg); // CHECK: call x86_stdcallcc void @baz(i32 baz(arg); diff --git a/test/CodeGen/ms_struct-bitfield-1.c b/test/CodeGen/ms_struct-bitfield-1.c index 0b15a24f0337..25c0ba233261 100644 --- a/test/CodeGen/ms_struct-bitfield-1.c +++ b/test/CodeGen/ms_struct-bitfield-1.c @@ -4,26 +4,26 @@ #define ATTR __attribute__((__ms_struct__)) struct { - unsigned int bf_1 : 12; - unsigned int : 0; - unsigned int bf_2 : 12; + unsigned int bf_1 : 12; + unsigned int : 0; + unsigned int bf_2 : 12; } ATTR t1; static int a1[(sizeof(t1) == 8) -1]; struct { - char foo : 4; - short : 0; - char bar; + char foo : 4; + short : 0; + char bar; } ATTR t2; static int a2[(sizeof(t2) == 4) -1]; #pragma ms_struct on struct { - char foo : 4; - short : 0; - char bar; + char foo : 4; + short : 0; + char bar; } t3; #pragma ms_struct off static int a3[(sizeof(t3) == 4) -1]; @@ -45,47 +45,47 @@ static int a5[(sizeof(t5) == 4) -1]; struct { - char foo : 4; - short : 0; - long :0; - char bar; + char foo : 4; + short : 0; + long : 0; + char bar; } ATTR t6; static int a6[(sizeof(t6) == 4) -1]; struct { - char foo : 4; - long :0; - short : 0; - char bar; + char foo : 4; + long : 0; + short : 0; + char bar; } ATTR t7; static int a7[(sizeof(t7) == 16) -1]; struct { - char foo : 4; - short : 0; - long :0; - char bar:7; + char foo : 4; + short : 0; + long : 0; + char bar:7; } ATTR t8; static int a8[(sizeof(t8) == 4) -1]; struct { - char foo : 4; - long :0; - short : 0; - char bar: 8; + char foo : 4; + long : 0; + short : 0; + char bar: 8; } ATTR t9; static int a9[(sizeof(t9) == 16) -1]; struct { - char foo : 4; - char : 0; - short : 0; - int : 0; - long :0; - char bar; + char foo : 4; + char : 0; + short : 0; + int : 0; + long :0; + char bar; } ATTR t10; static int a10[(sizeof(t10) == 2) -1]; diff --git a/test/CodeGen/pascal-wchar-string.c b/test/CodeGen/pascal-wchar-string.c index 7a03463d2cf1..a6b619643e1f 100644 --- a/test/CodeGen/pascal-wchar-string.c +++ b/test/CodeGen/pascal-wchar-string.c @@ -35,7 +35,7 @@ int main(int argc, char* argv[]) // PR8856 - -fshort-wchar makes wchar_t be unsigned. // CHECK: @test2 -// CHECK: volatile store i32 1, i32* %isUnsigned +// CHECK: store volatile i32 1, i32* %isUnsigned void test2() { volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0; } diff --git a/test/CodeGen/pr2394.c b/test/CodeGen/pr2394.c new file mode 100644 index 000000000000..e43281a3cd3e --- /dev/null +++ b/test/CodeGen/pr2394.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +struct __attribute((packed)) x {int a : 24;}; +int a(struct x* g) { + // CHECK: load i16 + // CHECK: load i8 + return g->a; +} diff --git a/test/CodeGen/pr3518.c b/test/CodeGen/pr3518.c new file mode 100644 index 000000000000..f96a5aa65f19 --- /dev/null +++ b/test/CodeGen/pr3518.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | FileCheck %s +// PR 3518 +// Some of the objects were coming out as unintialized (external) before 3518 +// was fixed. Internal names are different between llvm-gcc and clang so they +// are not tested. + +extern void abort (void); + +// CHECK: @.compoundliteral = internal global %struct.A { i32 1, i32 2 } +// CHECK: @.compoundliteral1 = internal global %struct.A { i32 3, i32 4 } +// CHECK: @.compoundliteral2 = internal global %struct.B { %struct.A* @.compoundliteral, %struct.A* @.compoundliteral1 } +// CHECK: @.compoundliteral3 = internal global %struct.A { i32 5, i32 6 } + +struct A { int i; int j; }; +struct B { struct A *a; struct A *b; }; +struct C { struct B *c; struct A *d; }; +struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } }; + +int +main (void) +{ + if (e.c->a->i != 1 || e.c->a->j != 2) + abort (); + if (e.c->b->i != 3 || e.c->b->j != 4) + abort (); + if (e.d->i != 5 || e.d->j != 6) + abort (); + return 0; +} diff --git a/test/CodeGen/pr4349.c b/test/CodeGen/pr4349.c new file mode 100644 index 000000000000..94b4fbd5db46 --- /dev/null +++ b/test/CodeGen/pr4349.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | FileCheck %s +// PR 4349 + +union reg +{ + unsigned char b[2][2]; + unsigned short w[2]; + unsigned int d; +}; +struct cpu +{ + union reg pc; +}; +extern struct cpu cpu; +struct svar +{ + void *ptr; +}; +// CHECK: @svars1 = global [1 x %struct.svar] [%struct.svar { i8* bitcast (%struct.cpu* @cpu to i8*) }] +struct svar svars1[] = +{ + { &((cpu.pc).w[0]) } +}; +// CHECK: @svars2 = global [1 x %struct.svar] [%struct.svar { i8* getelementptr (i8* bitcast (%struct.cpu* @cpu to i8*), i64 1) }] +struct svar svars2[] = +{ + { &((cpu.pc).b[0][1]) } +}; +// CHECK: @svars3 = global [1 x %struct.svar] [%struct.svar { i8* getelementptr (i8* bitcast (%struct.cpu* @cpu to i8*), i64 2) }] +struct svar svars3[] = +{ + { &((cpu.pc).w[1]) } +}; +// CHECK: @svars4 = global [1 x %struct.svar] [%struct.svar { i8* getelementptr (i8* bitcast (%struct.cpu* @cpu to i8*), i64 3) }] +struct svar svars4[] = +{ + { &((cpu.pc).b[1][1]) } +}; diff --git a/test/CodeGen/pr5406.c b/test/CodeGen/pr5406.c new file mode 100644 index 000000000000..da74d6b64fe5 --- /dev/null +++ b/test/CodeGen/pr5406.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple arm-apple-darwin -o - | FileCheck %s +// PR 5406 + +typedef struct { char x[3]; } A0; +void foo (int i, ...); + + +// CHECK: call arm_aapcscc void (i32, ...)* @foo(i32 1, [1 x i32] {{.*}}) +int main (void) +{ + A0 a3; + a3.x[0] = 0; + a3.x[0] = 0; + a3.x[2] = 26; + foo (1, a3 ); + return 0; +} diff --git a/test/CodeGen/pragma-weak.c b/test/CodeGen/pragma-weak.c index 1de60e106a95..7ad2b77d8e7e 100644 --- a/test/CodeGen/pragma-weak.c +++ b/test/CodeGen/pragma-weak.c @@ -136,7 +136,7 @@ void __both3(void) {} void __a1(void) __attribute((noinline)); #pragma weak a1 = __a1 void __a1(void) {} -// CHECK: define void @__a1() +// CHECK: define void @__a1() {{.*}} noinline // attributes introduced BEFORE a combination of #pragma weak and alias() // hold... @@ -144,13 +144,20 @@ void __a3(void) __attribute((noinline)); #pragma weak a3 = __a3 void a3(void) __attribute((alias("__a3"))); void __a3(void) {} -// CHECK: define void @__a3() +// CHECK: define void @__a3() {{.*}} noinline #pragma weak xxx = __xxx __attribute((pure,noinline,const,fastcall)) void __xxx(void) { } -// CHECK: void @__xxx() +// CHECK: void @__xxx() {{.*}} noinline -/// TODO: stuff that still doesn't work +///////////// PR10878: Make sure we can call a weak alias +void SHA512Pad(void *context) {} +#pragma weak SHA384Pad = SHA512Pad +void PR10878() { SHA384Pad(0); } +// CHECK: call void @SHA384Pad(i8* null) + + +///////////// TODO: stuff that still doesn't work // due to the fact that disparate TopLevelDecls cannot affect each other // (due to clang's Parser and ASTConsumer behavior, and quite reasonable) diff --git a/test/CodeGen/redef-ext-inline.c b/test/CodeGen/redef-ext-inline.c new file mode 100644 index 000000000000..b8e2f365ff41 --- /dev/null +++ b/test/CodeGen/redef-ext-inline.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -std=gnu89 +// rdar://7208839 + +extern inline int f1 (void) {return 1;} +int f3 (void) {return f1();} +int f1 (void) {return 0;} diff --git a/test/CodeGen/sret.c b/test/CodeGen/sret.c new file mode 100644 index 000000000000..ed1f9a44ef14 --- /dev/null +++ b/test/CodeGen/sret.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | grep sret | count 5 + +struct abc { + long a; + long b; + long c; +}; + +struct abc foo1(void); +struct abc foo2(); + +void bar() { + struct abc dummy1 = foo1(); + struct abc dummy2 = foo2(); +} diff --git a/test/CodeGen/sret2.c b/test/CodeGen/sret2.c new file mode 100644 index 000000000000..c96ce4d5c4e0 --- /dev/null +++ b/test/CodeGen/sret2.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | grep sret | count 2 + +struct abc { + long a; + long b; + long c; +}; + +struct abc foo2(){} diff --git a/test/CodeGen/sse-builtins.c b/test/CodeGen/sse-builtins.c new file mode 100644 index 000000000000..64ee4c970fe0 --- /dev/null +++ b/test/CodeGen/sse-builtins.c @@ -0,0 +1,104 @@ +// RUN: %clang_cc1 -ffreestanding -triple i386-apple-darwin9 -target-cpu pentium4 -target-feature +sse4.1 -g -emit-llvm %s -o - | FileCheck %s + +#include <emmintrin.h> + +__m128 test_loadl_pi(__m128 x, void* y) { + // CHECK: define {{.*}} @test_loadl_pi + // CHECK: load <2 x float>* {{.*}}, align 1{{$}} + // CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1 + // CHECK: shufflevector {{.*}} <4 x i32> <i32 4, i32 5, i32 2, i32 3> + return _mm_loadl_pi(x,y); +} + +__m128 test_loadh_pi(__m128 x, void* y) { + // CHECK: define {{.*}} @test_loadh_pi + // CHECK: load <2 x float>* {{.*}}, align 1{{$}} + // CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1 + // CHECK: shufflevector {{.*}} <4 x i32> <i32 0, i32 1, i32 4, i32 5> + return _mm_loadh_pi(x,y); +} + +__m128 test_load_ss(void* y) { + // CHECK: define {{.*}} @test_load_ss + // CHECK: load float* {{.*}}, align 1{{$}} + return _mm_load_ss(y); +} + +__m128 test_load1_ps(void* y) { + // CHECK: define {{.*}} @test_load1_ps + // CHECK: load float* {{.*}}, align 1{{$}} + return _mm_load1_ps(y); +} + +void test_store_ss(__m128 x, void* y) { + // CHECK: define void @test_store_ss + // CHECK: store {{.*}} float* {{.*}}, align 1, + _mm_store_ss(y, x); +} + +__m128d test_load1_pd(__m128 x, void* y) { + // CHECK: define {{.*}} @test_load1_pd + // CHECK: load double* {{.*}}, align 1{{$}} + return _mm_load1_pd(y); +} + +__m128d test_loadr_pd(__m128 x, void* y) { + // CHECK: define {{.*}} @test_loadr_pd + // CHECK: load <2 x double>* {{.*}}, align 16{{$}} + return _mm_loadr_pd(y); +} + +__m128d test_load_sd(void* y) { + // CHECK: define {{.*}} @test_load_sd + // CHECK: load double* {{.*}}, align 1{{$}} + return _mm_load_sd(y); +} + +__m128d test_loadh_pd(__m128d x, void* y) { + // CHECK: define {{.*}} @test_loadh_pd + // CHECK: load double* {{.*}}, align 1{{$}} + return _mm_loadh_pd(x, y); +} + +__m128d test_loadl_pd(__m128d x, void* y) { + // CHECK: define {{.*}} @test_loadl_pd + // CHECK: load double* {{.*}}, align 1{{$}} + return _mm_loadl_pd(x, y); +} + +void test_store_sd(__m128d x, void* y) { + // CHECK: define void @test_store_sd + // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + _mm_store_sd(y, x); +} + +void test_store1_pd(__m128d x, void* y) { + // CHECK: define void @test_store1_pd + // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + _mm_store1_pd(y, x); +} + +void test_storer_pd(__m128d x, void* y) { + // CHECK: define void @test_storer_pd + // CHECK: store {{.*}} <2 x double>* {{.*}}, align 16{{$}} + _mm_storer_pd(y, x); +} + +void test_storeh_pd(__m128d x, void* y) { + // CHECK: define void @test_storeh_pd + // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + _mm_storeh_pd(y, x); +} + +void test_storel_pd(__m128d x, void* y) { + // CHECK: define void @test_storel_pd + // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + _mm_storel_pd(y, x); +} + +__m128i test_loadl_epi64(void* y) { + // CHECK: define {{.*}} @test_loadl_epi64 + // CHECK: load i64* {{.*}}, align 1{{$}} + return _mm_loadl_epi64(y); +} diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c index 6f3b00328771..3de7b6727bc2 100644 --- a/test/CodeGen/stdcall-fastcall.c +++ b/test/CodeGen/stdcall-fastcall.c @@ -46,5 +46,5 @@ int main(void) { void __attribute((stdcall)) f7(foo) int foo; {} void f8(void) { f7(0); - // CHECK: call x86_stdcallcc void (...)* bitcast + // CHECK: call x86_stdcallcc void @f7(i32 0) } diff --git a/test/CodeGen/string-literal-short-wstring.c b/test/CodeGen/string-literal-short-wstring.c index ce2990492ad7..770c3d426871 100644 --- a/test/CodeGen/string-literal-short-wstring.c +++ b/test/CodeGen/string-literal-short-wstring.c @@ -3,7 +3,7 @@ int main() { // This should convert to utf8. - // CHECK: internal unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 + // CHECK: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 char b[10] = "\u1120\u0220\U00102030"; // CHECK: private unnamed_addr constant [6 x i8] c"A\00B\00\00\00" diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c index cc6c0943d95a..fa8f28a766c4 100644 --- a/test/CodeGen/string-literal.c +++ b/test/CodeGen/string-literal.c @@ -1,16 +1,80 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=C %s +// RUN: %clang_cc1 -x c++ -std=c++11 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -check-prefix=CPP0X %s + +#include <stddef.h> int main() { - // CHECK: internal unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1 + // CHECK-C: private unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1 + // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1 char a[10] = "abc"; // This should convert to utf8. - // CHECK: internal unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 + // CHECK-C: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 + // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1 char b[10] = "\u1120\u0220\U00102030"; - // CHECK: private unnamed_addr constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00", align 1 - void *foo = L"AB"; + // CHECK-C: private unnamed_addr constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00", align 4 + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00", align 4 + const wchar_t *foo = L"AB"; + + // CHECK-C: private unnamed_addr constant [12 x i8] c"4\12\00\00\0B\F0\10\00\00\00\00\00", align 4 + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"4\12\00\00\0B\F0\10\00\00\00\00\00", align 4 + const wchar_t *bar = L"\u1234\U0010F00B"; + + // CHECK-C: private unnamed_addr constant [12 x i8] c"4\12\00\00\0C\F0\10\00\00\00\00\00", align 4 + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"4\12\00\00\0C\F0\10\00\00\00\00\00", align 4 + const wchar_t *baz = L"\u1234" "\U0010F00C"; + +#if __cplusplus >= 201103L + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"C\00\00\00D\00\00\00\00\00\00\00", align 4 + const char32_t *c = U"CD"; + + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"5\12\00\00\0C\F0\10\00\00\00\00\00", align 4 + const char32_t *d = U"\u1235\U0010F00C"; + + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"5\12\00\00\0B\F0\10\00\00\00\00\00", align 4 + const char32_t *o = "\u1235" U"\U0010F00B"; + + // CHECK-CPP0X: private unnamed_addr constant [6 x i8] c"E\00F\00\00\00", align 2 + const char16_t *e = u"EF"; + + // This should convert to utf16. + // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c" \11 \02\C8\DB0\DC\00\00", align 2 + const char16_t *f = u"\u1120\u0220\U00102030"; + + // This should convert to utf16. + // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c" \11 \03\C8\DB0\DC\00\00", align 2 + const char16_t *p = u"\u1120\u0320" "\U00102030"; + + // CHECK-CPP0X: private unnamed_addr constant [4 x i8] c"def\00", align 1 + const char *g = u8"def"; + + // CHECK-CPP0X: private unnamed_addr constant [4 x i8] c"ghi\00", align 1 + const char *h = R"foo(ghi)foo"; + + // CHECK-CPP0X: private unnamed_addr constant [4 x i8] c"jkl\00", align 1 + const char *i = u8R"bar(jkl)bar"; + + // CHECK-CPP0X: private unnamed_addr constant [6 x i8] c"G\00H\00\00\00", align 2 + const char16_t *j = uR"foo(GH)foo"; + + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"I\00\00\00J\00\00\00\00\00\00\00", align 4 + const char32_t *k = UR"bar(IJ)bar"; + + // CHECK-CPP0X: private unnamed_addr constant [12 x i8] c"K\00\00\00L\00\00\00\00\00\00\00", align 4 + const wchar_t *l = LR"bar(KL)bar"; + + // CHECK-CPP0X: private unnamed_addr constant [9 x i8] c"abc\5Cndef\00", align 1 + const char *m = R"(abc\ndef)"; + + // CHECK-CPP0X: private unnamed_addr constant [8 x i8] c"abc\0Adef\00", align 1 + const char *n = R"(abc +def)"; + + // CHECK-CPP0X: private unnamed_addr constant [11 x i8] c"abc\0Adefghi\00", align 1 + const char *q = R"(abc +def)" "ghi"; - // CHECK: private unnamed_addr constant [12 x i8] c"4\12\00\00\0B\F0\10\00\00\00\00\00", align 1 - void *bar = L"\u1234\U0010F00B"; +#endif } diff --git a/test/CodeGen/struct-init.c b/test/CodeGen/struct-init.c index 8a605c1b67c8..6247729c17b7 100644 --- a/test/CodeGen/struct-init.c +++ b/test/CodeGen/struct-init.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -S -triple armv7-apple-darwin %s -emit-llvm -o - | FileCheck %s typedef struct _zend_ini_entry zend_ini_entry; struct _zend_ini_entry { @@ -23,17 +23,15 @@ typedef __attribute__(( ext_vector_type(2) )) unsigned int uint2; typedef __attribute__(( __vector_size__(8) )) unsigned int __neon_uint32x2_t; // rdar://8183908 -typedef struct __simd64_uint32_t { - __neon_uint32x2_t val; -} uint32x2_t; +typedef unsigned int uint32_t; +typedef __attribute__((neon_vector_type(2))) uint32_t uint32x2_t; void foo() { const uint32x2_t signBit = { (uint2) 0x80000000 }; } -// CHECK: %struct.fp_struct_foo = type { void (i32)* } +// CHECK: %struct.fp_struct_foo = type { void ([1 x i32])* } struct fp_struct_bar { int a; }; struct fp_struct_foo { void (*FP)(struct fp_struct_bar); } G; - diff --git a/test/CodeGen/struct-matching-constraint.c b/test/CodeGen/struct-matching-constraint.c new file mode 100644 index 000000000000..40c444f2b40d --- /dev/null +++ b/test/CodeGen/struct-matching-constraint.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -S -emit-llvm -triple armv7a-apple-darwin %s -o /dev/null +typedef unsigned short uint16_t; +typedef __attribute__((neon_vector_type(8))) uint16_t uint16x8_t; + +void b(uint16x8_t sat, uint16x8_t luma) +{ + __asm__("vmov.16 %1, %0 \n\t" + "vtrn.16 %0, %1 \n\t" + :"=w"(luma), "=w"(sat) + :"0"(luma) + ); + +} diff --git a/test/CodeGen/struct-passing.c b/test/CodeGen/struct-passing.c index 8e5c0adcfc10..efb00efd53ab 100644 --- a/test/CodeGen/struct-passing.c +++ b/test/CodeGen/struct-passing.c @@ -16,8 +16,8 @@ void __attribute__((pure)) f5(T1 a); void *ps[] = { f0, f1, f2, f3, f4, f5 }; -// CHECK: declare i32 @f0() readnone -// CHECK: declare i32 @f1() readonly +// CHECK: declare i32 @f0() nounwind readnone +// CHECK: declare i32 @f1() nounwind readonly // CHECK: declare void @f2({{.*}} sret) // CHECK: declare void @f3({{.*}} sret) // CHECK: declare void @f4({{.*}} byval align 4) diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c index 8139a4efc599..fc8f758afa59 100644 --- a/test/CodeGen/target-data.c +++ b/test/CodeGen/target-data.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple i686-unknown-unknown -emit-llvm -o %t %s -// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"' %t +// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"' %t // RUN: %clang_cc1 -triple i686-apple-darwin9 -emit-llvm -o %t %s -// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"' %t +// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"' %t // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s -// RUN: grep 'target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"' %t +// RUN: grep 'target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"' %t diff --git a/test/CodeGen/unaligned-memcpy.c b/test/CodeGen/unaligned-memcpy.c new file mode 100644 index 000000000000..0373b5617e05 --- /dev/null +++ b/test/CodeGen/unaligned-memcpy.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +void bork() { + char Qux[33] = {0}; +} diff --git a/test/CodeGen/union-align.c b/test/CodeGen/union-align.c new file mode 100644 index 000000000000..89a9456e609d --- /dev/null +++ b/test/CodeGen/union-align.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | grep load | grep "4 x float" | not grep "align 4" +// RUN: %clang_cc1 -emit-llvm %s -o - | grep load | grep "4 x float" | grep "align 16" +// PR3432 +// rdar://6536377 + +typedef float __m128 __attribute__ ((__vector_size__ (16))); + +typedef union +{ + int i[4]; + float f[4]; + __m128 v; +} u_t; + +__m128 t(u_t *a) { + return a->v; +} diff --git a/test/CodeGen/vla-2.c b/test/CodeGen/vla-2.c new file mode 100644 index 000000000000..0a74907f7b2d --- /dev/null +++ b/test/CodeGen/vla-2.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | grep ".*alloca.*align 16" + +extern void bar(int[]); + +void foo(int a) +{ + int var[a] __attribute__((__aligned__(16))); + bar(var); + return; +} diff --git a/test/CodeGen/vla-3.c b/test/CodeGen/vla-3.c new file mode 100644 index 000000000000..4927b464231f --- /dev/null +++ b/test/CodeGen/vla-3.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | grep ".*alloca.*align 16" + +void adr(char *); + +void vlaalign(int size) +{ + char __attribute__((aligned(16))) tmp[size+32]; + char tmp2[size+16]; + + adr(tmp); +} diff --git a/test/CodeGen/volatile-1.c b/test/CodeGen/volatile-1.c index 7c7a822e880c..65511593d32a 100644 --- a/test/CodeGen/volatile-1.c +++ b/test/CodeGen/volatile-1.c @@ -24,182 +24,182 @@ int printf(const char *, ...); // CHECK: define void @test() void test() { - // CHECK: volatile load [[INT]]* @i + // CHECK: load volatile [[INT]]* @i i; - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: sitofp [[INT]] (float)(ci); - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) (void)ci; // CHECK-NEXT: bitcast // CHECK-NEXT: memcpy (void)a; - // CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) (void)(ci=ci); - // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i + // CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* @j + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* @i (void)(i=j); - // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // Not sure why they're ordered this way. // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) ci+=ci; - // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // These additions can be elided // CHECK-NEXT: add [[INT]] [[R]], [[R2]] // CHECK-NEXT: add [[INT]] [[I]], [[I2]] (ci += ci) + ci; // CHECK-NEXT: call void asm asm("nop"); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] (i += j) + k; // CHECK-NEXT: call void asm asm("nop"); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile // CHECK-NEXT: add nsw [[INT]] (i += j) + 1; // CHECK-NEXT: call void asm asm("nop"); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add [[INT]] // CHECK-NEXT: add [[INT]] ci+ci; - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile __real i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile +ci; // CHECK-NEXT: call void asm asm("nop"); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (void)(i=i); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: sitofp (float)(i=i); - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile (void)i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile i=i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile i=i=i; #ifndef __cplusplus - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (void)__builtin_choose_expr(0, i=i, j=j); #endif - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: icmp // CHECK-NEXT: br i1 - // CHECK: volatile load - // CHECK-NEXT: volatile store + // CHECK: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: br label - // CHECK: volatile load - // CHECK-NEXT: volatile store + // CHECK: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: br label k ? (i=i) : (j=j); // CHECK: phi - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (void)(i,(i=i)); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile i=i,i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (i=j,k=j); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile (i=j,k); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile (i,j); - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: trunc - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile // CHECK-NEXT: sext - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile i=c=k; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile i+=k; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile ci; #ifndef __cplusplus - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile (int)ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: icmp ne // CHECK-NEXT: icmp ne // CHECK-NEXT: or i1 (_Bool)ci; #endif - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile ci=ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile ci=ci=ci; - // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) __imag ci = __imag ci = __imag ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile __real (i = j); - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile __imag i; // ============================================================ @@ -224,71 +224,71 @@ void test() { // Not a use. gcc got this wrong in 4.2 and omitted the side effects // entirely, but it is fixed in 4.4.0. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile __imag (i = j); #ifndef __cplusplus // A use of the real part - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: sitofp (float)(ci=ci); // Not a use, bug? gcc treats this as not a use, that's probably a bug due to // tree folding ignoring volatile. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile (int)(ci=ci); #endif // A use. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: sitofp (float)(i=i); // A use. gcc treats this as not a use, that's probably a bug due to tree // folding ignoring volatile. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (int)(i=i); // A use. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: sub -(i=j); // A use. gcc treats this a not a use, that's probably a bug due to tree // folding ignoring volatile. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile +(i=k); // A use. gcc treats this a not a use, that's probably a bug due to tree // folding ignoring volatile. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile __real (ci=ci); // A use. - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: add i + 0; // A use. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add (i=j) + i; // A use. gcc treats this as not a use, that's probably a bug due to tree // folding ignoring volatile. - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: add (i=j) + 0; diff --git a/test/CodeGen/volatile-2.c b/test/CodeGen/volatile-2.c index 490b7d776b9f..3d342de69005 100644 --- a/test/CodeGen/volatile-2.c +++ b/test/CodeGen/volatile-2.c @@ -3,8 +3,8 @@ void test0() { // CHECK: define void @test0() // CHECK: [[F:%.*]] = alloca float - // CHECK-NEXT: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({ float, float }* @test0_v, i32 0, i32 0) - // CHECK-NEXT: volatile load float* getelementptr inbounds ({{.*}} @test0_v, i32 0, i32 1) + // CHECK-NEXT: [[REAL:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @test0_v, i32 0, i32 0) + // CHECK-NEXT: load volatile float* getelementptr inbounds ({{.*}} @test0_v, i32 0, i32 1) // CHECK-NEXT: store float [[REAL]], float* [[F]], align 4 // CHECK-NEXT: ret void extern volatile _Complex float test0_v; @@ -13,10 +13,10 @@ void test0() { void test1() { // CHECK: define void @test1() - // CHECK: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0) - // CHECK-NEXT: [[IMAG:%.*]] = volatile load float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1) - // CHECK-NEXT: volatile store float [[REAL]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0) - // CHECK-NEXT: volatile store float [[IMAG]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1) + // CHECK: [[REAL:%.*]] = load volatile float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0) + // CHECK-NEXT: [[IMAG:%.*]] = load volatile float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1) + // CHECK-NEXT: store volatile float [[REAL]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0) + // CHECK-NEXT: store volatile float [[IMAG]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1) // CHECK-NEXT: ret void extern volatile _Complex float test1_v; test1_v = test1_v; diff --git a/test/CodeGen/wchar-const.c b/test/CodeGen/wchar-const.c new file mode 100644 index 000000000000..b672b15360a2 --- /dev/null +++ b/test/CodeGen/wchar-const.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-pc-win32 | FileCheck %s --check-prefix=WIN +// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-apple-darwin | FileCheck %s --check-prefix=DAR +// This should pass for any endianness combination of host and target. + +// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include. +typedef __WCHAR_TYPE__ wchar_t; +#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \ + || defined(_M_X64) || defined(SHORT_WCHAR) + #define WCHAR_T_TYPE unsigned short +#elif defined(__sun) || defined(__AuroraUX__) + #define WCHAR_T_TYPE long +#else /* Solaris or AuroraUX. */ + #define WCHAR_T_TYPE int +#endif + + +// CHECK-DAR: private unnamed_addr constant [72 x i8] c" +// CHECK-WIN: private unnamed_addr constant [36 x i8] c" +extern void foo(const wchar_t* p); +int main (int argc, const char * argv[]) +{ + foo(L"This is some text"); + return 0; +} diff --git a/test/CodeGen/weak_constant.c b/test/CodeGen/weak_constant.c new file mode 100644 index 000000000000..726d2ef122e1 --- /dev/null +++ b/test/CodeGen/weak_constant.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -w -emit-llvm %s -O1 -o - | FileCheck %s +// Check for bug compatibility with gcc. + +const int x __attribute((weak)) = 123; + +int* f(void) { + return &x; +} + +int g(void) { + // CHECK: ret i32 123 + return *f(); +} diff --git a/test/CodeGen/x86_32-arguments-darwin.c b/test/CodeGen/x86_32-arguments-darwin.c index 731d4f613f26..7727c43f6e8d 100644 --- a/test/CodeGen/x86_32-arguments-darwin.c +++ b/test/CodeGen/x86_32-arguments-darwin.c @@ -71,7 +71,7 @@ struct s10 { // Small vectors and 1 x {i64,double} are returned in registers // CHECK: i32 @f11() -// CHECK: void @f12(<2 x i32>* sret %agg.result) +// CHECK: void @f12(<2 x i32>* noalias sret %agg.result) // CHECK: i64 @f13() // CHECK: i64 @f14() // CHECK: <2 x i64> @f15() @@ -93,11 +93,11 @@ T16 f16(void) { while (1) {} } // 128-bits). // CHECK: i32 @f17() -// CHECK: void @f18(%{{.*}}* sret %agg.result) -// CHECK: void @f19(%{{.*}}* sret %agg.result) -// CHECK: void @f20(%{{.*}}* sret %agg.result) -// CHECK: void @f21(%{{.*}}* sret %agg.result) -// CHECK: void @f22(%{{.*}}* sret %agg.result) +// CHECK: void @f18(%{{.*}}* noalias sret %agg.result) +// CHECK: void @f19(%{{.*}}* noalias sret %agg.result) +// CHECK: void @f20(%{{.*}}* noalias sret %agg.result) +// CHECK: void @f21(%{{.*}}* noalias sret %agg.result) +// CHECK: void @f22(%{{.*}}* noalias sret %agg.result) struct { T11 a; } f17(void) { while (1) {} } struct { T12 a; } f18(void) { while (1) {} } struct { T13 a; } f19(void) { while (1) {} } @@ -116,11 +116,11 @@ struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} } // Small structures are handled recursively // CHECK: i32 @f26() -// CHECK: void @f27(%struct.s27* sret %agg.result) +// CHECK: void @f27(%struct.s27* noalias sret %agg.result) struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} } struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} } -// CHECK: void @f28(%struct.s28* sret %agg.result) +// CHECK: void @f28(%struct.s28* noalias sret %agg.result) struct s28 { int a; int b[]; } f28(void) { while (1) {} } // CHECK: define i16 @f29() @@ -150,7 +150,7 @@ struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while ( // CHECK: define float @f37() struct s37 { float c[1][1]; } f37(void) { while (1) {} } -// CHECK: define void @f38(%struct.s38* sret %agg.result) +// CHECK: define void @f38(%struct.s38* noalias sret %agg.result) struct s38 { char a[3]; short b; } f38(void) { while (1) {} } // CHECK: define void @f39(%struct.s39* byval align 16 %x) diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c index 221c7d38a73d..8571ac965552 100644 --- a/test/CodeGen/x86_64-arguments.c +++ b/test/CodeGen/x86_64-arguments.c @@ -42,7 +42,7 @@ void f7(e7 a0) { // Test merging/passing of upper eightbyte with X87 class. // -// CHECK: define void @f8_1(%union.u8* sret %agg.result) +// CHECK: define void @f8_1(%union.u8* noalias sret %agg.result) // CHECK: define void @f8_2(%union.u8* byval align 16 %a0) union u8 { long double a; @@ -58,7 +58,7 @@ struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} } struct s10 { int a; int b; int : 0; }; void f10(struct s10 a0) {} -// CHECK: define void @f11(%union.anon* sret %agg.result) +// CHECK: define void @f11(%union.anon* noalias sret %agg.result) union { long double a; float b; } f11() { while (1) {} } // CHECK: define i32 @f12_0() @@ -69,7 +69,7 @@ void f12_1(struct s12 a0) {} // Check that sret parameter is accounted for when checking available integer // registers. -// CHECK: define void @f13(%struct.s13_0* sret %agg.result, i32 %a, i32 %b, i32 %c, i32 %d, {{.*}}* byval align 8 %e, i32 %f) +// CHECK: define void @f13(%struct.s13_0* noalias sret %agg.result, i32 %a, i32 %b, i32 %c, i32 %d, {{.*}}* byval align 8 %e, i32 %f) struct s13_0 { long long f0[3]; }; struct s13_1 { long long f0[2]; }; diff --git a/test/CodeGenCUDA/device-stub.cu b/test/CodeGenCUDA/device-stub.cu new file mode 100644 index 000000000000..af73ea993f45 --- /dev/null +++ b/test/CodeGenCUDA/device-stub.cu @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +#include "../SemaCUDA/cuda.h" + +// Test that we build the correct number of calls to cudaSetupArgument followed +// by a call to cudaLaunch. + +// CHECK: define{{.*}}kernelfunc +// CHECK: call{{.*}}cudaSetupArgument +// CHECK: call{{.*}}cudaSetupArgument +// CHECK: call{{.*}}cudaSetupArgument +// CHECK: call{{.*}}cudaLaunch +__global__ void kernelfunc(int i, int j, int k) {} diff --git a/test/CodeGenCUDA/filter-decl.cu b/test/CodeGenCUDA/filter-decl.cu new file mode 100644 index 000000000000..b758632d12f7 --- /dev/null +++ b/test/CodeGenCUDA/filter-decl.cu @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-HOST %s +// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device | FileCheck -check-prefix=CHECK-DEVICE %s + +#include "../SemaCUDA/cuda.h" + +// CHECK-HOST-NOT: constantdata = global +// CHECK-DEVICE: constantdata = global +__constant__ char constantdata[256]; + +// CHECK-HOST-NOT: devicedata = global +// CHECK-DEVICE: devicedata = global +__device__ char devicedata[256]; + +// CHECK-HOST-NOT: shareddata = global +// CHECK-DEVICE: shareddata = global +__shared__ char shareddata[256]; + +// CHECK-HOST: hostdata = global +// CHECK-DEVICE-NOT: hostdata = global +char hostdata[256]; + +// CHECK-HOST: define{{.*}}implicithostonlyfunc +// CHECK-DEVICE-NOT: define{{.*}}implicithostonlyfunc +void implicithostonlyfunc(void) {} + +// CHECK-HOST: define{{.*}}explicithostonlyfunc +// CHECK-DEVICE-NOT: define{{.*}}explicithostonlyfunc +__host__ void explicithostonlyfunc(void) {} + +// CHECK-HOST-NOT: define{{.*}}deviceonlyfunc +// CHECK-DEVICE: define{{.*}}deviceonlyfunc +__device__ void deviceonlyfunc(void) {} + +// CHECK-HOST: define{{.*}}hostdevicefunc +// CHECK-DEVICE: define{{.*}}hostdevicefunc +__host__ __device__ void hostdevicefunc(void) {} + +// CHECK-HOST: define{{.*}}globalfunc +// CHECK-DEVICE: define{{.*}}globalfunc +__global__ void globalfunc(void) {} diff --git a/test/CodeGenCUDA/kernel-call.cu b/test/CodeGenCUDA/kernel-call.cu new file mode 100644 index 000000000000..f134624eec19 --- /dev/null +++ b/test/CodeGenCUDA/kernel-call.cu @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +#include "../SemaCUDA/cuda.h" + +__global__ void g1(int x) {} + +int main(void) { + // CHECK: call{{.*}}cudaConfigureCall + // CHECK: icmp + // CHECK: br + // CHECK: call{{.*}}g1 + g1<<<1, 1>>>(42); +} diff --git a/test/CodeGenCUDA/ptx-kernels.cu b/test/CodeGenCUDA/ptx-kernels.cu new file mode 100644 index 000000000000..ecca8519af63 --- /dev/null +++ b/test/CodeGenCUDA/ptx-kernels.cu @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s + +#include "../SemaCUDA/cuda.h" + +// CHECK: define ptx_device{{.*}}device_function +__device__ void device_function() {} + +// CHECK: define ptx_kernel{{.*}}global_function +__global__ void global_function() { + // CHECK: call ptx_device{{.*}}device_function + device_function(); +} diff --git a/test/CodeGenCXX/2003-11-02-WeakLinkage.cpp b/test/CodeGenCXX/2003-11-02-WeakLinkage.cpp new file mode 100644 index 000000000000..02f9fc6e911d --- /dev/null +++ b/test/CodeGenCXX/2003-11-02-WeakLinkage.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// The template should compile to linkonce linkage, not weak linkage. + +// CHECK-NOT: weak +template<class T> +void thefunc(); + +template<class T> +inline void thefunc() {} + +void test() { + thefunc<int>(); +} diff --git a/test/CodeGenCXX/2003-11-18-PtrMemConstantInitializer.cpp b/test/CodeGenCXX/2003-11-18-PtrMemConstantInitializer.cpp new file mode 100644 index 000000000000..9cecf4861163 --- /dev/null +++ b/test/CodeGenCXX/2003-11-18-PtrMemConstantInitializer.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct Gfx { + void opMoveSetShowText(); +}; + +struct Operator { + void (Gfx::*func)(); +}; + +Operator opTab[] = { + {&Gfx::opMoveSetShowText}, +}; diff --git a/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp b/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp new file mode 100644 index 000000000000..3e5339732767 --- /dev/null +++ b/test/CodeGenCXX/2003-11-27-MultipleInheritanceThunk.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +struct CallSite { + int X; + + CallSite(const CallSite &CS); +}; + +struct AliasAnalysis { + int TD; + + virtual int getModRefInfo(CallSite CS); +}; + + +struct Pass { + int X; + virtual int foo(); +}; + +struct AliasAnalysisCounter : public Pass, public AliasAnalysis { + int getModRefInfo(CallSite CS) { + return 0; + } +}; + +AliasAnalysisCounter AAC; diff --git a/test/CodeGenCXX/2003-11-29-DuplicatedCleanupTest.cpp b/test/CodeGenCXX/2003-11-29-DuplicatedCleanupTest.cpp new file mode 100644 index 000000000000..45325bc65c61 --- /dev/null +++ b/test/CodeGenCXX/2003-11-29-DuplicatedCleanupTest.cpp @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +void doesntThrow() throw(); +struct F { + ~F() { doesntThrow(); } +}; + +void atest() { + F A; +lab: + F B; + goto lab; +} + +void test(int val) { +label: { + F A; + F B; + if (val == 0) goto label; + if (val == 1) goto label; +} +} + +void test3(int val) { +label: { + F A; + F B; + if (val == 0) { doesntThrow(); goto label; } + if (val == 1) { doesntThrow(); goto label; } +} +} + +void test4(int val) { +label: { + F A; + F B; + if (val == 0) { F C; goto label; } + if (val == 1) { F D; goto label; } +} +} diff --git a/test/CodeGenCXX/2003-12-08-ArrayOfPtrToMemberFunc.cpp b/test/CodeGenCXX/2003-12-08-ArrayOfPtrToMemberFunc.cpp new file mode 100644 index 000000000000..38de271b6132 --- /dev/null +++ b/test/CodeGenCXX/2003-12-08-ArrayOfPtrToMemberFunc.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct Evil { + void fun (); +}; +int foo(); +typedef void (Evil::*memfunptr) (); +static memfunptr jumpTable[] = { &Evil::fun }; + +void Evil::fun() { + (this->*jumpTable[foo()]) (); +} diff --git a/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp b/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp new file mode 100644 index 000000000000..0c9333fb6d7a --- /dev/null +++ b/test/CodeGenCXX/2004-01-11-DynamicInitializedConstant.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +// CHECK-NOT: constant +extern int X; +const int Y = X; +const int* foo() { return &Y; } diff --git a/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp new file mode 100644 index 000000000000..a6e2e30dd59b --- /dev/null +++ b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct A { + virtual void Method() = 0; +}; + +struct B : public A { + virtual void Method() { } +}; + +typedef void (A::*fn_type_a)(void); +typedef void (B::*fn_type_b)(void); + +int main(int argc, char **argv) +{ + fn_type_a f = reinterpret_cast<fn_type_a>(&B::Method); + fn_type_b g = reinterpret_cast<fn_type_b>(f); + B b; + (b.*g)(); + return 0; +} diff --git a/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp new file mode 100644 index 000000000000..5d8c8b004b79 --- /dev/null +++ b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +// CHECK: _ZN11AccessFlags6strlenEv +struct AccessFlags { + void strlen(); +}; + +void AccessFlags::strlen() { } diff --git a/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp new file mode 100644 index 000000000000..01350c00b9bd --- /dev/null +++ b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +// Testcase from Bug 291 + +struct X { + ~X(); +}; + +void foo() { + X v; + +TryAgain: + goto TryAgain; +} diff --git a/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp new file mode 100644 index 000000000000..97254c18a51a --- /dev/null +++ b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +template<typename Ty> +struct normal_iterator { + int FIELD; +}; + +void foo(normal_iterator<int>); +normal_iterator<int> baz(); + +void bar() { + foo(baz()); +} + +void *bar2() { + return (void*)foo; +} diff --git a/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp new file mode 100644 index 000000000000..618894fd7248 --- /dev/null +++ b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// This is a testcase for LLVM PR445, which was a problem where the +// instantiation of callDefaultCtor was not being emitted correctly. + +// CHECK-NOT: declare{{.*}}callDefaultCtor +struct Pass {}; + +template<typename PassName> +Pass *callDefaultCtor() { return new Pass(); } + +void foo(Pass *(*C)()); + +struct basic_string { + bool empty() const { return true; } +}; + + +bool foo2(basic_string &X) { + return X.empty(); +} +void baz() { foo(callDefaultCtor<Pass>); } diff --git a/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp new file mode 100644 index 000000000000..ebcce7796e71 --- /dev/null +++ b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +// This is PR421 + +struct Strongbad { + Strongbad(const char *str ); + ~Strongbad(); + operator const char *() const; +}; + +void TheCheat () { + Strongbad foo(0); + Strongbad dirs[] = { Strongbad(0) + 1}; +} diff --git a/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp new file mode 100644 index 000000000000..3bfecd54b780 --- /dev/null +++ b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// PR447 + +namespace nm { + struct str { + friend int foo(int arg = 0); + }; +} diff --git a/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp new file mode 100644 index 000000000000..875c412c6b48 --- /dev/null +++ b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +struct S { + int A[2]; +}; + +// CHECK-NOT: llvm.global_ctor +int XX = (int)(long)&(((struct S*)0)->A[1]); diff --git a/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp b/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp new file mode 100644 index 000000000000..dee581736050 --- /dev/null +++ b/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +// Test anonymous union with members of the same size. +int test1(float F) { + union { + float G; + int i; + }; + G = F; + return i; +} + +// test anonymous union with members of differing size. +int test2(short F) { + volatile union { + short G; + int i; + }; + G = F; + return i; +} + +// Make sure that normal unions work. duh :) +volatile union U_t { + short S; + int i; +} U; + +int test3(short s) { + U.S = s; + return U.i; +} diff --git a/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp b/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp new file mode 100644 index 000000000000..b1db67aebfd3 --- /dev/null +++ b/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// This testcase corresponds to PR509 +struct Data { + unsigned *data; + unsigned array[1]; +}; + +// CHECK-NOT: llvm.global_ctors +Data shared_null = { shared_null.array }; diff --git a/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp b/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp new file mode 100644 index 000000000000..c37f5dce32b2 --- /dev/null +++ b/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// CHECK-NOT: i32 6 +struct QVectorTypedData { + int size; + unsigned int sharable : 1; + unsigned short array[1]; +}; + +void foo(QVectorTypedData *X) { + X->array[0] = 123; +} diff --git a/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp b/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp new file mode 100644 index 000000000000..937a300b5dfb --- /dev/null +++ b/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct QChar {unsigned short X; QChar(unsigned short); } ; + +struct Command { + Command(QChar c) : c(c) {} + unsigned int type : 4; + QChar c; + }; + +Command X(QChar('c')); + +void Foo(QChar ); +void bar() { Foo(X.c); } diff --git a/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp b/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp new file mode 100644 index 000000000000..986001ada0da --- /dev/null +++ b/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +struct Foo { + Foo(); + virtual ~Foo(); +}; + +struct Bar { + Bar(); + virtual ~Bar(); + virtual bool test(bool) const; +}; + +struct Baz : public Foo, public Bar { + Baz(); + virtual ~Baz(); + virtual bool test(bool) const; +}; + +bool Baz::test(bool) const { + return true; +} diff --git a/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp b/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp new file mode 100644 index 000000000000..36f911e227fe --- /dev/null +++ b/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +void test(unsigned char *b, int rb) { + typedef unsigned char imgfoo[10][rb]; + imgfoo &br = *(imgfoo *)b; + + br[0][0] = 1; + + rb = br[0][0]; +} diff --git a/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp b/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp new file mode 100644 index 000000000000..b809751cd0f2 --- /dev/null +++ b/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct PrefMapElem { + virtual ~PrefMapElem(); + unsigned int fPrefId; +}; + +int foo() { + PrefMapElem* fMap; + if (fMap[0].fPrefId == 1) + return 1; + + return 0; +} diff --git a/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp b/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp new file mode 100644 index 000000000000..01476b7ff0c2 --- /dev/null +++ b/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +namespace std { + class exception { }; + + class type_info { + public: + virtual ~type_info(); + }; + +} + +namespace __cxxabiv1 { + class __si_class_type_info : public std::type_info { + ~__si_class_type_info(); + }; +} + +class recursive_init: public std::exception { +public: + virtual ~recursive_init() throw (); +}; + +recursive_init::~recursive_init() throw() { } diff --git a/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp new file mode 100644 index 000000000000..bd270dd60238 --- /dev/null +++ b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s + +struct A { + virtual ~A(); +}; + +template <typename Ty> +struct B : public A { + ~B () { delete [] val; } +private: + Ty* val; +}; + +template <typename Ty> +struct C : public A { + C (); + ~C (); +}; + +template <typename Ty> +struct D : public A { + D () {} + private: + B<C<Ty> > blocks; +}; + +template class D<double>; diff --git a/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp b/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp new file mode 100644 index 000000000000..8f61f7b10a81 --- /dev/null +++ b/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR954 + +struct _Refcount_Base { + unsigned long _M_ref_count; + int _M_ref_count_lock; + _Refcount_Base() : _M_ref_count(0) {} +}; + +struct _Rope_RopeRep : public _Refcount_Base +{ +public: + int _M_tag:8; +}; + +int foo(_Rope_RopeRep* r) { return r->_M_tag; } diff --git a/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp b/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp new file mode 100644 index 000000000000..34594f43a0b9 --- /dev/null +++ b/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp @@ -0,0 +1,11 @@ +// PR1013 +// Check to make sure debug symbols use the correct name for globals and +// functions. Will not assemble if it fails to. +// RUN: %clang_cc1 -emit-llvm -g -o - %s | FileCheck %s + +// CHECK: f\01oo" +int foo __asm__("f\001oo"); + +int bar() { + return foo; +} diff --git a/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp b/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp new file mode 100644 index 000000000000..2088e63fd5f8 --- /dev/null +++ b/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - +// PR1027 + +struct sys_var { + unsigned name_length; + + bool no_support_one_shot; + sys_var() {} +}; + + +struct sys_var_thd : public sys_var { +}; + +extern sys_var_thd sys_auto_is_null; + +sys_var *getsys_variables() { + return &sys_auto_is_null; +} + +sys_var *sys_variables = &sys_auto_is_null; diff --git a/test/CodeGenCXX/2007-01-02-UnboundedArray.cpp b/test/CodeGenCXX/2007-01-02-UnboundedArray.cpp new file mode 100644 index 000000000000..0cd83fa7ed4c --- /dev/null +++ b/test/CodeGenCXX/2007-01-02-UnboundedArray.cpp @@ -0,0 +1,14 @@ +// Make sure unbounded arrays compile with debug information. +// +// RUN: %clang_cc1 -emit-llvm -g %s -o - + +// PR1068 + +struct Object { + char buffer[]; +}; + +int main(int argc, char** argv) { + new Object; + return 0; +} diff --git a/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp b/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp new file mode 100644 index 000000000000..f3aa51e725b1 --- /dev/null +++ b/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp @@ -0,0 +1,75 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR1084 + +extern "C" +{ + typedef unsigned char PRUint8; + typedef unsigned int PRUint32; +} +typedef PRUint32 nsresult; +struct nsID +{ +}; +typedef nsID nsIID; +class nsISupports +{ +}; +extern "C++" +{ + template < class T > struct nsCOMTypeInfo + { + static const nsIID & GetIID () + { + } + }; +} + +class nsIDOMEvent:public nsISupports +{ +}; +class nsIDOMEventListener:public nsISupports +{ +public:static const nsIID & GetIID () + { + } + virtual nsresult + __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) = + 0; +}; +class nsIDOMMouseListener:public nsIDOMEventListener +{ +public:static const nsIID & GetIID () + { + static const nsIID iid = { + }; + } + virtual nsresult + __attribute__ ((regparm (0), + cdecl)) MouseDown (nsIDOMEvent * aMouseEvent) = 0; +}; +typedef +typeof (&nsIDOMEventListener::HandleEvent) + GenericHandler; + struct EventDispatchData + { + PRUint32 message; + GenericHandler method; + PRUint8 bits; + }; + struct EventTypeData + { + const EventDispatchData *events; + int numEvents; + const nsIID *iid; + }; + static const EventDispatchData sMouseEvents[] = { + { + (300 + 2), + reinterpret_cast < GenericHandler > (&nsIDOMMouseListener::MouseDown), + 0x01} + }; +static const EventTypeData sEventTypes[] = { + { + sMouseEvents, (sizeof (sMouseEvents) / sizeof (sMouseEvents[0])), + &nsCOMTypeInfo < nsIDOMMouseListener >::GetIID ()} +}; diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp new file mode 100644 index 000000000000..6c39b55fd33e --- /dev/null +++ b/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +#ifdef PACKED +#define P __attribute__((packed)) +#else +#define P +#endif + +struct P M_Packed { + unsigned int l_Packed; + unsigned short k_Packed : 6, + i_Packed : 15, + j_Packed : 11; + +}; + +struct M_Packed sM_Packed; + +int testM_Packed (void) { + struct M_Packed x; + return (x.i_Packed != 0); +} diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp new file mode 100644 index 000000000000..d7b0eaeae1a2 --- /dev/null +++ b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +#ifdef PACKED +#define P __attribute__((packed)) +#else +#define P +#endif + +struct P M_Packed { + unsigned long sorted : 1; + unsigned long from_array : 1; + unsigned long mixed_encoding : 1; + unsigned long encoding : 8; + unsigned long count : 21; + +}; + +struct M_Packed sM_Packed; + +int testM_Packed (void) { + struct M_Packed x; + return (x.count != 0); +} diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp new file mode 100644 index 000000000000..691176739259 --- /dev/null +++ b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +#ifdef PACKED +#define P __attribute__((packed)) +#else +#define P +#endif + +struct P M_Packed { + unsigned int l_Packed; + unsigned short k_Packed : 6, + i_Packed : 15; + char c; + +}; + +struct M_Packed sM_Packed; + +int testM_Packed (void) { + struct M_Packed x; + return (x.i_Packed != 0); +} diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp new file mode 100644 index 000000000000..b31f95fa3b8a --- /dev/null +++ b/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +#ifdef PACKED +// This is an example where size of Packed struct is smaller then +// the size of bit field type. +#define P __attribute__((packed)) +#else +#define P +#endif + +struct P M_Packed { + unsigned long long X:50; + unsigned Y:2; +}; + +struct M_Packed sM_Packed; + +int testM_Packed (void) { + struct M_Packed x; + return (0 != x.Y); +} + +int testM_Packed2 (void) { + struct M_Packed x; + return (0 != x.X); +} diff --git a/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp b/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp new file mode 100644 index 000000000000..c848e7cb7dd9 --- /dev/null +++ b/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +#ifdef PACKED +#define P __attribute__((packed)) +#else +#define P +#endif + +struct UnPacked { + int X; + int Y; +}; + +struct P M_Packed { + unsigned char A; + struct UnPacked B; +}; + +struct M_Packed sM_Packed; + +int testM_Packed (void) { + struct M_Packed x; + return (x.B.Y != 0); +} diff --git a/test/CodeGenCXX/2007-04-10-PackedUnion.cpp b/test/CodeGenCXX/2007-04-10-PackedUnion.cpp new file mode 100644 index 000000000000..863fc82692e9 --- /dev/null +++ b/test/CodeGenCXX/2007-04-10-PackedUnion.cpp @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +extern "C" { + +#pragma pack(push, 2) + typedef struct ABC* abc; + + struct ABCS { + float red; + float green; + float blue; + float alpha; + }; + + typedef void (*XYZ)(); +#pragma pack(pop) +} + + +union ABCU { + ABCS color; + XYZ bg; +}; + +struct AData { + ABCU data; +}; + +class L { + public: + L() {} + L(const L& other); + + private: + AData fdata; +}; + + +L::L(const L& other) +{ + fdata = other.fdata; +} diff --git a/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp b/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp new file mode 100644 index 000000000000..4475fda95c08 --- /dev/null +++ b/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -fno-builtin -o - | FileCheck %s +// Check that -fno-builtin is honored. + +extern "C" int printf(const char*, ...); +void foo(const char *msg) { + // CHECK: call{{.*}}printf + printf("%s\n",msg); +} diff --git a/test/CodeGenCXX/2007-05-03-VectorInit.cpp b/test/CodeGenCXX/2007-05-03-VectorInit.cpp new file mode 100644 index 000000000000..5bc196f30fe2 --- /dev/null +++ b/test/CodeGenCXX/2007-05-03-VectorInit.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -O0 -o - +// PR1378 + +typedef float v4sf __attribute__((vector_size(16))); + +typedef v4sf float4; + +static float4 splat4(float a) +{ + float4 tmp = {a,a,a,a}; + return tmp; +} + +float4 foo(float a) +{ + return splat4(a); +} diff --git a/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp b/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp new file mode 100644 index 000000000000..d7c96f562acc --- /dev/null +++ b/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +void foo(int * __restrict myptr1, int * myptr2) { + // CHECK: noalias + myptr1[0] = 0; + myptr2[0] = 0; +} diff --git a/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp b/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp new file mode 100644 index 000000000000..aa9f48bb0abc --- /dev/null +++ b/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +void foo(int & __restrict myptr1, int & myptr2) { + // CHECK: noalias + myptr1 = 0; + myptr2 = 0; +} diff --git a/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp b/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp new file mode 100644 index 000000000000..ec8a516c696b --- /dev/null +++ b/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp @@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// PR1634 + +namespace Manta +{ + class CallbackHandle + { + protected:virtual ~ CallbackHandle (void) + { + } + }; +template < typename Data1 > class CallbackBase_1Data:public CallbackHandle + { + }; +} + +namespace __gnu_cxx +{ + template < typename _Iterator, typename _Container > + class __normal_iterator + { + _Iterator _M_current; + }; +} + +namespace std +{ + template < typename _Tp > struct allocator + { + typedef _Tp *pointer; + }; + template < typename _InputIterator, + typename _Tp > inline void find (_InputIterator __last, + const _Tp & __val) + { + }; +} + +namespace Manta +{ + template < typename _Tp, typename _Alloc> struct _Vector_base + { + struct _Vector_impl + { + _Tp *_M_start; + }; + public: + _Vector_impl _M_impl; + }; + template < typename _Tp, typename _Alloc = std::allocator < _Tp > > + class vector:protected _Vector_base < _Tp,_Alloc > + { + public: + typedef __gnu_cxx::__normal_iterator < typename _Alloc::pointer, + vector < _Tp, _Alloc > > iterator; + iterator end () + { + } + }; + class MantaInterface + { + }; + class RTRT + { + virtual CallbackHandle *registerTerminationCallback (CallbackBase_1Data < + MantaInterface * >*); + virtual void unregisterCallback (CallbackHandle *); + typedef vector < CallbackBase_1Data < int >*>PRCallbackMapType; + PRCallbackMapType parallelPreRenderCallbacks; + }; +} +using namespace Manta; +CallbackHandle * +RTRT::registerTerminationCallback (CallbackBase_1Data < MantaInterface * >*cb) +{ + return cb; +} + +void +RTRT::unregisterCallback (CallbackHandle * callback) +{ + { + typedef CallbackBase_1Data < int > callback_t; + callback_t *cb = static_cast < callback_t * >(callback); + find (parallelPreRenderCallbacks.end (), cb); + } +} diff --git a/test/CodeGenCXX/2007-10-01-StructResize.cpp b/test/CodeGenCXX/2007-10-01-StructResize.cpp new file mode 100644 index 000000000000..8e5750d3c4ef --- /dev/null +++ b/test/CodeGenCXX/2007-10-01-StructResize.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +#pragma pack(4) + +struct Bork { + unsigned int f1 : 3; + unsigned int f2 : 30; +}; + +int Foo(Bork *hdr) { + hdr->f1 = 7; + hdr->f2 = 927; +} diff --git a/test/CodeGenCXX/2008-01-12-VecInit.cpp b/test/CodeGenCXX/2008-01-12-VecInit.cpp new file mode 100644 index 000000000000..92bfd51d1ba8 --- /dev/null +++ b/test/CodeGenCXX/2008-01-12-VecInit.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// rdar://5685492 + +typedef int __attribute__((vector_size(16))) v; +v vt = {1, 2, 3, 4}; diff --git a/test/CodeGenCXX/2008-05-07-CrazyOffsetOf.cpp b/test/CodeGenCXX/2008-05-07-CrazyOffsetOf.cpp new file mode 100644 index 000000000000..f842f958e9e6 --- /dev/null +++ b/test/CodeGenCXX/2008-05-07-CrazyOffsetOf.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// rdar://5914926 + +struct bork { + struct bork *next_local; + char * query; +}; +int offset = (char *) &(((struct bork *) 0x10)->query) - (char *) 0x10; diff --git a/test/CodeGenCXX/2009-03-17-dbg.cpp b/test/CodeGenCXX/2009-03-17-dbg.cpp new file mode 100644 index 000000000000..e2e6c5a2dd29 --- /dev/null +++ b/test/CodeGenCXX/2009-03-17-dbg.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -g + +template <typename T1,typename T2> +inline void f(const T1&,const T2&) { } + +template <typename T1,typename T2,void F(const T1&,const T2&)> +struct A { + template <typename T> void g(T& i) { } +}; + +int main() { + int i; + A<int,int,f> a; + a.g(i); +} diff --git a/test/CodeGenCXX/2009-04-23-bool2.cpp b/test/CodeGenCXX/2009-04-23-bool2.cpp new file mode 100644 index 000000000000..cf81cc42eae4 --- /dev/null +++ b/test/CodeGenCXX/2009-04-23-bool2.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// g++.old-deja/g++.jason/bool2.C from gcc testsuite. +// Crashed before 67975 went in. +struct F { + bool b1 : 1; + bool b2 : 7; +}; + +int main() +{ + F f = { true, true }; + + if (int (f.b1) != 1) + return 1; +} diff --git a/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp b/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp new file mode 100644 index 000000000000..8361680546f3 --- /dev/null +++ b/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fexceptions -emit-llvm %s -o - | FileCheck %s +int c(void) __attribute__((const)); +int p(void) __attribute__((pure)); +int t(void); + +// CHECK: define i32 @_Z1fv() { +int f(void) { + // CHECK: call i32 @_Z1cv() nounwind readnone + // CHECK: call i32 @_Z1pv() nounwind readonly + return c() + p() + t(); +} + +// CHECK: declare i32 @_Z1cv() nounwind readnone +// CHECK: declare i32 @_Z1pv() nounwind readonly +// CHECK-NOT: declare i32 @_Z1tv() nounwind diff --git a/test/CodeGenCXX/2009-06-16-DebugInfoCrash.cpp b/test/CodeGenCXX/2009-06-16-DebugInfoCrash.cpp new file mode 100644 index 000000000000..500520b567f5 --- /dev/null +++ b/test/CodeGenCXX/2009-06-16-DebugInfoCrash.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -g +// This crashes if we try to emit debug info for TEMPLATE_DECL members. +template <class T> class K2PtrVectorBase {}; +template <class T> class K2Vector {}; +template <class U > class K2Vector<U*> : public K2PtrVectorBase<U*> {}; +class ScriptInfoManager { + void PostRegister() ; + template <class SI> short ReplaceExistingElement(K2Vector<SI*>& v); +}; +void ScriptInfoManager::PostRegister() {} diff --git a/test/CodeGenCXX/2009-07-16-Using.cpp b/test/CodeGenCXX/2009-07-16-Using.cpp new file mode 100644 index 000000000000..a692d4dbc32e --- /dev/null +++ b/test/CodeGenCXX/2009-07-16-Using.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +namespace A { + typedef int B; +} +struct B { +}; +using ::A::B; diff --git a/test/CodeGenCXX/2009-08-05-ZeroInitWidth.cpp b/test/CodeGenCXX/2009-08-05-ZeroInitWidth.cpp new file mode 100644 index 000000000000..4404d4a8d518 --- /dev/null +++ b/test/CodeGenCXX/2009-08-05-ZeroInitWidth.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +// rdar://7114564 +struct A { + unsigned long long : (sizeof(unsigned long long) * 8) - 16; +}; +struct B { + A a; +}; +struct B b = { + {} +}; diff --git a/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp b/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp new file mode 100644 index 000000000000..21b88c93ad7f --- /dev/null +++ b/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null +// <rdar://problem/7096460> +typedef void (*Func) (); +typedef long long m64 __attribute__((__vector_size__(8), __may_alias__)); +static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() {} +template <class MM> +static void Bork() { + const m64 mmx_0x00ff = _mm_set1_pi16(); +} +struct A {}; +Func arr[] = { + Bork<A> +}; diff --git a/test/CodeGenCXX/2009-09-09-packed-layout.cpp b/test/CodeGenCXX/2009-09-09-packed-layout.cpp new file mode 100644 index 000000000000..9de2f61420c4 --- /dev/null +++ b/test/CodeGenCXX/2009-09-09-packed-layout.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-apple-darwin11 %s -o /dev/null +class X { + public: + virtual ~X(); + short y; +}; +#pragma pack(push, 1) +class Z : public X { + public: enum { foo = ('x') }; + virtual int y() const; +}; +#pragma pack(pop) +class Y : public X { +public: enum { foo = ('y'), bar = 0 }; +}; +X x; +Y y; +Z z; diff --git a/test/CodeGenCXX/2009-10-27-crash.cpp b/test/CodeGenCXX/2009-10-27-crash.cpp new file mode 100644 index 000000000000..482bb752995f --- /dev/null +++ b/test/CodeGenCXX/2009-10-27-crash.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// Radar 7328944 + +typedef struct +{ + unsigned short a : 1; + unsigned short b : 2; + unsigned short c : 1; + unsigned short d : 1; + unsigned short e : 1; + unsigned short f : 1; + unsigned short g : 2; + unsigned short : 7; + union + { + struct + { + unsigned char h : 1; + unsigned char i : 1; + unsigned char j : 1; + unsigned char : 5; + }; + struct + { + unsigned char k : 3; + unsigned char : 5; + }; + }; + unsigned char : 8; +} tt; + +typedef struct +{ + unsigned char s; + tt t; + unsigned int u; +} ttt; + +ttt X = { + 4, + { 0 }, + 55, +}; diff --git a/test/CodeGenCXX/2009-12-23-MissingSext.cpp b/test/CodeGenCXX/2009-12-23-MissingSext.cpp new file mode 100644 index 000000000000..e6ff7b3952c5 --- /dev/null +++ b/test/CodeGenCXX/2009-12-23-MissingSext.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// The store of p.y into the temporary was not +// getting extended to 32 bits, so uninitialized +// bits of the temporary were used. 7366161. +struct foo { + char x:8; + signed int y:24; +}; +int bar(struct foo p, int x) { +// CHECK: bar +// CHECK: and {{.*}} 16777215 +// CHECK: and {{.*}} 16777215 + x = (p.y > x ? x : p.y); + return x; +// CHECK: ret +} diff --git a/test/CodeGenCXX/2010-05-10-Var-DbgInfo.cpp b/test/CodeGenCXX/2010-05-10-Var-DbgInfo.cpp new file mode 100644 index 000000000000..7c05535b3587 --- /dev/null +++ b/test/CodeGenCXX/2010-05-10-Var-DbgInfo.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -emit-llvm -O0 -g %s -o /dev/null +// PR 7104 + +struct A { + int Ai; +}; + +struct B : public A {}; +struct C : public B {}; + +const char * f(int C::*){ return ""; } +int f(int B::*) { return 1; } + +struct D : public C {}; + +const char * g(int B::*){ return ""; } +int g(int D::*) { return 1; } + +void test() +{ + int i = f(&A::Ai); + + const char * str = g(&A::Ai); +} + +// conversion of B::* to C::* is better than conversion of A::* to C::* +typedef void (A::*pmfa)(); +typedef void (B::*pmfb)(); +typedef void (C::*pmfc)(); + +struct X { + operator pmfa(); + operator pmfb(); +}; + + +void g(pmfc); + +void test2(X x) +{ + g(x); +} diff --git a/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp b/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp new file mode 100644 index 000000000000..fe0740b7cb5c --- /dev/null +++ b/test/CodeGenCXX/2010-05-11-alwaysinlineinstantiation.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// CHECK-NOT: ZN12basic_stringIcEC1Ev +// CHECK: ZN12basic_stringIcED1Ev +// CHECK: ZN12basic_stringIcED1Ev +template<class charT> +class basic_string +{ +public: + basic_string(); + ~basic_string(); +}; + +template <class charT> +__attribute__ ((__visibility__("hidden"), __always_inline__)) inline +basic_string<charT>::basic_string() +{ +} + +template <class charT> +inline +basic_string<charT>::~basic_string() +{ +} + +typedef basic_string<char> string; + +extern template class basic_string<char>; + +int main() +{ + string s; +} diff --git a/test/CodeGenCXX/2010-05-12-PtrToMember-Dbg.cpp b/test/CodeGenCXX/2010-05-12-PtrToMember-Dbg.cpp new file mode 100644 index 000000000000..048811f6e641 --- /dev/null +++ b/test/CodeGenCXX/2010-05-12-PtrToMember-Dbg.cpp @@ -0,0 +1,17 @@ +//RUN: %clang_cc1 -emit-llvm -g -o - %s | FileCheck %s +//CHECK: DW_TAG_auto_variable +class Foo +{ + public: + int x; + int y; + Foo (int i, int j) { x = i; y = j; } +}; + + +Foo foo(10, 11); + +int main() { + int Foo::* pmi = &Foo::y; + return foo.*pmi; +} diff --git a/test/CodeGenCXX/2010-06-21-LocalVarDbg.cpp b/test/CodeGenCXX/2010-06-21-LocalVarDbg.cpp new file mode 100644 index 000000000000..2542378e909a --- /dev/null +++ b/test/CodeGenCXX/2010-06-21-LocalVarDbg.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s +// Do not use function name to create named metadata used to hold +// local variable info. For example. llvm.dbg.lv.~A is an invalid name. + +// CHECK-NOT: llvm.dbg.lv.~A +class A { +public: + ~A() { int i = 0; i++; } +}; + +int foo(int i) { + A a; + return 0; +} diff --git a/test/CodeGenCXX/2010-06-22-BitfieldInit.cpp b/test/CodeGenCXX/2010-06-22-BitfieldInit.cpp new file mode 100644 index 000000000000..f82e527844fd --- /dev/null +++ b/test/CodeGenCXX/2010-06-22-BitfieldInit.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - +struct TEST2 +{ + int subid:32; + int :0; +}; + +typedef struct _TEST3 +{ + TEST2 foo; + TEST2 foo2; +} TEST3; + +TEST3 test = + { + {0}, + {0} + }; + +int main() { return 0; } diff --git a/test/CodeGenCXX/2010-06-22-ZeroBitfield.cpp b/test/CodeGenCXX/2010-06-22-ZeroBitfield.cpp new file mode 100644 index 000000000000..c2f37f740549 --- /dev/null +++ b/test/CodeGenCXX/2010-06-22-ZeroBitfield.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - +struct s8_0 { unsigned : 0; }; +struct s8_1 { double x; }; +struct s8 { s8_0 a; s8_1 b; }; +s8 f8() { return s8(); } diff --git a/test/CodeGenCXX/2010-07-23-DeclLoc.cpp b/test/CodeGenCXX/2010-07-23-DeclLoc.cpp new file mode 100644 index 000000000000..74054481cdb4 --- /dev/null +++ b/test/CodeGenCXX/2010-07-23-DeclLoc.cpp @@ -0,0 +1,86 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s +// Require the template function declaration refer to the correct filename. +// First, locate the function decl in metadata, and pluck out the file handle: +// CHECK: {{extract_dwarf_data_from_header.*extract_dwarf_data_from_header.*extract_dwarf_data_from_header.*[^ ]+", metadata !}}[[filehandle:[0-9]+]], +// Second: Require that filehandle refer to the correct filename: +// CHECK: {{^!}}[[filehandle]] = metadata {{![{].*}} metadata !"decl_should_be_here.hpp", +typedef long unsigned int __darwin_size_t; +typedef __darwin_size_t size_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +namespace std { + template<typename _Tp> class auto_ptr { + _Tp* _M_ptr; + public: + typedef _Tp element_type; + auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } + element_type& operator*() const throw() { } + }; +} +class Pointer32 { +public: + typedef uint32_t ptr_t; + typedef uint32_t size_t; +}; +class Pointer64 { +public: + typedef uint64_t ptr_t; + typedef uint64_t size_t; +}; +class BigEndian {}; +class LittleEndian {}; +template <typename _SIZE, typename _ENDIANNESS> class SizeAndEndianness { +public: + typedef _SIZE SIZE; +}; +typedef SizeAndEndianness<Pointer32, LittleEndian> ISA32Little; +typedef SizeAndEndianness<Pointer32, BigEndian> ISA32Big; +typedef SizeAndEndianness<Pointer64, LittleEndian> ISA64Little; +typedef SizeAndEndianness<Pointer64, BigEndian> ISA64Big; +template <typename SIZE> class TRange { +protected: + typename SIZE::ptr_t _location; + typename SIZE::size_t _length; + TRange(typename SIZE::ptr_t location, typename SIZE::size_t length) : _location(location), _length(length) { } +}; +template <typename SIZE, typename T> class TRangeValue : public TRange<SIZE> { + T _value; +public: + TRangeValue(typename SIZE::ptr_t location, typename SIZE::size_t length, T value) : TRange<SIZE>(location, length), _value(value) {}; +}; +template <typename SIZE> class TAddressRelocator {}; +class CSCppSymbolOwner{}; +class CSCppSymbolOwnerData{}; +template <typename SIZE> class TRawSymbolOwnerData +{ + TRangeValue< SIZE, uint8_t* > _TEXT_text_section; + const char* _dsym_path; + uint32_t _dylib_current_version; + uint32_t _dylib_compatibility_version; +public: + TRawSymbolOwnerData() : + _TEXT_text_section(0, 0, __null), _dsym_path(__null), _dylib_current_version(0), _dylib_compatibility_version(0) {} +}; +template <typename SIZE_AND_ENDIANNESS> class TExtendedMachOHeader {}; +# 16 "decl_should_be_here.hpp" +template <typename SIZE_AND_ENDIANNESS> void extract_dwarf_data_from_header(TExtendedMachOHeader<SIZE_AND_ENDIANNESS>& header, + TRawSymbolOwnerData<typename SIZE_AND_ENDIANNESS::SIZE>& symbol_owner_data, + TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>* address_relocator) {} +struct CSCppSymbolOwnerHashFunctor { + size_t operator()(const CSCppSymbolOwner& symbol_owner) const { +# 97 "wrong_place_for_decl.cpp" + } +}; +template <typename SIZE_AND_ENDIANNESS> CSCppSymbolOwnerData* create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { + typedef typename SIZE_AND_ENDIANNESS::SIZE SIZE; + std::auto_ptr< TRawSymbolOwnerData<SIZE> > data(new TRawSymbolOwnerData<SIZE>()); + std::auto_ptr< TExtendedMachOHeader<SIZE_AND_ENDIANNESS> > header; + extract_dwarf_data_from_header(*header, *data, (TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>*)__null); +} +CSCppSymbolOwnerData* create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { + create_symbol_owner_data_arch_specific< ISA32Little >(symbol_owner, dsym_path); + create_symbol_owner_data_arch_specific< ISA32Big >(symbol_owner, dsym_path); + create_symbol_owner_data_arch_specific< ISA64Little >(symbol_owner, dsym_path); + create_symbol_owner_data_arch_specific< ISA64Big >(symbol_owner, dsym_path); +} diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp index 9b993f2506c6..c50dafbbab20 100644 --- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp +++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s struct A { A(const A&, int i1 = 1); }; diff --git a/test/CodeGenCXX/abstract-class-ctors-dtors.cpp b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp index e1c1a75e4790..012c2231551d 100644 --- a/test/CodeGenCXX/abstract-class-ctors-dtors.cpp +++ b/test/CodeGenCXX/abstract-class-ctors-dtors.cpp @@ -9,7 +9,7 @@ struct A { // CHECK-NOT: define void @_ZN1AC1Ev // CHECK: define void @_ZN1AC2Ev -// CHECK-NOT: define void @_ZN1AD1Ev +// CHECK: define void @_ZN1AD1Ev // CHECK: define void @_ZN1AD2Ev A::A() { } diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp index 324ff4aee2b7..a12ae53f395f 100644 --- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp +++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp @@ -67,6 +67,55 @@ namespace test2 { // CHECK: } } +namespace PR10512 { + struct A { + A(); + A(int); + A(long); + + struct { + struct {int x;}; + struct {int y;}; + }; + }; + + // CHECK: define void @_ZN7PR105121AC2Ev + // CHECK: [[THISADDR:%[a-zA-z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] + // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-z0-9.]+]], [[A]]** [[THISADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-z0-9.]+]] = load [[A]]** [[THISADDR]] + // CHECK-NEXT: ret void + A::A() {} + + // CHECK: define void @_ZN7PR105121AC2Ei + // CHECK: [[THISADDR:%[a-zA-z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] + // CHECK-NEXT: [[XADDR:%[a-zA-z0-9.]+]] = alloca i32 + // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-z0-9.]+]], [[A]]** [[THISADDR]] + // CHECK-NEXT: store i32 [[X:%[a-zA-z0-9.]+]], i32* [[XADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-z0-9.]+]] = load [[A]]** [[THISADDR]] + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} + // CHECK-NEXT: [[TMP:%[a-zA-z0-9.]+]] = load i32* [[XADDR]] + // CHECK-NEXT: store i32 [[TMP]] + // CHECK-NEXT: ret void + A::A(int x) : x(x) { } + + // CHECK: define void @_ZN7PR105121AC2El + // CHECK: [[THISADDR:%[a-zA-z0-9.]+]] = alloca [[A:%"struct[A-Za-z0-9:.]+"]] + // CHECK-NEXT: [[XADDR:%[a-zA-z0-9.]+]] = alloca i64 + // CHECK-NEXT: store [[A]]* [[THIS:%[a-zA-z0-9.]+]], [[A]]** [[THISADDR]] + // CHECK-NEXT: store i64 [[X:%[a-zA-z0-9.]+]], i64* [[XADDR]] + // CHECK-NEXT: [[THIS1:%[a-zA-z0-9.]+]] = load [[A]]** [[THISADDR]] + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 1}} + // CHECK-NEXT: {{getelementptr inbounds.*i32 0, i32 0}} + // CHECK-NEXT: [[TMP:%[a-zA-z0-9.]+]] = load i64* [[XADDR]] + // CHECK-NEXT: [[CONV:%[a-zA-z0-9.]+]] = trunc i64 [[TMP]] to i32 + // CHECK-NEXT: store i32 [[CONV]] + // CHECK-NEXT: ret void + A::A(long y) : y(y) { } +} + namespace test3 { struct A { union { diff --git a/test/CodeGenCXX/apple-kext-linkage.C b/test/CodeGenCXX/apple-kext-linkage.C index 9df11511762c..59d228e2300c 100644 --- a/test/CodeGenCXX/apple-kext-linkage.C +++ b/test/CodeGenCXX/apple-kext-linkage.C @@ -13,13 +13,21 @@ void foo() { Derived d1; // ok } +// CHECK: define internal i32 @_Z1fj( inline unsigned f(unsigned n) { return n == 0 ? 0 : n + f(n-1); } unsigned g(unsigned n) { return f(n); } +// rdar://problem/10133200: give explicit instantiations external linkage in kernel mode +// CHECK: define void @_Z3barIiEvv() +template <typename T> void bar() {} +template void bar<int>(); +// CHECK: define internal i32 @_Z5identIiET_S0_( template <typename X> X ident(X x) { return x; } + int foo(int n) { return ident(n); } -// CHECK-NOT: define linkonce_odr -// CHECK 5 : define internal +// CHECK: define internal void @_ZN7DerivedD1Ev( +// CHECK: define internal void @_ZN7DerivedD0Ev( +// CHECK: define internal void @_ZN7DeriveddlEPv( diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp index dcb27ce0dab3..a767f425553b 100644 --- a/test/CodeGenCXX/arm.cpp +++ b/test/CodeGenCXX/arm.cpp @@ -308,9 +308,10 @@ namespace test7 { // CHECK: ret void static int x = foo(); - // CHECK: call i8* @llvm.eh.exception() + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test74testEvE1x) - // CHECK: call void @llvm.eh.resume( + // CHECK: resume { i8*, i32 } } } @@ -347,9 +348,10 @@ namespace test8 { // CHECK: ret void static A x; - // CHECK: call i8* @llvm.eh.exception() + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test84testEvE1x) - // CHECK: call void @llvm.eh.resume( + // CHECK: resume { i8*, i32 } } } diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp index 5efe18322d85..7b565a490c11 100644 --- a/test/CodeGenCXX/array-construction.cpp +++ b/test/CodeGenCXX/array-construction.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp index 41b0118fe8a9..1b23c4d137aa 100644 --- a/test/CodeGenCXX/array-operator-delete-call.cpp +++ b/test/CodeGenCXX/array-operator-delete-call.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp index 0e310bdbbc13..cc56525e1d54 100644 --- a/test/CodeGenCXX/blocks.cpp +++ b/test/CodeGenCXX/blocks.cpp @@ -104,3 +104,27 @@ namespace test3 { consume(^{ (void) b; }); } } + +// rdar://problem/9971485 +namespace test4 { + struct A { + A(); + ~A(); + }; + + void foo(A a); + + void test() { + extern void consume(void(^)()); + consume(^{ return foo(A()); }); + } + // CHECK: define void @_ZN5test44testEv() + // CHECK: define internal void @__test_block_invoke + // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1 + // CHECK-NEXT: bitcast i8* + // CHECK-NEXT: call void @_ZN5test41AC1Ev([[A]]* [[TMP]]) + // CHECK-NEXT: call void @_ZN5test43fooENS_1AE([[A]]* [[TMP]]) + // CHECK-NEXT: call void @_ZN5test41AD1Ev([[A]]* [[TMP]]) + // CHECK-NEXT: ret void +} + diff --git a/test/CodeGenCXX/builtins.cpp b/test/CodeGenCXX/builtins.cpp index 0629c31015c7..4542563717a1 100644 --- a/test/CodeGenCXX/builtins.cpp +++ b/test/CodeGenCXX/builtins.cpp @@ -7,3 +7,15 @@ int main() { // CHECK: call signext i8 @memmove() return memmove(); } + +// <rdar://problem/10063539> + +template<int (*Compare)(const char *s1, const char *s2)> +int equal(const char *s1, const char *s2) { + return Compare(s1, s2) == 0; +} + +// CHECK: define weak_odr i32 @_Z5equalIXadL_Z16__builtin_strcmpPKcS1_EEEiS1_S1_ +// CHECK: call i32 @strcmp +template int equal<&__builtin_strcmp>(const char*, const char*); + diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp index b7a9740ddf1c..d023b9abfee0 100644 --- a/test/CodeGenCXX/cast-conversion.cpp +++ b/test/CodeGenCXX/cast-conversion.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s struct A { diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp index 9569f476dd87..dac0a0ae5467 100644 --- a/test/CodeGenCXX/class-layout.cpp +++ b/test/CodeGenCXX/class-layout.cpp @@ -45,3 +45,35 @@ namespace Test5 { char c; } *b; } + +// PR10912: don't crash +namespace Test6 { + template <typename T> class A { + // If T is complete, IR-gen will want to translate it recursively + // when translating T*. + T *foo; + }; + + class B; + + // This causes IR-gen to have an incomplete translation of A<B> + // sitting around. + A<B> *a; + + class C {}; + class B : public C { + // This forces Sema to instantiate A<B>, which triggers a callback + // to IR-gen. Because of the previous, incomplete translation, + // IR-gen actually cares, and it immediately tries to complete + // A<B>'s IR type. That, in turn, causes the translation of B*. + // B isn't complete yet, but it has a definition, and if we try to + // compute a record layout for that definition then we'll really + // regret it later. + A<B> a; + }; + + // The derived class E and empty base class C are required to + // provoke the original assertion. + class E : public B {}; + E *e; +} diff --git a/test/CodeGenCXX/conditional-expr-lvalue.cpp b/test/CodeGenCXX/conditional-expr-lvalue.cpp index a0843c40f071..96aa8b07a664 100644 --- a/test/CodeGenCXX/conditional-expr-lvalue.cpp +++ b/test/CodeGenCXX/conditional-expr-lvalue.cpp @@ -5,3 +5,16 @@ void f(bool flag) { (flag ? a : b) = 3; } + +// PR10756 +namespace test0 { + struct A { + A(const A &); + A &operator=(const A &); + A sub() const; + void foo() const; + }; + void foo(bool cond, const A &a) { + (cond ? a : a.sub()).foo(); + } +} diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp index 58d0d39c8107..f50346328500 100644 --- a/test/CodeGenCXX/constructor-conversion.cpp +++ b/test/CodeGenCXX/constructor-conversion.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-convert.cpp b/test/CodeGenCXX/constructor-convert.cpp index 9122dae128ec..7feeaa900af6 100644 --- a/test/CodeGenCXX/constructor-convert.cpp +++ b/test/CodeGenCXX/constructor-convert.cpp @@ -2,6 +2,7 @@ // PR5775 class Twine { +public: Twine(const char *Str) { } }; diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp index dc0ab50ba5c6..32086c1ad37c 100644 --- a/test/CodeGenCXX/constructor-default-arg.cpp +++ b/test/CodeGenCXX/constructor-default-arg.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp index ef5900e59c11..7a365cd26da4 100644 --- a/test/CodeGenCXX/constructor-for-array-members.cpp +++ b/test/CodeGenCXX/constructor-for-array-members.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-init.cpp b/test/CodeGenCXX/constructor-init.cpp index a195afe0692f..6af5188a41f6 100644 --- a/test/CodeGenCXX/constructor-init.cpp +++ b/test/CodeGenCXX/constructor-init.cpp @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 %s -emit-llvm -o %t +// RUN: FileCheck %s < %t +// RUN: FileCheck -check-prefix=CHECK-PR10720 %s < %t extern "C" int printf(...); @@ -149,3 +151,73 @@ template<typename T> X<T>::X(const X &other) : start(0), end(0) { } X<int> get_X(X<int> x) { return x; } + +namespace PR10720 { + struct X { + X(const X&); + X(X&&); + X& operator=(const X&); + X& operator=(X&&); + ~X(); + }; + + struct pair2 { + X second[4]; + + // CHECK-PR10720: define linkonce_odr {{.*}} @_ZN7PR107205pair2aSERKS0_ + // CHECK-PR10720: load + // CHECK-PR10720: icmp ne + // CHECK-PR10720-NEXT: br i1 + // CHECK-PR10720: call {{.*}} @_ZN7PR107201XaSERKS0_ + // CHECK-PR10720: ret + pair2 &operator=(const pair2&) = default; + + // CHECK-PR10720: define linkonce_odr {{.*}} @_ZN7PR107205pair2aSEOS0_ + // CHECK-PR10720: load + // CHECK-PR10720: icmp ne + // CHECK-PR10720-NEXT: br i1 + // CHECK-PR10720: call {{.*}} @_ZN7PR107201XaSEOS0_ + // CHECK-PR10720: ret + pair2 &operator=(pair2&&) = default; + + // CHECK-PR10720: define linkonce_odr void @_ZN7PR107205pair2C2EOS0_ + // CHECK-PR10720-NOT: ret + // CHECK-PR10720: load + // CHECK-PR10720: icmp ult + // CHECK-PR10720-NEXT: br i1 + // CHECK-PR10720: call void @_ZN7PR107201XC1EOS0_ + // CHECK-PR10720-NEXT: br label + // CHECK-PR10720: ret void + pair2(pair2&&) = default; + + // CHECK-PR10720: define linkonce_odr void @_ZN7PR107205pair2C2ERKS0_ + // CHECK-PR10720-NOT: ret + // CHECK-PR10720: load + // CHECK-PR10720: icmp ult + // CHECK-PR10720-NEXT: br i1 + // CHECK-PR10720: call void @_ZN7PR107201XC1ERKS0_ + // CHECK-PR10720-NEXT: br label + // CHECK-PR10720: ret void + pair2(const pair2&) = default; + }; + + struct pair { + int second[4]; + // CHECK-PR10720: define linkonce_odr void @_ZN7PR107204pairC2ERKS0_ + // CHECK-PR10720-NOT: ret + // CHECK-PR10720: call void @llvm.memcpy + // CHECK-PR10720-NEXT: ret void + pair(const pair&) = default; + }; + + void foo(const pair &x, const pair2 &x2) { + pair y(x); + pair2 y2(x2); + pair2 y2m(static_cast<pair2&&>(y2)); + + y2 = x2; + y2m = static_cast<pair2&&>(y2); + } + +} + diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp index 7472d7e5bc63..fe4687c1b303 100644 --- a/test/CodeGenCXX/constructor-template.cpp +++ b/test/CodeGenCXX/constructor-template.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s // PR4826 diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp index e2f8f7e17b93..76d9e027d997 100644 --- a/test/CodeGenCXX/conversion-function.cpp +++ b/test/CodeGenCXX/conversion-function.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s // XFAIL: * extern "C" int printf(...); diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp index c1c9f63079f9..425f79de5067 100644 --- a/test/CodeGenCXX/convert-to-fptr.cpp +++ b/test/CodeGenCXX/convert-to-fptr.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-assign-synthesis-1.cpp b/test/CodeGenCXX/copy-assign-synthesis-1.cpp index 17abeb90d4b3..46d048364118 100644 --- a/test/CodeGenCXX/copy-assign-synthesis-1.cpp +++ b/test/CodeGenCXX/copy-assign-synthesis-1.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-assign-volatile-synthesis.cpp b/test/CodeGenCXX/copy-assign-volatile-synthesis.cpp new file mode 100644 index 000000000000..eb13503fdc3f --- /dev/null +++ b/test/CodeGenCXX/copy-assign-volatile-synthesis.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// rdar://9894548 + +typedef unsigned long word_t; +typedef unsigned long u64_t; +typedef unsigned int u32_t; + +class ioapic_redir_t { +public: + union { + struct { + word_t vector : 8; + + word_t delivery_mode : 3; + word_t dest_mode : 1; + + word_t delivery_status : 1; + word_t polarity : 1; + word_t irr : 1; + word_t trigger_mode : 1; + + word_t mask : 1; + word_t _pad0 : 15; + + word_t dest : 8; + }; + volatile u32_t raw[2]; + volatile u64_t raw64; + }; +}; + +struct ioapic_shadow_struct +{ + ioapic_redir_t redirs[24]; +} ioapic_shadow[16]; + +void init_ioapic(unsigned long ioapic_id) +{ + ioapic_redir_t entry; + ioapic_shadow[ioapic_id].redirs[3] = entry; +} + +// CHECK: call void @llvm.memcpy diff --git a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp index 09eb4fe7a7f6..f4d5ccc0e331 100644 --- a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp +++ b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s template <typename T> struct X { diff --git a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp index 0bac492796f8..f5684d93abd9 100644 --- a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp +++ b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -fexceptions -fcxx-exceptions -std=c++0x -o - %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fexceptions -fcxx-exceptions -std=c++11 -o - %s | FileCheck %s struct non_trivial { non_trivial(); diff --git a/test/CodeGenCXX/cxx0x-initializer-scalars.cpp b/test/CodeGenCXX/cxx0x-initializer-scalars.cpp new file mode 100644 index 000000000000..10c696604867 --- /dev/null +++ b/test/CodeGenCXX/cxx0x-initializer-scalars.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o - %s | FileCheck %s + +void f() +{ + // CHECK: store i32 0 + int i{}; +} diff --git a/test/CodeGenCXX/debug-info-char16.cpp b/test/CodeGenCXX/debug-info-char16.cpp new file mode 100644 index 000000000000..da8ca051da84 --- /dev/null +++ b/test/CodeGenCXX/debug-info-char16.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -S -std=c++11 -masm-verbose -g %s -o -| FileCheck %s + +//CHECK: .ascii "char16_t" +//CHECK-NEXT: .byte 0 +//CHECK-NEXT: .byte 16 + +// 16 is DW_ATE_UTF (0x10) encoding attribute. +char16_t char_a = u'h'; + diff --git a/test/CodeGenCXX/debug-info-cxx0x.cpp b/test/CodeGenCXX/debug-info-cxx0x.cpp index 5753b05d728e..37ccdb01c5c0 100644 --- a/test/CodeGenCXX/debug-info-cxx0x.cpp +++ b/test/CodeGenCXX/debug-info-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -g %s +// RUN: %clang_cc1 -emit-llvm-only -std=c++11 -g %s namespace PR9414 { int f() { diff --git a/test/CodeGenCXX/debug-info-nullptr.cpp b/test/CodeGenCXX/debug-info-nullptr.cpp new file mode 100644 index 000000000000..588dc5f3c399 --- /dev/null +++ b/test/CodeGenCXX/debug-info-nullptr.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -S -std=c++11 -masm-verbose -g %s -o -| FileCheck %s + +//CHECK: DW_TAG_unspecified_type +//CHECK-NEXT: "nullptr_t" + +void foo() { + decltype(nullptr) t = 0; + } diff --git a/test/CodeGenCXX/debug-info-wchar.cpp b/test/CodeGenCXX/debug-info-wchar.cpp new file mode 100644 index 000000000000..6f5384966b99 --- /dev/null +++ b/test/CodeGenCXX/debug-info-wchar.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o -| FileCheck %s +void foo() { +// CHECK: metadata !"wchar_t", + const wchar_t w = L'x'; +} diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index 71c8603a9faa..33b52789caf2 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -55,3 +55,15 @@ void foo() { const wchar_t c = L'x'; wchar_t d = c; } + +namespace b5249287 { +template <typename T> class A { + struct B; +}; + +class Cls { + template <typename T> friend class A<T>::B; +}; + +Cls obj; +} diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp index 08ce0de3b5c3..5a88f9f92437 100644 --- a/test/CodeGenCXX/delete.cpp +++ b/test/CodeGenCXX/delete.cpp @@ -30,7 +30,7 @@ void t4(T *t) { // PR5102 template <typename T> class A { - operator T *() const; + public: operator T *() const; }; void f() { @@ -122,3 +122,14 @@ namespace test4 { ::delete xp; } } + +namespace test5 { + struct Incomplete; + // CHECK: define void @_ZN5test523array_delete_incompleteEPNS_10IncompleteES1_ + void array_delete_incomplete(Incomplete *p1, Incomplete *p2) { + // CHECK: call void @_ZdlPv + delete p1; + // CHECK: call void @_ZdaPv + delete [] p2; + } +} diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp index c47c83180906..8c51809e0427 100644 --- a/test/CodeGenCXX/derived-to-base-conv.cpp +++ b/test/CodeGenCXX/derived-to-base-conv.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp index 33819858149b..d9962e615ec5 100644 --- a/test/CodeGenCXX/destructors.cpp +++ b/test/CodeGenCXX/destructors.cpp @@ -237,7 +237,6 @@ namespace test5 { // CHECK: [[ELEMS:%.*]] = alloca [5 x [[A:%.*]]], align // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: [[EHCLEANUP:%.*]] = alloca i32 // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [5 x [[A]]]* [[ELEMS]], i32 0, i32 0 // CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [[A]]* [[BEGIN]], i64 5 // CHECK-NEXT: br label @@ -323,7 +322,32 @@ namespace test7 { // CHECK: invoke void @_ZN5test71DD1Ev( // CHECK: call void @_ZN5test71AD2Ev( B::~B() {} +} + +// PR10467 +namespace test8 { + struct A { A(); ~A(); }; + void die() __attribute__((noreturn)); + void test() { + A x; + while (1) { + A y; + goto l; + } + l: die(); + } + + // CHECK: define void @_ZN5test84testEv() + // CHECK: [[X:%.*]] = alloca [[A:%.*]], align 1 + // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]], align 1 + // CHECK: call void @_ZN5test81AC1Ev([[A]]* [[X]]) + // CHECK-NEXT: br label + // CHECK: invoke void @_ZN5test81AC1Ev([[A]]* [[Y]]) + // CHECK: invoke void @_ZN5test81AD1Ev([[A]]* [[Y]]) + // CHECK-NOT: switch + // CHECK: invoke void @_ZN5test83dieEv() + // CHECK: unreachable } // Checks from test3: @@ -332,9 +356,10 @@ namespace test7 { // CHECK: invoke void @_ZN5test312_GLOBAL__N_11DD1Ev( // CHECK: call void @_ZdlPv({{.*}}) nounwind // CHECK: ret void - // CHECK: call i8* @llvm.eh.exception( + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: call void @_ZdlPv({{.*}}) nounwind - // CHECK: call void @llvm.eh.resume( + // CHECK: resume { i8*, i32 } // Checked at top of file: // @_ZN5test312_GLOBAL__N_11DD1Ev = alias internal {{.*}} @_ZN5test312_GLOBAL__N_11DD2Ev @@ -362,9 +387,10 @@ namespace test7 { // CHECK: invoke void @_ZN5test312_GLOBAL__N_11CD1Ev( // CHECK: call void @_ZdlPv({{.*}}) nounwind // CHECK: ret void - // CHECK: call i8* @llvm.eh.exception() + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: call void @_ZdlPv({{.*}}) nounwind - // CHECK: call void @llvm.eh.resume( + // CHECK: resume { i8*, i32 } // CHECK: define internal void @_ZThn8_N5test312_GLOBAL__N_11CD1Ev( // CHECK: getelementptr inbounds i8* {{.*}}, i64 -8 diff --git a/test/CodeGenCXX/dynamic-cast-always-null.cpp b/test/CodeGenCXX/dynamic-cast-always-null.cpp index e4e86942181d..2c3ea13d1957 100644 --- a/test/CodeGenCXX/dynamic-cast-always-null.cpp +++ b/test/CodeGenCXX/dynamic-cast-always-null.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++0x -o - | FileCheck %s +// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++11 -o - | FileCheck %s struct A { virtual ~A(); }; struct B final : A { }; struct C { virtual ~C(); int c; }; diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp index e84bb9b4ff50..813e36e941b7 100644 --- a/test/CodeGenCXX/dynamic-cast.cpp +++ b/test/CodeGenCXX/dynamic-cast.cpp @@ -11,7 +11,8 @@ const B& f(A *a) { // CHECK: invoke void @__cxa_bad_cast() noreturn dynamic_cast<const B&>(*a); } catch (...) { - // CHECK: call i8* @llvm.eh.exception + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: catch i8* null } return fail; } diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp index 58cb44515ddf..584af40da62d 100644 --- a/test/CodeGenCXX/eh.cpp +++ b/test/CodeGenCXX/eh.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o %t.ll // RUN: FileCheck --input-file=%t.ll %s struct test1_D { @@ -32,7 +32,6 @@ void test2() { // CHECK: define void @_Z5test2v() // CHECK: [[EXNVAR:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 -// CHECK-NEXT: [[CLEANUPDESTVAR:%.*]] = alloca i32 // CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 16) // CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]] // CHECK-NEXT: invoke void @_ZN7test2_DC1ERKS_([[DSTAR]] [[EXN]], [[DSTAR]] @d2) @@ -107,7 +106,6 @@ namespace test7 { // CHECK: [[CAUGHTEXNVAR:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 // CHECK-NEXT: [[INTCATCHVAR:%.*]] = alloca i32 -// CHECK-NEXT: [[EHCLEANUPDESTVAR:%.*]] = alloca i32 try { try { // CHECK-NEXT: [[EXNALLOC:%.*]] = call i8* @__cxa_allocate_exception @@ -117,25 +115,34 @@ namespace test7 { throw 1; } -// CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() +// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) +// CHECK-NEXT: catch i8* null +// CHECK-NEXT: [[CAUGHTEXN:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 // CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) +// CHECK-NEXT: [[SELECTOR:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 1 // CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] -// CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) -// CHECK-NEXT: icmp eq +// CHECK-NEXT: br label +// CHECK: [[SELECTOR:%.*]] = load i32* [[SELECTORVAR]] +// CHECK-NEXT: [[T0:%.*]] = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) +// CHECK-NEXT: icmp eq i32 [[SELECTOR]], [[T0]] // CHECK-NEXT: br i1 -// CHECK: load i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: call i8* @__cxa_begin_catch -// CHECK: invoke void @__cxa_rethrow +// CHECK: [[T0:%.*]] = load i8** [[CAUGHTEXNVAR]] +// CHECK-NEXT: [[T1:%.*]] = call i8* @__cxa_begin_catch(i8* [[T0]]) +// CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to i32* +// CHECK-NEXT: [[T3:%.*]] = load i32* [[T2]] +// CHECK-NEXT: store i32 [[T3]], i32* {{%.*}}, align 4 +// CHECK-NEXT: invoke void @__cxa_rethrow catch (int) { throw; } } -// CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() +// CHECK: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) +// CHECK-NEXT: catch i8* null +// CHECK-NEXT: [[CAUGHTEXN:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 // CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) +// CHECK-NEXT: [[SELECTOR:%.*]] = extractvalue { i8*, i32 } [[CAUGHTVAL]], 1 // CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] -// CHECK-NEXT: store i32 1, i32* [[EHCLEANUPDESTVAR]] // CHECK-NEXT: call void @__cxa_end_catch() // CHECK-NEXT: br label // CHECK: load i8** [[CAUGHTEXNVAR]] @@ -186,15 +193,14 @@ namespace test9 { // CHECK: invoke void @_ZN5test96opaqueEv() opaque(); } catch (int x) { + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: catch i8* bitcast (i8** @_ZTIi to i8*) + // CHECK: call i8* @__cxa_begin_catch // CHECK: invoke void @_ZN5test96opaqueEv() // CHECK: invoke void @__cxa_rethrow() opaque(); } - - // landing pad from first call to invoke - // CHECK: call i8* @llvm.eh.exception - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*)) } // __cxa_end_catch can throw for some kinds of caught exceptions. @@ -296,10 +302,7 @@ namespace test12 { // CHECK: invoke void @_ZN6test121AD1Ev([[A]]* [[Z]]) // CHECK: invoke void @_ZN6test121AD1Ev([[A]]* [[Y]]) - - // It'd be great if something eliminated this switch. - // CHECK: load i32* [[CLEANUPDEST]] - // CHECK-NEXT: switch i32 + // CHECK-NOT: switch goto success; } @@ -409,7 +412,6 @@ namespace test16 { // CHECK-NEXT: [[TEMP:%.*]] = alloca [[A:%.*]], // CHECK-NEXT: [[EXNSLOT:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 - // CHECK-NEXT: [[EHDEST:%.*]] = alloca i32 // CHECK-NEXT: [[TEMP_ACTIVE:%.*]] = alloca i1 cond() ? throw B(A()) : foo(); diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp index b32b90bf7412..0fbb09c2624a 100644 --- a/test/CodeGenCXX/exceptions.cpp +++ b/test/CodeGenCXX/exceptions.cpp @@ -276,7 +276,6 @@ namespace test5 { // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 // CHECK-NEXT: [[A:%.*]] = alloca [[A_T:%.*]], align 1 // CHECK-NEXT: [[T:%.*]] = alloca [[T_T:%.*]], align 1 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: invoke void @_ZN5test53fooEv() // CHECK: [[EXN:%.*]] = load i8** [[EXNSLOT]] // CHECK-NEXT: [[ADJ:%.*]] = call i8* @__cxa_get_exception_ptr(i8* [[EXN]]) @@ -325,7 +324,6 @@ namespace test7 { // CHECK-NEXT: alloca [[A:%.*]], // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[OUTER_A:%.*]] = alloca i1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: [[INNER_NEW:%.*]] = alloca i1 @@ -392,3 +390,38 @@ namespace test7 { return new B(A(), new B(A(), 0)); } } + +// Just don't crash. +namespace test8 { + struct A { + // Having both of these is required to trigger the assert we're + // trying to avoid. + A(const A&); + A&operator=(const A&); + + ~A(); + }; + + A makeA(); + void test() { + throw makeA(); + } + // CHECK: define void @_ZN5test84testEv +} + +// Make sure we generate the correct code for the delete[] call which +// happens if A::A() throws. (We were previously calling delete[] on +// a pointer to the first array element, not the pointer returned by new[].) +// PR10870 +namespace test9 { + struct A { + A(); + ~A(); + }; + A* test() { + return new A[10]; + } + // CHECK: define {{%.*}}* @_ZN5test94testEv + // CHECK: [[TEST9_NEW:%.*]] = call noalias i8* @_Znam + // CHECK: call void @_ZdaPv(i8* [[TEST9_NEW]]) +} diff --git a/test/CodeGenCXX/for-range-temporaries.cpp b/test/CodeGenCXX/for-range-temporaries.cpp index be594ce5223d..c705702f4f51 100644 --- a/test/CodeGenCXX/for-range-temporaries.cpp +++ b/test/CodeGenCXX/for-range-temporaries.cpp @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - -UDESUGAR %s | opt -instnamer -S | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - -DDESUGAR %s | opt -instnamer -S | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - -UDESUGAR %s | opt -instnamer -S | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - -DDESUGAR %s | opt -instnamer -S | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - -DDESUGAR -DTEMPLATE %s | opt -instnamer -S | FileCheck %s struct A { A(); @@ -65,6 +66,9 @@ struct I { void body(const I &); +#ifdef TEMPLATE +template<typename D> +#endif void for_temps() { A a; #ifdef DESUGAR @@ -83,7 +87,11 @@ void for_temps() { #endif } -// CHECK: define void @_Z9for_tempsv() +#ifdef TEMPLATE +template void for_temps<D>(); +#endif + +// CHECK: define {{.*}}for_temps // CHECK: call void @_ZN1AC1Ev( // CHECK: call void @_ZN1BC1Ev( // CHECK: call void @_ZN1CC1ERK1B( diff --git a/test/CodeGenCXX/for-range.cpp b/test/CodeGenCXX/for-range.cpp index ab1a2317ba93..0f35dda737fe 100644 --- a/test/CodeGenCXX/for-range.cpp +++ b/test/CodeGenCXX/for-range.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - %s | opt -instnamer -S | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - %s | opt -instnamer -S | FileCheck %s struct A { A(); diff --git a/test/CodeGenCXX/fp16-mangle.cpp b/test/CodeGenCXX/fp16-mangle.cpp new file mode 100644 index 000000000000..4a056d6c6bbb --- /dev/null +++ b/test/CodeGenCXX/fp16-mangle.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s + +// CHECK: @_ZN1SIDhDhE1iE = global i32 3 +template <typename T, typename U> struct S { static int i; }; +template <> int S<__fp16, __fp16>::i = 3; + +// CHECK: define void @_Z1fPDh(i16* %x) +void f (__fp16 *x) { } + +// CHECK: define void @_Z1gPDhS_(i16* %x, i16* %y) +void g (__fp16 *x, __fp16 *y) { } + diff --git a/test/CodeGenCXX/fp16-overload.cpp b/test/CodeGenCXX/fp16-overload.cpp new file mode 100644 index 000000000000..75622109c175 --- /dev/null +++ b/test/CodeGenCXX/fp16-overload.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple arm-none-linux-gnueabi %s | FileCheck %s + +extern int foo(float x); +extern int foo(double x); + +__fp16 a; + +// CHECK: call i32 @_Z3foof +// CHECK-NOT: call i32 @_Z3food +int bar (void) { return foo(a); } diff --git a/test/CodeGenCXX/global-array-destruction.cpp b/test/CodeGenCXX/global-array-destruction.cpp index bbe574daa588..5b5dfac0f228 100644 --- a/test/CodeGenCXX/global-array-destruction.cpp +++ b/test/CodeGenCXX/global-array-destruction.cpp @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp index 9a12a9125398..f32847d122bc 100644 --- a/test/CodeGenCXX/goto.cpp +++ b/test/CodeGenCXX/goto.cpp @@ -13,7 +13,6 @@ namespace test0 { // CHECK-NEXT: [[Z:%.*]] = alloca [[A]] // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*, // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1 diff --git a/test/CodeGenCXX/init-incomplete-type.cpp b/test/CodeGenCXX/incomplete-types.cpp index 1755dfb7beb1..1d4f430e5cb5 100644 --- a/test/CodeGenCXX/init-incomplete-type.cpp +++ b/test/CodeGenCXX/incomplete-types.cpp @@ -28,4 +28,16 @@ namespace incomplete_type_refs { return &g[1]; } -}
\ No newline at end of file +} + +namespace PR10395 { + struct T; + extern T x[]; + T* f() { return x; } +} + +namespace PR10384 { + struct X; + extern X x[1]; + X* f() { return x; } +} diff --git a/test/CodeGenCXX/m64-ptr.cpp b/test/CodeGenCXX/m64-ptr.cpp new file mode 100644 index 000000000000..29916bf32a65 --- /dev/null +++ b/test/CodeGenCXX/m64-ptr.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s + +// Make sure pointers are passed as pointers, not converted to int. +// The first load should be of type i8** in either 32 or 64 bit mode. +// This formerly happened on x86-64, 7375899. + +class StringRef { +public: + const char *Data; + long Len; +}; +void foo(StringRef X); +void bar(StringRef &A) { +// CHECK: @_Z3barR9StringRef +// CHECK: load i8** + foo(A); +// CHECK: ret void +} diff --git a/test/CodeGenCXX/mangle-alias-template.cpp b/test/CodeGenCXX/mangle-alias-template.cpp index 2020a0a584e1..1143ea114a1a 100644 --- a/test/CodeGenCXX/mangle-alias-template.cpp +++ b/test/CodeGenCXX/mangle-alias-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s template<typename T> struct alloc {}; template<typename T> using Alloc = alloc<T>; diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp index 75294e059c55..c5f72d83c750 100644 --- a/test/CodeGenCXX/mangle-exprs.cpp +++ b/test/CodeGenCXX/mangle-exprs.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s template < bool condition, typename T = void > struct enable_if { typedef T type; }; diff --git a/test/CodeGenCXX/mangle-ref-qualifiers.cpp b/test/CodeGenCXX/mangle-ref-qualifiers.cpp index b3f37d7db31a..568cf9f24700 100644 --- a/test/CodeGenCXX/mangle-ref-qualifiers.cpp +++ b/test/CodeGenCXX/mangle-ref-qualifiers.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s struct X { int f() &; int g() &&; diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp index 30b579ceb823..04e3e84304e8 100644 --- a/test/CodeGenCXX/mangle-subst-std.cpp +++ b/test/CodeGenCXX/mangle-subst-std.cpp @@ -3,14 +3,14 @@ // Check mangling of Vtables, VTTs, and construction vtables that // involve standard substitutions. -// CHECK: @_ZTTSd = linkonce_odr unnamed_addr constant // CHECK: @_ZTVSd = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSd = linkonce_odr unnamed_addr constant // CHECK: @_ZTCSd0_Si = linkonce_odr unnamed_addr constant // CHECK: @_ZTCSd16_So = linkonce_odr unnamed_addr constant -// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant // CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant -// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant // CHECK: @_ZTVSi = linkonce_odr unnamed_addr constant +// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant namespace std { struct A { A(); }; diff --git a/test/CodeGenCXX/mangle-unnameable-conversions.cpp b/test/CodeGenCXX/mangle-unnameable-conversions.cpp index 2132eff5e511..2ecded05d979 100644 --- a/test/CodeGenCXX/mangle-unnameable-conversions.cpp +++ b/test/CodeGenCXX/mangle-unnameable-conversions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s template<typename T> using id = T; struct S { diff --git a/test/CodeGenCXX/mangle-variadic-templates.cpp b/test/CodeGenCXX/mangle-variadic-templates.cpp index a987b49a1281..b5bdae234445 100644 --- a/test/CodeGenCXX/mangle-variadic-templates.cpp +++ b/test/CodeGenCXX/mangle-variadic-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s template<unsigned I, typename ...Types> struct X { }; diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 453b7b713ac6..47c42a7347fa 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -fblocks -std=c++0x | FileCheck %s +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -fblocks -std=c++11 | FileCheck %s struct X { }; struct Y { }; @@ -533,17 +533,6 @@ namespace test15 { template void f<7>(S<7 + e>); } -// rdar://problem/8125400. Don't crash. -namespace test16 { - static union {}; - static union { union {}; }; - static union { struct {}; }; - static union { union { union {}; }; }; - static union { union { struct {}; }; }; - static union { struct { union {}; }; }; - static union { struct { struct {}; }; }; -} - // rdar://problem/8302148 namespace test17 { template <int N> struct A {}; diff --git a/test/CodeGenCXX/member-alignment.cpp b/test/CodeGenCXX/member-alignment.cpp new file mode 100644 index 000000000000..8e120f712507 --- /dev/null +++ b/test/CodeGenCXX/member-alignment.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// XFAIL: arm,powerpc + +// rdar://7268289 + +class t { +public: + virtual void foo(void); + void bar(void); +}; + +void +t::bar(void) { +// CHECK: _ZN1t3barEv{{.*}} align 2 +} + +void +t::foo(void) { +// CHECK: _ZN1t3fooEv{{.*}} align 2 +} diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp index 4c42bd8283ae..5ce5fbf760db 100644 --- a/test/CodeGenCXX/member-function-pointers.cpp +++ b/test/CodeGenCXX/member-function-pointers.cpp @@ -33,7 +33,7 @@ void f() { pa = 0; // Is this okay? What are LLVM's volatile semantics for structs? - // CHECK: volatile store { i64, i64 } zeroinitializer, { i64, i64 }* @vpa + // CHECK: store volatile { i64, i64 } zeroinitializer, { i64, i64 }* @vpa vpa = 0; // CHECK: [[TMP:%.*]] = load { i64, i64 }* @pa, align 8 diff --git a/test/CodeGenCXX/member-init-anon-union.cpp b/test/CodeGenCXX/member-init-anon-union.cpp new file mode 100644 index 000000000000..1ff7537387c2 --- /dev/null +++ b/test/CodeGenCXX/member-init-anon-union.cpp @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s + +// PR10531. + +static union { + int a = 42; + char *b; +}; + +int f() { return a; } + +// CHECK: define internal void @__cxx_global_var_init +// CHECK-NOT: } +// CHECK: call {{.*}}@"[[CONSTRUCT_GLOBAL:.*]]C1Ev" + + +int g() { + union { + int a; + int b = 81; + }; + // CHECK: define {{.*}}_Z1gv + // CHECK-NOT: } + // CHECK: call {{.*}}@"[[CONSTRUCT_LOCAL:.*]]C1Ev" + return b; +} + + +// CHECK: define {{.*}}@"[[CONSTRUCT_LOCAL]]C2Ev" +// CHECK-NOT: } +// CHECK: store i32 81 + +// CHECK: define {{.*}}@"[[CONSTRUCT_GLOBAL]]C2Ev" +// CHECK-NOT: } +// CHECK: store i32 42 diff --git a/test/CodeGenCXX/member-init-ctor.cpp b/test/CodeGenCXX/member-init-ctor.cpp index d70947bcab00..21723942571f 100644 --- a/test/CodeGenCXX/member-init-ctor.cpp +++ b/test/CodeGenCXX/member-init-ctor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -std=c++0x -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s bool b(); struct S { diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp index 0efb35538038..57bf27ab7aff 100644 --- a/test/CodeGenCXX/nrvo.cpp +++ b/test/CodeGenCXX/nrvo.cpp @@ -68,8 +68,10 @@ X test2(bool B) { // -> %cleanup, %lpad1 // %lpad: landing pad for ctor of 'y', dtor of 'y' - // CHECK-EH: call i8* @llvm.eh.exception() - // CHECK-EH: call i32 (i8*, i8*, ...)* @llvm.eh.selector + // CHECK-EH: [[CAUGHTVAL:%.*]] = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-EH-NEXT: cleanup + // CHECK-EH-NEXT: extractvalue { i8*, i32 } [[CAUGHTVAL]], 0 + // CHECK-EH-NEXT: extractvalue { i8*, i32 } [[CAUGHTVAL]], 1 // CHECK-EH-NEXT: br label // -> %eh.cleanup @@ -95,12 +97,11 @@ X test2(bool B) { // %invoke.cont17: rethrow block for %eh.cleanup. // This really should be elsewhere in the function. - // CHECK-EH: call void @llvm.eh.resume( - // CHECK-EH-NEXT: unreachable + // CHECK-EH: resume { i8*, i32 } // %terminate.lpad: terminate landing pad. - // CHECK-EH: call i8* @llvm.eh.exception() - // CHECK-EH-NEXT: call i32 (i8*, i8*, ...)* @llvm.eh.selector + // CHECK-EH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-EH-NEXT: catch i8* null // CHECK-EH-NEXT: call void @_ZSt9terminatev() // CHECK-EH-NEXT: unreachable diff --git a/test/CodeGenCXX/nullptr.cpp b/test/CodeGenCXX/nullptr.cpp index 1ea23ec0a95b..e93f7061bdda 100644 --- a/test/CodeGenCXX/nullptr.cpp +++ b/test/CodeGenCXX/nullptr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s | FileCheck %s #include <typeinfo> diff --git a/test/CodeGenCXX/partial-destruction.cpp b/test/CodeGenCXX/partial-destruction.cpp index 82deca06cf80..f232a159eda5 100644 --- a/test/CodeGenCXX/partial-destruction.cpp +++ b/test/CodeGenCXX/partial-destruction.cpp @@ -16,7 +16,6 @@ namespace test0 { // CHECK-NEXT: [[ENDVAR:%.*]] = alloca [[A]]* // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: [[CLEANUP:%.*]] = alloca i32 // Initialize. // CHECK-NEXT: [[E_BEGIN:%.*]] = getelementptr inbounds [10 x [[A]]]* [[AS]], i64 0, i64 0 @@ -51,7 +50,8 @@ namespace test0 { // CHECK: ret void // Partial destroy for initialization. - // CHECK: llvm.eh.selector({{.*}}, i32 0) + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: [[PARTIAL_END:%.*]] = load [[A]]** [[ENDVAR]] // CHECK-NEXT: [[T0:%.*]] = icmp eq [[A]]* [[E_BEGIN]], [[PARTIAL_END]] // CHECK-NEXT: br i1 [[T0]], @@ -62,7 +62,8 @@ namespace test0 { // CHECK-NEXT: br i1 [[T0]], // Primary EH destructor. - // CHECK: llvm.eh.selector({{.*}}, i32 0) + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: [[E0:%.*]] = getelementptr inbounds [10 x [[A]]]* [[AS]], i32 0, i32 0 // CHECK-NEXT: [[E_END:%.*]] = getelementptr inbounds [[A]]* [[E0]], i64 10 // CHECK-NEXT: br label @@ -71,7 +72,8 @@ namespace test0 { // FIXME: There's some really bad block ordering here which causes // the partial destroy for the primary normal destructor to fall // within the primary EH destructor. - // CHECK: llvm.eh.selector({{.*}}, i32 0) + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: [[T0:%.*]] = icmp eq [[A]]* [[ED_BEGIN]], [[ED_CUR]] // CHECK-NEXT: br i1 [[T0]] // CHECK: [[EDD_AFTER:%.*]] = phi [[A]]* [ [[ED_CUR]], {{%.*}} ], [ [[EDD_CUR:%.*]], {{%.*}} ] @@ -100,7 +102,6 @@ namespace test1 { // CHECK: [[V:%.*]] = alloca [[B:%.*]], align 4 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[X:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 0 // CHECK-NEXT: call void @_ZN5test11AC1Ei([[A:%.*]]* [[X]], i32 5) // CHECK-NEXT: [[Y:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 1 @@ -113,8 +114,10 @@ namespace test1 { // CHECK-NEXT: ret void // FIXME: again, the block ordering is pretty bad here - // CHECK: eh.selector({{.*}}, i32 0) - // CHECK: eh.selector({{.*}}, i32 0) + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[Y]]) // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[X]]) } @@ -129,7 +132,6 @@ namespace test2 { // CHECK: [[V:%.*]] = alloca [4 x [7 x [[A:%.*]]]], align 1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // Main initialization loop. // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [4 x [7 x [[A]]]]* [[V]], i32 0, i32 0, i32 0 @@ -142,7 +144,8 @@ namespace test2 { // CHECK-NEXT: br i1 [[DONE]], // Partial destruction landing pad. - // CHECK: llvm.eh.exception() + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: cleanup // CHECK: [[EMPTY:%.*]] = icmp eq [[A]]* [[BEGIN]], [[CUR]] // CHECK-NEXT: br i1 [[EMPTY]], // CHECK: [[PAST:%.*]] = phi [[A]]* [ [[CUR]], {{%.*}} ], [ [[DEL:%.*]], {{%.*}} ] diff --git a/test/CodeGenCXX/pr9965.cpp b/test/CodeGenCXX/pr9965.cpp index 596dee9caaa3..145fd4e424f4 100644 --- a/test/CodeGenCXX/pr9965.cpp +++ b/test/CodeGenCXX/pr9965.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s | FileCheck %s template<typename T> struct X { diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp index d012fb9c59b5..3989c0362889 100644 --- a/test/CodeGenCXX/ptr-to-member-function.cpp +++ b/test/CodeGenCXX/ptr-to-member-function.cpp @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s // 13.3.3.2 Ranking implicit conversion sequences diff --git a/test/CodeGenCXX/reference-cast.cpp b/test/CodeGenCXX/reference-cast.cpp index 585d1dbd4084..1d08b2b2e4b7 100644 --- a/test/CodeGenCXX/reference-cast.cpp +++ b/test/CodeGenCXX/reference-cast.cpp @@ -168,3 +168,27 @@ const _Complex float &f1() { // CHECK: store float return get_complex_double(); } + +// CHECK: define i32 @_Z7pr10592RKi(i32* +unsigned pr10592(const int &v) { + // CHECK: [[VADDR:%[a-zA-Z0-9.]+]] = alloca i32* + // CHECK-NEXT: [[REFTMP:%[a-zA-Z0-9.]+]] = alloca i32 + // CHECK-NEXT: store i32* [[V:%[a-zA-Z0-9.]+]], i32** [[VADDR]] + // CHECK-NEXT: [[VADDR_1:%[a-zA-Z0-9.]+]] = load i32** [[VADDR]] + // CHECK-NEXT: [[VVAL:%[a-zA-Z0-9.]+]] = load i32* [[VADDR_1]] + // CHECK-NEXT: store i32 [[VVAL]], i32* [[REFTMP]] + // CHECK-NEXT: [[VVAL_I:%[a-zA-Z0-9.]+]] = load i32* [[REFTMP]] + // CHECK-NEXT: ret i32 [[VVAL_I]] + return static_cast<const unsigned &>(v); +} + +namespace PR10650 { + struct Helper { + unsigned long long id(); + }; + unsigned long long test(Helper *obj) { + return static_cast<const unsigned long long&>(obj->id()); + } + // CHECK: define i64 @_ZN7PR106504testEPNS_6HelperE + // CHECK: store i64 +} diff --git a/test/CodeGenCXX/reinterpret-cast.cpp b/test/CodeGenCXX/reinterpret-cast.cpp index ff5679248c25..dafa67529f77 100644 --- a/test/CodeGenCXX/reinterpret-cast.cpp +++ b/test/CodeGenCXX/reinterpret-cast.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s -std=c++0x +// RUN: %clang_cc1 -emit-llvm -o - %s -std=c++11 void *f1(unsigned long l) { return reinterpret_cast<void *>(l); } diff --git a/test/CodeGenCXX/rvalue-references.cpp b/test/CodeGenCXX/rvalue-references.cpp index e15172355ebd..1c25543beabc 100644 --- a/test/CodeGenCXX/rvalue-references.cpp +++ b/test/CodeGenCXX/rvalue-references.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s struct Spacer { int x; }; @@ -83,3 +83,29 @@ C test_move_return() { // CHECK: call void @_ZN1CD1Ev //CHECK: ret void } + +// PR10800: don't crash +namespace test1 { + int &&move(int&); + + struct A { A(int); }; + struct B { + A a; + B(int i); + }; + + // CHECK: define void @_ZN5test11BC2Ei( + // CHECK: [[T0:%.*]] = call i32* @_ZN5test14moveERi( + // CHECK-NEXT: [[T1:%.*]] = load i32* [[T0]] + // CHECK-NEXT: call void @_ZN5test11AC1Ei({{.*}}, i32 [[T1]]) + // CHECK-NEXT: ret void + B::B(int i) : a(move(i)) {} +} + +// PR11009 +struct MoveConvertible { + operator int&& () const; +}; +void moveConstruct() { + (void)(int)MoveConvertible(); +} diff --git a/test/CodeGenCXX/scoped-enums.cpp b/test/CodeGenCXX/scoped-enums.cpp index d40ab3651116..fca05098923c 100644 --- a/test/CodeGenCXX/scoped-enums.cpp +++ b/test/CodeGenCXX/scoped-enums.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -emit-llvm -o - %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s // PR9923 enum class Color { red, blue, green }; diff --git a/test/CodeGenCXX/sizeof-unwind-exception.cpp b/test/CodeGenCXX/sizeof-unwind-exception.cpp new file mode 100644 index 000000000000..5db4df7c75ac --- /dev/null +++ b/test/CodeGenCXX/sizeof-unwind-exception.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=X86-64 +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=X86-32 +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-DARWIN +// RUN: %clang_cc1 -triple arm-unknown-gnueabi -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-EABI +// RUN: %clang_cc1 -triple mipsel-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=MIPS + +void foo(); +void test() { + try { + foo(); + } catch (int *&i) { + *i = 5; + } +} + +// PR10789: different platforms have different sizes for struct UnwindException. + +// X86-64: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) nounwind +// X86-64-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32 +// X86-32: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) nounwind +// X86-32-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32 +// ARM-DARWIN: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) nounwind +// ARM-DARWIN-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32 +// ARM-EABI: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) nounwind +// ARM-EABI-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i32 88 +// MIPS: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) nounwind +// MIPS-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i32 24 + diff --git a/test/CodeGenCXX/static-assert.cpp b/test/CodeGenCXX/static-assert.cpp index dbb8f34d8414..53dc9a73805f 100644 --- a/test/CodeGenCXX/static-assert.cpp +++ b/test/CodeGenCXX/static-assert.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -std=c++0x -verify +// RUN: %clang_cc1 %s -emit-llvm -o - -std=c++11 -verify static_assert(true, ""); diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp index d488e636696e..9e2673cc967d 100644 --- a/test/CodeGenCXX/static-init.cpp +++ b/test/CodeGenCXX/static-init.cpp @@ -12,13 +12,11 @@ struct A { }; void f() { + // CHECK: load atomic i8* bitcast (i64* @_ZGVZ1fvE1a to i8*) acquire, align 1 // CHECK: call i32 @__cxa_guard_acquire // CHECK: call void @_ZN1AC1Ev // CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @_ZZ1fvE1a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*)) // CHECK: call void @__cxa_guard_release - - // rdar://problem/9496726 - // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 false, i1 false, i1 false) static A a; } diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp index cc30af0aba4b..09b3a4fcc544 100644 --- a/test/CodeGenCXX/template-instantiation.cpp +++ b/test/CodeGenCXX/template-instantiation.cpp @@ -17,6 +17,19 @@ // CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_( // CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd( +// CHECK: define linkonce_odr void @_ZN7PR106662g1ENS_1SILi1EEE() +// CHECK: define linkonce_odr void @_ZN7PR106662g1ENS_1SILi2EEE() +// CHECK: define linkonce_odr void @_ZN7PR106662g1ENS_1SILi3EEE() +// CHECK: define linkonce_odr void @_ZN7PR106662g2ENS_1SILi1EEE() +// CHECK: define linkonce_odr void @_ZN7PR106662g2ENS_1SILi2EEE() +// CHECK: define linkonce_odr void @_ZN7PR106662g2ENS_1SILi3EEE() +// CHECK: declare void @_ZN7PR106662h1ENS_1SILi1EEE() +// CHECK: declare void @_ZN7PR106662h1ENS_1SILi2EEE() +// CHECK: declare void @_ZN7PR106662h1ENS_1SILi3EEE() +// CHECK: declare void @_ZN7PR106662h2ENS_1SILi1EEE() +// CHECK: declare void @_ZN7PR106662h2ENS_1SILi2EEE() +// CHECK: declare void @_ZN7PR106662h2ENS_1SILi3EEE() + namespace test0 { struct basic_streambuf { virtual ~basic_streambuf(); @@ -152,3 +165,26 @@ namespace PR10001 { int x = S<int>::f(); } + +// Ensure that definitions are emitted for all friend functions defined within +// class templates. Order of declaration is extremely important here. Different +// instantiations of the class happen at different points during the deferred +// method body parsing and afterward. Those different points of instantiation +// change the exact form the class template appears to have. +namespace PR10666 { + template <int N> struct S { + void f1() { S<1> s; } + friend void g1(S s) {} + friend void h1(S s); + void f2() { S<2> s; } + friend void g2(S s) {} + friend void h2(S s); + void f3() { S<3> s; } + }; + void test(S<1> s1, S<2> s2, S<3> s3) { + g1(s1); g1(s2); g1(s3); + g2(s1); g2(s2); g2(s3); + h1(s1); h1(s2); h1(s3); + h2(s1); h2(s2); h2(s3); + } +} diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp index 8aeca653da55..98e5ae3e6ee7 100644 --- a/test/CodeGenCXX/temporaries.cpp +++ b/test/CodeGenCXX/temporaries.cpp @@ -395,7 +395,7 @@ namespace Elision { // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[I]]) } - // CHECK: define void @_ZN7Elision5test2Ev([[A]]* sret + // CHECK: define void @_ZN7Elision5test2Ev([[A]]* noalias sret A test2() { // CHECK: call void @_ZN7Elision3fooEv() // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]]) @@ -403,7 +403,7 @@ namespace Elision { return (foo(), A()); } - // CHECK: define void @_ZN7Elision5test3EiNS_1AE([[A]]* sret + // CHECK: define void @_ZN7Elision5test3EiNS_1AE([[A]]* noalias sret A test3(int v, A x) { if (v < 5) // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]]) @@ -444,7 +444,7 @@ namespace Elision { } // rdar://problem/8433352 - // CHECK: define void @_ZN7Elision5test5Ev([[A]]* sret + // CHECK: define void @_ZN7Elision5test5Ev([[A]]* noalias sret struct B { A a; B(); }; A test5() { // CHECK: [[AT0:%.*]] = alloca [[A]], align 8 diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp index aa79a4f6dd3d..769d120be323 100644 --- a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp +++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp @@ -21,9 +21,8 @@ void f() { throw Y(); // Finally, the landing pad. - // CHECK: call i8* @llvm.eh.exception() - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK: cleanup // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x) - // CHECK: call void @llvm.eh.resume( - // CHECK: unreachable + // CHECK: resume { i8*, i32 } } diff --git a/test/CodeGenCXX/thunk-linkonce-odr.cpp b/test/CodeGenCXX/thunk-linkonce-odr.cpp new file mode 100644 index 000000000000..4f4d61d5a9a8 --- /dev/null +++ b/test/CodeGenCXX/thunk-linkonce-odr.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// <rdar://problem/7929157> & <rdar://problem/8104369> + +struct A { + virtual int f() { return 1; } +}; + +struct B { + virtual int f() { return 2; } +}; + +struct C : A, B { + virtual int f() { return 3; } +}; + +struct D : C { + virtual int f() { return 4; } +}; + +static int f(D* d) { + B* b = d; + return b->f(); +}; + +int g() { + D d; + return f(&d); +} + +// Thunks should be marked as "linkonce ODR" not "weak". +// +// CHECK: define linkonce_odr i32 @_ZThn{{[48]}}_N1D1fEv +// CHECK: define linkonce_odr i32 @_ZThn{{[48]}}_N1C1fEv diff --git a/test/CodeGenCXX/typeid.cpp b/test/CodeGenCXX/typeid.cpp index 1af96705ba41..7ebf41c09f6c 100644 --- a/test/CodeGenCXX/typeid.cpp +++ b/test/CodeGenCXX/typeid.cpp @@ -13,7 +13,8 @@ const char *f() { // CHECK: invoke void @__cxa_bad_typeid() noreturn return typeid(*static_cast<A *>(0)).name(); } catch (...) { - // CHECK: call i8* @llvm.eh.exception + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: catch i8* null } return 0; diff --git a/test/CodeGenCXX/union-dtor.cpp b/test/CodeGenCXX/union-dtor.cpp new file mode 100644 index 000000000000..a0b822aa54dd --- /dev/null +++ b/test/CodeGenCXX/union-dtor.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -std=c++11 %s -S -o - -emit-llvm | FileCheck %s + +// PR10304: destructors should not call destructors for variant members. + +template<bool b = false> +struct Foo { + Foo() { static_assert(b, "Foo::Foo used"); } + ~Foo() { static_assert(b, "Foo::~Foo used"); } +}; + +struct Bar { + Bar(); + ~Bar(); +}; + +union FooBar { + FooBar() {} + ~FooBar() {} + Foo<> foo; + Bar bar; +}; + +struct Variant { + Variant() {} + ~Variant() {} + union { + Foo<> foo; + Bar bar; + }; +}; + +FooBar foobar; +Variant variant; + +// The ctor and dtor of Foo<> and Bar should not be mentioned in the resulting +// code. +// +// CHECK-NOT: 3FooILb1EEC1 +// CHECK-NOT: 3BarC1 +// +// CHECK-NOT: 3FooILb1EED1 +// CHECK-NOT: 3BarD1 diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp index 04a18b3fa801..fb981d1ff717 100644 --- a/test/CodeGenCXX/value-init.cpp +++ b/test/CodeGenCXX/value-init.cpp @@ -238,6 +238,25 @@ namespace test6 { // CHECK: ret void } +namespace PR11124 { + // Make sure C::C doesn't overwrite parts of A while it is zero-initializing B + struct A { int a; A(); A(int); }; + struct B : virtual A { int b; }; + struct C : B { C(); }; + C::C() : A(3), B() {} + // CHECK: define void @_ZN7PR111241CC1Ev + // CHECK: call void @llvm.memset.p0i8.i64(i8* {{.*}}, i8 0, i64 12, i32 8, i1 false) + // CHECK-NEXT: call void @_ZN7PR111241BC2Ev + // Make sure C::C doesn't overwrite parts of A while it is zero-initializing B + + struct B2 : virtual A { int B::*b; }; + struct C2 : B2 { C2(); }; + C2::C2() : A(3), B2() {} + // CHECK: define void @_ZN7PR111242C2C1Ev + // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.*}}, i8* {{.*}}, i64 16, i32 8, i1 false) + // CHECK-NEXT: call void @_ZN7PR111242B2C2Ev +} + // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev(%"struct.zeroinit::X3"* %this) unnamed_addr // CHECK: call void @llvm.memset.p0i8.i64 // CHECK-NEXT: call void @_ZN8zeroinit2X2IiEC2Ev diff --git a/test/CodeGenCXX/vararg-conversion-ctor.cpp b/test/CodeGenCXX/vararg-conversion-ctor.cpp index 7e42859ac93e..a49b1dba9961 100644 --- a/test/CodeGenCXX/vararg-conversion-ctor.cpp +++ b/test/CodeGenCXX/vararg-conversion-ctor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o %t-64.ll // RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/varargs.cpp b/test/CodeGenCXX/varargs.cpp new file mode 100644 index 000000000000..af34336a0ae2 --- /dev/null +++ b/test/CodeGenCXX/varargs.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s + +// rdar://7309675 +// PR4678 +namespace test0 { + // test1 should be compmiled to be a varargs function in the IR even + // though there is no way to do a va_begin. Otherwise, the optimizer + // will warn about 'dropped arguments' at the call site. + + // CHECK: define i32 @_ZN5test05test1Ez(...) + int test1(...) { + return -1; + } + + // CHECK: call i32 (...)* @_ZN5test05test1Ez(i32 0) + void test() { + test1(0); + } +} + +namespace test1 { + struct A { + int x; + int y; + }; + + void foo(...); + + void test() { + A x; + foo(x); + } + // CHECK: define void @_ZN5test14testEv() + // CHECK: [[X:%.*]] = alloca [[A:%.*]], align 4 + // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 4 + // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i8* + // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[X]] to i8* + // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T0]], i8* [[T1]], i64 8, i32 4, i1 false) + // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i64* + // CHECK-NEXT: [[T1:%.*]] = load i64* [[T0]], align 1 + // CHECK-NEXT: call void (...)* @_ZN5test13fooEz(i64 [[T1]]) + // CHECK-NEXT: ret void +} diff --git a/test/CodeGenCXX/variadic-templates.cpp b/test/CodeGenCXX/variadic-templates.cpp index 90c837067559..c56bec33a0f8 100644 --- a/test/CodeGenCXX/variadic-templates.cpp +++ b/test/CodeGenCXX/variadic-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s template<typename ...Types> int get_num_types(Types...) { diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index fdccd4604545..0f36a6a75324 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -26,8 +26,8 @@ // CHECK: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr global i64 // CHECK-HIDDEN: @_ZZN6Test193fooIiEEvvE1a = linkonce_odr hidden global // CHECK-HIDDEN: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr hidden global i64 -// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external unnamed_addr constant // CHECK-HIDDEN: @_ZTVN6Test161AIcEE = external unnamed_addr constant +// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external unnamed_addr constant // CHECK: @_ZTVN5Test63fooE = linkonce_odr hidden unnamed_addr constant namespace Test1 { diff --git a/test/CodeGenCXX/volatile-1.cpp b/test/CodeGenCXX/volatile-1.cpp index 1a69648d42a7..71ff1ed7d689 100644 --- a/test/CodeGenCXX/volatile-1.cpp +++ b/test/CodeGenCXX/volatile-1.cpp @@ -26,8 +26,8 @@ void test() { i; (float)(ci); - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: sitofp [[INT]] // These are not uses in C++: @@ -37,202 +37,202 @@ void test() { (void)a; (void)(ci=ci); - // CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) (void)(i=j); - // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i + // CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* @j + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* @i ci+=ci; - // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // Not sure why they're ordered this way. // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // Note that C++ requires an extra volatile load over C from the LHS of the '+'. + // Note that C++ requires an extra load volatile over C from the LHS of the '+'. (ci += ci) + ci; - // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] - // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) - // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: store volatile [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I1:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[R2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) + // CHECK-NEXT: [[I2:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) // These additions can be elided. // CHECK-NEXT: add [[INT]] [[R1]], [[R2]] // CHECK-NEXT: add [[INT]] [[I1]], [[I2]] asm("nop"); // CHECK-NEXT: call void asm - // Extra volatile load in C++. + // Extra load volatile in C++. (i += j) + k; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] asm("nop"); // CHECK-NEXT: call void asm - // Extra volatile load in C++. + // Extra load volatile in C++. (i += j) + 1; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] asm("nop"); // CHECK-NEXT: call void asm ci+ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add [[INT]] // CHECK-NEXT: add [[INT]] __real i; +ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile asm("nop"); // CHECK-NEXT: call void asm (void)(i=i); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (float)(i=i); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp (void)i; i=i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile - // Extra volatile load in C++. + // Extra load volatile in C++. i=i=i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile (void)__builtin_choose_expr(0, i=i, j=j); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile k ? (i=i) : (j=j); - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: icmp // CHECK-NEXT: br i1 - // CHECK: volatile load - // CHECK-NEXT: volatile store + // CHECK: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: br label - // CHECK: volatile load - // CHECK-NEXT: volatile store + // CHECK: load volatile + // CHECK-NEXT: store volatile // CHECK-NEXT: br label // CHECK: phi (void)(i,(i=i)); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile i=i,k; - // CHECK-NEXT: volatile load [[INT]]* @i - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i + // CHECK-NEXT: load volatile [[INT]]* @i + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i (i=j,k=j); - // CHECK-NEXT: volatile load [[INT]]* @j - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i - // CHECK-NEXT: volatile load [[INT]]* @j - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @k + // CHECK-NEXT: load volatile [[INT]]* @j + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i + // CHECK-NEXT: load volatile [[INT]]* @j + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k (i=j,k); - // CHECK-NEXT: volatile load [[INT]]* @j - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i + // CHECK-NEXT: load volatile [[INT]]* @j + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i (i,j); // Extra load in C++. i=c=k; - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: trunc - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: sext - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile i+=k; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add nsw [[INT]] - // CHECK-NEXT: volatile store + // CHECK-NEXT: store volatile ci; asm("nop"); // CHECK-NEXT: call void asm (int)ci; - // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0 - // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1 + // CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 0 + // CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 1 (bool)ci; - // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0 - // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1 + // CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 0 + // CHECK-NEXT: load volatile {{.*}} @ci, i32 0, i32 1 // CHECK-NEXT: icmp ne // CHECK-NEXT: icmp ne // CHECK-NEXT: or i1 ci=ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile asm("nop"); // CHECK-NEXT: call void asm // Extra load in C++. ci=ci=ci; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile __imag ci = __imag ci = __imag ci; - // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) - // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: [[T:%.*]] = load volatile [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) + // CHECK-NEXT: store volatile [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) __real (i = j); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile __imag i; @@ -258,95 +258,95 @@ void test() { // Not a use. gcc got this wrong in 4.2 and omitted the side effects // entirely, but it is fixed in 4.4.0. __imag (i = j); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile // C++ does an extra load here. Note that we have to do full loads. (float)(ci=ci); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp // Not a use, bug? gcc treats this as not a use, that's probably a // bug due to tree folding ignoring volatile. (int)(ci=ci); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // A use. (float)(i=i); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: sitofp // A use. gcc treats this as not a use, that's probably a bug due to tree // folding ignoring volatile. (int)(i=i); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // A use. -(i=j); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: sub // A use. gcc treats this a not a use, that's probably a bug due to tree // folding ignoring volatile. +(i=k); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // A use. gcc treats this a not a use, that's probably a bug due to tree // folding ignoring volatile. __real (ci=ci); - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile store + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: store volatile // A use. i + 0; - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile // CHECK-NEXT: add // A use. (i=j) + i; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add // A use. gcc treats this as not a use, that's probably a bug due to tree // folding ignoring volatile. (i=j) + 0; - // CHECK-NEXT: volatile load - // CHECK-NEXT: volatile store - // CHECK-NEXT: volatile load + // CHECK-NEXT: load volatile + // CHECK-NEXT: store volatile + // CHECK-NEXT: load volatile // CHECK-NEXT: add (i,j)=k; - // CHECK-NEXT: volatile load [[INT]]* @k - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j + // CHECK-NEXT: load volatile [[INT]]* @k + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j (j=k,i)=i; - // CHECK-NEXT: volatile load [[INT]]* @i - // CHECK-NEXT: volatile load [[INT]]* @k - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j - // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i + // CHECK-NEXT: load volatile [[INT]]* @i + // CHECK-NEXT: load volatile [[INT]]* @k + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j + // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i // CHECK-NEXT: ret void } diff --git a/test/CodeGenCXX/vtable-layout-abi-examples.cpp b/test/CodeGenCXX/vtable-layout-abi-examples.cpp index c01c5ef72cc5..8f084a9c5b7b 100644 --- a/test/CodeGenCXX/vtable-layout-abi-examples.cpp +++ b/test/CodeGenCXX/vtable-layout-abi-examples.cpp @@ -1,4 +1,15 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts 2>&1 | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>&1 +// RUN: FileCheck --check-prefix=CHECK-1 %s < %t +// RUN: FileCheck --check-prefix=CHECK-2 %s < %t +// RUN: FileCheck --check-prefix=CHECK-3 %s < %t +// RUN: FileCheck --check-prefix=CHECK-4 %s < %t +// RUN: FileCheck --check-prefix=CHECK-5 %s < %t +// RUN: FileCheck --check-prefix=CHECK-6 %s < %t +// RUN: FileCheck --check-prefix=CHECK-7 %s < %t +// RUN: FileCheck --check-prefix=CHECK-8 %s < %t +// RUN: FileCheck --check-prefix=CHECK-9 %s < %t +// RUN: FileCheck --check-prefix=CHECK-10 %s < %t +// RUN: FileCheck --check-prefix=CHECK-11 %s < %t /// Examples from the Itanium C++ ABI specification. /// http://www.codesourcery.com/public/cxx-abi/ @@ -7,13 +18,13 @@ namespace Test1 { // This is from http://www.codesourcery.com/public/cxx-abi/cxx-vtable-ex.html -// CHECK: Vtable for 'Test1::A' (5 entries). -// CHECK-NEXT: 0 | offset_to_top (0) -// CHECK-NEXT: 1 | Test1::A RTTI -// CHECK-NEXT: -- (Test1::A, 0) vtable address -- -// CHECK-NEXT: 2 | void Test1::A::f() -// CHECK-NEXT: 3 | void Test1::A::g() -// CHECK-NEXT: 4 | void Test1::A::h() +// CHECK-1: Vtable for 'Test1::A' (5 entries). +// CHECK-1-NEXT: 0 | offset_to_top (0) +// CHECK-1-NEXT: 1 | Test1::A RTTI +// CHECK-1-NEXT: -- (Test1::A, 0) vtable address -- +// CHECK-1-NEXT: 2 | void Test1::A::f() +// CHECK-1-NEXT: 3 | void Test1::A::g() +// CHECK-1-NEXT: 4 | void Test1::A::h() struct A { virtual void f (); virtual void g (); @@ -22,24 +33,24 @@ struct A { }; void A::f() {} -// CHECK: Vtable for 'Test1::B' (13 entries). -// CHECK-NEXT: 0 | vbase_offset (16) -// CHECK-NEXT: 1 | offset_to_top (0) -// CHECK-NEXT: 2 | Test1::B RTTI -// CHECK-NEXT: -- (Test1::B, 0) vtable address -- -// CHECK-NEXT: 3 | void Test1::B::f() -// CHECK-NEXT: 4 | void Test1::B::h() -// CHECK-NEXT: 5 | vcall_offset (-16) -// CHECK-NEXT: 6 | vcall_offset (0) -// CHECK-NEXT: 7 | vcall_offset (-16) -// CHECK-NEXT: 8 | offset_to_top (-16) -// CHECK-NEXT: 9 | Test1::B RTTI -// CHECK-NEXT: -- (Test1::A, 16) vtable address -- -// CHECK-NEXT: 10 | void Test1::B::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 11 | void Test1::A::g() -// CHECK-NEXT: 12 | void Test1::B::h() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] +// CHECK-2: Vtable for 'Test1::B' (13 entries). +// CHECK-2-NEXT: 0 | vbase_offset (16) +// CHECK-2-NEXT: 1 | offset_to_top (0) +// CHECK-2-NEXT: 2 | Test1::B RTTI +// CHECK-2-NEXT: -- (Test1::B, 0) vtable address -- +// CHECK-2-NEXT: 3 | void Test1::B::f() +// CHECK-2-NEXT: 4 | void Test1::B::h() +// CHECK-2-NEXT: 5 | vcall_offset (-16) +// CHECK-2-NEXT: 6 | vcall_offset (0) +// CHECK-2-NEXT: 7 | vcall_offset (-16) +// CHECK-2-NEXT: 8 | offset_to_top (-16) +// CHECK-2-NEXT: 9 | Test1::B RTTI +// CHECK-2-NEXT: -- (Test1::A, 16) vtable address -- +// CHECK-2-NEXT: 10 | void Test1::B::f() +// CHECK-2-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-2-NEXT: 11 | void Test1::A::g() +// CHECK-2-NEXT: 12 | void Test1::B::h() +// CHECK-2-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] struct B: public virtual A { void f (); void h (); @@ -47,24 +58,24 @@ struct B: public virtual A { }; void B::f() {} -// CHECK: Vtable for 'Test1::C' (13 entries). -// CHECK-NEXT: 0 | vbase_offset (16) -// CHECK-NEXT: 1 | offset_to_top (0) -// CHECK-NEXT: 2 | Test1::C RTTI -// CHECK-NEXT: -- (Test1::C, 0) vtable address -- -// CHECK-NEXT: 3 | void Test1::C::g() -// CHECK-NEXT: 4 | void Test1::C::h() -// CHECK-NEXT: 5 | vcall_offset (-16) -// CHECK-NEXT: 6 | vcall_offset (-16) -// CHECK-NEXT: 7 | vcall_offset (0) -// CHECK-NEXT: 8 | offset_to_top (-16) -// CHECK-NEXT: 9 | Test1::C RTTI -// CHECK-NEXT: -- (Test1::A, 16) vtable address -- -// CHECK-NEXT: 10 | void Test1::A::f() -// CHECK-NEXT: 11 | void Test1::C::g() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK-NEXT: 12 | void Test1::C::h() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] +// CHECK-3: Vtable for 'Test1::C' (13 entries). +// CHECK-3-NEXT: 0 | vbase_offset (16) +// CHECK-3-NEXT: 1 | offset_to_top (0) +// CHECK-3-NEXT: 2 | Test1::C RTTI +// CHECK-3-NEXT: -- (Test1::C, 0) vtable address -- +// CHECK-3-NEXT: 3 | void Test1::C::g() +// CHECK-3-NEXT: 4 | void Test1::C::h() +// CHECK-3-NEXT: 5 | vcall_offset (-16) +// CHECK-3-NEXT: 6 | vcall_offset (-16) +// CHECK-3-NEXT: 7 | vcall_offset (0) +// CHECK-3-NEXT: 8 | offset_to_top (-16) +// CHECK-3-NEXT: 9 | Test1::C RTTI +// CHECK-3-NEXT: -- (Test1::A, 16) vtable address -- +// CHECK-3-NEXT: 10 | void Test1::A::f() +// CHECK-3-NEXT: 11 | void Test1::C::g() +// CHECK-3-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-3-NEXT: 12 | void Test1::C::h() +// CHECK-3-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] struct C: public virtual A { void g (); void h (); @@ -72,33 +83,33 @@ struct C: public virtual A { }; void C::g() {} -// CHECK: Vtable for 'Test1::D' (18 entries). -// CHECK-NEXT: 0 | vbase_offset (32) -// CHECK-NEXT: 1 | offset_to_top (0) -// CHECK-NEXT: 2 | Test1::D RTTI -// CHECK-NEXT: -- (Test1::B, 0) vtable address -- -// CHECK-NEXT: -- (Test1::D, 0) vtable address -- -// CHECK-NEXT: 3 | void Test1::B::f() -// CHECK-NEXT: 4 | void Test1::D::h() -// CHECK-NEXT: 5 | vbase_offset (16) -// CHECK-NEXT: 6 | offset_to_top (-16) -// CHECK-NEXT: 7 | Test1::D RTTI -// CHECK-NEXT: -- (Test1::C, 16) vtable address -- -// CHECK-NEXT: 8 | void Test1::C::g() -// CHECK-NEXT: 9 | void Test1::D::h() -// CHECK-NEXT: [this adjustment: -16 non-virtual] -// CHECK-NEXT: 10 | vcall_offset (-32) -// CHECK-NEXT: 11 | vcall_offset (-16) -// CHECK-NEXT: 12 | vcall_offset (-32) -// CHECK-NEXT: 13 | offset_to_top (-32) -// CHECK-NEXT: 14 | Test1::D RTTI -// CHECK-NEXT: -- (Test1::A, 32) vtable address -- -// CHECK-NEXT: 15 | void Test1::B::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 16 | void Test1::C::g() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK-NEXT: 17 | void Test1::D::h() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] +// CHECK-4: Vtable for 'Test1::D' (18 entries). +// CHECK-4-NEXT: 0 | vbase_offset (32) +// CHECK-4-NEXT: 1 | offset_to_top (0) +// CHECK-4-NEXT: 2 | Test1::D RTTI +// CHECK-4-NEXT: -- (Test1::B, 0) vtable address -- +// CHECK-4-NEXT: -- (Test1::D, 0) vtable address -- +// CHECK-4-NEXT: 3 | void Test1::B::f() +// CHECK-4-NEXT: 4 | void Test1::D::h() +// CHECK-4-NEXT: 5 | vbase_offset (16) +// CHECK-4-NEXT: 6 | offset_to_top (-16) +// CHECK-4-NEXT: 7 | Test1::D RTTI +// CHECK-4-NEXT: -- (Test1::C, 16) vtable address -- +// CHECK-4-NEXT: 8 | void Test1::C::g() +// CHECK-4-NEXT: 9 | void Test1::D::h() +// CHECK-4-NEXT: [this adjustment: -16 non-virtual] +// CHECK-4-NEXT: 10 | vcall_offset (-32) +// CHECK-4-NEXT: 11 | vcall_offset (-16) +// CHECK-4-NEXT: 12 | vcall_offset (-32) +// CHECK-4-NEXT: 13 | offset_to_top (-32) +// CHECK-4-NEXT: 14 | Test1::D RTTI +// CHECK-4-NEXT: -- (Test1::A, 32) vtable address -- +// CHECK-4-NEXT: 15 | void Test1::B::f() +// CHECK-4-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-4-NEXT: 16 | void Test1::C::g() +// CHECK-4-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-4-NEXT: 17 | void Test1::D::h() +// CHECK-4-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] struct D: public B, public C { void h (); int id; @@ -110,43 +121,43 @@ struct X { virtual void x(); }; -// CHECK: Vtable for 'Test1::E' (24 entries). -// CHECK-NEXT: 0 | vbase_offset (56) -// CHECK-NEXT: 1 | offset_to_top (0) -// CHECK-NEXT: 2 | Test1::E RTTI -// CHECK-NEXT: -- (Test1::E, 0) vtable address -- -// CHECK-NEXT: -- (Test1::X, 0) vtable address -- -// CHECK-NEXT: 3 | void Test1::X::x() -// CHECK-NEXT: 4 | void Test1::E::f() -// CHECK-NEXT: 5 | void Test1::E::h() -// CHECK-NEXT: 6 | vbase_offset (40) -// CHECK-NEXT: 7 | offset_to_top (-16) -// CHECK-NEXT: 8 | Test1::E RTTI -// CHECK-NEXT: -- (Test1::B, 16) vtable address -- -// CHECK-NEXT: -- (Test1::D, 16) vtable address -- -// CHECK-NEXT: 9 | void Test1::E::f() -// CHECK-NEXT: [this adjustment: -16 non-virtual] -// CHECK-NEXT: 10 | void Test1::E::h() -// CHECK-NEXT: [this adjustment: -16 non-virtual] -// CHECK-NEXT: 11 | vbase_offset (24) -// CHECK-NEXT: 12 | offset_to_top (-32) -// CHECK-NEXT: 13 | Test1::E RTTI -// CHECK-NEXT: -- (Test1::C, 32) vtable address -- -// CHECK-NEXT: 14 | void Test1::C::g() -// CHECK-NEXT: 15 | void Test1::E::h() -// CHECK-NEXT: [this adjustment: -32 non-virtual] -// CHECK-NEXT: 16 | vcall_offset (-56) -// CHECK-NEXT: 17 | vcall_offset (-24) -// CHECK-NEXT: 18 | vcall_offset (-56) -// CHECK-NEXT: 19 | offset_to_top (-56) -// CHECK-NEXT: 20 | Test1::E RTTI -// CHECK-NEXT: -- (Test1::A, 56) vtable address -- -// CHECK-NEXT: 21 | void Test1::E::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 22 | void Test1::C::g() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK-NEXT: 23 | void Test1::E::h() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] +// CHECK-5: Vtable for 'Test1::E' (24 entries). +// CHECK-5-NEXT: 0 | vbase_offset (56) +// CHECK-5-NEXT: 1 | offset_to_top (0) +// CHECK-5-NEXT: 2 | Test1::E RTTI +// CHECK-5-NEXT: -- (Test1::E, 0) vtable address -- +// CHECK-5-NEXT: -- (Test1::X, 0) vtable address -- +// CHECK-5-NEXT: 3 | void Test1::X::x() +// CHECK-5-NEXT: 4 | void Test1::E::f() +// CHECK-5-NEXT: 5 | void Test1::E::h() +// CHECK-5-NEXT: 6 | vbase_offset (40) +// CHECK-5-NEXT: 7 | offset_to_top (-16) +// CHECK-5-NEXT: 8 | Test1::E RTTI +// CHECK-5-NEXT: -- (Test1::B, 16) vtable address -- +// CHECK-5-NEXT: -- (Test1::D, 16) vtable address -- +// CHECK-5-NEXT: 9 | void Test1::E::f() +// CHECK-5-NEXT: [this adjustment: -16 non-virtual] +// CHECK-5-NEXT: 10 | void Test1::E::h() +// CHECK-5-NEXT: [this adjustment: -16 non-virtual] +// CHECK-5-NEXT: 11 | vbase_offset (24) +// CHECK-5-NEXT: 12 | offset_to_top (-32) +// CHECK-5-NEXT: 13 | Test1::E RTTI +// CHECK-5-NEXT: -- (Test1::C, 32) vtable address -- +// CHECK-5-NEXT: 14 | void Test1::C::g() +// CHECK-5-NEXT: 15 | void Test1::E::h() +// CHECK-5-NEXT: [this adjustment: -32 non-virtual] +// CHECK-5-NEXT: 16 | vcall_offset (-56) +// CHECK-5-NEXT: 17 | vcall_offset (-24) +// CHECK-5-NEXT: 18 | vcall_offset (-56) +// CHECK-5-NEXT: 19 | offset_to_top (-56) +// CHECK-5-NEXT: 20 | Test1::E RTTI +// CHECK-5-NEXT: -- (Test1::A, 56) vtable address -- +// CHECK-5-NEXT: 21 | void Test1::E::f() +// CHECK-5-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-5-NEXT: 22 | void Test1::C::g() +// CHECK-5-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-5-NEXT: 23 | void Test1::E::h() +// CHECK-5-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] struct E : X, D { int ie; void f(); @@ -164,22 +175,22 @@ struct A { virtual void f(); }; struct B : virtual public A { int i; }; struct C : virtual public A { int j; }; -// CHECK: Vtable for 'Test2::D' (11 entries). -// CHECK-NEXT: 0 | vbase_offset (0) -// CHECK-NEXT: 1 | vcall_offset (0) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test2::D RTTI -// CHECK-NEXT: -- (Test2::A, 0) vtable address -- -// CHECK-NEXT: -- (Test2::B, 0) vtable address -- -// CHECK-NEXT: -- (Test2::D, 0) vtable address -- -// CHECK-NEXT: 4 | void Test2::A::f() -// CHECK-NEXT: 5 | void Test2::D::d() -// CHECK-NEXT: 6 | vbase_offset (-16) -// CHECK-NEXT: 7 | vcall_offset (-16) -// CHECK-NEXT: 8 | offset_to_top (-16) -// CHECK-NEXT: 9 | Test2::D RTTI -// CHECK-NEXT: -- (Test2::C, 16) vtable address -- -// CHECK-NEXT: 10 | [unused] void Test2::A::f() +// CHECK-6: Vtable for 'Test2::D' (11 entries). +// CHECK-6-NEXT: 0 | vbase_offset (0) +// CHECK-6-NEXT: 1 | vcall_offset (0) +// CHECK-6-NEXT: 2 | offset_to_top (0) +// CHECK-6-NEXT: 3 | Test2::D RTTI +// CHECK-6-NEXT: -- (Test2::A, 0) vtable address -- +// CHECK-6-NEXT: -- (Test2::B, 0) vtable address -- +// CHECK-6-NEXT: -- (Test2::D, 0) vtable address -- +// CHECK-6-NEXT: 4 | void Test2::A::f() +// CHECK-6-NEXT: 5 | void Test2::D::d() +// CHECK-6-NEXT: 6 | vbase_offset (-16) +// CHECK-6-NEXT: 7 | vcall_offset (-16) +// CHECK-6-NEXT: 8 | offset_to_top (-16) +// CHECK-6-NEXT: 9 | Test2::D RTTI +// CHECK-6-NEXT: -- (Test2::C, 16) vtable address -- +// CHECK-6-NEXT: 10 | [unused] void Test2::A::f() struct D : public B, public C { virtual void d(); }; @@ -201,40 +212,40 @@ struct V2 : virtual V1 { virtual void f(); }; -// CHECK: Vtable for 'Test3::C' (14 entries). -// CHECK-NEXT: 0 | vbase_offset (32) -// CHECK-NEXT: 1 | vbase_offset (16) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::C, 0) vtable address -- -// CHECK-NEXT: 4 | void Test3::C::f() -// CHECK-NEXT: 5 | vcall_offset (-16) -// CHECK-NEXT: 6 | offset_to_top (-16) -// CHECK-NEXT: 7 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::V1, 16) vtable address -- -// CHECK-NEXT: 8 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 9 | vcall_offset (-32) -// CHECK-NEXT: 10 | vbase_offset (-16) -// CHECK-NEXT: 11 | offset_to_top (-32) -// CHECK-NEXT: 12 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::V2, 32) vtable address -- -// CHECK-NEXT: 13 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-7: Vtable for 'Test3::C' (14 entries). +// CHECK-7-NEXT: 0 | vbase_offset (32) +// CHECK-7-NEXT: 1 | vbase_offset (16) +// CHECK-7-NEXT: 2 | offset_to_top (0) +// CHECK-7-NEXT: 3 | Test3::C RTTI +// CHECK-7-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-7-NEXT: 4 | void Test3::C::f() +// CHECK-7-NEXT: 5 | vcall_offset (-16) +// CHECK-7-NEXT: 6 | offset_to_top (-16) +// CHECK-7-NEXT: 7 | Test3::C RTTI +// CHECK-7-NEXT: -- (Test3::V1, 16) vtable address -- +// CHECK-7-NEXT: 8 | void Test3::C::f() +// CHECK-7-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-7-NEXT: 9 | vcall_offset (-32) +// CHECK-7-NEXT: 10 | vbase_offset (-16) +// CHECK-7-NEXT: 11 | offset_to_top (-32) +// CHECK-7-NEXT: 12 | Test3::C RTTI +// CHECK-7-NEXT: -- (Test3::V2, 32) vtable address -- +// CHECK-7-NEXT: 13 | void Test3::C::f() +// CHECK-7-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK: Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries). -// CHECK-NEXT: 0 | vcall_offset (0) -// CHECK-NEXT: 1 | vbase_offset (-16) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test3::V2 RTTI -// CHECK-NEXT: -- (Test3::V2, 32) vtable address -- -// CHECK-NEXT: 4 | void Test3::V2::f() -// CHECK-NEXT: 5 | vcall_offset (16) -// CHECK-NEXT: 6 | offset_to_top (16) -// CHECK-NEXT: 7 | Test3::V2 RTTI -// CHECK-NEXT: -- (Test3::V1, 16) vtable address -- -// CHECK-NEXT: 8 | void Test3::V2::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-8: Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries). +// CHECK-8-NEXT: 0 | vcall_offset (0) +// CHECK-8-NEXT: 1 | vbase_offset (-16) +// CHECK-8-NEXT: 2 | offset_to_top (0) +// CHECK-8-NEXT: 3 | Test3::V2 RTTI +// CHECK-8-NEXT: -- (Test3::V2, 32) vtable address -- +// CHECK-8-NEXT: 4 | void Test3::V2::f() +// CHECK-8-NEXT: 5 | vcall_offset (16) +// CHECK-8-NEXT: 6 | offset_to_top (16) +// CHECK-8-NEXT: 7 | Test3::V2 RTTI +// CHECK-8-NEXT: -- (Test3::V1, 16) vtable address -- +// CHECK-8-NEXT: 8 | void Test3::V2::f() +// CHECK-8-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] struct C : virtual V1, virtual V2 { int c; virtual void f(); @@ -245,63 +256,63 @@ struct B { int b; }; -// CHECK: Vtable for 'Test3::D' (15 entries). -// CHECK-NEXT: 0 | vbase_offset (40) -// CHECK-NEXT: 1 | vbase_offset (24) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test3::D RTTI -// CHECK-NEXT: -- (Test3::C, 0) vtable address -- -// CHECK-NEXT: -- (Test3::D, 0) vtable address -- -// CHECK-NEXT: 4 | void Test3::C::f() -// CHECK-NEXT: 5 | void Test3::D::g() -// CHECK-NEXT: 6 | vcall_offset (-24) -// CHECK-NEXT: 7 | offset_to_top (-24) -// CHECK-NEXT: 8 | Test3::D RTTI -// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- -// CHECK-NEXT: 9 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 10 | vcall_offset (-40) -// CHECK-NEXT: 11 | vbase_offset (-16) -// CHECK-NEXT: 12 | offset_to_top (-40) -// CHECK-NEXT: 13 | Test3::D RTTI -// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- -// CHECK-NEXT: 14 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-9: Vtable for 'Test3::D' (15 entries). +// CHECK-9-NEXT: 0 | vbase_offset (40) +// CHECK-9-NEXT: 1 | vbase_offset (24) +// CHECK-9-NEXT: 2 | offset_to_top (0) +// CHECK-9-NEXT: 3 | Test3::D RTTI +// CHECK-9-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-9-NEXT: -- (Test3::D, 0) vtable address -- +// CHECK-9-NEXT: 4 | void Test3::C::f() +// CHECK-9-NEXT: 5 | void Test3::D::g() +// CHECK-9-NEXT: 6 | vcall_offset (-24) +// CHECK-9-NEXT: 7 | offset_to_top (-24) +// CHECK-9-NEXT: 8 | Test3::D RTTI +// CHECK-9-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-9-NEXT: 9 | void Test3::C::f() +// CHECK-9-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-9-NEXT: 10 | vcall_offset (-40) +// CHECK-9-NEXT: 11 | vbase_offset (-16) +// CHECK-9-NEXT: 12 | offset_to_top (-40) +// CHECK-9-NEXT: 13 | Test3::D RTTI +// CHECK-9-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-9-NEXT: 14 | void Test3::C::f() +// CHECK-9-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK: Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries). -// CHECK-NEXT: 0 | vbase_offset (40) -// CHECK-NEXT: 1 | vbase_offset (24) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::C, 0) vtable address -- -// CHECK-NEXT: 4 | void Test3::C::f() -// CHECK-NEXT: 5 | vcall_offset (-24) -// CHECK-NEXT: 6 | offset_to_top (-24) -// CHECK-NEXT: 7 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- -// CHECK-NEXT: 8 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] -// CHECK-NEXT: 9 | vcall_offset (-40) -// CHECK-NEXT: 10 | vbase_offset (-16) -// CHECK-NEXT: 11 | offset_to_top (-40) -// CHECK-NEXT: 12 | Test3::C RTTI -// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- -// CHECK-NEXT: 13 | void Test3::C::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] +// CHECK-10: Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries). +// CHECK-10-NEXT: 0 | vbase_offset (40) +// CHECK-10-NEXT: 1 | vbase_offset (24) +// CHECK-10-NEXT: 2 | offset_to_top (0) +// CHECK-10-NEXT: 3 | Test3::C RTTI +// CHECK-10-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-10-NEXT: 4 | void Test3::C::f() +// CHECK-10-NEXT: 5 | vcall_offset (-24) +// CHECK-10-NEXT: 6 | offset_to_top (-24) +// CHECK-10-NEXT: 7 | Test3::C RTTI +// CHECK-10-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-10-NEXT: 8 | void Test3::C::f() +// CHECK-10-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-10-NEXT: 9 | vcall_offset (-40) +// CHECK-10-NEXT: 10 | vbase_offset (-16) +// CHECK-10-NEXT: 11 | offset_to_top (-40) +// CHECK-10-NEXT: 12 | Test3::C RTTI +// CHECK-10-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-10-NEXT: 13 | void Test3::C::f() +// CHECK-10-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] -// CHECK: Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries). -// CHECK-NEXT: 0 | vcall_offset (0) -// CHECK-NEXT: 1 | vbase_offset (-16) -// CHECK-NEXT: 2 | offset_to_top (0) -// CHECK-NEXT: 3 | Test3::V2 RTTI -// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- -// CHECK-NEXT: 4 | void Test3::V2::f() -// CHECK-NEXT: 5 | vcall_offset (16) -// CHECK-NEXT: 6 | offset_to_top (16) -// CHECK-NEXT: 7 | Test3::V2 RTTI -// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- -// CHECK-NEXT: 8 | void Test3::V2::f() -// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-11: Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries). +// CHECK-11-NEXT: 0 | vcall_offset (0) +// CHECK-11-NEXT: 1 | vbase_offset (-16) +// CHECK-11-NEXT: 2 | offset_to_top (0) +// CHECK-11-NEXT: 3 | Test3::V2 RTTI +// CHECK-11-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-11-NEXT: 4 | void Test3::V2::f() +// CHECK-11-NEXT: 5 | vcall_offset (16) +// CHECK-11-NEXT: 6 | offset_to_top (16) +// CHECK-11-NEXT: 7 | Test3::V2 RTTI +// CHECK-11-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-11-NEXT: 8 | void Test3::V2::f() +// CHECK-11-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] struct D : B, C { int d; virtual void g(); diff --git a/test/CodeGenCXX/weak-external.cpp b/test/CodeGenCXX/weak-external.cpp new file mode 100644 index 000000000000..dad54f6861b0 --- /dev/null +++ b/test/CodeGenCXX/weak-external.cpp @@ -0,0 +1,66 @@ +// RUN: %clang -fexceptions %s -S -emit-llvm -o - | FileCheck %s +// PR4262 + +// CHECK-NOT: _ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag + +// The "basic_string" extern template instantiation declaration is supposed to +// suppress the implicit instantiation of non-inline member functions. Make sure +// that we suppress the implicit instantiation of non-inline member functions +// defined out-of-line. That we aren't instantiating the basic_string +// constructor when we shouldn't be. Such an instantiation forces the implicit +// instantiation of _S_construct<const char*>. Since _S_construct is a member +// template, it's instantiation is *not* suppressed (despite being in +// basic_string<char>), so we would emit it as a weak definition. + +#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) +#if (__has_feature(cxx_noexcept)) +# define _NOEXCEPT noexcept +# define _NOEXCEPT_(x) noexcept(x) +#else +# define _NOEXCEPT throw() +# define _NOEXCEPT_(x) +#endif + +namespace std // purposefully not using versioning namespace +{ + +template<class charT> struct char_traits; +template<class T> class allocator; +template <class _CharT, + class _Traits = char_traits<_CharT>, + class _Allocator = allocator<_CharT> > + class _LIBCPP_VISIBLE basic_string; +typedef basic_string<char, char_traits<char>, allocator<char> > string; + +class _LIBCPP_EXCEPTION_ABI exception +{ +public: + _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; +}; + +class _LIBCPP_EXCEPTION_ABI runtime_error + : public exception +{ +private: + void* __imp_; +public: + explicit runtime_error(const string&); + explicit runtime_error(const char*); + + runtime_error(const runtime_error&) _NOEXCEPT; + runtime_error& operator=(const runtime_error&) _NOEXCEPT; + + virtual ~runtime_error() _NOEXCEPT; + + virtual const char* what() const _NOEXCEPT; +}; + +} + +void dummysymbol() { + throw(std::runtime_error("string")); +} diff --git a/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp b/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp new file mode 100644 index 000000000000..1aa80f2d6e6f --- /dev/null +++ b/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// XTARGET: x86 +// PR4242 +// (PR 4242 bug is on 64-bit only, test passes on x86-32 as well) + +struct S { + void* data[3]; +}; + +struct T { + void* data[2]; +}; + +// CHECK: %struct.T* byval +extern "C" S fail(int, int, int, int, T t, void* p) { + S s; + s.data[0] = t.data[0]; + s.data[1] = t.data[1]; + s.data[2] = p; + return s; +} + +// CHECK: %struct.T* byval +extern "C" S* succeed(S* sret, int, int, int, int, T t, void* p) { + sret->data[0] = t.data[0]; + sret->data[1] = t.data[1]; + sret->data[2] = p; + return sret; +} diff --git a/test/CodeGenCXX/x86_32-arguments.cpp b/test/CodeGenCXX/x86_32-arguments.cpp index 4d4339381dbe..1cbeb71b2285 100644 --- a/test/CodeGenCXX/x86_32-arguments.cpp +++ b/test/CodeGenCXX/x86_32-arguments.cpp @@ -6,7 +6,7 @@ struct S { short s; }; -// CHECK: define void @_Z1fv(%struct.S* sret % +// CHECK: define void @_Z1fv(%struct.S* noalias sret % S f() { return S(); } // CHECK: define void @_Z1f1S(%struct.S*) void f(S) { } @@ -18,7 +18,7 @@ public: double c; }; -// CHECK: define void @_Z1gv(%class.C* sret % +// CHECK: define void @_Z1gv(%class.C* noalias sret % C g() { return C(); } // CHECK: define void @_Z1f1C(%class.C*) @@ -103,13 +103,13 @@ struct s7_1 { double x; }; struct s7 : s7_0, s7_1 { }; s7 f7() { return s7(); } -// CHECK: define void @_Z2f8v(%struct.s8* sret %agg.result) +// CHECK: define void @_Z2f8v(%struct.s8* noalias sret %agg.result) struct s8_0 { }; struct s8_1 { double x; }; struct s8 { s8_0 a; s8_1 b; }; s8 f8() { return s8(); } -// CHECK: define void @_Z2f9v(%struct.s9* sret %agg.result) +// CHECK: define void @_Z2f9v(%struct.s9* noalias sret %agg.result) struct s9_0 { unsigned : 0; }; struct s9_1 { double x; }; struct s9 { s9_0 a; s9_1 b; }; diff --git a/test/CodeGenObjC/2007-04-03-ObjcEH.m b/test/CodeGenObjC/2007-04-03-ObjcEH.m new file mode 100644 index 000000000000..f86ff49bbbd5 --- /dev/null +++ b/test/CodeGenObjC/2007-04-03-ObjcEH.m @@ -0,0 +1,27 @@ +// RUN: %clang -fexceptions -S -emit-llvm %s -o - + +@interface B +-(int)bar; +@end + +@interface A +-(void) Foo:(int) state; +@end + +@implementation A +- (void) Foo:(int) state { + + int wasResponded = 0; + @try { + if (state) { + B * b = 0; + @try { } + @finally { + wasResponded = ![b bar]; + } + } + } + @finally { + } +} +@end diff --git a/test/CodeGenObjC/2007-05-02-Strong.m b/test/CodeGenObjC/2007-05-02-Strong.m new file mode 100644 index 000000000000..31553df6130a --- /dev/null +++ b/test/CodeGenObjC/2007-05-02-Strong.m @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -S %s -fobjc-gc -o /dev/null +typedef int NSInteger; +typedef struct _NSRect { + int origin; + int size; +} NSRect; + +__attribute__((objc_gc(strong))) NSRect *_cachedRectArray; +extern const NSRect NSZeroRect; +@interface A{ +} +-(void)bar:(NSInteger *)rectCount; +@end + +@implementation A + +-(void)bar:(NSInteger *)rectCount { + NSRect appendRect = NSZeroRect; + + _cachedRectArray[*rectCount - 1] = NSZeroRect; +} + +@end diff --git a/test/CodeGenObjC/2007-10-18-ProDescriptor.m b/test/CodeGenObjC/2007-10-18-ProDescriptor.m new file mode 100644 index 000000000000..35a0df3a1a9f --- /dev/null +++ b/test/CodeGenObjC/2007-10-18-ProDescriptor.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +@protocol O +@end +@interface O < O > { +} +@end +struct A { +}; +@protocol AB +- (unsigned) ver; +@end +@interface AGy:O < AB > { +} +@end +@implementation AGy +- (unsigned) ver { +} +@end diff --git a/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m b/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m new file mode 100644 index 000000000000..af8508b6463a --- /dev/null +++ b/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -fobjc-gc +// rdar://5541393 + +typedef unsigned int NSUInteger; +__attribute__((objc_gc(strong))) float *_scores; + +void foo(int i, float f) { + _scores[i] = f; +} diff --git a/test/CodeGenObjC/2008-10-3-EhValue.m b/test/CodeGenObjC/2008-10-3-EhValue.m new file mode 100644 index 000000000000..0ed0d8993977 --- /dev/null +++ b/test/CodeGenObjC/2008-10-3-EhValue.m @@ -0,0 +1,50 @@ +// RUN: %clang -fexceptions -S -emit-llvm %s -o /dev/null + +@interface Object { +@public + Class isa; +} ++initialize; ++alloc; ++new; ++free; +-free; ++(Class)class; +-(Class)class; +-init; +-superclass; +-(const char *)name; +@end + +@interface Frob: Object +@end + +@implementation Frob: Object +@end + +static Frob* _connection = ((void *)0); + +extern void abort(void); + +void test (Object* sendPort) +{ + int cleanupPorts = 1; + Frob* receivePort = ((void *)0); + + @try { + receivePort = (Frob *) -1; + _connection = (Frob *) -1; + receivePort = ((void *)0); + sendPort = ((void *)0); + cleanupPorts = 0; + @throw [Object new]; + } + @catch(Frob *obj) { + if(!(0)) abort(); + } + @catch(id exc) { + if(!(!receivePort)) abort(); + if(!(!sendPort)) abort(); + if(!(!cleanupPorts)) abort(); + } +} diff --git a/test/CodeGenObjC/2008-11-12-Metadata.m b/test/CodeGenObjC/2008-11-12-Metadata.m new file mode 100644 index 000000000000..afd7ce035aea --- /dev/null +++ b/test/CodeGenObjC/2008-11-12-Metadata.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -fobjc-fragile-abi %s -o /dev/null + +@interface A +@end +@protocol P +@end +@interface B : A <P> +{ +} +@end +@implementation B +- (void)test { +} +@end diff --git a/test/CodeGenObjC/2008-11-24-ConstCFStrings.m b/test/CodeGenObjC/2008-11-24-ConstCFStrings.m new file mode 100644 index 000000000000..b37f66c29707 --- /dev/null +++ b/test/CodeGenObjC/2008-11-24-ConstCFStrings.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -fobjc-fragile-abi %s -o - | FileCheck %s + +// CHECK: _unnamed_cfstring_ + +@class NSString; + +@interface A +- (void)bork:(NSString*)msg; +@end + +void func(A *a) { + [a bork:@"Hello world!"]; +} diff --git a/test/CodeGenObjC/2008-11-25-Blocks.m b/test/CodeGenObjC/2008-11-25-Blocks.m new file mode 100644 index 000000000000..39364d5de00a --- /dev/null +++ b/test/CodeGenObjC/2008-11-25-Blocks.m @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fblocks -emit-llvm %s -o /dev/null +// rdar://6394879 + +@interface bork +- (id)B:(void (^)())blk; +- (void)C; +@end +@implementation bork +- (id)B:(void (^)())blk { + __attribute__((__blocks__(byref))) bork* new = ((void *)0); + blk(); +} +- (void)C { + __attribute__((__blocks__(byref))) id var; + [self B:^() {}]; +} +@end diff --git a/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m b/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m new file mode 100644 index 000000000000..d7219f185ba7 --- /dev/null +++ b/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fblocks -emit-llvm %s -fobjc-gc -o - | FileCheck %s + +// CHECK: objc_assign_strongCast +// rdar://5541393 + +typedef __SIZE_TYPE__ size_t; +void * malloc(size_t size); + +typedef struct { + void (^ivarBlock)(void); +} StructWithBlock_t; + +int main(int argc, char *argv[]) { + StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*)); + __block int i = 10; + // assigning a Block into an struct slot should elicit a write-barrier under GC + swbp->ivarBlock = ^ { ++i; }; + return 0; +} diff --git a/test/CodeGenObjC/2009-02-05-VolatileProp.m b/test/CodeGenObjC/2009-02-05-VolatileProp.m new file mode 100644 index 000000000000..1f696ac7c2d0 --- /dev/null +++ b/test/CodeGenObjC/2009-02-05-VolatileProp.m @@ -0,0 +1,10 @@ +// RUN: %clang -fexceptions -S -emit-llvm %s -o /dev/null -pedantic-errors +// rdar://6551276 + +void foo(const unsigned short *); +void bar() { + unsigned short *s[3]; + int i; + @try { } @catch (id anException) { } + foo(2+s[i]); +} diff --git a/test/CodeGenObjC/2009-08-05-utf16.m b/test/CodeGenObjC/2009-08-05-utf16.m new file mode 100644 index 000000000000..38c9c82e7835 --- /dev/null +++ b/test/CodeGenObjC/2009-08-05-utf16.m @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm -w -x objective-c %s -o - | FileCheck %s +// rdar://7095855 rdar://7115749 + +// CHECK: internal unnamed_addr constant [12 x i8] +void *P = @"iPodâ„¢"; diff --git a/test/CodeGenObjC/2010-02-01-utf16-with-null.m b/test/CodeGenObjC/2010-02-01-utf16-with-null.m new file mode 100644 index 000000000000..1863984c216e --- /dev/null +++ b/test/CodeGenObjC/2010-02-01-utf16-with-null.m @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// rdar://7589850 + +// CHECK-NOT: __ustring +void *P = @"good\0bye"; diff --git a/test/CodeGenObjC/2010-02-23-DbgInheritance.m b/test/CodeGenObjC/2010-02-23-DbgInheritance.m new file mode 100644 index 000000000000..7d31b30cce5f --- /dev/null +++ b/test/CodeGenObjC/2010-02-23-DbgInheritance.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -g -o - | FileCheck %s +// CHECK-NOT: DW_TAG_member +// Interface P should not be a member of interface I in debug info. +@interface P +@end + +@interface I : P +@end + +void fn(I *iptr) {} diff --git a/test/CodeGenObjC/2010-03-17-StructRef.m b/test/CodeGenObjC/2010-03-17-StructRef.m new file mode 100644 index 000000000000..fd0e6462ce2e --- /dev/null +++ b/test/CodeGenObjC/2010-03-17-StructRef.m @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -fobjc-fragile-abi -o - | FileCheck %s +// Bitfield references must not touch memory outside of the enclosing +// struct. Radar 7639995 +typedef signed char BOOL; +@protocol NSObject +- (id)init; +@end +@interface NSObject <NSObject> {} +@end +@interface IMAVChatParticipant : NSObject { + int _ardRole; + int _state; + int _avRelayStatus; + int _chatEndedReason; + int _chatError; + unsigned _sendingAudio:1; + unsigned _sendingVideo:1; + unsigned _sendingAuxVideo:1; + unsigned _audioMuted:1; + unsigned _videoPaused:1; + unsigned _networkStalled:1; + unsigned _isInitiator:1; + unsigned _isAOLInterop:1; + unsigned _isRecording:1; + unsigned _isUsingICE:1; +} +@end +@implementation IMAVChatParticipant +- (id) init { + self = [super init]; + if ( self ) { + BOOL blah = (BOOL)1; + // We're expecting these three bitfield assignments will generate i8 stores. + _sendingAudio = (BOOL)1; + _isUsingICE = (BOOL)1; + _isUsingICE = blah; + // CHECK: store i8 + // CHECK: store i8 + // CHECK: store i8 + } + return self; +} +@end diff --git a/test/CodeGenObjC/2011-03-08-IVarLookup.m b/test/CodeGenObjC/2011-03-08-IVarLookup.m new file mode 100644 index 000000000000..a24b98c3ac6c --- /dev/null +++ b/test/CodeGenObjC/2011-03-08-IVarLookup.m @@ -0,0 +1,30 @@ +// RUN: %clang -S -emit-llvm -m64 -fobjc-abi-version=2 %s -o /dev/null + +typedef unsigned int UInt_t; + +@interface A +{ +@protected + UInt_t _f1; +} +@end + +@interface B : A { } +@end + +@interface A () +@property (assign) UInt_t f1; +@end + +@interface B () +@property (assign) int x; +@end + +@implementation B +@synthesize x; +- (id) init +{ + _f1 = 0; + return self; +} +@end diff --git a/test/CodeGenObjC/arc-arm.m b/test/CodeGenObjC/arc-arm.m index a3d55c28f400..23da3be2a5dd 100644 --- a/test/CodeGenObjC/arc-arm.m +++ b/test/CodeGenObjC/arc-arm.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s id test0(void) { extern id test0_helper(void); diff --git a/test/CodeGenObjC/arc-block-copy-escape.m b/test/CodeGenObjC/arc-block-copy-escape.m new file mode 100644 index 000000000000..15c0d1d0f496 --- /dev/null +++ b/test/CodeGenObjC/arc-block-copy-escape.m @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fobjc-arc -fblocks -emit-llvm %s -o - | FileCheck %s + +typedef void (^block_t)(void); +void use_block(block_t); +void use_int(int); + +// rdar://problem/10211676 + +void test0(int i) { + block_t block = ^{ use_int(i); }; + // CHECK: define void @test0( + // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) nounwind, !clang.arc.copy_on_escape + // CHECK: ret void +} + +void test1(int i) { + id block = ^{ use_int(i); }; + // CHECK: define void @test1( + // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) nounwind + // CHECK-NOT: !clang.arc.copy_on_escape + // CHECK: ret void +} diff --git a/test/CodeGenObjC/arc-block-ivar-layout.m b/test/CodeGenObjC/arc-block-ivar-layout.m index 50c35bacda06..6c82f2969823 100644 --- a/test/CodeGenObjC/arc-block-ivar-layout.m +++ b/test/CodeGenObjC/arc-block-ivar-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // rdar://8991729 diff --git a/test/CodeGenObjC/arc-bridged-cast.m b/test/CodeGenObjC/arc-bridged-cast.m index 3354bda5bf00..eb9045d3d840 100644 --- a/test/CodeGenObjC/arc-bridged-cast.m +++ b/test/CodeGenObjC/arc-bridged-cast.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; diff --git a/test/CodeGenObjC/arc-compound-stmt.m b/test/CodeGenObjC/arc-compound-stmt.m index 946d72f00591..573ee449aaae 100644 --- a/test/CodeGenObjC/arc-compound-stmt.m +++ b/test/CodeGenObjC/arc-compound-stmt.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-arc -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - %s // rdar://9694706 typedef unsigned long NSUInteger; diff --git a/test/CodeGenObjC/arc-foreach.m b/test/CodeGenObjC/arc-foreach.m index f9d7782fbedd..9449b3d2d602 100644 --- a/test/CodeGenObjC/arc-foreach.m +++ b/test/CodeGenObjC/arc-foreach.m @@ -1,11 +1,17 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // rdar://9503326 // rdar://9606600 extern void use(id); extern void use_block(void (^)(void)); -@class NSArray; + +struct NSFastEnumerationState; +@interface NSArray +- (unsigned long) countByEnumeratingWithState: (struct NSFastEnumerationState*) state + objects: (id*) buffer + count: (unsigned long) bufferSize; +@end; void test0(NSArray *array) { // 'x' should be initialized without a retain. @@ -17,12 +23,37 @@ void test0(NSArray *array) { } // CHECK-LP64: define void @test0( -// CHECK-LP64: alloca [[ARRAY_T:%.*]]*, +// CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*, // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]], -// CHECK-LP64-NEXT: alloca [16 x i8*], align 8 +// CHECK-LP64-NEXT: [[BUFFER:%.*]] = alloca [16 x i8*], align 8 // CHECK-LP64-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], +// Initialize 'array'. +// CHECK-LP64-NEXT: [[T0:%.*]] = bitcast [[ARRAY_T:%.*]]* {{%.*}} to i8* +// CHECK-LP64-NEXT: [[T1:%.*]] = call i8* @objc_retain(i8* [[T0]]) +// CHECK-LP64-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to [[ARRAY_T]]* +// CHECK-LP64-NEXT: store [[ARRAY_T]]* [[T2]], [[ARRAY_T]]** [[ARRAY]], align 8 + +// Initialize the fast enumaration state. +// CHECK-LP64-NEXT: [[T0:%.*]] = bitcast [[STATE_T]]* [[STATE]] to i8* +// CHECK-LP64-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 64, i32 8, i1 false) + +// Evaluate the collection expression and retain. +// CHECK-LP64-NEXT: [[T0:%.*]] = load [[ARRAY_T]]** [[ARRAY]], align 8 +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[T0]] to i8* +// CHECK-LP64-NEXT: [[T2:%.*]] = call i8* @objc_retain(i8* [[T1]]) +// CHECK-LP64-NEXT: [[SAVED_ARRAY:%.*]] = bitcast i8* [[T2]] to [[ARRAY_T]]* + +// Call the enumeration method. +// CHECK-LP64-NEXT: [[T0:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* +// CHECK-LP64-NEXT: [[SIZE:%.*]] = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, [[STATE_T]]*, [16 x i8*]*, i64)*)(i8* [[T1]], i8* [[T0]], [[STATE_T]]* [[STATE]], [16 x i8*]* [[BUFFER]], i64 16) + +// Check for a nonzero result. +// CHECK-LP64-NEXT: [[T0:%.*]] = icmp eq i64 [[SIZE]], 0 +// CHECK-LP64-NEXT: br i1 [[T0]] + // CHECK-LP64: [[T0:%.*]] = getelementptr inbounds [[STATE_T]]* [[STATE]], i32 0, i32 1 // CHECK-LP64-NEXT: [[T1:%.*]] = load i8*** [[T0]] // CHECK-LP64-NEXT: [[T2:%.*]] = getelementptr i8** [[T1]], i64 @@ -38,6 +69,20 @@ void test0(NSArray *array) { // CHECK-LP64-NEXT: [[T1:%.*]] = load i8** [[T0]] // CHECK-LP64-NEXT: call void @objc_release(i8* [[T1]]) +// CHECK-LP64: [[T0:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* +// CHECK-LP64-NEXT: [[SIZE:%.*]] = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, [[STATE_T]]*, [16 x i8*]*, i64)*)(i8* [[T1]], i8* [[T0]], [[STATE_T]]* [[STATE]], [16 x i8*]* [[BUFFER]], i64 16) + +// Release the array. +// CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[SAVED_ARRAY]] to i8* +// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]]) + +// Destroy 'array'. +// CHECK-LP64: [[T0:%.*]] = load [[ARRAY_T]]** [[ARRAY]] +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[T0]] to i8* +// CHECK-LP64-NEXT: call void @objc_release(i8* [[T1]]) +// CHECK-LP64-NEXT: ret void + // CHECK-LP64: define internal void @__test0_block_invoke // CHECK-LP64: [[BLOCK:%.*]] = bitcast i8* {{%.*}} to [[BLOCK_T]]* // CHECK-LP64-NEXT: [[T0:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5 @@ -70,3 +115,57 @@ void test1(NSArray *array) { // CHECK-LP64: call void @use_block // CHECK-LP64-NEXT: call void @objc_destroyWeak(i8** [[T0]]) // CHECK-LP64-NEXT: call void @objc_destroyWeak(i8** [[X]]) + +// rdar://problem/9817306 +@interface Test2 +- (NSArray *) array; +@end +void test2(Test2 *a) { + for (id x in a.array) { + use(x); + } +} + +// CHECK-LP64: define void @test2( +// CHECK-LP64: [[T0:%.*]] = call [[ARRAY_T]]* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to [[ARRAY_T]]* (i8*, i8*)*)( +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[T0]] to i8* +// CHECK-LP64-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) +// CHECK-LP64-NEXT: [[COLL:%.*]] = bitcast i8* [[T2]] to [[ARRAY_T]]* + +// Make sure it's not immediately released before starting the iteration. +// CHECK-LP64-NEXT: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ +// CHECK-LP64-NEXT: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_msgSend + +// This bitcast is for the mutation check. +// CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_enumerationMutation + +// This bitcast is for the 'next' message send. +// CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_msgSend + +// This bitcast is for the final release. +// CHECK-LP64: [[T0:%.*]] = bitcast [[ARRAY_T]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]]) + + +// Check that the 'continue' label is positioned appropriately +// relative to the collection clenaup. +void test3(NSArray *array) { + for (id x in array) { + if (!x) continue; + use(x); + } + + // CHECK-LP64: define void @test3( + // CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8 + // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8 + // CHECK-LP64: [[T0:%.*]] = load i8** [[X]], align 8 + // CHECK-LP64-NEXT: [[T1:%.*]] = icmp ne i8* [[T0]], null + // CHECK-LP64-NEXT: br i1 [[T1]], + // CHECK-LP64: br label [[L:%[^ ]+]] + // CHECK-LP64: [[T0:%.*]] = load i8** [[X]], align 8 + // CHECK-LP64-NEXT: call void @use(i8* [[T0]]) + // CHECK-LP64-NEXT: br label [[L]] +} diff --git a/test/CodeGenObjC/arc-ivar-layout.m b/test/CodeGenObjC/arc-ivar-layout.m index cb930fe3d365..30c90fac9e40 100644 --- a/test/CodeGenObjC/arc-ivar-layout.m +++ b/test/CodeGenObjC/arc-ivar-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // rdar://8991729 diff --git a/test/CodeGenObjC/arc-no-runtime.m b/test/CodeGenObjC/arc-no-runtime.m index 39f7da3460e5..3c85e8783cb8 100644 --- a/test/CodeGenObjC/arc-no-runtime.m +++ b/test/CodeGenObjC/arc-no-runtime.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -fobjc-nonfragile-abi -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -emit-llvm %s -o - | FileCheck %s // rdar://problem/9224855 void test0() { diff --git a/test/CodeGenObjC/arc-related-result-type.m b/test/CodeGenObjC/arc-related-result-type.m index c51757df5d8d..f73aa5049f5c 100644 --- a/test/CodeGenObjC/arc-related-result-type.m +++ b/test/CodeGenObjC/arc-related-result-type.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s @interface Test0 - (id) self; diff --git a/test/CodeGenObjC/arc-unbridged-cast.m b/test/CodeGenObjC/arc-unbridged-cast.m index 0f3db09f1ffd..5ab5d02fffee 100644 --- a/test/CodeGenObjC/arc-unbridged-cast.m +++ b/test/CodeGenObjC/arc-unbridged-cast.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-nonfragile-abi -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-arc -o - %s | FileCheck %s // rdar://9744349 typedef const struct __CFString * CFStringRef; @@ -29,8 +29,6 @@ CFStringRef SomeOtherFunc() __attribute__((cf_returns_retained)); id MMM() { id obj = (id)((CFStringRef) __builtin___CFStringMakeConstantString ("" "Some CF String" "")); - if (obj) - return (id) SomeOtherFunc(); return 0; } diff --git a/test/CodeGenObjC/arc-unopt.m b/test/CodeGenObjC/arc-unopt.m index ed46052af848..c319bf260f6b 100644 --- a/test/CodeGenObjC/arc-unopt.m +++ b/test/CodeGenObjC/arc-unopt.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s // A test to ensure that we generate fused calls at -O0. diff --git a/test/CodeGenObjC/arc-weak-property.m b/test/CodeGenObjC/arc-weak-property.m index c0796046446e..0a6b2a63bfc6 100644 --- a/test/CodeGenObjC/arc-weak-property.m +++ b/test/CodeGenObjC/arc-weak-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -o - %s | FileCheck %s // rdar://8899430 @interface WeakPropertyTest { diff --git a/test/CodeGenObjC/arc-with-atthrow.m b/test/CodeGenObjC/arc-with-atthrow.m new file mode 100644 index 000000000000..213b05bffded --- /dev/null +++ b/test/CodeGenObjC/arc-with-atthrow.m @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-exceptions -o - %s | FileCheck %s +// pr10411 +// rdar://10042689 + +id make(void); +void test() { + @throw make(); +} + +// TODO: We should probably emit this specific pattern without the reclaim. + +// CHECK: define void @test() +// CHECK: [[T0:%.*]] = call i8* @make() +// CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) +// CHECK-NEXT: [[T2:%.*]] = call i8* @objc_autorelease(i8* [[T1]]) +// CHECK-NEXT: call void @objc_exception_throw(i8* [[T2]]) noreturn +// CHECK-NEXT: unreachable diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m index 407b3eb77167..e97e625b06eb 100644 --- a/test/CodeGenObjC/arc.m +++ b/test/CodeGenObjC/arc.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-GLOBALS %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-GLOBALS %s // CHECK: define void @test0 void test0(id x) { @@ -578,18 +578,18 @@ void test22(_Bool cond) { // CHECK: define void @test22( // CHECK: [[COND:%.*]] = alloca i8, // CHECK-NEXT: [[X:%.*]] = alloca i8*, - // CHECK-NEXT: [[RELCOND:%.*]] = alloca i1 // CHECK-NEXT: [[RELVAL:%.*]] = alloca i8* - // CHECK-NEXT: store i1 false, i1* [[RELCOND]] + // CHECK-NEXT: [[RELCOND:%.*]] = alloca i1 // CHECK-NEXT: zext // CHECK-NEXT: store // CHECK-NEXT: [[T0:%.*]] = load i8* [[COND]] // CHECK-NEXT: [[T1:%.*]] = trunc i8 [[T0]] to i1 + // CHECK-NEXT: store i1 false, i1* [[RELCOND]] // CHECK-NEXT: br i1 [[T1]], // CHECK: br label // CHECK: [[CALL:%.*]] = call i8* @test22_helper() - // CHECK-NEXT: store i1 true, i1* [[RELCOND]] // CHECK-NEXT: store i8* [[CALL]], i8** [[RELVAL]] + // CHECK-NEXT: store i1 true, i1* [[RELCOND]] // CHECK-NEXT: br label // CHECK: [[T0:%.*]] = phi i8* [ null, {{%.*}} ], [ [[CALL]], {{%.*}} ] // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retain(i8* [[T0]]) nounwind @@ -1552,3 +1552,387 @@ void test54(int first, ...) { // CHECK: define internal void @"\01-[Test55(Category) dealloc]"( // CHECK-NOT: ret // CHECK: call void bitcast (i8* ({{%.*}}*, i8*, ...)* @objc_msgSendSuper2 to void ({{%.*}}*, i8*)*)( + +// rdar://problem/8024350 +@protocol Test56Protocol ++ (id) make __attribute__((ns_returns_retained)); +@end +@interface Test56<Test56Protocol> @end +@implementation Test56 +// CHECK: define internal i8* @"\01+[Test56 make]"( ++ (id) make { + extern id test56_helper(void); + // CHECK: [[T0:%.*]] = call i8* @test56_helper() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: ret i8* [[T1]] + return test56_helper(); +} +@end +void test56_test(void) { + id x = [Test56 make]; + // CHECK: define void @test56_test() + // CHECK: [[X:%.*]] = alloca i8*, align 8 + // CHECK: [[T0:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)( + // CHECK-NEXT: store i8* [[T0]], i8** [[X]] + // CHECK-NEXT: [[T0:%.*]] = load i8** [[X]] + // CHECK-NEXT: call void @objc_release(i8* [[T0]]) + // CHECK-NEXT: ret void +} + +// rdar://problem/9784964 +@interface Test57 +@property (nonatomic, strong) id strong; +@property (nonatomic, weak) id weak; +@property (nonatomic, unsafe_unretained) id unsafe; +@end +@implementation Test57 +@synthesize strong, weak, unsafe; +@end +// CHECK: define internal i8* @"\01-[Test57 strong]"( +// CHECK: [[T0:%.*]] = load [[TEST57:%.*]]** {{%.*}} +// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_Test57.strong" +// CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST57]]* [[T0]] to i8* +// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]] +// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8** +// CHECK-NEXT: [[T5:%.*]] = load i8** [[T4]] +// CHECK-NEXT: ret i8* [[T5]] + +// CHECK: define internal i8* @"\01-[Test57 weak]"( +// CHECK: [[T0:%.*]] = load [[TEST57]]** {{%.*}} +// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_Test57.weak" +// CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST57]]* [[T0]] to i8* +// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]] +// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8** +// CHECK-NEXT: [[T5:%.*]] = call i8* @objc_loadWeakRetained(i8** [[T4]]) +// CHECK-NEXT: [[T6:%.*]] = call i8* @objc_autoreleaseReturnValue(i8* [[T5]]) +// CHECK-NEXT: ret i8* [[T6]] + +// CHECK: define internal i8* @"\01-[Test57 unsafe]"( +// CHECK: [[T0:%.*]] = load [[TEST57]]** {{%.*}} +// CHECK-NEXT: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_Test57.unsafe" +// CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST57]]* [[T0]] to i8* +// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 [[T1]] +// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i8** +// CHECK-NEXT: [[T5:%.*]] = load i8** [[T4]] +// CHECK-NEXT: ret i8* [[T5]] + +// rdar://problem/9821110 +@interface Test58 +- (char*) interior __attribute__((objc_returns_inner_pointer)); +// Should we allow this on properties? +@end +extern Test58 *test58_helper(void); + +// CHECK: define void @test58a() +void test58a(void) { + // CHECK: [[T0:%.*]] = call [[TEST58:%.*]]* @test58_helper() + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST58]]* + // CHECK-NEXT: store [[TEST58]]* [[T3]] + // CHECK-NEXT: [[T0:%.*]] = load [[TEST58]]** + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST58]]* + // CHECK-NEXT: [[T4:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T5:%.*]] = bitcast [[TEST58]]* [[T3]] to i8* + // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast + // CHECK-NEXT: store i8* [[T6]], i8** + // CHECK-NEXT: [[T0:%.*]] = load [[TEST58]]** + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) nounwind, !clang.imprecise_release + // CHECK-NEXT: ret void + Test58 *ptr = test58_helper(); + char *c = [(ptr) interior]; +} + +// CHECK: define void @test58b() +void test58b(void) { + // CHECK: [[T0:%.*]] = call [[TEST58:%.*]]* @test58_helper() + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST58]]* + // CHECK-NEXT: store [[TEST58]]* [[T3]] + // CHECK-NEXT: [[T0:%.*]] = load [[TEST58]]** + // CHECK-NEXT: [[T1:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: [[T3:%.*]] = call i8* bitcast + // CHECK-NEXT: store i8* [[T3]], i8** + // CHECK-NEXT: [[T0:%.*]] = load [[TEST58]]** + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST58]]* [[T0]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) nounwind + // CHECK-NOT: clang.imprecise_release + // CHECK-NEXT: ret void + __attribute__((objc_precise_lifetime)) Test58 *ptr = test58_helper(); + char *c = [ptr interior]; +} + +// rdar://problem/9842343 +void test59(void) { + extern id test59_getlock(void); + extern void test59_body(void); + @synchronized (test59_getlock()) { + test59_body(); + } + + // CHECK: define void @test59() + // CHECK: [[T0:%.*]] = call i8* @test59_getlock() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: call void @objc_sync_enter(i8* [[T1]]) + // CHECK-NEXT: call void @test59_body() + // CHECK-NEXT: call void @objc_sync_exit(i8* [[T1]]) + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) + // CHECK-NEXT: ret void +} + +// rdar://problem/9814099 +// Test that we correctly initialize __block variables +// when the initialization captures the variable. +void test60a(void) { + __block void (^block)(void) = ^{ block(); }; + // CHECK: define void @test60a() + // CHECK: [[BYREF:%.*]] = alloca [[BYREF_T:%.*]], + + // Zero-initialization before running the initializer. + // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 6 + // CHECK-NEXT: store void ()* null, void ()** [[T0]], align 8 + + // Run the initializer as an assignment. + // CHECK: [[T0:%.*]] = bitcast void ()* {{%.*}} to i8* + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainBlock(i8* [[T0]]) + // CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to void ()* + // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 1 + // CHECK-NEXT: [[T4:%.*]] = load [[BYREF_T]]** [[T3]] + // CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[BYREF_T]]* [[T4]], i32 0, i32 6 + // CHECK-NEXT: [[T6:%.*]] = load void ()** [[T5]], align 8 + // CHECK-NEXT: store void ()* {{%.*}}, void ()** [[T5]], align 8 + // CHECK-NEXT: [[T7:%.*]] = bitcast void ()* [[T6]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T7]]) + + // Destroy at end of function. + // CHECK-NEXT: [[SLOT:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 6 + // CHECK-NEXT: [[T0:%.*]] = bitcast [[BYREF_T]]* [[BYREF]] to i8* + // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T0]], i32 8) + // CHECK-NEXT: [[T1:%.*]] = load void ()** [[SLOT]] + // CHECK-NEXT: [[T2:%.*]] = bitcast void ()* [[T1]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T2]]) + // CHECK-NEXT: ret void +} + +// Test that we correctly assign to __block variables when the +// assignment captures the variable. +void test60b(void) { + __block void (^block)(void); + block = ^{ block(); }; + + // CHECK: define void @test60b() + // CHECK: [[BYREF:%.*]] = alloca [[BYREF_T:%.*]], + + // Zero-initialize. + // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 6 + // CHECK-NEXT: store void ()* null, void ()** [[T0]], align 8 + + // CHECK-NEXT: [[SLOT:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 6 + + // The assignment. + // CHECK: [[T0:%.*]] = bitcast void ()* {{%.*}} to i8* + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainBlock(i8* [[T0]]) + // CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to void ()* + // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[BYREF_T]]* [[BYREF]], i32 0, i32 1 + // CHECK-NEXT: [[T4:%.*]] = load [[BYREF_T]]** [[T3]] + // CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[BYREF_T]]* [[T4]], i32 0, i32 6 + // CHECK-NEXT: [[T6:%.*]] = load void ()** [[T5]], align 8 + // CHECK-NEXT: store void ()* {{%.*}}, void ()** [[T5]], align 8 + // CHECK-NEXT: [[T7:%.*]] = bitcast void ()* [[T6]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T7]]) + + // Destroy at end of function. + // CHECK-NEXT: [[T0:%.*]] = bitcast [[BYREF_T]]* [[BYREF]] to i8* + // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T0]], i32 8) + // CHECK-NEXT: [[T1:%.*]] = load void ()** [[SLOT]] + // CHECK-NEXT: [[T2:%.*]] = bitcast void ()* [[T1]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T2]]) + // CHECK-NEXT: ret void +} + +// Verify that we don't try to reclaim the result of performSelector. +// rdar://problem/9887545 +@interface Test61 +- (id) performSelector: (SEL) selector; +- (void) test61_void; +- (id) test61_id; +@end +void test61(void) { + // CHECK: define void @test61() + // CHECK: [[Y:%.*]] = alloca i8*, align 8 + + extern id test61_make(void); + + // CHECK-NEXT: [[T0:%.*]] = call i8* @test61_make() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: [[T2:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T3:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T4:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* [[T1]], i8* [[T3]], i8* [[T2]]) + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) + [test61_make() performSelector: @selector(test61_void)]; + + // CHECK-NEXT: [[T0:%.*]] = call i8* @test61_make() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: [[T2:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T3:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T4:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i8*)*)(i8* [[T1]], i8* [[T3]], i8* [[T2]]) + // CHECK-NEXT: [[T5:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T4]]) + // CHECK-NEXT: store i8* [[T5]], i8** [[Y]] + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) + id y = [test61_make() performSelector: @selector(test61_id)]; + + // CHECK-NEXT: [[T0:%.*]] = load i8** [[Y]] + // CHECK-NEXT: call void @objc_release(i8* [[T0]]) + // CHECK-NEXT: ret void +} + +// rdar://problem/9891815 +void test62(void) { + // CHECK: define void @test62() + // CHECK: [[I:%.*]] = alloca i32, align 4 + // CHECK-NEXT: [[CLEANUP_VALUE:%.*]] = alloca i8* + // CHECK-NEXT: [[CLEANUP_REQUIRED:%.*]] = alloca i1 + extern id test62_make(void); + extern void test62_body(void); + + // CHECK-NEXT: store i32 0, i32* [[I]], align 4 + // CHECK-NEXT: br label + + // CHECK: [[T0:%.*]] = load i32* [[I]], align 4 + // CHECK-NEXT: [[T1:%.*]] = icmp ne i32 [[T0]], 20 + // CHECK-NEXT: br i1 [[T1]], + + for (unsigned i = 0; i != 20; ++i) { + // CHECK: [[T0:%.*]] = load i32* [[I]], align 4 + // CHECK-NEXT: [[T1:%.*]] = icmp ne i32 [[T0]], 0 + // CHECK-NEXT: store i1 false, i1* [[CLEANUP_REQUIRED]] + // CHECK-NEXT: br i1 [[T1]], + // CHECK: [[T0:%.*]] = call i8* @test62_make() + // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK-NEXT: store i8* [[T1]], i8** [[CLEANUP_VALUE]] + // CHECK-NEXT: store i1 true, i1* [[CLEANUP_REQUIRED]] + // CHECK-NEXT: [[T2:%.*]] = icmp ne i8* [[T1]], null + // CHECK-NEXT: br label + // CHECK: [[COND:%.*]] = phi i1 [ false, {{%.*}} ], [ [[T2]], {{%.*}} ] + // CHECK-NEXT: [[T0:%.*]] = load i1* [[CLEANUP_REQUIRED]] + // CHECK-NEXT: br i1 [[T0]], + // CHECK: [[T0:%.*]] = load i8** [[CLEANUP_VALUE]] + // CHECK-NEXT: call void @objc_release(i8* [[T0]]) + // CHECK-NEXT: br label + // CHECK: br i1 [[COND]] + // CHECK: call void @test62_body() + // CHECK-NEXT: br label + // CHECK: br label + if (i != 0 && test62_make() != 0) + test62_body(); + } + + // CHECK: [[T0:%.*]] = load i32* [[I]], align 4 + // CHECK-NEXT: [[T1:%.*]] = add i32 [[T0]], 1 + // CHECK-NEXT: store i32 [[T1]], i32* [[I]] + // CHECK-NEXT: br label + + // CHECK: ret void +} + +// rdar://9971982 +@class NSString; + +@interface Person { + NSString *name; +} +@property NSString *address; +@end + +@implementation Person +@synthesize address; +@end +// CHECK: call i8* @objc_getProperty +// CHECK: call void @objc_setProperty + +// rdar://problem/10088932 +void test64_helper(id); +void test64a(void) { + int x; + test64_helper(^{ (void) x; }); + + // CHECK: define void @test64a() + // CHECK: [[X:%.*]] = alloca i32, align 4 + // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], align 8 + // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()* + // CHECK-NEXT: [[T1:%.*]] = bitcast void ()* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainBlock(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to void ()* + // CHECK-NEXT: [[T4:%.*]] = bitcast void ()* [[T3]] to i8* + // CHECK-NEXT: call void @test64_helper(i8* [[T4]]) + // CHECK-NEXT: [[T5:%.*]] = bitcast void ()* [[T3]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T5]]) + // CHECK-NEXT: ret void +} +void test64b(void) { + int x; + id b = ^{ (void) x; }; + + // CHECK: define void @test64b() + // CHECK: [[X:%.*]] = alloca i32, align 4 + // CHECK-NEXT: [[B:%.*]] = alloca i8*, align 8 + // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], align 8 + // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()* + // CHECK-NEXT: [[T1:%.*]] = bitcast void ()* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainBlock(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to void ()* + // CHECK-NEXT: [[T4:%.*]] = bitcast void ()* [[T3]] to i8* + // CHECK-NEXT: store i8* [[T4]], i8** [[B]], align 8 + // CHECK-NEXT: [[T5:%.*]] = load i8** [[B]] + // CHECK-NEXT: call void @objc_release(i8* [[T5]]) + // CHECK-NEXT: ret void +} + +// rdar://problem/9979150 +@interface Test65 +@property (strong) void(^ablock)(void); +@property (nonatomic, strong) void(^nblock)(void); +@end +@implementation Test65 +@synthesize ablock, nblock; +// CHECK: define internal void ()* @"\01-[Test65 ablock]"( +// CHECK: call i8* @objc_getProperty(i8* {{%.*}}, i8* {{%.*}}, i64 {{%.*}}, i1 zeroext true) + +// CHECK: define internal void @"\01-[Test65 setAblock:]"( +// CHECK: call void @objc_setProperty(i8* {{%.*}}, i8* {{%.*}}, i64 {{%.*}}, i8* {{%.*}}, i1 zeroext true, i1 zeroext true) + +// CHECK: define internal void ()* @"\01-[Test65 nblock]"( +// CHECK: call i8* @objc_getProperty(i8* {{%.*}}, i8* {{%.*}}, i64 {{%.*}}, i1 zeroext false) + +// CHECK: define internal void @"\01-[Test65 setNblock:]"( +// CHECK: call void @objc_setProperty(i8* {{%.*}}, i8* {{%.*}}, i64 {{%.*}}, i8* {{%.*}}, i1 zeroext false, i1 zeroext true) +@end + +// Verify that we successfully parse and preserve this attribute in +// this position. +@interface Test66 +- (void) consume: (id __attribute__((ns_consumed))) ptr; +@end +void test66(void) { + extern Test66 *test66_receiver(void); + extern id test66_arg(void); + [test66_receiver() consume: test66_arg()]; +} +// CHECK: define void @test66() +// CHECK: [[T0:%.*]] = call [[TEST66:%.*]]* @test66_receiver() +// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST66]]* [[T0]] to i8* +// CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) +// CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST66]]* +// CHECK-NEXT: [[T4:%.*]] = call i8* @test66_arg() +// CHECK-NEXT: [[T5:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T4]]) +// CHECK-NEXT: [[T6:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES +// CHECK-NEXT: [[T7:%.*]] = bitcast [[TEST66]]* [[T3]] to i8* +// CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*)*)(i8* [[T7]], i8* [[T6]], i8* [[T5]]) +// CHECK-NEXT: [[T8:%.*]] = bitcast [[TEST66]]* [[T3]] to i8* +// CHECK-NEXT: call void @objc_release(i8* [[T8]]) +// CHECK-NEXT: ret void diff --git a/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m b/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m index 2515c706a9bf..535cbbb85c4f 100644 --- a/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m +++ b/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple armv7-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-ARM %s +// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-ARM %s // rdar://7761305 @interface I diff --git a/test/CodeGenObjC/assign.m b/test/CodeGenObjC/assign.m index 87e3834fc874..82da800e7399 100644 --- a/test/CodeGenObjC/assign.m +++ b/test/CodeGenObjC/assign.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s struct s0 { int x; diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m index 3cd12a5c2c1a..978299b45a6d 100644 --- a/test/CodeGenObjC/atomic-aggregate-property.m +++ b/test/CodeGenObjC/atomic-aggregate-property.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s // rdar: // 7849824 struct s { @@ -23,7 +23,20 @@ struct s1 { @synthesize y; @synthesize z; @end -// CHECK-LP64: call void @objc_copyStruct -// CHECK-LP64: call void @objc_copyStruct -// CHECK-LP64: call void @objc_copyStruct -// CHECK-LP64: call i8* @objc_memmove_collectable +// CHECK-LP64: define internal double @"\01-[A x]"( +// CHECK-LP64: load atomic i64* {{%.*}} unordered, align 8 + +// CHECK-LP64: define internal void @"\01-[A setX:]"( +// CHECK-LP64: store atomic i64 {{%.*}}, i64* {{%.*}} unordered, align 8 + +// CHECK-LP64: define internal void @"\01-[A y]"( +// CHECK-LP64: call void @objc_copyStruct(i8* {{%.*}}, i8* {{%.*}}, i64 32, i1 zeroext true, i1 zeroext false) + +// CHECK-LP64: define internal void @"\01-[A setY:]"( +// CHECK-LP64: call void @objc_copyStruct(i8* {{%.*}}, i8* {{%.*}}, i64 32, i1 zeroext true, i1 zeroext false) + +// CHECK-LP64: define internal void @"\01-[A z]"( +// CHECK-LP64: call i8* @objc_memmove_collectable( + +// CHECK-LP64: define internal void @"\01-[A setZ:]"( +// CHECK-LP64: call i8* @objc_memmove_collectable( diff --git a/test/CodeGenObjC/attr-availability.m b/test/CodeGenObjC/attr-availability.m index d2b2973c78d3..375a5be4fadd 100644 --- a/test/CodeGenObjC/attr-availability.m +++ b/test/CodeGenObjC/attr-availability.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin8.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_4 %s -// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin9.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_5 %s -// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin10.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_6 %s +// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin8.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_4 %s +// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin9.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_5 %s +// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin10.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_6 %s // CHECK-10_4: @"OBJC_CLASS_$_WeakClass1" = extern_weak global // CHECK-10_5: @"OBJC_CLASS_$_WeakClass1" = external global diff --git a/test/CodeGenObjC/autorelease.m b/test/CodeGenObjC/autorelease.m index 7bf40f11ffd1..9260c3fafe8b 100644 --- a/test/CodeGenObjC/autorelease.m +++ b/test/CodeGenObjC/autorelease.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-arc -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-runtime-has-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-runtime-has-arc -o - %s | FileCheck %s // rdar://8881826 // rdar://9412038 diff --git a/test/CodeGenObjC/bitfield-1.m b/test/CodeGenObjC/bitfield-1.m index 978b3cc30403..648ab2a374db 100644 --- a/test/CodeGenObjC/bitfield-1.m +++ b/test/CodeGenObjC/bitfield-1.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s -// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-pc-linux-gnu -fobjc-fragile-abi -emit-llvm -o %t %s @interface Object - (id) alloc; diff --git a/test/CodeGenObjC/bitfield-access.m b/test/CodeGenObjC/bitfield-access.m index ab776abd4ea6..521d2e52a6fa 100644 --- a/test/CodeGenObjC/bitfield-access.m +++ b/test/CodeGenObjC/bitfield-access.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o %t1 %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o %t1 %s // RUN: FileCheck -check-prefix=CHECK-I386 < %t1 %s -// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -emit-llvm -o %t2 %s +// RUN: %clang_cc1 -triple armv6-apple-darwin10 -fobjc-fragile-abi -target-abi apcs-gnu -emit-llvm -o %t2 %s // RUN: FileCheck -check-prefix=CHECK-ARM < %t2 %s @interface I0 { diff --git a/test/CodeGenObjC/bitfield-ivar-offsets.m b/test/CodeGenObjC/bitfield-ivar-offsets.m index ce6f17b8a725..b0c848fd7e3c 100644 --- a/test/CodeGenObjC/bitfield-ivar-offsets.m +++ b/test/CodeGenObjC/bitfield-ivar-offsets.m @@ -1,5 +1,5 @@ // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUN: grep -F '@"OBJC_IVAR_$_I0._b0" = global i64 0, section "__DATA, __objc_ivar", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._b1" = global i64 0, section "__DATA, __objc_ivar", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._b2" = global i64 1, section "__DATA, __objc_ivar", align 8' %t diff --git a/test/CodeGenObjC/bitfield_encoding.m b/test/CodeGenObjC/bitfield_encoding.m index 03cf9bfba722..17fd4a4108b7 100644 --- a/test/CodeGenObjC/bitfield_encoding.m +++ b/test/CodeGenObjC/bitfield_encoding.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: grep "ib1b14" %t | count 1 -// RUN: %clang_cc1 -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi -fgnu-runtime -emit-llvm -o %t %s // RUN: grep "ib32i1b33i14" %t | count 1 struct foo{ diff --git a/test/CodeGenObjC/block-6.m b/test/CodeGenObjC/block-6.m index 44c7a78e698e..140fa8831937 100644 --- a/test/CodeGenObjC/block-6.m +++ b/test/CodeGenObjC/block-6.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 -fobjc-fragile-abi | FileCheck %s // rdar://8893785 void MYFUNC() { diff --git a/test/CodeGenObjC/block-var-layout.m b/test/CodeGenObjC/block-var-layout.m index 466dee1e9e96..1d0ce2d373ad 100644 --- a/test/CodeGenObjC/block-var-layout.m +++ b/test/CodeGenObjC/block-var-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -O0 -emit-llvm %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s struct S { diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m index 55ce38fe9ef9..64da3594c271 100644 --- a/test/CodeGenObjC/blocks-1.m +++ b/test/CodeGenObjC/blocks-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 +// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-fragile-abi // RUN: grep "_Block_object_dispose" %t | count 6 // RUN: grep "__copy_helper_block_" %t | count 4 // RUN: grep "__destroy_helper_block_" %t | count 4 @@ -8,7 +8,7 @@ // RUN: grep "_Block_object_assign" %t | count 4 // RUN: grep "objc_read_weak" %t | count 2 // RUN: grep "objc_assign_weak" %t | count 3 -// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 +// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-fragile-abi // RUN: grep "_Block_object_dispose" %t | count 6 // RUN: grep "__copy_helper_block_" %t | count 4 // RUN: grep "__destroy_helper_block_" %t | count 4 diff --git a/test/CodeGenObjC/blocks-2.m b/test/CodeGenObjC/blocks-2.m index 5d63e919fb31..591d63bf37da 100644 --- a/test/CodeGenObjC/blocks-2.m +++ b/test/CodeGenObjC/blocks-2.m @@ -1,6 +1,6 @@ // We run this twice, once as Objective-C and once as Objective-C++. -// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 | FileCheck %s -// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -x objective-c++ | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -fobjc-fragile-abi | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -fobjc-fragile-abi -x objective-c++ | FileCheck %s // CHECK: define i8* @{{.*}}test0 @@ -30,8 +30,9 @@ void test1() { // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8) // CHECK-NEXT: ret void - // CHECK: call i8* @llvm.eh.exception() + // CHECK: landingpad { i8*, i32 } personality + // CHECK-NEXT: cleanup // CHECK: [[T1:%.*]] = bitcast [[N_T]]* [[N]] to i8* // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8) - // CHECK: call void @llvm.eh.resume( + // CHECK: resume { i8*, i32 } } diff --git a/test/CodeGenObjC/blocks-3.m b/test/CodeGenObjC/blocks-3.m index a0b693dc810b..55e215c7e6ab 100644 --- a/test/CodeGenObjC/blocks-3.m +++ b/test/CodeGenObjC/blocks-3.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fblocks -o %t %s // 1x for the declaration // 1x for the object-pointer byref copy helper diff --git a/test/CodeGenObjC/blocks-4.m b/test/CodeGenObjC/blocks-4.m index f2d6e21a1ce1..b3d099811cf0 100644 --- a/test/CodeGenObjC/blocks-4.m +++ b/test/CodeGenObjC/blocks-4.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions -fblocks -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fobjc-exceptions -fblocks -o %t %s // rdar://7590273 void EXIT(id e); diff --git a/test/CodeGenObjC/blocks-5.m b/test/CodeGenObjC/blocks-5.m index 2d48b46a4316..caa8d664455e 100644 --- a/test/CodeGenObjC/blocks-5.m +++ b/test/CodeGenObjC/blocks-5.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fblocks -o %t %s // rdar: // 8064140 diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index 47d47cca2e8c..f478c07f78fb 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fblocks -o - %s | FileCheck %s // test1. All of this is somehow testing rdar://6676764 struct S { diff --git a/test/CodeGenObjC/builtins.m b/test/CodeGenObjC/builtins.m new file mode 100644 index 000000000000..cb2995da52a5 --- /dev/null +++ b/test/CodeGenObjC/builtins.m @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s + +void test0(id receiver, SEL sel, const char *str) { + short s = ((short (*)(id, SEL, const char*)) objc_msgSend)(receiver, sel, str); +} +// CHECK: define void @test0( +// CHECK: call signext i16 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i16 (i8*, i8*, i8*)*)( diff --git a/test/CodeGenObjC/category-class.m b/test/CodeGenObjC/category-class.m index 22d197380f32..5a82c1425504 100644 --- a/test/CodeGenObjC/category-class.m +++ b/test/CodeGenObjC/category-class.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // PR7431 // CHECK: module asm "\09.lazy_reference .objc_class_name_A" diff --git a/test/CodeGenObjC/class-type.m b/test/CodeGenObjC/class-type.m index 192a80832783..45aae254bd33 100644 --- a/test/CodeGenObjC/class-type.m +++ b/test/CodeGenObjC/class-type.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-fragile-abi -emit-llvm -o - %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s @interface I0 { diff --git a/test/CodeGenObjC/complex-property.m b/test/CodeGenObjC/complex-property.m index 5a2b78b5977a..8c3aef9e24bd 100644 --- a/test/CodeGenObjC/complex-property.m +++ b/test/CodeGenObjC/complex-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s // rdar: // 7351147 @interface A diff --git a/test/CodeGenObjC/constant-string-class-1.m b/test/CodeGenObjC/constant-string-class-1.m index 8ff605ec6934..5f1e882d0d2e 100644 --- a/test/CodeGenObjC/constant-string-class-1.m +++ b/test/CodeGenObjC/constant-string-class-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -fconstant-string-class OFConstantString -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-constant-cfstrings -fconstant-string-class OFConstantString -emit-llvm -o %t %s // pr9914 @interface OFConstantString diff --git a/test/CodeGenObjC/constant-string-class.m b/test/CodeGenObjC/constant-string-class.m index 489f511e7813..ea049a51e12b 100644 --- a/test/CodeGenObjC/constant-string-class.m +++ b/test/CodeGenObjC/constant-string-class.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s // rdar: // 8564463 diff --git a/test/CodeGenObjC/deadcode_strip_used_var.m b/test/CodeGenObjC/deadcode_strip_used_var.m index 01e6bd4feb33..3137ceb22298 100644 --- a/test/CodeGenObjC/deadcode_strip_used_var.m +++ b/test/CodeGenObjC/deadcode_strip_used_var.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 %s -emit-llvm -o %t -triple i386-apple-darwin10 +// RUN: %clang_cc1 %s -emit-llvm -o %t -triple i386-apple-darwin10 -fobjc-fragile-abi // RUN: grep "llvm.used" %t | count 1 -// RUN: %clang_cc1 %s -emit-llvm -o %t -triple x86_64-apple-darwin10 +// RUN: %clang_cc1 %s -emit-llvm -o %t -triple x86_64-apple-darwin10 -fobjc-fragile-abi // RUN: grep "llvm.used" %t | count 1 diff --git a/test/CodeGenObjC/debug-info-block-helper.m b/test/CodeGenObjC/debug-info-block-helper.m index 136af14bff8b..644e458bbd2c 100644 --- a/test/CodeGenObjC/debug-info-block-helper.m +++ b/test/CodeGenObjC/debug-info-block-helper.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -masm-verbose -S -fblocks -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -fblocks -g -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s -o - | FileCheck %s extern void foo(void(^)(void)); // CHECK: .ascii "__destroy_helper_block_" ## DW_AT_name diff --git a/test/CodeGenObjC/debug-info-blocks.m b/test/CodeGenObjC/debug-info-blocks.m index fc8e9629734f..71ae8a610ee8 100644 --- a/test/CodeGenObjC/debug-info-blocks.m +++ b/test/CodeGenObjC/debug-info-blocks.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -masm-verbose -S -fblocks -g -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -fblocks -g -triple x86_64-apple-darwin10 -fobjc-dispatch-method=mixed %s -o - | FileCheck %s //Radar 9279956 //CHECK: ## DW_OP_deref diff --git a/test/CodeGenObjC/debug-info-class-extension.m b/test/CodeGenObjC/debug-info-class-extension.m index cf0445d539b5..e1573f063377 100644 --- a/test/CodeGenObjC/debug-info-class-extension.m +++ b/test/CodeGenObjC/debug-info-class-extension.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_objc_complete_type diff --git a/test/CodeGenObjC/debug-info-class-extension2.m b/test/CodeGenObjC/debug-info-class-extension2.m index 4cef88f1637a..bae12dce4e4d 100644 --- a/test/CodeGenObjC/debug-info-class-extension2.m +++ b/test/CodeGenObjC/debug-info-class-extension2.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_objc_complete_type @interface Foo {} @end diff --git a/test/CodeGenObjC/debug-info-class-extension3.m b/test/CodeGenObjC/debug-info-class-extension3.m index 595c7bd2c6bc..f49bef82a24f 100644 --- a/test/CodeGenObjC/debug-info-class-extension3.m +++ b/test/CodeGenObjC/debug-info-class-extension3.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -masm-verbose -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK-NOT: AT_APPLE_objc_complete_type diff --git a/test/CodeGenObjC/debug-info-crash-2.m b/test/CodeGenObjC/debug-info-crash-2.m new file mode 100644 index 000000000000..a2acd9dc9170 --- /dev/null +++ b/test/CodeGenObjC/debug-info-crash-2.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -g -S %s -o - +@class Bar; +@interface Foo +@property (strong, nonatomic) Bar *window; +@end + +@interface Foo__ : Foo +@end +@implementation Foo__ +@end + +@implementation Foo +@synthesize window = _window; +@end + diff --git a/test/CodeGenObjC/debug-info-crash.m b/test/CodeGenObjC/debug-info-crash.m index eb2143faed6c..5504356d2e3a 100644 --- a/test/CodeGenObjC/debug-info-crash.m +++ b/test/CodeGenObjC/debug-info-crash.m @@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -g -S %s -o - +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fobjc-fragile-abi -fblocks -g -S %s -o - // rdar://7556129 @implementation test diff --git a/test/CodeGenObjC/debug-info-default-synth-ivar.m b/test/CodeGenObjC/debug-info-default-synth-ivar.m index 967a361d6c48..30d751e67d1e 100644 --- a/test/CodeGenObjC/debug-info-default-synth-ivar.m +++ b/test/CodeGenObjC/debug-info-default-synth-ivar.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t // RUN: grep DW_TAG_member %t | count 5 // rdar://8493239 diff --git a/test/CodeGenObjC/debug-info-fnname.m b/test/CodeGenObjC/debug-info-fnname.m deleted file mode 100644 index f336d6b26875..000000000000 --- a/test/CodeGenObjC/debug-info-fnname.m +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -Os -g %s -o - | FileCheck %s -// Radar 8653152 -@interface A { -} -@end - - -// CHECK: llvm.dbg.lv.-.A.title. -@implementation A --(int) title { - int x = 1; - return x; -} -@end - diff --git a/test/CodeGenObjC/debug-info-getter-name.m b/test/CodeGenObjC/debug-info-getter-name.m index ec784e372bf8..e7d3a9a8749e 100644 --- a/test/CodeGenObjC/debug-info-getter-name.m +++ b/test/CodeGenObjC/debug-info-getter-name.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -fno-dwarf2-cfi-asm -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -fno-dwarf2-cfi-asm -triple x86_64-apple-darwin10 -fexceptions -fobjc-exceptions -S -g %s -o - | FileCheck %s //CHECK: "-[InstanceVariablesEverywhereButTheInterface someString]": //CHECK: .quad "-[InstanceVariablesEverywhereButTheInterface someString]" diff --git a/test/CodeGenObjC/debug-info-property2.m b/test/CodeGenObjC/debug-info-property2.m new file mode 100644 index 000000000000..4cd76c1ca6dc --- /dev/null +++ b/test/CodeGenObjC/debug-info-property2.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s + +// CHECK: AT_APPLE_property_name +@interface C { + int _base; +} +@property int base; +@end + +@implementation C +@synthesize base = _base; +@end + +void foo(C *cptr) {} diff --git a/test/CodeGenObjC/debug-info-static-var.m b/test/CodeGenObjC/debug-info-static-var.m index 94513f227884..1f281d042d10 100644 --- a/test/CodeGenObjC/debug-info-static-var.m +++ b/test/CodeGenObjC/debug-info-static-var.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -g -triple x86_64-apple-darwin10 -S -masm-verbose -o - %s | FileCheck %s +// RUN: %clang_cc1 -g -triple x86_64-apple-darwin10 -fobjc-fragile-abi -S -masm-verbose -o - %s | FileCheck %s // Radar 8801045 // Do not emit AT_MIPS_linkage_name for static variable i diff --git a/test/CodeGenObjC/default-property-synthesis.m b/test/CodeGenObjC/default-property-synthesis.m index 72acb768a11a..7d7296b5df78 100644 --- a/test/CodeGenObjC/default-property-synthesis.m +++ b/test/CodeGenObjC/default-property-synthesis.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // rdar://7923851. // Superclass declares property. Subclass redeclares the same property. diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m index 187c9bfa9d63..ea630230b541 100644 --- a/test/CodeGenObjC/encode-cstyle-method.m +++ b/test/CodeGenObjC/encode-cstyle-method.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s // rdar: // 7445205 @interface Foo diff --git a/test/CodeGenObjC/encode-test-4.m b/test/CodeGenObjC/encode-test-4.m index 117e1733486e..2624bc71fce2 100644 --- a/test/CodeGenObjC/encode-test-4.m +++ b/test/CodeGenObjC/encode-test-4.m @@ -1,5 +1,10 @@ // RUN: %clang_cc1 -emit-llvm -o - %s -O2 | grep "ret i32 1" +typedef long Integer; +typedef enum : Integer { Red, Green, Blue} Color; +typedef enum { Cyan, Magenta, Yellow, Key } PrintColor; int a() { - return @encode(int) == @encode(int); + return @encode(int) == @encode(int) && + @encode(Color) == @encode(long) && + @encode(PrintColor) == @encode(int); } diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index f30fb26a1e65..02af5daa2265 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: FileCheck < %t %s // // CHECK: @"\01L_OBJC_METH_VAR_TYPE_34" = internal global [16 x i8] c"v12@0:4[3[4@]]8\00" diff --git a/test/CodeGenObjC/exceptions-nonfragile.m b/test/CodeGenObjC/exceptions-nonfragile.m index 2557aab25219..1f3892699839 100644 --- a/test/CodeGenObjC/exceptions-nonfragile.m +++ b/test/CodeGenObjC/exceptions-nonfragile.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -fobjc-exceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s // rdar://problem/8535238 // CHECK: declare void @objc_exception_rethrow() diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m index d378f848f861..2472869ff58b 100644 --- a/test/CodeGenObjC/exceptions.m +++ b/test/CodeGenObjC/exceptions.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s // // <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes diff --git a/test/CodeGenObjC/forward-class-impl-metadata.m b/test/CodeGenObjC/forward-class-impl-metadata.m index 0ab7a8166453..e9e08589d19f 100644 --- a/test/CodeGenObjC/forward-class-impl-metadata.m +++ b/test/CodeGenObjC/forward-class-impl-metadata.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm -o %t %s @interface BASE { @private diff --git a/test/CodeGenObjC/fpret.m b/test/CodeGenObjC/fpret.m index bde0caa8ff3a..bf111e001d04 100644 --- a/test/CodeGenObjC/fpret.m +++ b/test/CodeGenObjC/fpret.m @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | \ +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=CHECK-X86_32 %s // -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | \ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | \ // RUN: FileCheck --check-prefix=CHECK-X86_64 %s // -// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -target-abi apcs-gnu -o - %s | \ +// RUN: %clang_cc1 -triple armv7-apple-darwin10 -fobjc-fragile-abi -emit-llvm -target-abi apcs-gnu -o - %s | \ // RUN: FileCheck --check-prefix=CHECK-ARMV7 %s @interface A diff --git a/test/CodeGenObjC/gc-weak-attribute.m b/test/CodeGenObjC/gc-weak-attribute.m new file mode 100644 index 000000000000..032c7c6beb4f --- /dev/null +++ b/test/CodeGenObjC/gc-weak-attribute.m @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s +// rdar://10073896 + +@interface I +{ + __weak id wObject; +} +@property (readwrite, weak) id representedObject; +@property (readwrite, weak) id wObject; +@property (readwrite, weak) __weak id wRandom; +@property (readwrite, assign) __weak id wAnother; +@end + +@implementation I +@synthesize representedObject; +@synthesize wObject; +@synthesize wRandom; +@synthesize wAnother; +@end +// CHECK: call i8* @objc_read_weak +// CHECK: call i8* @objc_assign_weak +// CHECK: call i8* @objc_read_weak +// CHECK: call i8* @objc_assign_weak +// CHECK: call i8* @objc_read_weak +// CHECK: call i8* @objc_assign_weak +// CHECK: call i8* @objc_read_weak +// CHECK: call i8* @objc_assign_weak + diff --git a/test/CodeGenObjC/gc.m b/test/CodeGenObjC/gc.m index 93554e65b880..b6721813c17e 100644 --- a/test/CodeGenObjC/gc.m +++ b/test/CodeGenObjC/gc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s void test0(void) { extern id test0_helper(void); diff --git a/test/CodeGenObjC/gnu-exceptions.m b/test/CodeGenObjC/gnu-exceptions.m index 7f3ae9df467e..8917bf3120da 100644 --- a/test/CodeGenObjC/gnu-exceptions.m +++ b/test/CodeGenObjC/gnu-exceptions.m @@ -14,9 +14,9 @@ void test0() { // CHECK: call void @log(i32 1) } @catch (C *c) { - // CHECK: call i8* @llvm.eh.exception() - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__gnu_objc_personality_v0 - // CHECK: br i1 + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*) + // CHECK-NEXT: catch i8* getelementptr inbounds ([2 x i8]* @0, i64 0, i64 0) + // CHECK: br i1 // CHECK: call void @log(i32 0) diff --git a/test/CodeGenObjC/hidden-visibility.m b/test/CodeGenObjC/hidden-visibility.m index 5e08ef9d55d2..9f5071d5ffaa 100644 --- a/test/CodeGenObjC/hidden-visibility.m +++ b/test/CodeGenObjC/hidden-visibility.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fvisibility hidden -emit-llvm -o - %s | FileCheck %s // CHECK: @"OBJC_IVAR_$_I.P" = hidden // CHECK: @"OBJC_CLASS_$_I" = hidden // CHECK: @"OBJC_METACLASS_$_I" = hidden diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m index e4f5fd9ab571..8cac750773c4 100644 --- a/test/CodeGenObjC/id-isa-codegen.m +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck -check-prefix LP32 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP32 %s typedef struct objc_class *Class; diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m index 2777723f736f..22f7229b6950 100644 --- a/test/CodeGenObjC/image-info.m +++ b/test/CodeGenObjC/image-info.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s // CHECK-FRAGILE: @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular" diff --git a/test/CodeGenObjC/implicit-objc_msgSend.m b/test/CodeGenObjC/implicit-objc_msgSend.m index 322f82e920a0..aff0fe45a009 100644 --- a/test/CodeGenObjC/implicit-objc_msgSend.m +++ b/test/CodeGenObjC/implicit-objc_msgSend.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: grep -F 'declare i8* @objc_msgSend(i8*, i8*, ...)' %t typedef struct objc_selector *SEL; diff --git a/test/CodeGenObjC/instance-method-metadata.m b/test/CodeGenObjC/instance-method-metadata.m index 4e752c0061b9..ec24c287a36d 100644 --- a/test/CodeGenObjC/instance-method-metadata.m +++ b/test/CodeGenObjC/instance-method-metadata.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o %t %s // RUN: FileCheck < %t %s // rdar://9072317 diff --git a/test/CodeGenObjC/interface-layout-64.m b/test/CodeGenObjC/interface-layout-64.m index 5158c61c5bdb..4fdda4559d14 100644 --- a/test/CodeGenObjC/interface-layout-64.m +++ b/test/CodeGenObjC/interface-layout-64.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && // RUN: grep '@"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_ivar", align 8' %t diff --git a/test/CodeGenObjC/interface.m b/test/CodeGenObjC/interface.m index 17d56f7b1db4..0ca64ecd3ffc 100644 --- a/test/CodeGenObjC/interface.m +++ b/test/CodeGenObjC/interface.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -O3 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -O3 -emit-llvm -o %t %s // RUN: grep 'ret i32 385' %t void *alloca(); diff --git a/test/CodeGenObjC/ivar-layout-64-bitfields.m b/test/CodeGenObjC/ivar-layout-64-bitfields.m index 700ce18d74cb..acc734a575de 100644 --- a/test/CodeGenObjC/ivar-layout-64-bitfields.m +++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s #ifdef __cplusplus typedef bool _Bool; diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m index f227bfc30d36..ea4cdce4b8b2 100644 --- a/test/CodeGenObjC/ivar-layout-64.m +++ b/test/CodeGenObjC/ivar-layout-64.m @@ -1,11 +1,11 @@ // RUNX: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\01\\14\\00"' %t // RUNX: llvm-gcc -ObjC++ -m64 -fobjc-gc -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t diff --git a/test/CodeGenObjC/ivar-layout-array0-struct.m b/test/CodeGenObjC/ivar-layout-array0-struct.m index a9ae0ac73389..7ef32f634237 100644 --- a/test/CodeGenObjC/ivar-layout-array0-struct.m +++ b/test/CodeGenObjC/ivar-layout-array0-struct.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -O0 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s // rdar://8800513 diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m index 2851e7942798..85bba8abaaa9 100644 --- a/test/CodeGenObjC/ivar-layout-no-optimize.m +++ b/test/CodeGenObjC/ivar-layout-no-optimize.m @@ -1,7 +1,7 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -O0 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s +// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -O0 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s @interface NSObject { diff --git a/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m b/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m index 012ccadd9f92..65e17a84f163 100644 --- a/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m +++ b/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // rdar: // 7824380 @interface Super { diff --git a/test/CodeGenObjC/ivars.m b/test/CodeGenObjC/ivars.m index 98c39b7a844b..6c8a72d0f100 100644 --- a/test/CodeGenObjC/ivars.m +++ b/test/CodeGenObjC/ivars.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s // RUN: %clang_cc1 -fobjc-gc -emit-llvm -o - %s // rdar://6800926 diff --git a/test/CodeGenObjC/link-errors.m b/test/CodeGenObjC/link-errors.m index a82f0ceaf76d..0d19681ec109 100644 --- a/test/CodeGenObjC/link-errors.m +++ b/test/CodeGenObjC/link-errors.m @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: grep '.lazy_reference .objc_class_name_A' %t | count 1 // RUN: grep '.lazy_reference .objc_class_name_Unknown' %t | count 1 // RUN: grep '.lazy_reference .objc_class_name_Protocol' %t | count 1 -// RUN: %clang_cc1 -triple i386-apple-darwin9 -DWITH_IMPL -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -DWITH_IMPL -emit-llvm -o %t %s // RUN: grep '.lazy_reference .objc_class_name_Root' %t | count 1 @interface Root diff --git a/test/CodeGenObjC/local-static-block.m b/test/CodeGenObjC/local-static-block.m index a40abb26ea79..7a7b6f6e087b 100644 --- a/test/CodeGenObjC/local-static-block.m +++ b/test/CodeGenObjC/local-static-block.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.ll +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fobjc-fragile-abi -emit-llvm %s -o %t-64.ll // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s // rdar: // 8390455 diff --git a/test/CodeGenObjC/messages-2.m b/test/CodeGenObjC/messages-2.m index e4e8cfb5e202..7c9d81cc9d71 100644 --- a/test/CodeGenObjC/messages-2.m +++ b/test/CodeGenObjC/messages-2.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NF +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NF // Most of this test is apparently just verifying that we don't crash. diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m index a921dc774ad1..6f39602d9c96 100644 --- a/test/CodeGenObjC/messages.m +++ b/test/CodeGenObjC/messages.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC -// RUN: %clang_cc1 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF -// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU -// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF +// RUN: %clang_cc1 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF +// RUN: %clang_cc1 -fobjc-fragile-abi -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU +// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF typedef struct { int x; diff --git a/test/CodeGenObjC/metadata-symbols-32.m b/test/CodeGenObjC/metadata-symbols-32.m index 34cc83da315a..a7bcf01926b2 100644 --- a/test/CodeGenObjC/metadata-symbols-32.m +++ b/test/CodeGenObjC/metadata-symbols-32.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUNX: llvm-gcc -m32 -emit-llvm -S -o %t %s && // RUN: grep '@"\\01L_OBJC_CATEGORY_A_Cat" = internal global .*section "__OBJC,__category,regular,no_dead_strip", align 4' %t diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m index 4bc41fa443da..57f5d508ab1c 100644 --- a/test/CodeGenObjC/metadata-symbols-64.m +++ b/test/CodeGenObjC/metadata-symbols-64.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-dispatch-method=mixed -emit-llvm -o %t %s // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && // RUN: grep '@"OBJC_CLASS_$_A" = global' %t diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m index 370ca6eccbe9..576a55b13693 100644 --- a/test/CodeGenObjC/metadata_symbols.m +++ b/test/CodeGenObjC/metadata_symbols.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o %t %s // RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3 @@ -12,7 +12,7 @@ // CHECK-X86_64: define internal void @"\01-[A im0]" // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s // RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s // CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8 @@ -23,7 +23,7 @@ // CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]" // CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]" -// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -fobjc-exceptions -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-exceptions -emit-llvm -o %t %s // RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s // CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4 diff --git a/test/CodeGenObjC/misc-atomic-property.m b/test/CodeGenObjC/misc-atomic-property.m index 26402d355b59..f2645dcaef84 100644 --- a/test/CodeGenObjC/misc-atomic-property.m +++ b/test/CodeGenObjC/misc-atomic-property.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar: //8808439 typedef struct { diff --git a/test/CodeGenObjC/mrr-autorelease.m b/test/CodeGenObjC/mrr-autorelease.m index 10f549fcec5e..f7a13fd8dcf2 100644 --- a/test/CodeGenObjC/mrr-autorelease.m +++ b/test/CodeGenObjC/mrr-autorelease.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar://8881826 // rdar://9423507 diff --git a/test/CodeGenObjC/nested-rethrow.m b/test/CodeGenObjC/nested-rethrow.m index af5154a24c27..5576c1640d18 100644 --- a/test/CodeGenObjC/nested-rethrow.m +++ b/test/CodeGenObjC/nested-rethrow.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fobjc-exceptions %s -o - | FileCheck %s extern int printf(const char*, ...); diff --git a/test/CodeGenObjC/next-objc-dispatch.m b/test/CodeGenObjC/next-objc-dispatch.m index a3e8e19641eb..4288b2da0cb2 100644 --- a/test/CodeGenObjC/next-objc-dispatch.m +++ b/test/CodeGenObjC/next-objc-dispatch.m @@ -1,17 +1,17 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \ +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s \ // RUN: -fobjc-dispatch-method=legacy | \ // RUN: FileCheck -check-prefix CHECK-FRAGILE_LEGACY %s // // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \ -// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy | \ +// RUN: -fobjc-dispatch-method=legacy | \ // RUN: FileCheck -check-prefix CHECK-NONFRAGILE_LEGACY %s // // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \ -// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=non-legacy | \ +// RUN: -fobjc-dispatch-method=non-legacy | \ // RUN: FileCheck -check-prefix CHECK-NONFRAGILE_NONLEGACY %s // // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \ -// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed | \ +// RUN: -fobjc-dispatch-method=mixed | \ // RUN: FileCheck -check-prefix CHECK-NONFRAGILE_MIXED %s // // <rdar://problem/7866951> diff --git a/test/CodeGenObjC/no-category-class.m b/test/CodeGenObjC/no-category-class.m index 0bd999689dd1..3969f917e2f3 100644 --- a/test/CodeGenObjC/no-category-class.m +++ b/test/CodeGenObjC/no-category-class.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-fragile-abi -emit-llvm -o %t %s @interface NSObject @end diff --git a/test/CodeGenObjC/no-vararg-messaging.m b/test/CodeGenObjC/no-vararg-messaging.m index 6747c0c9e4ef..3f9d934ec88f 100644 --- a/test/CodeGenObjC/no-vararg-messaging.m +++ b/test/CodeGenObjC/no-vararg-messaging.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o - %s | FileCheck %s // rdar://9048030 @interface Foo diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m index 512ad897c7fe..5d8290155e32 100644 --- a/test/CodeGenObjC/non-lazy-classes.m +++ b/test/CodeGenObjC/non-lazy-classes.m @@ -1,5 +1,5 @@ // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = internal global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t // RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t diff --git a/test/CodeGenObjC/nonlazy-msgSend.m b/test/CodeGenObjC/nonlazy-msgSend.m index 3d7ba10dc5e8..73157c77c030 100644 --- a/test/CodeGenObjC/nonlazy-msgSend.m +++ b/test/CodeGenObjC/nonlazy-msgSend.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: grep -F 'declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind' %t void f0(id x) { diff --git a/test/CodeGenObjC/ns-constant-strings.m b/test/CodeGenObjC/ns-constant-strings.m index 389132bd05ee..d04793c8c239 100644 --- a/test/CodeGenObjC/ns-constant-strings.m +++ b/test/CodeGenObjC/ns-constant-strings.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fno-constant-cfstrings -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -fno-constant-cfstrings -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fno-constant-cfstrings -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s @interface NSString @end diff --git a/test/CodeGenObjC/objc-align.m b/test/CodeGenObjC/objc-align.m index ff3f2a0a9088..f07272516f1c 100644 --- a/test/CodeGenObjC/objc-align.m +++ b/test/CodeGenObjC/objc-align.m @@ -1,7 +1,7 @@ // 32-bit // RUNX: llvm-gcc -m32 -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s // RUN: grep '@"\\01L_OBJC_CATEGORY_A_Cat" = internal global .*, section "__OBJC,__category,regular,no_dead_strip", align 4' %t // RUN: grep '@"\\01L_OBJC_CLASS_A" = internal global .*, section "__OBJC,__class,regular,no_dead_strip", align 4' %t // RUN: grep '@"\\01L_OBJC_CLASS_C" = internal global .*, section "__OBJC,__class,regular,no_dead_strip", align 4' %t diff --git a/test/CodeGenObjC/objc-assign-ivar.m b/test/CodeGenObjC/objc-assign-ivar.m index aefe97d0f2a7..d0a1a0fceefe 100644 --- a/test/CodeGenObjC/objc-assign-ivar.m +++ b/test/CodeGenObjC/objc-assign-ivar.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_ivar' %t | count 14 typedef struct { diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m index 9fd64d5645c8..dfdf02e2a5a6 100644 --- a/test/CodeGenObjC/objc-gc-aggr-assign.m +++ b/test/CodeGenObjC/objc-gc-aggr-assign.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix C %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CP %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix C %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CP %s static int count; diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m index c89fcd520e5e..8fe1436567b1 100644 --- a/test/CodeGenObjC/objc-read-weak-byref.m +++ b/test/CodeGenObjC/objc-read-weak-byref.m @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s @interface NSObject diff --git a/test/CodeGenObjC/objc2-assign-global.m b/test/CodeGenObjC/objc2-assign-global.m index ff3ecef72d8d..36c95f792dae 100644 --- a/test/CodeGenObjC/objc2-assign-global.m +++ b/test/CodeGenObjC/objc2-assign-global.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_global' %t | count 26 @class NSObject; diff --git a/test/CodeGenObjC/objc2-ivar-assign.m b/test/CodeGenObjC/objc2-ivar-assign.m index e50cc5b53729..af768007212b 100644 --- a/test/CodeGenObjC/objc2-ivar-assign.m +++ b/test/CodeGenObjC/objc2-ivar-assign.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 6 @interface I @end diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m index 7a99d15ba0dc..a6b20000d802 100644 --- a/test/CodeGenObjC/objc2-legacy-dispatch.m +++ b/test/CodeGenObjC/objc2-legacy-dispatch.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s +// RUN: %clang_cc1 -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s // // CHECK_NEW_DISPATCH: define void @f0 // CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc // CHECK_NEW_DISPATCH: define void @f1 // CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES // -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s +// RUN: %clang_cc1 -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s // // CHECK_OLD_DISPATCH: define void @f0 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES diff --git a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m index 0413910855e5..1044ba529857 100644 --- a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m +++ b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_strongCast' %t | count 4 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_strongCast' %t | count 4 @interface DSATextSearch @end diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m index a0ebc100fb2f..d439368cc608 100644 --- a/test/CodeGenObjC/objc2-no-write-barrier.m +++ b/test/CodeGenObjC/objc2-no-write-barrier.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep 'objc_assign' %t | count 0 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep 'objc_assign' %t | count 0 typedef struct { diff --git a/test/CodeGenObjC/objc2-nonfragile-abi-impl.m b/test/CodeGenObjC/objc2-nonfragile-abi-impl.m index cb830b8dcc92..c785a5d47642 100644 --- a/test/CodeGenObjC/objc2-nonfragile-abi-impl.m +++ b/test/CodeGenObjC/objc2-nonfragile-abi-impl.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // rdar://7547942. @interface Base @end diff --git a/test/CodeGenObjC/objc2-retain-codegen.m b/test/CodeGenObjC/objc2-retain-codegen.m index 9f6620619ecd..d5b473e33473 100644 --- a/test/CodeGenObjC/objc2-retain-codegen.m +++ b/test/CodeGenObjC/objc2-retain-codegen.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-fragile-abi -fobjc-gc-only -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-fragile-abi -fobjc-gc-only -emit-llvm -o %t %s @interface I0 { I0 *_f0; diff --git a/test/CodeGenObjC/objc2-strong-cast-1.m b/test/CodeGenObjC/objc2-strong-cast-1.m index b79f8a00f7a3..9bb750fd0523 100644 --- a/test/CodeGenObjC/objc2-strong-cast-1.m +++ b/test/CodeGenObjC/objc2-strong-cast-1.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-unknown-unknown -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s @interface I { __attribute__((objc_gc(strong))) int *i_IdocumentIDs; diff --git a/test/CodeGenObjC/objc2-strong-cast-block-import.m b/test/CodeGenObjC/objc2-strong-cast-block-import.m new file mode 100644 index 000000000000..adec3762012b --- /dev/null +++ b/test/CodeGenObjC/objc2-strong-cast-block-import.m @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc-only -fblocks -emit-llvm -o - %s | FileCheck %s +// rdar://10150823 + +@interface Test { +@package + Test ** __strong objects; +} +@end + +id newObject(); +void runWithBlock(void(^)(int i)); + +@implementation Test + +- (void)testWithObjectInBlock { + Test **children = objects; + runWithBlock(^(int i){ + children[i] = newObject(); + }); +} + +@end +// CHECK: call i8* @objc_assign_strongCast +// CHECK: call i8* @objc_assign_strongCast + diff --git a/test/CodeGenObjC/objc2-weak-assign.m b/test/CodeGenObjC/objc2-weak-assign.m index 74c0c00c7caa..e5c67c58d64a 100644 --- a/test/CodeGenObjC/objc2-weak-assign.m +++ b/test/CodeGenObjC/objc2-weak-assign.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -e "objc_assign_weak" %t | grep -e "call" | count 6 __weak id* x; diff --git a/test/CodeGenObjC/objc2-weak-block-call.m b/test/CodeGenObjC/objc2-weak-block-call.m index 8cd233e286b2..94c54e7f3ba2 100644 --- a/test/CodeGenObjC/objc2-weak-block-call.m +++ b/test/CodeGenObjC/objc2-weak-block-call.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s @interface MyView - (void)MyView_sharedInit; diff --git a/test/CodeGenObjC/objc2-weak-compare.m b/test/CodeGenObjC/objc2-weak-compare.m index 8cba1a986094..75cf689737b4 100644 --- a/test/CodeGenObjC/objc2-weak-compare.m +++ b/test/CodeGenObjC/objc2-weak-compare.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s @interface PBXTarget { diff --git a/test/CodeGenObjC/objc2-weak-import-attribute.m b/test/CodeGenObjC/objc2-weak-import-attribute.m index 946c79b5bcc5..201e24b9e5ec 100644 --- a/test/CodeGenObjC/objc2-weak-import-attribute.m +++ b/test/CodeGenObjC/objc2-weak-import-attribute.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s __attribute__((weak_import)) @interface WeakRootClass @end diff --git a/test/CodeGenObjC/objc2-weak-ivar-debug.m b/test/CodeGenObjC/objc2-weak-ivar-debug.m index 8f7acd7619ac..83262a82a61b 100644 --- a/test/CodeGenObjC/objc2-weak-ivar-debug.m +++ b/test/CodeGenObjC/objc2-weak-ivar-debug.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s -// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -g -emit-llvm -o - %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -g -emit-llvm -o - %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -g -emit-llvm -o - %s +// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -g -emit-llvm -o - %s // rdar://7252252 @interface Loop { diff --git a/test/CodeGenObjC/objc2-weak-ivar.m b/test/CodeGenObjC/objc2-weak-ivar.m index 8c91a80b6863..78ccdf8876cc 100644 --- a/test/CodeGenObjC/objc2-weak-ivar.m +++ b/test/CodeGenObjC/objc2-weak-ivar.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s @class NSObject; @interface Foo { diff --git a/test/CodeGenObjC/objc2-write-barrier-2.m b/test/CodeGenObjC/objc2-write-barrier-2.m index 74cd7eafad4f..eae2551aa074 100644 --- a/test/CodeGenObjC/objc2-write-barrier-2.m +++ b/test/CodeGenObjC/objc2-write-barrier-2.m @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_global' %t | count 7 // RUN: grep -F '@objc_assign_ivar' %t | count 5 // RUN: grep -F '@objc_assign_strongCast' %t | count 8 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_global' %t | count 7 // RUN: grep -F '@objc_assign_ivar' %t | count 5 // RUN: grep -F '@objc_assign_strongCast' %t | count 8 diff --git a/test/CodeGenObjC/objc2-write-barrier-3.m b/test/CodeGenObjC/objc2-write-barrier-3.m index cb72cc06e55c..4ef1b8aa1e86 100644 --- a/test/CodeGenObjC/objc2-write-barrier-3.m +++ b/test/CodeGenObjC/objc2-write-barrier-3.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 3 // RUN: grep objc_assign_strongCast %t | count 6 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 3 // RUN: grep objc_assign_strongCast %t | count 6 diff --git a/test/CodeGenObjC/objc2-write-barrier-4.m b/test/CodeGenObjC/objc2-write-barrier-4.m index ab30649bec2b..4089920b0925 100644 --- a/test/CodeGenObjC/objc2-write-barrier-4.m +++ b/test/CodeGenObjC/objc2-write-barrier-4.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_global %t | count 3 // RUN: grep objc_assign_strongCast %t | count 2 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_global %t | count 3 // RUN: grep objc_assign_strongCast %t | count 2 diff --git a/test/CodeGenObjC/objc2-write-barrier-5.m b/test/CodeGenObjC/objc2-write-barrier-5.m index 373df0cc16b9..122fa9f3c0b7 100644 --- a/test/CodeGenObjC/objc2-write-barrier-5.m +++ b/test/CodeGenObjC/objc2-write-barrier-5.m @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 0 -// RUN: grep objc_assign_strongCast %t | count 5 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: grep objc_assign_strongCast %t | count 8 +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 0 -// RUN: grep objc_assign_strongCast %t | count 5 +// RUN: grep objc_assign_strongCast %t | count 8 @interface TestUnarchiver { @@ -27,3 +27,20 @@ struct unarchive_list { } @end + +// rdar://10191569 +@interface I +{ + struct S { + id _timer; + } *p_animationState; +} +@end + +@implementation I +- (void) Meth { + p_animationState->_timer = 0; + (*p_animationState)._timer = 0; + (&(*p_animationState))->_timer = 0; +} +@end diff --git a/test/CodeGenObjC/objc2-write-barrier.m b/test/CodeGenObjC/objc2-write-barrier.m index 08b65deaa38d..bf2dfb9b14f9 100644 --- a/test/CodeGenObjC/objc2-write-barrier.m +++ b/test/CodeGenObjC/objc2-write-barrier.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_global' %t | count 21 // RUN: grep -F '@objc_assign_ivar' %t | count 11 -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep -F '@objc_assign_global' %t | count 21 // RUN: grep -F '@objc_assign_ivar' %t | count 11 diff --git a/test/CodeGenObjC/object-incr-decr-1.m b/test/CodeGenObjC/object-incr-decr-1.m index 6369076174b3..19c12cb315a2 100644 --- a/test/CodeGenObjC/object-incr-decr-1.m +++ b/test/CodeGenObjC/object-incr-decr-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm %s -o %t @interface Foo { diff --git a/test/CodeGenObjC/predefined-expr.m b/test/CodeGenObjC/predefined-expr.m index 43d329e2ab1d..009bbcdb013c 100644 --- a/test/CodeGenObjC/predefined-expr.m +++ b/test/CodeGenObjC/predefined-expr.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi %s -emit-llvm -o - | FileCheck %s // CHECK: @"__func__.-[Foo instanceTest1]" = private unnamed_addr constant [21 x i8] c"-[Foo instanceTest1]\00" // CHECK: @"__func__.-[Foo instanceTest2:]" = private unnamed_addr constant [22 x i8] c"-[Foo instanceTest2:]\00" diff --git a/test/CodeGenObjC/property-aggr-type.m b/test/CodeGenObjC/property-aggr-type.m deleted file mode 100644 index 8ba87de3534a..000000000000 --- a/test/CodeGenObjC/property-aggr-type.m +++ /dev/null @@ -1,50 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s - -@interface Object -- (id) new; -@end - -typedef struct {int x, y, w, h;} st1; -typedef struct {int x, y, w, h;} st2; - -@interface bar : Object -- (void)setFrame:(st1)frameRect; -@end - -@interface bar1 : Object -- (void)setFrame:(int)frameRect; -@end - -@interface foo : Object -{ - st2 ivar; -} -@property (assign) st2 frame; -@end - -@implementation foo -@synthesize frame = ivar; -@end - -extern void abort(); - -static st2 r = {1,2,3,4}; -st2 test (void) -{ - foo *obj = [foo new]; - id objid = [foo new];; - - obj.frame = r; - - ((foo*)objid).frame = obj.frame; - - return ((foo*)objid).frame; -} - -int main () -{ - st2 res = test (); - if (res.x != 1 || res.h != 4) - abort(); - return 0; -} diff --git a/test/CodeGenObjC/property-aggregate.m b/test/CodeGenObjC/property-aggregate.m new file mode 100644 index 000000000000..f4211b6b62bd --- /dev/null +++ b/test/CodeGenObjC/property-aggregate.m @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s + +// This structure's size is not a power of two, so the property does +// not get native atomics, even though x86-64 can do unaligned atomics +// with a lock prefix. +struct s3 { char c[3]; }; + +// This structure's size is, so it does, because it can. +// FIXME: But we don't at the moment; the backend doesn't know how to generate +// correct code. +struct s4 { char c[4]; }; + +@interface Test0 +@property struct s3 s3; +@property struct s4 s4; +@end +@implementation Test0 +@synthesize s3, s4; +@end + +// CHECK: define internal i24 @"\01-[Test0 s3]"( +// CHECK: call void @objc_copyStruct + +// CHECK: define internal void @"\01-[Test0 setS3:]"( +// CHECK: call void @objc_copyStruct + +// CHECK: define internal i32 @"\01-[Test0 s4]"( +// CHECK: call void @objc_copyStruct + +// CHECK: define internal void @"\01-[Test0 setS4:]"( +// CHECK: call void @objc_copyStruct diff --git a/test/CodeGenObjC/property-category-impl.m b/test/CodeGenObjC/property-category-impl.m index 80a18cb1daab..734f9a37a24c 100644 --- a/test/CodeGenObjC/property-category-impl.m +++ b/test/CodeGenObjC/property-category-impl.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // rdar : // 8093297 diff --git a/test/CodeGenObjC/property-complex.m b/test/CodeGenObjC/property-complex.m index 071d0b1d24d2..3cdd2ecfd15d 100644 --- a/test/CodeGenObjC/property-complex.m +++ b/test/CodeGenObjC/property-complex.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s @interface I0 { @public diff --git a/test/CodeGenObjC/property-list-in-class.m b/test/CodeGenObjC/property-list-in-class.m index 05210588ba9b..e8014855af7e 100644 --- a/test/CodeGenObjC/property-list-in-class.m +++ b/test/CodeGenObjC/property-list-in-class.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s // CHECK: l_OBJC_$_PROP_LIST_C2" = internal global { i32, i32, [3 x %struct._prop_t] } { i32 16, i32 3 @protocol P diff --git a/test/CodeGenObjC/property-ref-cast-to-void.m b/test/CodeGenObjC/property-ref-cast-to-void.m index a365aa56e84d..ad1689fd6243 100644 --- a/test/CodeGenObjC/property-ref-cast-to-void.m +++ b/test/CodeGenObjC/property-ref-cast-to-void.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar: // 8399655 @interface TestClass diff --git a/test/CodeGenObjC/property-type-mismatch.m b/test/CodeGenObjC/property-type-mismatch.m index 7045947b1abf..b920b45aef95 100644 --- a/test/CodeGenObjC/property-type-mismatch.m +++ b/test/CodeGenObjC/property-type-mismatch.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // rdar://8966864 @interface Foo diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index dd0786eb30ee..3cc9200f333c 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -103,3 +103,12 @@ void test4(Test4 *t) { // CHECK-NEXT: ret void test4_printf("%.2f", t.f); } + +@interface Test5 { + unsigned _x : 5; +} +@property unsigned x; +@end +@implementation Test5 +@synthesize x = _x; +@end diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m index daf4d4ccf578..a92408463deb 100644 --- a/test/CodeGenObjC/protocol-in-extended-class.m +++ b/test/CodeGenObjC/protocol-in-extended-class.m @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target,x86-64-registered-target -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S %s -o %t-64.s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: %clang_cc1 -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s @protocol MyProtocol diff --git a/test/CodeGenObjC/protocol-property-synth.m b/test/CodeGenObjC/protocol-property-synth.m index 8566949e5c94..c998d631677a 100644 --- a/test/CodeGenObjC/protocol-property-synth.m +++ b/test/CodeGenObjC/protocol-property-synth.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm -o %t %s @interface BaseClass { id _delegate; diff --git a/test/CodeGenObjC/protocols-lazy.m b/test/CodeGenObjC/protocols-lazy.m index 2038e60c4e61..1c551fbeec11 100644 --- a/test/CodeGenObjC/protocols-lazy.m +++ b/test/CodeGenObjC/protocols-lazy.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s +// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-fragile-abi -o %t %s // RUNX: llvm-gcc -S -emit-llvm -o %t %s && // No object generated diff --git a/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m b/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m index fd812dd38823..a93ca033c13c 100644 --- a/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m +++ b/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o - +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-fragile-abi -emit-llvm -fobjc-exceptions %s -o - void f0(id x) { @synchronized (x) { diff --git a/test/CodeGenObjC/simplify-exceptions.mm b/test/CodeGenObjC/simplify-exceptions.mm index a35b10d73d2d..d0baf808531c 100644 --- a/test/CodeGenObjC/simplify-exceptions.mm +++ b/test/CodeGenObjC/simplify-exceptions.mm @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm \ -// RUN: -fexceptions -fobjc-exceptions -fobjc-nonfragile-abi \ +// RUN: -fexceptions -fobjc-exceptions \ // RUN: -o %t %s // RUN: FileCheck < %t %s // diff --git a/test/CodeGenObjC/stand-alone-implementation.m b/test/CodeGenObjC/stand-alone-implementation.m index a51949578b37..8245f01028b9 100644 --- a/test/CodeGenObjC/stand-alone-implementation.m +++ b/test/CodeGenObjC/stand-alone-implementation.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s // radar 7547942 // Allow injection of ivars into implementation's implicit class. diff --git a/test/CodeGenObjC/super-dotsyntax-struct-property.m b/test/CodeGenObjC/super-dotsyntax-struct-property.m index aac4c1de06a3..a7910a047be8 100644 --- a/test/CodeGenObjC/super-dotsyntax-struct-property.m +++ b/test/CodeGenObjC/super-dotsyntax-struct-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s // rdar: // 8203426 diff --git a/test/CodeGenObjC/super-message-fragileabi.m b/test/CodeGenObjC/super-message-fragileabi.m index 5efc234dcafd..0135919b8946 100644 --- a/test/CodeGenObjC/super-message-fragileabi.m +++ b/test/CodeGenObjC/super-message-fragileabi.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm %s -o - | FileCheck %s @class Some; diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m index 2a809063fe03..4997bb77525e 100644 --- a/test/CodeGenObjC/synchronized.m +++ b/test/CodeGenObjC/synchronized.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -triple=i686-apple-darwin9 -o - %s -O2 | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin9 -fobjc-fragile-abi -o - %s -O2 | FileCheck %s @interface MyClass { diff --git a/test/CodeGenObjC/synthesize_ivar-cont-class.m b/test/CodeGenObjC/synthesize_ivar-cont-class.m index f85320279bc4..6bc7ac8170ef 100644 --- a/test/CodeGenObjC/synthesize_ivar-cont-class.m +++ b/test/CodeGenObjC/synthesize_ivar-cont-class.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm -o %t %s // RUN: grep '@"OBJC_IVAR_$_XCOrganizerDeviceNodeInfo.viewController"' %t @interface XCOrganizerNodeInfo diff --git a/test/CodeGenObjC/synthesize_ivar.m b/test/CodeGenObjC/synthesize_ivar.m index 5dd90ab618bb..e4fbe101a648 100644 --- a/test/CodeGenObjC/synthesize_ivar.m +++ b/test/CodeGenObjC/synthesize_ivar.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm -o %t %s @interface I @property int IP; diff --git a/test/CodeGenObjC/terminate.m b/test/CodeGenObjC/terminate.m index f04eb6a92bb7..a86205839d45 100644 --- a/test/CodeGenObjC/terminate.m +++ b/test/CodeGenObjC/terminate.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime-has-terminate -o - %s | FileCheck %s -check-prefix=CHECK-WITH -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s -check-prefix=CHECK-WITHOUT +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime-has-terminate -o - %s | FileCheck %s -check-prefix=CHECK-WITH +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s -check-prefix=CHECK-WITHOUT void destroy(void**); @@ -14,8 +14,8 @@ void test0(void) { // CHECK-WITH: call void @destroy(i8** [[PTR]]) // CHECK-WITH-NEXT: ret void // CHECK-WITH: invoke void @destroy(i8** [[PTR]]) - // CHECK-WITH: call i8* @llvm.eh.exception() - // CHECK-WITH-NEXT: @llvm.eh.selector + // CHECK-WITH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-WITH-NEXT: catch i8* null // CHECK-WITH-NEXT: call void @objc_terminate() // CHECK-WITHOUT: define void @test0() @@ -23,7 +23,7 @@ void test0(void) { // CHECK-WITHOUT: call void @destroy(i8** [[PTR]]) // CHECK-WITHOUT-NEXT: ret void // CHECK-WITHOUT: invoke void @destroy(i8** [[PTR]]) - // CHECK-WITHOUT: call i8* @llvm.eh.exception() - // CHECK-WITHOUT-NEXT: @llvm.eh.selector + // CHECK-WITHOUT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) + // CHECK-WITHOUT-NEXT: catch i8* null // CHECK-WITHOUT-NEXT: call void @abort() } diff --git a/test/CodeGenObjC/variadic-sends.m b/test/CodeGenObjC/variadic-sends.m index 6b04b50ca152..7e557b0178d8 100644 --- a/test/CodeGenObjC/variadic-sends.m +++ b/test/CodeGenObjC/variadic-sends.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s @interface A -(void) im0; diff --git a/test/CodeGenObjC/x86_64-struct-return-gc.m b/test/CodeGenObjC/x86_64-struct-return-gc.m index 8022d5903ecf..76407d6654e0 100644 --- a/test/CodeGenObjC/x86_64-struct-return-gc.m +++ b/test/CodeGenObjC/x86_64-struct-return-gc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck %s struct Coerce { id a; }; diff --git a/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm b/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm new file mode 100644 index 000000000000..2564d67ee501 --- /dev/null +++ b/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +@class NSImage; +void bork() { + NSImage *nsimage; + [nsimage release]; +} diff --git a/test/CodeGenObjCXX/2010-08-04-Template.mm b/test/CodeGenObjCXX/2010-08-04-Template.mm new file mode 100644 index 000000000000..c53e3cb6da44 --- /dev/null +++ b/test/CodeGenObjCXX/2010-08-04-Template.mm @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +struct TRunSoon { + template <class P1> static void Post() {} +}; + +@implementation TPrivsTableViewMainController +- (void) applyToEnclosed { + TRunSoon::Post<int>(); +} +@end diff --git a/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm b/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm new file mode 100644 index 000000000000..290aaf67bbfd --- /dev/null +++ b/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - +struct TFENode { + TFENode(const TFENode& inNode); +}; + +@interface TIconViewController +- (const TFENode&) target; +@end + +void sortAllChildrenForNode(const TFENode&node); + +@implementation TIconViewController +- (void) setArrangeBy { + sortAllChildrenForNode(self.target); +} +@end diff --git a/test/CodeGenObjCXX/arc-globals.mm b/test/CodeGenObjCXX/arc-globals.mm index 7167dbc366d0..958d1d872c28 100644 --- a/test/CodeGenObjCXX/arc-globals.mm +++ b/test/CodeGenObjCXX/arc-globals.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s // Test that we're properly retaining lifetime-qualified pointers // initialized statically and wrapping up those initialization in an diff --git a/test/CodeGenObjCXX/arc-mangle.mm b/test/CodeGenObjCXX/arc-mangle.mm index 1955348f1c32..c2b5817c73b3 100644 --- a/test/CodeGenObjCXX/arc-mangle.mm +++ b/test/CodeGenObjCXX/arc-mangle.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s // CHECK: define void @_Z1fPU8__strongP11objc_object(i8**) void f(__strong id *) {} diff --git a/test/CodeGenObjCXX/arc-move.mm b/test/CodeGenObjCXX/arc-move.mm index 70469e6a8586..cf3051dd1fe6 100644 --- a/test/CodeGenObjCXX/arc-move.mm +++ b/test/CodeGenObjCXX/arc-move.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -O2 -std=c++0x -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -std=c++11 -disable-llvm-optzns -o - %s | FileCheck %s // define void @_Z11simple_moveRU8__strongP11objc_objectS2_ void simple_move(__strong id &x, __strong id &y) { diff --git a/test/CodeGenObjCXX/arc-new-delete.mm b/test/CodeGenObjCXX/arc-new-delete.mm index 4597985f8dfe..a778bcad8fa7 100644 --- a/test/CodeGenObjCXX/arc-new-delete.mm +++ b/test/CodeGenObjCXX/arc-new-delete.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s typedef __strong id strong_id; typedef __weak id weak_id; diff --git a/test/CodeGenObjCXX/arc-pseudo-destructors.mm b/test/CodeGenObjCXX/arc-pseudo-destructors.mm index 4023e90b7dc7..2f8d9e1878bb 100644 --- a/test/CodeGenObjCXX/arc-pseudo-destructors.mm +++ b/test/CodeGenObjCXX/arc-pseudo-destructors.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s // CHECK: define void @_Z28test_objc_object_pseudo_dtorPU8__strongP11objc_objectPU6__weakS0_ void test_objc_object_pseudo_dtor(__strong id *ptr, __weak id *wptr) { diff --git a/test/CodeGenObjCXX/arc-references.mm b/test/CodeGenObjCXX/arc-references.mm index 3d0313d13ac8..954c02abf23a 100644 --- a/test/CodeGenObjCXX/arc-references.mm +++ b/test/CodeGenObjCXX/arc-references.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s @interface A @end @@ -61,8 +61,9 @@ void sink(__strong A* &&); // CHECK: define void @_Z5test5RU8__strongP11objc_object void test5(__strong id &x) { - // CHECK: [[OBJ_ID:%[a-zA-Z0-9]+]] = call i8* @objc_retain - // CHECK-NEXT: [[OBJ_A:%[a-zA-Z0-9]+]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]* + // CHECK: [[REFTMP:%.*]] = alloca {{%.*}}*, align 8 + // CHECK: [[OBJ_ID:%.*]] = call i8* @objc_retain( + // CHECK-NEXT: [[OBJ_A:%.*]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]* // CHECK-NEXT: store [[A]]* [[OBJ_A]], [[A]]** [[REFTMP:%[a-zA-Z0-9]+]] // CHECK-NEXT: call void @_Z4sinkOU8__strongP1A sink(x); diff --git a/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm b/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm new file mode 100644 index 000000000000..c4ab34ea0e8b --- /dev/null +++ b/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - %s | FileCheck %s +// rdar://10139365 + +@interface Test58 +- (char* &) interior __attribute__((objc_returns_inner_pointer)); +- (int&)reference_to_interior_int __attribute__((objc_returns_inner_pointer)); +@end + +void foo() { + Test58 *ptr; + char *c = [(ptr) interior]; + + int i = [(ptr) reference_to_interior_int]; +} + +// CHECK: [[T0:%.*]] = load {{%.*}} {{%.*}}, align 8 +// CHECK: [[T1:%.*]] = bitcast {{%.*}} [[T0]] to i8* +// call i8* @objc_retainAutorelease(i8* [[T1]]) nounwind +// CHECK: [[T2:%.*]] = load {{%.*}} {{%.*}}, align 8 +// CHECK: [[T3:%.*]] = bitcast {{%.*}} [[T2]] to i8* +// call i8* @objc_retainAutorelease(i8* [[T3]]) nounwind + diff --git a/test/CodeGenObjCXX/arc-special-member-functions.mm b/test/CodeGenObjCXX/arc-special-member-functions.mm index d88a2bd62ffc..421a9fedffac 100644 --- a/test/CodeGenObjCXX/arc-special-member-functions.mm +++ b/test/CodeGenObjCXX/arc-special-member-functions.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s struct ObjCMember { id member; @@ -92,12 +92,16 @@ void test_ObjCBlockMember_copy_assign(ObjCBlockMember m1, ObjCBlockMember m2) { // Implicitly-generated copy assignment operator for ObjCBlockMember // CHECK: define linkonce_odr {{%.*}}* @_ZN15ObjCBlockMemberaSERKS_( -// CHECK: [[T0:%.*]] = call i8* @objc_retainBlock( -// CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to i32 (i32)* -// CHECK-NEXT: [[T2:%.*]] = load {{.*}} [[SLOT:%.*]], -// CHECK: store -// CHECK-NEXT: [[T3:%.*]] = bitcast -// CHECK-NEXT: call void @objc_release(i8* [[T3]]) +// CHECK: [[T0:%.*]] = getelementptr inbounds [[T:%.*]]* {{%.*}}, i32 0, i32 0 +// CHECK-NEXT: [[T1:%.*]] = load i32 (i32)** [[T0]], align 8 +// CHECK-NEXT: [[T2:%.*]] = bitcast i32 (i32)* [[T1]] to i8* +// CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retainBlock(i8* [[T2]]) +// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i32 (i32)* +// CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[T]]* {{%.*}}, i32 0, i32 0 +// CHECK-NEXT: [[T6:%.*]] = load i32 (i32)** [[T5]], align 8 +// CHECK-NEXT: store i32 (i32)* [[T4]], i32 (i32)** [[T5]] +// CHECK-NEXT: [[T7:%.*]] = bitcast i32 (i32)* [[T6]] to i8* +// CHECK-NEXT: call void @objc_release(i8* [[T7]]) // CHECK-NEXT: ret // Implicitly-generated copy constructor for ObjCBlockMember diff --git a/test/CodeGenObjCXX/arc.mm b/test/CodeGenObjCXX/arc.mm index 0c5466a4cea3..8f3aa711d65d 100644 --- a/test/CodeGenObjCXX/arc.mm +++ b/test/CodeGenObjCXX/arc.mm @@ -1,4 +1,15 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s + +struct NSFastEnumerationState; +@interface NSArray +- (unsigned long) countByEnumeratingWithState: (struct NSFastEnumerationState*) state + objects: (id*) buffer + count: (unsigned long) bufferSize; +@end; +NSArray *nsarray() { return 0; } +// CHECK: define [[NSARRAY:%.*]]* @_Z7nsarrayv() + +void use(id); // rdar://problem/9315552 // The analogous ObjC testcase test46 in arr.m. @@ -164,3 +175,37 @@ id test36(id z) { // CHECK: objc_autoreleaseReturnValue return z; } + +// Template instantiation side of rdar://problem/9817306 +@interface Test37 +- (NSArray *) array; +@end +template <class T> void test37(T *a) { + for (id x in a.array) { + use(x); + } +} +extern template void test37<Test37>(Test37 *a); +template void test37<Test37>(Test37 *a); +// CHECK: define weak_odr void @_Z6test37I6Test37EvPT_( +// CHECK-LP64: [[T0:%.*]] = call [[NSARRAY]]* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to [[NSARRAY]]* (i8*, i8*)*)( +// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[NSARRAY]]* [[T0]] to i8* +// CHECK-LP64-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) +// CHECK-LP64-NEXT: [[COLL:%.*]] = bitcast i8* [[T2]] to [[NSARRAY]]* + +// Make sure it's not immediately released before starting the iteration. +// CHECK-LP64-NEXT: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ +// CHECK-LP64-NEXT: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_msgSend + +// This bitcast is for the mutation check. +// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_enumerationMutation + +// This bitcast is for the 'next' message send. +// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: @objc_msgSend + +// This bitcast is for the final release. +// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8* +// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]]) diff --git a/test/CodeGenObjCXX/block-in-template-inst.mm b/test/CodeGenObjCXX/block-in-template-inst.mm index 72042fc03330..93a0e4907d29 100644 --- a/test/CodeGenObjCXX/block-in-template-inst.mm +++ b/test/CodeGenObjCXX/block-in-template-inst.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -fblocks -o - -triple x86_64-apple-darwin10 %s +// RUN: %clang_cc1 -emit-llvm-only -std=c++11 -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s // rdar://9362021 @class DYFuture; diff --git a/test/CodeGenObjCXX/block-var-layout.mm b/test/CodeGenObjCXX/block-var-layout.mm index 363e21497ec7..a8f8be0ea8a3 100644 --- a/test/CodeGenObjCXX/block-var-layout.mm +++ b/test/CodeGenObjCXX/block-var-layout.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.ll +// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -emit-llvm %s -o %t-64.ll // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s // See commentary in test/CodeGenObjC/block-var-layout.m, from which diff --git a/test/CodeGenObjCXX/blocks.mm b/test/CodeGenObjCXX/blocks.mm index e220753ff788..126931d51fad 100644 --- a/test/CodeGenObjCXX/blocks.mm +++ b/test/CodeGenObjCXX/blocks.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin %s -verify -emit-llvm -o %t +// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin -fobjc-fragile-abi %s -verify -emit-llvm -o %t // rdar://8979379 @interface A @@ -30,7 +30,7 @@ void foo(id <NSObject>(^objectCreationBlock)(void)) { // Test4 struct S { - S *(^a)() = ^{ // expected-warning {{C++0x}} + S *(^a)() = ^{ // expected-warning {{C++11}} return this; }; }; @@ -40,7 +40,7 @@ S s; struct X { void f() { ^ { - struct Nested { Nested *ptr = this; }; // expected-warning {{C++0x}} + struct Nested { Nested *ptr = this; }; // expected-warning {{C++11}} } (); }; }; diff --git a/test/CodeGenObjCXX/catch-id-type.mm b/test/CodeGenObjCXX/catch-id-type.mm index ece342bb8720..a5fa3e78fb59 100644 --- a/test/CodeGenObjCXX/catch-id-type.mm +++ b/test/CodeGenObjCXX/catch-id-type.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-macosx10.6.6 -emit-llvm -fobjc-exceptions -fcxx-exceptions -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.6 -fobjc-fragile-abi -emit-llvm -fobjc-exceptions -fcxx-exceptions -fexceptions -o - %s | FileCheck %s // rdar://8940528 @interface ns_array @@ -30,7 +30,10 @@ id FUNC() { } catch( id error ) { - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__gxx_personality_v0 {{.*}} @_ZTIP4INTF {{.*}} @_ZTIP11objc_object {{.*}} @_ZTIP10objc_class + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP4INTF to i8*) + // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP11objc_object to i8*) + // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP10objc_class to i8*) error = error; groups = [ns_array array]; } diff --git a/test/CodeGenObjCXX/copy.mm b/test/CodeGenObjCXX/copy.mm index 133910f25dcf..a61ccd4e5daa 100644 --- a/test/CodeGenObjCXX/copy.mm +++ b/test/CodeGenObjCXX/copy.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar://problem/9158302 // This should not use a memmove_collectable in non-GC mode. @@ -24,3 +24,18 @@ namespace test0 { } } + +// rdar://9780211 +@protocol bork +@end + +namespace test1 { +template<typename T> struct RetainPtr { + RetainPtr() {} +}; + + +RetainPtr<id<bork> > x; +RetainPtr<id> y; + +} diff --git a/test/CodeGenObjCXX/copyable-property-object.mm b/test/CodeGenObjCXX/copyable-property-object.mm index 8962c536ea29..03c0c06a41ee 100644 --- a/test/CodeGenObjCXX/copyable-property-object.mm +++ b/test/CodeGenObjCXX/copyable-property-object.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s struct POD { int array[3][4]; diff --git a/test/CodeGenObjCXX/encode.mm b/test/CodeGenObjCXX/encode.mm index 2c10fbcb9753..8391c04b7da8 100644 --- a/test/CodeGenObjCXX/encode.mm +++ b/test/CodeGenObjCXX/encode.mm @@ -105,6 +105,27 @@ namespace rdar9624314 { const char g2[] = @encode(S2); } +namespace test { + class Foo { + public: + virtual void f() {}; + }; + + class Bar { + public: + virtual void g() {}; + }; + + class Zoo : virtual public Foo, virtual public Bar { + public: + int x; + int y; + }; + + // CHECK: @_ZN4testL3ecdE = internal constant [15 x i8] c"{Zoo=^^?ii^^?}\00" + const char ecd[] = @encode(Zoo); +} + struct Base1 { char x; }; @@ -146,3 +167,23 @@ _Alloc_hider _M_dataplus; // CHECK: @_ZL2g5 = internal constant [32 x i8] c"{basic_string={_Alloc_hider=*}}\00" const char g5[] = @encode(basic_string); + + +// PR10990 +class CefBase { + virtual ~CefBase() {} +}; +class CefBrowser : public virtual CefBase {}; +class CefBrowserImpl : public CefBrowser {}; +// CHECK: @_ZL2g6 = internal constant [21 x i8] c"{CefBrowserImpl=^^?}\00" +const char g6[] = @encode(CefBrowserImpl); + +// PR10990_2 +class CefBase2 { + virtual ~CefBase2() {} + int i; +}; +class CefBrowser2 : public virtual CefBase2 {}; +class CefBrowserImpl2 : public CefBrowser2 {}; +// CHECK: @_ZL2g7 = internal constant [26 x i8] c"{CefBrowserImpl2=^^?^^?i}\00" +const char g7[] = @encode(CefBrowserImpl2); diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm index d4c0756cb89f..ce6d20aa98b6 100644 --- a/test/CodeGenObjCXX/exceptions.mm +++ b/test/CodeGenObjCXX/exceptions.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fcxx-exceptions -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - %s | FileCheck %s @interface OCType @end void opaque(); @@ -11,7 +11,8 @@ namespace test0 { // CHECK: invoke void @_Z6opaquev opaque(); } catch (OCType *T) { - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__objc_personality_v0 {{.*}} @"OBJC_EHTYPE_$_OCType" + // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType" } } } diff --git a/test/CodeGenObjCXX/gc.mm b/test/CodeGenObjCXX/gc.mm index aa293dacf3a7..1e9fe00fd060 100644 --- a/test/CodeGenObjCXX/gc.mm +++ b/test/CodeGenObjCXX/gc.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s namespace test0 { extern id x; diff --git a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm index 16ae1472ddfd..0a6e08e2ff62 100644 --- a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm +++ b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -fobjc-fragile-abi -o - %s | FileCheck %s struct A { A &operator=(const A&); A &operator=(A&); diff --git a/test/CodeGenObjCXX/implicit-copy-constructor.mm b/test/CodeGenObjCXX/implicit-copy-constructor.mm index 10eb644ddb22..63dd4f084cd8 100644 --- a/test/CodeGenObjCXX/implicit-copy-constructor.mm +++ b/test/CodeGenObjCXX/implicit-copy-constructor.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s struct A { A(); diff --git a/test/CodeGenObjCXX/mangle-blocks.mm b/test/CodeGenObjCXX/mangle-blocks.mm index 9f57557f8f67..fcbc60860884 100644 --- a/test/CodeGenObjCXX/mangle-blocks.mm +++ b/test/CodeGenObjCXX/mangle-blocks.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s | FileCheck %s // CHECK: @_ZGVN3foo20__foo_block_invoke_05valueE = internal global i64 0 diff --git a/test/CodeGenObjCXX/message-reference.mm b/test/CodeGenObjCXX/message-reference.mm index b7cf98d88c66..fa41fef4c909 100644 --- a/test/CodeGenObjCXX/message-reference.mm +++ b/test/CodeGenObjCXX/message-reference.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar://8604515 @interface I {} diff --git a/test/CodeGenObjCXX/nrvo.mm b/test/CodeGenObjCXX/nrvo.mm new file mode 100644 index 000000000000..ef5052eea603 --- /dev/null +++ b/test/CodeGenObjCXX/nrvo.mm @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -emit-llvm -o - -fblocks %s -O1 -triple x86_64-apple-darwin10.0.0 -fobjc-fragile-abi | FileCheck %s + +// PR10835 / <rdar://problem/10050178> +struct X { + X(); + X(const X&); + ~X(); +}; + +@interface NRVO +@end + +@implementation NRVO +// CHECK: define internal void @"\01-[NRVO getNRVO]" +- (X)getNRVO { + X x; + // CHECK: tail call void @_ZN1XC1Ev + // CHECK-NEXT: ret void + return x; +} +@end + +X blocksNRVO() { + return ^{ + // CHECK: define internal void @__blocksNRVO_block_invoke_0 + X x; + // CHECK: tail call void @_ZN1XC1Ev + // CHECK-NEXT: ret void + return x; + }() ; +} + diff --git a/test/CodeGenObjCXX/property-derived-to-base-conv.mm b/test/CodeGenObjCXX/property-derived-to-base-conv.mm index d7c743c69068..ddca857fbab0 100644 --- a/test/CodeGenObjCXX/property-derived-to-base-conv.mm +++ b/test/CodeGenObjCXX/property-derived-to-base-conv.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s // rdar: // 7501812 struct A { diff --git a/test/CodeGenObjCXX/property-dot-copy.mm b/test/CodeGenObjCXX/property-dot-copy.mm index 9b23c58ca17b..c0ff258e8585 100644 --- a/test/CodeGenObjCXX/property-dot-copy.mm +++ b/test/CodeGenObjCXX/property-dot-copy.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // rdar://8427922 struct Vector3D diff --git a/test/CodeGenObjCXX/property-dot-reference.mm b/test/CodeGenObjCXX/property-dot-reference.mm index 6b53639f54cb..e64b397cc026 100644 --- a/test/CodeGenObjCXX/property-dot-reference.mm +++ b/test/CodeGenObjCXX/property-dot-reference.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s // rdar://8409336 struct TFENode { diff --git a/test/CodeGenObjCXX/property-object-conditional-exp.mm b/test/CodeGenObjCXX/property-object-conditional-exp.mm index 5d8a8826355c..281076e47f4d 100644 --- a/test/CodeGenObjCXX/property-object-conditional-exp.mm +++ b/test/CodeGenObjCXX/property-object-conditional-exp.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s struct CGRect { char* origin; diff --git a/test/CodeGenObjCXX/property-object-reference.mm b/test/CodeGenObjCXX/property-object-reference.mm new file mode 100644 index 000000000000..b87ce2303b5e --- /dev/null +++ b/test/CodeGenObjCXX/property-object-reference.mm @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - | FileCheck %s +// rdar://10188258 + +struct Foo {int i;}; + +@interface ObjCTest { } +@property (nonatomic, readonly) Foo& FooRefProperty; +@end + + +@implementation ObjCTest +@dynamic FooRefProperty; + +-(void) test { + Foo& f = self.FooRefProperty; +} +@end + +// CHECK: [[T0:%.*]] = load {{%.*}} [[S0:%.*]] +// CHECK: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ +// CHECK: [[T2:%.*]] = bitcast {{%.*}} [[T0]] to i8* +// CHECK: @objc_msgSend + diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm index 1f4311763595..6dfcc27f1921 100644 --- a/test/CodeGenObjCXX/property-objects.mm +++ b/test/CodeGenObjCXX/property-objects.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // CHECK-NOT: callq _objc_msgSend_stret // CHECK: call void @_ZN1SC1ERKS_ // CHECK: call %class.S* @_ZN1SaSERKS_ diff --git a/test/CodeGenObjCXX/property-reference.mm b/test/CodeGenObjCXX/property-reference.mm index 7c235cb9b4ef..bc3bb475f5f7 100644 --- a/test/CodeGenObjCXX/property-reference.mm +++ b/test/CodeGenObjCXX/property-reference.mm @@ -1,16 +1,14 @@ -// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - | FileCheck %s // rdar://9208606 -struct MyStruct -{ - int x; - int y; - int z; +struct MyStruct { + int x; + int y; + int z; }; -@interface MyClass -{ - MyStruct _foo; +@interface MyClass { + MyStruct _foo; } @property (assign, readwrite) const MyStruct& foo; @@ -19,16 +17,38 @@ struct MyStruct - (void) setFoo:(const MyStruct&)inFoo; @end -int main() -{ - MyClass* myClass; - MyStruct myStruct; +void test0() { + MyClass* myClass; + MyStruct myStruct; - myClass.foo = myStruct; + myClass.foo = myStruct; - const MyStruct& currentMyStruct = myClass.foo; - return 0; + const MyStruct& currentMyStruct = myClass.foo; } // CHECK: [[C:%.*]] = call %struct.MyStruct* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend // CHECK: store %struct.MyStruct* [[C]], %struct.MyStruct** [[D:%.*]] + +namespace test1 { + struct A { A(); A(const A&); A&operator=(const A&); ~A(); }; +} +@interface Test1 { + test1::A ivar; +} +@property const test1::A &prop1; +@end +@implementation Test1 +@synthesize prop1 = ivar; +@end +// CHECK: define internal [[A:%.*]]* @"\01-[Test1 prop1]"( +// CHECK: [[SELF:%.*]] = alloca [[TEST1:%.*]]*, align 8 +// CHECK: [[T0:%.*]] = load [[TEST1]]** [[SELF]] +// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* +// CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds i8* [[T1]], i64 0 +// CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[A]]* +// CHECK-NEXT: ret [[A]]* [[T3]] + +// CHECK: define internal void @"\01-[Test1 setProp1:]"( +// CHECK: call [[A]]* @_ZN5test11AaSERKS0_( +// CHECK-NEXT: ret void + diff --git a/test/CodeGenObjCXX/refence-assign-write-barrier.mm b/test/CodeGenObjCXX/refence-assign-write-barrier.mm index b295eb25672f..206ecb0c29e3 100644 --- a/test/CodeGenObjCXX/refence-assign-write-barrier.mm +++ b/test/CodeGenObjCXX/refence-assign-write-barrier.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar://8681766 @interface NSArray diff --git a/test/CodeGenObjCXX/selector-expr-lvalue.mm b/test/CodeGenObjCXX/selector-expr-lvalue.mm index 030545119be4..3e3bf4ecf20e 100644 --- a/test/CodeGenObjCXX/selector-expr-lvalue.mm +++ b/test/CodeGenObjCXX/selector-expr-lvalue.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s // PR7390 @interface NSObject {} diff --git a/test/CodeGenObjCXX/write-barrier-global-assign.mm b/test/CodeGenObjCXX/write-barrier-global-assign.mm index a14804ffe104..cb563f339565 100644 --- a/test/CodeGenObjCXX/write-barrier-global-assign.mm +++ b/test/CodeGenObjCXX/write-barrier-global-assign.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s // rdar://8761767 @class CPDestUser; diff --git a/test/CodeGenOpenCL/local.cl b/test/CodeGenOpenCL/local.cl new file mode 100644 index 000000000000..32fa7be0f764 --- /dev/null +++ b/test/CodeGenOpenCL/local.cl @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s + +__kernel void foo(void) { + // CHECK: @foo.i = internal addrspace(2) + __local int i; + ++i; +} diff --git a/test/CodeGenOpenCL/ptx-calls.cl b/test/CodeGenOpenCL/ptx-calls.cl new file mode 100644 index 000000000000..6f336405c301 --- /dev/null +++ b/test/CodeGenOpenCL/ptx-calls.cl @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -emit-llvm -O0 -o - | FileCheck %s + +void device_function() { +} +// CHECK: define ptx_device void @device_function() + +__kernel void kernel_function() { + device_function(); +} +// CHECK: define ptx_kernel void @kernel_function() +// CHECK: call ptx_device void @device_function() + diff --git a/test/CodeGenOpenCL/ptx-kernels.cl b/test/CodeGenOpenCL/ptx-kernels.cl new file mode 100644 index 000000000000..4d6fa1084d4b --- /dev/null +++ b/test/CodeGenOpenCL/ptx-kernels.cl @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -triple ptx32-unknown-unknown -emit-llvm -o - | FileCheck %s + +void device_function() { +} +// CHECK: define ptx_device void @device_function() + +__kernel void kernel_function() { +} +// CHECK: define ptx_kernel void @kernel_function() + diff --git a/test/Driver/Inputs/basic_linux_tree/lib/.keep b/test/Driver/Inputs/basic_linux_tree/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/lib/.keep diff --git a/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep b/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep b/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o diff --git a/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep b/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep diff --git a/test/Driver/Inputs/fake_install_tree/bin/.keep b/test/Driver/Inputs/fake_install_tree/bin/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/fake_install_tree/bin/.keep diff --git a/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o b/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o diff --git a/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o b/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o diff --git a/test/Driver/Inputs/gcc_version_parsing1/bin/.keep b/test/Driver/Inputs/gcc_version_parsing1/bin/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing1/bin/.keep diff --git a/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o b/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o diff --git a/test/Driver/Inputs/gcc_version_parsing2/bin/.keep b/test/Driver/Inputs/gcc_version_parsing2/bin/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing2/bin/.keep diff --git a/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o b/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o diff --git a/test/Driver/Inputs/gcc_version_parsing3/bin/.keep b/test/Driver/Inputs/gcc_version_parsing3/bin/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing3/bin/.keep diff --git a/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o b/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep diff --git a/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep diff --git a/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep diff --git a/test/Driver/apple-kext-i386.cpp b/test/Driver/apple-kext-i386.cpp index dc4e6a641f0d..8ce9f87dab38 100644 --- a/test/Driver/apple-kext-i386.cpp +++ b/test/Driver/apple-kext-i386.cpp @@ -7,3 +7,36 @@ // CHECK: cc1plus" // CHECK: "-fapple-kext" + +// RUN: %clang -ccc-host-triple i386-apple-darwin10 \ +// RUN: -mkernel -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-MKERNEL < %t %s + +// CHECK-MKERNEL: cc1plus" +// CHECK-MKERNEL: "-mkernel" + +// RUN: %clang -ccc-host-triple i386-apple-darwin10 \ +// RUN: -Wno-self-assign -Wc++0x-extensions -Wno-microsoft -Wmicrosoft -Wvla \ +// RUN: -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \ +// RUN: -fapple-kext -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s + +// CHECK-UNSUPPORTED: cc1plus" +// CHECK-UNSUPPORTED-NOT: "-Wno-self-assign" +// CHECK-UNSUPPORTED-NOT: "-Wc++0x-extensions" +// CHECK-UNSUPPORTED-NOT: "-Wno-microsoft" +// CHECK-UNSUPPORTED-NOT: "-Wmicrosoft" +// CHECK-UNSUPPORTED-NOT: "-Wvla" +// CHECK-UNSUPPORTED-NOT: "-faltivec" +// CHECK-UNSUPPORTED-NOT: "-mthumb" +// CHECK-UNSUPPORTED-NOT: "-mlongcall" +// CHECK-UNSUPPORTED: "-mno-longcall" +// CHECK-UNSUPPORTED: "-msoft-float" + +// RUN: %clang -ccc-host-triple i386-apple-darwin10 \ +// RUN: -Wconstant-logical-operand -save-temps \ +// RUN: -fapple-kext -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED2 < %t %s + +// CHECK-UNSUPPORTED2: cc1plus" +// CHECK-UNSUPPORTED2-NOT: "-Wconstant-logical-operand" diff --git a/test/Driver/cc-log-diagnostics.c b/test/Driver/cc-log-diagnostics.c index 6c1b8ed896f1..2fdbe5133c5b 100644 --- a/test/Driver/cc-log-diagnostics.c +++ b/test/Driver/cc-log-diagnostics.c @@ -17,7 +17,7 @@ int f0() {} // CHECK: <key>level</key> // CHECK: <string>warning</string> // CHECK: <key>message</key> -// CHECK: <string>unknown warning option '-Wfoobar'</string> +// CHECK: <string>unknown warning option '-Wfoobar'</string> // CHECK: </dict> // CHECK: <dict> // CHECK: <key>level</key> diff --git a/test/Driver/ccc-host-triple-no-integrated-as.c b/test/Driver/ccc-host-triple-no-integrated-as.c new file mode 100644 index 000000000000..a94dea3a7da2 --- /dev/null +++ b/test/Driver/ccc-host-triple-no-integrated-as.c @@ -0,0 +1,17 @@ +// Check that -no-integrated-as works when -ccc-host-triple i386-pc-win32-macho or +// -ccc-host-triple x86_64-pc-win32-macho is specified. + +// RUN: %clang -### -c -ccc-host-triple i386-pc-win32-macho -no-integrated-as %s 2> %t1 +// RUN: FileCheck -check-prefix=X86 < %t1 %s +// RUN: %clang -### -c -ccc-host-triple x86_64-pc-win32-macho -no-integrated-as %s 2> %t2 +// RUN: FileCheck -check-prefix=X86_64 < %t2 %s +// +// X86: "-cc1" +// X86-NOT: "-cc1as" +// X86: "-arch" +// X86: "i386" +// +// X86_64: "-cc1" +// X86_64-NOT: "-cc1as" +// X86_64: "-arch" +// X86_64: "x86_64" diff --git a/test/Driver/cpath.c b/test/Driver/cpath.c new file mode 100644 index 000000000000..7caa014b2afc --- /dev/null +++ b/test/Driver/cpath.c @@ -0,0 +1,20 @@ +// RUN: mkdir -p %T/test1 %T/test2 + +// RUN: env CPATH=%T/test1 %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=CPATH +// CPATH: -I {{.*}}/test1 +// CPATH: search starts here +// CPATH: test1 + +// RUN: env OBJC_INCLUDE_PATH=%T/test1 OBJCPLUS_INCLUDE_PATH=%T/test1 CPLUS_INCLUDE_PATH=%T/test1 C_INCLUDE_PATH=%T/test2 %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=C_INCLUDE_PATH +// C_INCLUDE_PATH: -c-isystem {{"?.*}}/test2{{"?}} -cxx-isystem {{"?.*}}/test1{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objcxx-isystem {{"?.*}}/test1{{"?}} +// C_INCLUDE_PATH: search starts here +// C_INCLUDE_PATH-NOT: test1 +// C_INCLUDE_PATH: test2 +// C_INCLUDE_PATH-NOT: test1 + +// RUN: env OBJC_INCLUDE_PATH=%T/test1 OBJCPLUS_INCLUDE_PATH=%T/test2 CPLUS_INCLUDE_PATH=%T/test2 C_INCLUDE_PATH=%T/test1 %clang -x objective-c++ -E -v %s 2>&1 | FileCheck %s -check-prefix=OBJCPLUS_INCLUDE_PATH +// OBJCPLUS_INCLUDE_PATH: -c-isystem {{"?.*}}/test1{{"?}} -cxx-isystem {{"?.*}}/test2{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objcxx-isystem {{"?.*}}/test2{{"?}} +// OBJCPLUS_INCLUDE_PATH: search starts here +// OBJCPLUS_INCLUDE_PATH-NOT: test1 +// OBJCPLUS_INCLUDE_PATH: test2 +// OBJCPLUS_INCLUDE_PATH-NOT: test1 diff --git a/test/Driver/darwin-objc-defaults.m b/test/Driver/darwin-objc-defaults.m index 4cf83a121d19..dc062aea36e9 100644 --- a/test/Driver/darwin-objc-defaults.m +++ b/test/Driver/darwin-objc-defaults.m @@ -7,7 +7,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_OSX10_5 < %t %s // CHECK-CHECK-I386_OSX10_5: "-cc1" -// CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-nonfragile-abi +// CHECK-CHECK-I386_OSX10_5: -fobjc-fragile-abi // CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_OSX10_5: darwin-objc-defaults @@ -16,7 +16,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_OSX10_6 < %t %s // CHECK-CHECK-I386_OSX10_6: "-cc1" -// CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-nonfragile-abi +// CHECK-CHECK-I386_OSX10_6: -fobjc-fragile-abi // CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_OSX10_6: darwin-objc-defaults @@ -25,7 +25,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_IPHONE3_0 < %t %s // CHECK-CHECK-I386_IPHONE3_0: "-cc1" -// CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-nonfragile-abi +// CHECK-CHECK-I386_IPHONE3_0: -fobjc-fragile-abi // CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_IPHONE3_0: darwin-objc-defaults @@ -36,7 +36,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_5 < %t %s // CHECK-CHECK-X86_64_OSX10_5: "-cc1" -// CHECK-CHECK-X86_64_OSX10_5: -fobjc-nonfragile-abi +// CHECK-CHECK-X86_64_OSX10_5-NOT: -fobjc-fragile-abi // CHECK-CHECK-X86_64_OSX10_5: -fobjc-dispatch-method=non-legacy // CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults @@ -45,7 +45,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_6 < %t %s // CHECK-CHECK-X86_64_OSX10_6: "-cc1" -// CHECK-CHECK-X86_64_OSX10_6: -fobjc-nonfragile-abi +// CHECK-CHECK-X86_64_OSX10_6-NOT: -fobjc-fragile-abi // CHECK-CHECK-X86_64_OSX10_6: -fobjc-dispatch-method=mixed // CHECK-CHECK-X86_64_OSX10_6: darwin-objc-defaults @@ -54,7 +54,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_IPHONE3_0 < %t %s // CHECK-CHECK-X86_64_IPHONE3_0: "-cc1" -// CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-nonfragile-abi +// CHECK-CHECK-X86_64_IPHONE3_0-NOT: -fobjc-fragile-abi // CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-dispatch-method=mixed // CHECK-CHECK-X86_64_IPHONE3_0: darwin-objc-defaults @@ -65,7 +65,7 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_5 < %t %s // CHECK-CHECK-ARMV7_OSX10_5: "-cc1" -// CHECK-CHECK-ARMV7_OSX10_5: -fobjc-nonfragile-abi +// CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-fragile-abi // CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults @@ -74,7 +74,7 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_6 < %t %s // CHECK-CHECK-ARMV7_OSX10_6: "-cc1" -// CHECK-CHECK-ARMV7_OSX10_6: -fobjc-nonfragile-abi +// CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-fragile-abi // CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_OSX10_6: darwin-objc-defaults @@ -83,6 +83,6 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_IPHONE3_0 < %t %s // CHECK-CHECK-ARMV7_IPHONE3_0: "-cc1" -// CHECK-CHECK-ARMV7_IPHONE3_0: -fobjc-nonfragile-abi +// CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-fragile-abi // CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_IPHONE3_0: darwin-objc-defaults diff --git a/test/Driver/darwin-objc-options.m b/test/Driver/darwin-objc-options.m index 50daa72333e8..a62a62c4fa70 100644 --- a/test/Driver/darwin-objc-options.m +++ b/test/Driver/darwin-objc-options.m @@ -5,7 +5,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_ABI1 < %t %s // CHECK-CHECK-X86_64_ABI1: "-cc1" -// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-nonfragile-abi +// CHECK-CHECK-X86_64_ABI1: -fobjc-fragile-abi // CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-dispatch-method // CHECK-CHECK-X86_64_ABI1: darwin-objc-options @@ -14,7 +14,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_ABI2 < %t %s // CHECK-CHECK-I386_ABI2: "-cc1" -// CHECK-CHECK-I386_ABI2: -fobjc-nonfragile-abi +// CHECK-CHECK-I386_ABI2-NOT: -fobjc-fragile-abi // CHECK-CHECK-I386_ABI2: -fobjc-exceptions // CHECK-CHECK-I386_ABI2: -fexceptions // CHECK-CHECK-I386_ABI2-NOT: -fobjc-dispatch-method diff --git a/test/Driver/darwin-verify-debug.c b/test/Driver/darwin-verify-debug.c new file mode 100644 index 000000000000..1e4eff8c83f1 --- /dev/null +++ b/test/Driver/darwin-verify-debug.c @@ -0,0 +1,34 @@ +// Check that we verify debug output properly with multiple -arch options. +// +// REQUIRES: asserts +// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-phases \ +// RUN: -verify -arch i386 -arch x86_64 %s -g 2> %t +// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-ACTIONS < %t %s +// +// CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-verify-debug.c", c +// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM +// CHECK-MULTIARCH-ACTIONS: 9: verify, {8}, none +// +// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \ +// RUN: -verify -arch i386 -arch x86_64 %s -g 2> %t +// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-BINDINGS < %t %s +// +// CHECK-MULTIARCH-BINDINGS: # "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["a.out"], output: "a.out.dSYM" +// CHECK-MULTIARCH-BINDINGS: # "x86_64-apple-darwin10" - "darwin::VerifyDebug", inputs: ["a.out.dSYM"], output: (nothing) + +// Check output name derivation. +// +// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \ +// RUN: -verify -o foo %s -g 2> %t +// RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s +// +// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo" +// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM" +// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::VerifyDebug", inputs: ["foo.dSYM"], output: (nothing) + +// Check that we only verify when needed. +// +// RUN: touch %t.o +// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \ +// RUN: -verify -o foo %t.o -g 2> %t +// RUN: grep "Verify" %t | count 0 diff --git a/test/Driver/index-header-map.c b/test/Driver/index-header-map.c new file mode 100644 index 000000000000..8bd677a0ba98 --- /dev/null +++ b/test/Driver/index-header-map.c @@ -0,0 +1,4 @@ +// RUN: %clang -I%S/Before -index-header-map -I%S/Index -I%S/After %s -### 2>> %t.log +// RUN: FileCheck %s < %t.log + +// CHECK: {{-I.*Before.*-index-header-map.*-I.*Index.*-I.*After}} diff --git a/test/Driver/le32-unknown-nacl.cpp b/test/Driver/le32-unknown-nacl.cpp new file mode 100644 index 000000000000..bc31802410db --- /dev/null +++ b/test/Driver/le32-unknown-nacl.cpp @@ -0,0 +1,141 @@ +// RUN: %clang -ccc-host-triple le32-unknown-nacl -ccc-clang-archs le32 -ccc-echo %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO +// RUN: %clang -ccc-host-triple le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -o - | FileCheck %s +// RUN: %clang -ccc-host-triple le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS + +// ECHO: {{.*}} -cc1 {{.*}}le32-unknown-nacl.c + +// Check platform defines +#include <stdarg.h> +#include <stddef.h> + +extern "C" { + +// CHECK: @align_c = global i32 1 +int align_c = __alignof(char); + +// CHECK: @align_s = global i32 2 +int align_s = __alignof(short); + +// CHECK: @align_i = global i32 4 +int align_i = __alignof(int); + +// CHECK: @align_l = global i32 4 +int align_l = __alignof(long); + +// CHECK: @align_ll = global i32 8 +int align_ll = __alignof(long long); + +// CHECK: @align_p = global i32 4 +int align_p = __alignof(void*); + +// CHECK: @align_f = global i32 4 +int align_f = __alignof(float); + +// CHECK: @align_d = global i32 8 +int align_d = __alignof(double); + +// CHECK: @align_ld = global i32 8 +int align_ld = __alignof(long double); + +// CHECK: @align_vl = global i32 4 +int align_vl = __alignof(va_list); + +// CHECK: __native_client__defined +#ifdef __native_client__ +void __native_client__defined() {} +#endif + +// CHECK: __le32__defined +#ifdef __le32__ +void __le32__defined() {} +#endif + +// CHECK: __pnacl__defined +#ifdef __pnacl__ +void __pnacl__defined() {} +#endif + +// CHECK: unixdefined +#ifdef unix +void unixdefined() {} +#endif + +// CHECK: __ELF__defined +#ifdef __ELF__ +void __ELF__defined() {} +#endif + +// CHECK: _GNU_SOURCEdefined +#ifdef _GNU_SOURCE +void _GNU_SOURCEdefined() {} +#endif + +// THREADS: _REENTRANTdefined +// CHECK: _REENTRANTundefined +#ifdef _REENTRANT +void _REENTRANTdefined() {} +#else +void _REENTRANTundefined() {} +#endif + +// Check types + +// CHECK: signext i8 @check_char() +char check_char() { return 0; } + +// CHECK: signext i16 @check_short() +short check_short() { return 0; } + +// CHECK: i32 @check_int() +int check_int() { return 0; } + +// CHECK: i32 @check_long() +long check_long() { return 0; } + +// CHECK: i64 @check_longlong() +long long check_longlong() { return 0; } + +// CHECK: zeroext i8 @check_uchar() +unsigned char check_uchar() { return 0; } + +// CHECK: zeroext i16 @check_ushort() +unsigned short check_ushort() { return 0; } + +// CHECK: i32 @check_uint() +unsigned int check_uint() { return 0; } + +// CHECK: i32 @check_ulong() +unsigned long check_ulong() { return 0; } + +// CHECK: i64 @check_ulonglong() +unsigned long long check_ulonglong() { return 0; } + +// CHECK: i32 @check_size_t() +size_t check_size_t() { return 0; } + +// CHECK: float @check_float() +float check_float() { return 0; } + +// CHECK: double @check_double() +double check_double() { return 0; } + +// CHECK: double @check_longdouble() +long double check_longdouble() { return 0; } + +} + +template<int> void Switch(); +template<> void Switch<4>(); +template<> void Switch<8>(); +template<> void Switch<16>(); + +void check_pointer_size() { + // CHECK: SwitchILi4 + Switch<sizeof(void*)>(); + + // CHECK: SwitchILi8 + Switch<sizeof(long long)>(); + + // CHECK: SwitchILi16 + Switch<sizeof(va_list)>(); +} diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c new file mode 100644 index 000000000000..46fbe7f52dea --- /dev/null +++ b/test/Driver/linux-ld.c @@ -0,0 +1,139 @@ +// General tests that ld invocations on Linux targets sane. Note that we use +// sysroot to make these tests independent of the host system. +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s +// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o" +// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0" +// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" +// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." +// CHECK-LD-32: "-L[[SYSROOT]]/lib" +// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s +// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" +// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" +// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." +// CHECK-LD-64: "-L[[SYSROOT]]/lib" +// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m32 \ +// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s +// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32" +// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." +// CHECK-32-TO-32: "-L[[SYSROOT]]/lib" +// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m64 \ +// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s +// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64" +// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." +// CHECK-32-TO-64: "-L[[SYSROOT]]/lib" +// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple x86_64-unknown-linux -m64 \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s +// CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64" +// CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." +// CHECK-64-TO-64: "-L[[SYSROOT]]/lib" +// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple x86_64-unknown-linux -m32 \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s +// CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32" +// CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." +// CHECK-64-TO-32: "-L[[SYSROOT]]/lib" +// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s +// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o" +// CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0" +// +// Check that with 64-bit builds, we don't actually use the install directory +// as its version of GCC is lower than our sysrooted version. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple x86_64-unknown-linux -m64 \ +// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s +// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o" +// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0" +// +// Check that we support unusual patch version formats, including missing that +// component. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s +// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7/crtbegin.o" +// CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s +// CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o" +// CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -ccc-host-triple i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s +// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o" +// CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5" diff --git a/test/Driver/mno-global-merge.c b/test/Driver/mno-global-merge.c new file mode 100644 index 000000000000..b4d8f8757281 --- /dev/null +++ b/test/Driver/mno-global-merge.c @@ -0,0 +1,12 @@ +// RUN: %clang -ccc-host-triple armv7-apple-darwin10 \ +// RUN: -mno-global-merge -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NGM < %t %s + +// CHECK-NGM: "-mno-global-merge" + +// RUN: %clang -ccc-host-triple armv7-apple-darwin10 \ +// RUN: -mglobal-merge -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-GM < %t %s + +// CHECK-GM-NOT: "-mglobal-merge" + diff --git a/test/Driver/nostdlibinc.c b/test/Driver/nostdlibinc.c new file mode 100644 index 000000000000..f7ee712d866c --- /dev/null +++ b/test/Driver/nostdlibinc.c @@ -0,0 +1,10 @@ +// RUN: %clang -ccc-host-triple x86_64-unknown-unknown \ +// RUN: -nostdlibinc -ffreestanding -fsyntax-only %s + +#if !__has_include("stddef.h") +#error "expected to be able to find compiler builtin headers!" +#endif + +#if __has_include("stdlib.h") +#error "expected to *not* be able to find standard C headers" +#endif diff --git a/test/Driver/objc++-cpp-output.mm b/test/Driver/objc++-cpp-output.mm new file mode 100644 index 000000000000..bb8814428ac4 --- /dev/null +++ b/test/Driver/objc++-cpp-output.mm @@ -0,0 +1,8 @@ +// RUN: %clang -x objc++-cpp-output -c %s -o /dev/null + +// Should compile without errors +@protocol P +- (void)m; +@end +void f() {} +class C {}; diff --git a/test/Driver/objc-cpp-output.m b/test/Driver/objc-cpp-output.m new file mode 100644 index 000000000000..6d974838c150 --- /dev/null +++ b/test/Driver/objc-cpp-output.m @@ -0,0 +1,7 @@ +// RUN: %clang -x objc-cpp-output -c %s -o /dev/null + +// Should compile without errors +@protocol P +- (void)m; +@end +void f() {} diff --git a/test/Driver/rewrite-objc.m b/test/Driver/rewrite-objc.m index c47b52334c91..80190917c9c2 100644 --- a/test/Driver/rewrite-objc.m +++ b/test/Driver/rewrite-objc.m @@ -1,9 +1,9 @@ -// RUN: %clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \ +// RUN: %clang -ccc-host-triple x86_64-apple-macosx10.7.0 -rewrite-objc %s -o - -### 2>&1 | \ // RUN: FileCheck -check-prefix=TEST0 %s // TEST0: clang{{.*}}" "-cc1" // TEST0: "-rewrite-objc" // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead. -// TEST0: "-fmessage-length" "0" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fdiagnostics-show-option" +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fobjc-fragile-abi" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option" // TEST0: rewrite-objc.m" // RUN: not %clang -ccc-no-clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \ diff --git a/test/Driver/std.cpp b/test/Driver/std.cpp new file mode 100644 index 000000000000..7704c8dda1ea --- /dev/null +++ b/test/Driver/std.cpp @@ -0,0 +1,24 @@ +// RUN: %clang -std=c++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX98 %s +// RUN: %clang -std=gnu++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX98 %s +// RUN: %clang -std=c++03 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX98 %s +// RUN: %clang -std=c++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s +// RUN: %clang -std=gnu++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s +// RUN: %clang -std=c++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s +// RUN: %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s + +void f(int n) { + typeof(n)(); + decltype(n)(); +} + +// CXX98: undeclared identifier 'typeof' +// CXX98: undeclared identifier 'decltype' + +// GNUXX98-NOT: undeclared identifier 'typeof' +// GNUXX98: undeclared identifier 'decltype' + +// CXX11: undeclared identifier 'typeof' +// CXX11-NOT: undeclared identifier 'decltype' + +// GNUXX11-NOT: undeclared identifier 'typeof' +// GNUXX11-NOT: undeclared identifier 'decltype' diff --git a/test/FixIt/dereference-addressof.c b/test/FixIt/dereference-addressof.c new file mode 100644 index 000000000000..950fadc83055 --- /dev/null +++ b/test/FixIt/dereference-addressof.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: cp %s %t +// RUN: not %clang_cc1 -fsyntax-only -fixit -x c %t +// RUN: %clang_cc1 -fsyntax-only -pedantic -x c %t + +void ip(int *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}} +void i(int a) {} // expected-note{{passing argument to parameter 'a' here}} +void ii(int a) {} // expected-note{{passing argument to parameter 'a' here}} +void fp(float *aPtr) {} // expected-note{{passing argument to parameter 'aPtr' here}} +void f(float a) {} // expected-note{{passing argument to parameter 'a' here}} + +void f2(int *aPtr, int a, float *bPtr, char c) { + float fl = 0; + ip(a); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'; take the address with &}} + i(aPtr); // expected-warning{{incompatible pointer to integer conversion passing 'int *' to parameter of type 'int'; dereference with *}} + ii(&a); // expected-warning{{incompatible pointer to integer conversion passing 'int *' to parameter of type 'int'; remove &}} + fp(*bPtr); // expected-error{{passing 'float' to parameter of incompatible type 'float *'; remove *}} + f(bPtr); // expected-error{{passing 'float *' to parameter of incompatible type 'float'; dereference with *}} + a = aPtr; // expected-warning{{incompatible pointer to integer conversion assigning to 'int' from 'int *'; dereference with *}} + fl = bPtr + a; // expected-error{{assigning to 'float' from incompatible type 'float *'; dereference with *}} + bPtr = bPtr[a]; // expected-error{{assigning to 'float *' from incompatible type 'float'; take the address with &}} +} diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp index 77e9e5815c2f..73316457b18f 100644 --- a/test/FixIt/fixit-cxx0x.cpp +++ b/test/FixIt/fixit-cxx0x.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -verify -std=c++0x %s +// RUN: %clang_cc1 -verify -std=c++11 %s // RUN: cp %s %t -// RUN: %clang_cc1 -x c++ -std=c++0x -fixit %t || true -// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++0x %t +// RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t +// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t /* This is a test of the various code modification hints that only apply in C++0x. */ @@ -17,3 +17,38 @@ void x() { using ::T = void; // expected-error {{name defined in alias declaration must be an identifier}} using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}} using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}} + +namespace Constexpr { + extern constexpr int a; // expected-error {{must be a definition}} + // -> extern const int a; + + extern constexpr int *b; // expected-error {{must be a definition}} + // -> extern int *const b; + + extern constexpr int &c; // expected-error {{must be a definition}} + // -> extern int &b; + + extern constexpr const int d; // expected-error {{must be a definition}} + // -> extern const int d; + + int z; + constexpr int a = 0; + constexpr int *b = &z; + constexpr int &c = z; + constexpr int d = a; + + // FIXME: Provide FixIts for static data members too. +#if 0 + struct S { + static constexpr int b; // xpected-error {{requires an initializer}} + // -> const int b; + }; + + constexpr int S::b = 0; +#endif + + struct S { + static char *const p = 0; // expected-error {{requires 'constexpr' specifier}} + // -> constexpr static char *const p = 0; + }; +} diff --git a/test/FixIt/fixit-errors.c b/test/FixIt/fixit-errors.c index f8e2295d496a..356e862ff606 100644 --- a/test/FixIt/fixit-errors.c +++ b/test/FixIt/fixit-errors.c @@ -1,5 +1,5 @@ // RUN: cp %s %t -// RUN: true || %clang_cc1 -pedantic -verify -fixit -x c %t +// RUN: %clang_cc1 -pedantic -verify -fixit -x c %t // RUN: %clang_cc1 -pedantic -Werror -x c %t // XFAIL: * diff --git a/test/FixIt/fixit-function-call.cpp b/test/FixIt/fixit-function-call.cpp new file mode 100644 index 000000000000..273e4a41ec8d --- /dev/null +++ b/test/FixIt/fixit-function-call.cpp @@ -0,0 +1,118 @@ +// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2> %t +// RUN: FileCheck %s < %t +// PR5941 +// END. + +/* Test fixits for * and & mismatch in function arguments. + * Since fixits are on the notes, they cannot be applied automatically. */ + +typedef int intTy; +typedef int intTy2; + +void f0(int *a); +void f1(double *a); +void f1(intTy &a); + +void f2(intTy2 *a) { +// CHECK: error: no matching function for call to 'f1 +// CHECK: dereference the argument with * +// CHECK: void f1(intTy &a); +// CHECK: fix-it{{.*}}*( +// CHECK-NEXT: fix-it{{.*}}) +// CHECK: void f1(double *a); + f1(a + 1); + +// This call cannot be fixed since without resulting in null pointer dereference. +// CHECK: error: no matching function for call to 'f1 +// CHECK-NOT: dereference the argument with * +// CHECK-NOT: fix-it + f1((int *)0); +} + +void f3(int &a) { +// CHECK: error: no matching function for call to 'f0 +// CHECK: fix-it{{.*}}& + f0(a); +} + + +void m(int *a, const int *b); // match 2 +void m(double *a, int *b); // no match +void m(int *a, double *b); // no match +void m(intTy &a, int *b); // match 1 + +void mcaller(intTy2 a, int b) { +// CHECK: error: no matching function for call to 'm +// CHECK: take the address of the argument with & +// CHECK: fix-it{{.*}}& +// CHECK: take the address of the argument with & +// CHECK: fix-it{{.*}}& +// CHECK: fix-it{{.*}}& + m(a, b); + +// This call cannot be fixed because (a + 1) is not an l-value. +// CHECK: error: no matching function for call to 'm +// CHECK-NOT: fix-it + m(a + 1, b); +} + +// Test derived to base conversions. +struct A { + int xx; +}; + +struct B : public A { + double y; +}; + +class C : A {}; + +bool br(A &a); +bool bp(A *a); +bool dv(B b); + +void u(int x); +void u(const C *x); +void u(double x); + +void dbcaller(A *ptra, B *ptrb, C &c, B &refb) { + B b; + +// CHECK: error: no matching function for call to 'br +// CHECK: fix-it{{.*}}* + br(ptrb); // good + +// CHECK: error: no matching function for call to 'bp +// CHECK: fix-it{{.*}}& + bp(b); // good + +// CHECK: error: no matching function for call to 'dv +// CHECK-NOT: fix-it + dv(ptra); // bad: base to derived + +// CHECK: error: no matching function for call to 'dv +// CHECK: remove & + dv(&b); + +// CHECK: error: no matching function for call to 'bp +// CHECK: remove * + bp(*ptra); + +// CHECK: error: no viable overloaded '=' +// CHECK: remove & + b = &refb; + +// TODO: Test that we do not provide a fixit when inheritance is private. +// CHECK: error: no matching function for call to 'bp +// There should not be a fixit here: +// CHECK: fix-it + bp(c); + +// CHECK: no matching function for call to 'u' +// CHECK: candidate function not viable: no known conversion from 'C' to 'const C *' for 1st argument; take the address of the argument with & +// CHECK: candidate function not viable +// CHECK: candidate function not viable + u(c); +} + +// CHECK: errors generated diff --git a/test/FixIt/fixit-missing-method-return-type.m b/test/FixIt/fixit-missing-method-return-type.m new file mode 100644 index 000000000000..027c89572ff9 --- /dev/null +++ b/test/FixIt/fixit-missing-method-return-type.m @@ -0,0 +1,24 @@ +// Objective-C recovery +// RUN: cp %s %t +// RUN: %clang_cc1 -Wmissing-method-return-type -fixit -x objective-c %t +// RUN: %clang_cc1 -fsyntax-only -pedantic -Wmissing-method-return-type -Werror -x objective-c %t + +// Objective-C++ recovery +// RUN: cp %s %t +// RUN: %clang_cc1 -Wmissing-method-return-type -fixit -x objective-c++ %t +// RUN: %clang_cc1 -fsyntax-only -pedantic -Wmissing-method-return-type -Werror -x objective-c++ %t +// rdar://9615045 + +@interface I +- initWithFoo:(id)foo; // expected-warning {{method has no return type specified; defaults to 'id' [-Wmissing-method-return-type]}} +- Meth; +-Meth1; +@end + +@implementation I +- initWithFoo:(id)foo { return 0; } // expected-warning {{method has no return type specified; defaults to 'id' [-Wmissing-method-return-type]}} + +-Meth { return 0;} +- Meth1 { return 0;} +@end + diff --git a/test/FixIt/fixit-objc-message.m b/test/FixIt/fixit-objc-message.m index 1fef3cc56d5e..a3680e475ee2 100644 --- a/test/FixIt/fixit-objc-message.m +++ b/test/FixIt/fixit-objc-message.m @@ -1,11 +1,11 @@ // Objective-C recovery // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -Wall -fixit -x objective-c %t || true +// RUN: not %clang_cc1 -pedantic -Wall -fixit -x objective-c %t // RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x objective-c %t // Objective-C++ recovery // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -Wall -fixit -x objective-c++ %t || true +// RUN: not %clang_cc1 -pedantic -Wall -fixit -x objective-c++ %t // RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x objective-c++ %t @interface A diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m index 2e8bfaea6aa3..df591c792296 100644 --- a/test/FixIt/fixit-objc.m +++ b/test/FixIt/fixit-objc.m @@ -53,3 +53,17 @@ int f0(Radar7861841 *a) { return a.x; } // expected-error {{property 'x' not fou int f1(Radar7861841 *a) { return a->y; } // expected-error {{property 'y' found on object of type 'Radar7861841 *'; did you mean to access it with the "." operator?}} + +#define nil ((void*)0) +#define NULL ((void*)0) + +void sentinel(int x, ...) __attribute__((sentinel)); // expected-note{{function has been explicitly marked sentinel here}} + +@interface Sentinel +- (void)sentinel:(int)x, ... __attribute__((sentinel)); // expected-note{{method has been explicitly marked sentinel here}} +@end + +void sentinel_test(Sentinel *a) { + sentinel(1, 2, 3); // expected-warning{{missing sentinel in function call}} + [a sentinel:1, 2, 3]; // expected-warning{{missing sentinel in method dispatch}} +} diff --git a/test/FixIt/fixit-static-object-decl.m b/test/FixIt/fixit-static-object-decl.m new file mode 100644 index 000000000000..e13900fa786f --- /dev/null +++ b/test/FixIt/fixit-static-object-decl.m @@ -0,0 +1,29 @@ +// Objective-C recovery +// RUN: cp %s %t +// RUN: not %clang_cc1 -fixit -x objective-c %t +// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c %t + +// Objective-C++ recovery +// RUN: cp %s %t +// RUN: not %clang_cc1 -fixit -x objective-c++ %t +// RUN: %clang_cc1 -fsyntax-only -Werror -x objective-c++ %t +// rdar://9603056 + +@interface S @end + +@interface NSArray +{ +@public + S iS; +} ++ (id) arrayWithObjects; +@end + +NSArray func() { + NSArray P; + return P; +} + +int main() { + NSArray pluginNames = [NSArray arrayWithObjects]; +} diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c index ba45cf28e694..5ba0aac4509b 100644 --- a/test/FixIt/fixit.c +++ b/test/FixIt/fixit.c @@ -1,7 +1,7 @@ // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -fixit -x c %t || true +// RUN: not %clang_cc1 -pedantic -Wunused-label -fixit -x c %t // RUN: grep -v CHECK %t > %t2 -// RUN: %clang_cc1 -pedantic -Werror -x c %t +// RUN: %clang_cc1 -pedantic -Wunused-label -Werror -x c %t // RUN: FileCheck -input-file=%t2 %t /* This is a test of the various code modification hints that are @@ -59,3 +59,14 @@ struct test_struct { // CHECK: struct test_struct *struct_ptr; test_struct *struct_ptr; // expected-error {{must use 'struct' tag to refer to type 'test_struct'}} }; + +void removeUnusedLabels(char c) { + L0 /*removed comment*/: c++; + removeUnusedLabels(c); + L1: + c++; + /*preserved comment*/ L2 : c++; + LL + : c++; + c = c + 3; L4: return; +} diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index ac749859ea05..785b92b2d817 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -1,5 +1,5 @@ // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -Wall -fixit -x c++ %t || true +// RUN: not %clang_cc1 -pedantic -Wall -fixit -x c++ %t // RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x c++ %t /* This is a test of the various code modification hints that are @@ -96,4 +96,15 @@ void f(){ typename F1<T>:: /*template*/ Iterator<0> Mypos; // expected-error {{use 'template' keyword to treat 'Iterator' as a dependent template name}} } +// Tests for &/* fixits radar 7113438. +class AD {}; +class BD: public AD {}; + +void test (BD &br) { + AD* aPtr; + BD b; + aPtr = b; // expected-error {{assigning to 'AD *' from incompatible type 'BD'; take the address with &}} + aPtr = br; // expected-error {{assigning to 'A *' from incompatible type 'B'; take the address with &}} +} + diff --git a/test/FixIt/typo-crash.cpp b/test/FixIt/typo-crash.cpp index b156e1b44c45..92d20377e886 100644 --- a/test/FixIt/typo-crash.cpp +++ b/test/FixIt/typo-crash.cpp @@ -3,9 +3,10 @@ // FIXME: The diagnostics and recovery here are very, very poor. // PR10355 -template<typename T> void template_id1() { - template_id2<> t; // expected-error 2{{use of undeclared identifier 'template_id2'; did you mean 'template_id1'?}} \ - // expected-error{{expected expression}} \ - // expected-error{{use of undeclared identifier 't'}} +template<typename T> void template_id1() { // expected-note {{'template_id1' declared here}} \ + // expected-note {{possible target for call}} + template_id2<> t; // expected-error {{no template named 'template_id2'; did you mean 'template_id1'?}} \ + // expected-error {{expected ';' after expression}} \ + // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} \ + // expected-error {{use of undeclared identifier 't'}} } - diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m index ecb207ee3917..a474035021e6 100644 --- a/test/FixIt/typo.m +++ b/test/FixIt/typo.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -DNON_FIXITS -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -DNON_FIXITS -verify %s // RUN: cp %s %t -// RUN: not %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fixit %t -// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -pedantic -Werror %t +// RUN: not %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fixit %t +// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -pedantic -Werror %t // RUN: grep "@implementation Sub3" %t @interface NSString // expected-note 2{{'NSString' declared here}} diff --git a/test/Frontend/Weverything.c b/test/Frontend/Weverything.c new file mode 100644 index 000000000000..32f314720b24 --- /dev/null +++ b/test/Frontend/Weverything.c @@ -0,0 +1,9 @@ +// Regression check that -pedantic-errors doesn't cause other diagnostics to +// become errors. +// +// RUN: %clang_cc1 -verify -Weverything -pedantic-errors %s + +int f0(int, unsigned); +int f0(int x, unsigned y) { + return x < y; // expected-warning {{comparison of integers}} +} diff --git a/test/Frontend/diagnostics-option-names.c b/test/Frontend/diagnostics-option-names.c new file mode 100644 index 000000000000..ed0d2ed8ef9e --- /dev/null +++ b/test/Frontend/diagnostics-option-names.c @@ -0,0 +1,8 @@ +// RUN: not %clang_cc1 -fdiagnostics-show-option -Werror -Weverything %s 2> %t +// RUN: FileCheck < %t %s + +int f0(int, unsigned); +int f0(int x, unsigned y) { +// CHECK: comparison of integers of different signs{{.*}} [-Werror,-Wsign-compare] + return x < y; // expected-error {{ : 'int' and 'unsigned int' }} +} diff --git a/test/Frontend/warning-mapping-1.c b/test/Frontend/warning-mapping-1.c new file mode 100644 index 000000000000..883dafb1f500 --- /dev/null +++ b/test/Frontend/warning-mapping-1.c @@ -0,0 +1,6 @@ +// Check that -w has higher priority than -Werror. +// RUN: %clang_cc1 -verify -Wsign-compare -Werror -w %s + +int f0(int x, unsigned y) { + return x < y; +} diff --git a/test/Frontend/warning-mapping-2.c b/test/Frontend/warning-mapping-2.c new file mode 100644 index 000000000000..39ba4997a4fa --- /dev/null +++ b/test/Frontend/warning-mapping-2.c @@ -0,0 +1,5 @@ +// Check that -w has lower priority than -pedantic-errors. +// RUN: %clang_cc1 -verify -pedantic-errors -w %s + +void f0() { f1(); } // expected-error {{implicit declaration of function}} + diff --git a/test/Frontend/warning-mapping-3.c b/test/Frontend/warning-mapping-3.c new file mode 100644 index 000000000000..8c701903f4e8 --- /dev/null +++ b/test/Frontend/warning-mapping-3.c @@ -0,0 +1,10 @@ +// Check that -Werror and -Wfatal-error interact properly. +// +// Verify mode doesn't work with fatal errors, just use FileCheck here. +// +// RUN: not %clang_cc1 -Wunused-function -Werror -Wfatal-errors %s 2> %t.err +// RUN: FileCheck < %t.err %s +// CHECK: fatal error: unused function +// CHECK: 1 error generated + +static void f0(void) {} // expected-fatal {{unused function}} diff --git a/test/Frontend/warning-mapping-4.c b/test/Frontend/warning-mapping-4.c new file mode 100644 index 000000000000..d8d2769fc535 --- /dev/null +++ b/test/Frontend/warning-mapping-4.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -verify -Wno-error=sign-compare %s +// RUN: %clang_cc1 -verify -Wsign-compare -w -Wno-error=sign-compare %s + +int f0(int x, unsigned y) { + return x < y; +} diff --git a/test/Frontend/warning-mapping-5.c b/test/Frontend/warning-mapping-5.c new file mode 100644 index 000000000000..27d53dc18915 --- /dev/null +++ b/test/Frontend/warning-mapping-5.c @@ -0,0 +1,9 @@ +// Check that #pragma diagnostic warning overrides -Werror. This matches GCC's +// original documentation, but not its earlier implementations. +// +// RUN: %clang_cc1 -verify -Werror %s + +#pragma clang diagnostic warning "-Wsign-compare" +int f0(int x, unsigned y) { + return x < y; // expected-warning {{comparison of integers}} +} diff --git a/test/Headers/wchar_limits.cpp b/test/Headers/wchar_limits.cpp new file mode 100644 index 000000000000..93a99ad78f2b --- /dev/null +++ b/test/Headers/wchar_limits.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify %s +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -fshort-wchar %s + +#include <stdint.h> + +const bool swchar = (wchar_t)-1 > (wchar_t)0; + +int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar_t)-1)]; +int min_test[WCHAR_MIN == (swchar ? 0 : -WCHAR_MAX-1)]; diff --git a/test/Index/IBOutletCollection.m b/test/Index/IBOutletCollection.m new file mode 100644 index 000000000000..a95df8694c78 --- /dev/null +++ b/test/Index/IBOutletCollection.m @@ -0,0 +1,18 @@ +#define IBOutletCollection(ClassName) __attribute__((iboutletcollection(ClassName))) + +@interface Test { + IBOutletCollection(Test) Test *anOutletCollection; +} +@end + +// RUN: c-index-test -cursor-at=%s:4:24 %s | FileCheck -check-prefix=CHECK-CURSOR %s +// CHECK-CURSOR: ObjCClassRef=Test:3:12 + +// RUN: c-index-test -test-annotate-tokens=%s:4:1:5:1 %s | FileCheck -check-prefix=CHECK-TOK %s +// CHECK-TOK: Identifier: "IBOutletCollection" [4:3 - 4:21] macro expansion=IBOutletCollection:1:9 +// CHECK-TOK: Punctuation: "(" [4:21 - 4:22] ObjCInterfaceDecl=Test:3:12 +// CHECK-TOK: Identifier: "Test" [4:22 - 4:26] ObjCClassRef=Test:3:12 +// CHECK-TOK: Punctuation: ")" [4:26 - 4:27] ObjCIvarDecl=anOutletCollection:4:34 (Definition) +// CHECK-TOK: Identifier: "Test" [4:28 - 4:32] ObjCClassRef=Test:3:12 +// CHECK-TOK: Punctuation: "*" [4:33 - 4:34] ObjCIvarDecl=anOutletCollection:4:34 (Definition) +// CHECK-TOK: Identifier: "anOutletCollection" [4:34 - 4:52] ObjCIvarDecl=anOutletCollection:4:34 (Definition) diff --git a/test/Index/Inputs/preamble_macro_template.h b/test/Index/Inputs/preamble_macro_template.h new file mode 100644 index 000000000000..18b076d95cfc --- /dev/null +++ b/test/Index/Inputs/preamble_macro_template.h @@ -0,0 +1,6 @@ +#define STATIC_CAST static_cast + +template<typename T> +void foo(T *p) { + (void)STATIC_CAST<T*>(0); +} diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index 2e11191dca63..e94a5c12fa39 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -25,7 +25,7 @@ void function(Foo * arg) // CHECK-scan: [13:15 - 13:18] ObjCClassRef=Foo:10:12 // CHECK-scan: [13:18 - 13:24] ParmDecl=arg:13:21 (Definition) // CHECK-scan: [13:24 - 14:1] FunctionDecl=function:13:6 (Definition) -// CHECK-scan: [14:1 - 16:2] UnexposedStmt= +// CHECK-scan: [14:1 - 16:2] CompoundStmt= // CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:5] // CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:1 - 16:2] diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 8a8314078999..d3d720c2bafa 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=scan %s // RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=load %s @@ -20,7 +20,7 @@ void function(Foo * arg) // CHECK-scan: [10:15 - 10:18] ObjCClassRef=Foo:8:8 // CHECK-scan: [10:18 - 10:24] ParmDecl=arg:10:21 (Definition) // CHECK-scan: [10:24 - 11:1] FunctionDecl=function:10:6 (Definition) -// CHECK-scan: [11:1 - 13:2] UnexposedStmt= +// CHECK: [11:1 - 13:2] CompundStmt= diff --git a/test/Index/annotate-attribute.cpp b/test/Index/annotate-attribute.cpp new file mode 100644 index 000000000000..6721371ca754 --- /dev/null +++ b/test/Index/annotate-attribute.cpp @@ -0,0 +1,33 @@ +// RUN: c-index-test -test-load-source all %s | FileCheck %s + +class Test { +public: + __attribute__((annotate("spiffy_method"))) void aMethod(); + +public __attribute__((annotate("works"))): + void anotherMethod(); // annotation attribute should be propagated. + +private __attribute__((annotate("investigations"))): + //propagated annotation should have changed from "works" to "investigations" + void inlineMethod() {} + +protected: + // attribute propagation should have stopped here + void methodWithoutAttribute(); +}; + +// CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2] +// CHECK: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8] +// CHECK: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60] +// CHECK: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43] +// CHECK: CXXAccessSpecifier=:7:1 (Definition) Extent=[7:1 - 7:43] +// CHECK: attribute(annotate)=works Extent=[7:23 - 7:40] +// CHECK: CXXMethod=anotherMethod:8:8 Extent=[8:3 - 8:23] +// CHECK: attribute(annotate)=works Extent=[7:23 - 7:40] +// CHECK: CXXAccessSpecifier=:10:1 (Definition) Extent=[10:1 - 10:53] +// CHECK: attribute(annotate)=investigations Extent=[10:24 - 10:50] +// CHECK: CXXMethod=inlineMethod:12:8 (Definition) Extent=[12:3 - 12:25] +// CHECK: attribute(annotate)=investigations Extent=[10:24 - 10:50] +// CHECK: CompoundStmt= Extent=[12:23 - 12:25] +// CHECK: CXXAccessSpecifier=:14:1 (Definition) Extent=[14:1 - 14:11] +// CHECK: CXXMethod=methodWithoutAttribute:16:8 Extent=[16:3 - 16:32] diff --git a/test/Index/annotate-context-sensitive.cpp b/test/Index/annotate-context-sensitive.cpp index 151914cde4a4..34e67a2264b1 100644 --- a/test/Index/annotate-context-sensitive.cpp +++ b/test/Index/annotate-context-sensitive.cpp @@ -22,7 +22,7 @@ struct Derived2 : Base2 { // CHECK-OVERRIDE-FINAL: Keyword: "class" [6:1 - 6:6] ClassDecl=Derived:6:7 (Definition) // CHECK-OVERRIDE-FINAL: Identifier: "Derived" [6:7 - 6:14] ClassDecl=Derived:6:7 (Definition) -// CHECK-OVERRIDE-FINAL: Keyword: "final" [6:15 - 6:20] ClassDecl=Derived:6:7 (Definition) +// CHECK-OVERRIDE-FINAL: Keyword: "final" [6:15 - 6:20] attribute(final)= // CHECK-OVERRIDE-FINAL: Punctuation: ":" [6:21 - 6:22] ClassDecl=Derived:6:7 (Definition) // CHECK-OVERRIDE-FINAL: Keyword: "public" [6:23 - 6:29] C++ base class specifier=class Base:1:7 [access=public isVirtual=false] // CHECK-OVERRIDE-FINAL: Identifier: "Base" [6:30 - 6:34] TypeRef=class Base:1:7 @@ -32,8 +32,8 @@ struct Derived2 : Base2 { // CHECK-OVERRIDE-FINAL: Identifier: "f" [7:16 - 7:17] CXXMethod=f:7:16 (virtual) [Overrides @3:16] // CHECK-OVERRIDE-FINAL: Punctuation: "(" [7:17 - 7:18] CXXMethod=f:7:16 (virtual) [Overrides @3:16] // CHECK-OVERRIDE-FINAL: Punctuation: ")" [7:18 - 7:19] CXXMethod=f:7:16 (virtual) [Overrides @3:16] -// CHECK-OVERRIDE-FINAL: Keyword: "override" [7:20 - 7:28] CXXMethod=f:7:16 (virtual) [Overrides @3:16] -// CHECK-OVERRIDE-FINAL: Keyword: "final" [7:29 - 7:34] CXXMethod=f:7:16 (virtual) [Overrides @3:16] +// CHECK-OVERRIDE-FINAL: Keyword: "override" [7:20 - 7:28] attribute(override)= +// CHECK-OVERRIDE-FINAL: Keyword: "final" [7:29 - 7:34] attribute(final)= // CHECK-OVERRIDE-FINAL: Punctuation: ";" [7:34 - 7:35] ClassDecl=Derived:6:7 (Definition) // CHECK-OVERRIDE-FINAL: Keyword: "struct" [9:3 - 9:9] StructDecl=final:9:10 (Definition) // CHECK-OVERRIDE-FINAL: Identifier: "final" [9:10 - 9:15] StructDecl=final:9:10 (Definition) diff --git a/test/Index/annotate-macro-args.h b/test/Index/annotate-macro-args.h new file mode 100644 index 000000000000..40ec8dc0b81f --- /dev/null +++ b/test/Index/annotate-macro-args.h @@ -0,0 +1,16 @@ +@interface MyClass ++(void)meth; +@end + +#define MACRO2(x) x +#define MACRO(x) MACRO2(x) + +void test() { + MACRO([MyClass meth]); +} + +#define INVOKE(METHOD, CLASS) [CLASS METHOD] + +void test2() { + INVOKE(meth, MyClass); +} diff --git a/test/Index/annotate-macro-args.m b/test/Index/annotate-macro-args.m new file mode 100644 index 000000000000..6adfb8ded1c5 --- /dev/null +++ b/test/Index/annotate-macro-args.m @@ -0,0 +1,23 @@ +// Test without PCH +// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -include annotate-macro-args.h | FileCheck -check-prefix=CHECK1 %s +// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -include annotate-macro-args.h | FileCheck -check-prefix=CHECK2 %s + +// Test with PCH +// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/annotate-macro-args.h -Xclang -detailed-preprocessing-record +// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:9:1:10:1 %s -include-pch %t.pch | FileCheck -check-prefix=CHECK1 %s +// RUN: c-index-test -test-annotate-tokens=%S/annotate-macro-args.h:15:1:16:1 %s -include-pch %t.pch | FileCheck -check-prefix=CHECK2 %s + +// CHECK1: Identifier: "MACRO" [9:3 - 9:8] macro expansion=MACRO:6:9 +// CHECK1: Punctuation: "(" [9:8 - 9:9] +// CHECK1: Punctuation: "[" [9:9 - 9:10] ObjCMessageExpr=meth:2:1 +// CHECK1: Identifier: "MyClass" [9:10 - 9:17] ObjCClassRef=MyClass:1:12 +// CHECK1: Identifier: "meth" [9:18 - 9:22] ObjCMessageExpr=meth:2:1 +// CHECK1: Punctuation: "]" [9:22 - 9:23] ObjCMessageExpr=meth:2:1 +// CHECK1: Punctuation: ")" [9:23 - 9:24] + +// CHECK2: Identifier: "INVOKE" [15:3 - 15:9] macro expansion=INVOKE:12:9 +// CHECK2: Punctuation: "(" [15:9 - 15:10] +// CHECK2: Identifier: "meth" [15:10 - 15:14] ObjCMessageExpr=meth:2:1 +// CHECK2: Punctuation: "," [15:14 - 15:15] +// CHECK2: Identifier: "MyClass" [15:16 - 15:23] ObjCClassRef=MyClass:1:12 +// CHECK2: Punctuation: ")" [15:23 - 15:24] diff --git a/test/Index/annotate-nested-name-specifier.cpp b/test/Index/annotate-nested-name-specifier.cpp index 7c83740f0888..c4f60e399216 100644 --- a/test/Index/annotate-nested-name-specifier.cpp +++ b/test/Index/annotate-nested-name-specifier.cpp @@ -137,7 +137,7 @@ struct X9 : X8 { } }; -// RUN: c-index-test -test-annotate-tokens=%s:13:1:137:1 %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:13:1:137:1 -fno-delayed-template-parsing %s | FileCheck %s // CHECK: Keyword: "using" [14:1 - 14:6] UsingDeclaration=vector[4:12] // CHECK: Identifier: "outer_alias" [14:7 - 14:18] NamespaceRef=outer_alias:10:11 @@ -200,7 +200,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [35:30 - 35:32] VarDecl=max_size:35:32 (Definition) // CHECK: Identifier: "max_size" [35:32 - 35:40] VarDecl=max_size:35:32 (Definition) // CHECK: Punctuation: "=" [35:41 - 35:42] VarDecl=max_size:35:32 (Definition) -// CHECK: Literal: "17" [35:43 - 35:45] UnexposedExpr= +// CHECK: Literal: "17" [35:43 - 35:45] IntegerLiteral= // CHECK: Punctuation: ";" [35:45 - 35:46] // CHECK: Keyword: "using" [40:3 - 40:8] UsingDeclaration=iterator:40:46 @@ -250,56 +250,56 @@ struct X9 : X8 { // Pseudo-destructor // CHECK: Identifier: "t" [57:5 - 57:6] DeclRefExpr=t:56:13 -// CHECK: Punctuation: "->" [57:6 - 57:8] UnexposedExpr= -// CHECK: Punctuation: "::" [57:8 - 57:10] UnexposedExpr= +// CHECK: Punctuation: "->" [57:6 - 57:8] MemberRefExpr= +// CHECK: Punctuation: "::" [57:8 - 57:10] MemberRefExpr= // CHECK: Identifier: "outer_alias" [57:10 - 57:21] NamespaceRef=outer_alias:10:11 -// CHECK: Punctuation: "::" [57:21 - 57:23] UnexposedExpr= +// CHECK: Punctuation: "::" [57:21 - 57:23] MemberRefExpr= // CHECK: Identifier: "inner" [57:23 - 57:28] NamespaceRef=inner:45:13 -// CHECK: Punctuation: "::" [57:28 - 57:30] UnexposedExpr= -// CHECK: Keyword: "template" [57:30 - 57:38] UnexposedExpr= +// CHECK: Punctuation: "::" [57:28 - 57:30] MemberRefExpr= +// CHECK: Keyword: "template" [57:30 - 57:38] MemberRefExpr= // CHECK: Identifier: "vector" [57:39 - 57:45] TemplateRef=vector:4:12 -// CHECK: Punctuation: "<" [57:45 - 57:46] UnexposedExpr= +// CHECK: Punctuation: "<" [57:45 - 57:46] MemberRefExpr= // CHECK: Identifier: "T" [57:46 - 57:47] TypeRef=T:54:19 -// CHECK: Punctuation: ">" [57:47 - 57:48] UnexposedExpr= -// CHECK: Punctuation: "::" [57:48 - 57:50] UnexposedExpr= -// CHECK: Punctuation: "~" [57:50 - 57:51] UnexposedExpr= +// CHECK: Punctuation: ">" [57:47 - 57:48] MemberRefExpr= +// CHECK: Punctuation: "::" [57:48 - 57:50] MemberRefExpr= +// CHECK: Punctuation: "~" [57:50 - 57:51] MemberRefExpr= // CHECK: Identifier: "vector" [57:51 - 57:57] TemplateRef=vector:4:12 -// CHECK: Punctuation: "<" [57:57 - 57:58] UnexposedExpr= +// CHECK: Punctuation: "<" [57:57 - 57:58] MemberRefExpr= // CHECK: Identifier: "T" [57:58 - 57:59] TypeRef=T:54:19 // CHECK: Punctuation: ">" [57:59 - 57:60] CallExpr= // CHECK: Punctuation: "(" [57:60 - 57:61] CallExpr= // CHECK: Punctuation: ")" [57:61 - 57:62] CallExpr= // Unresolved member and non-member references -// CHECK: Punctuation: "::" [75:5 - 75:7] UnexposedExpr=[63:10, 64:10] +// CHECK: Punctuation: "::" [75:5 - 75:7] DeclRefExpr=[63:10, 64:10] // CHECK: Identifier: "outer_alias" [75:7 - 75:18] NamespaceRef=outer_alias:10:11 -// CHECK: Punctuation: "::" [75:18 - 75:20] UnexposedExpr=[63:10, 64:10] +// CHECK: Punctuation: "::" [75:18 - 75:20] DeclRefExpr=[63:10, 64:10] // CHECK: Identifier: "inner" [75:20 - 75:25] NamespaceRef=inner:62:13 -// CHECK: Punctuation: "::" [75:25 - 75:27] UnexposedExpr=[63:10, 64:10] +// CHECK: Punctuation: "::" [75:25 - 75:27] DeclRefExpr=[63:10, 64:10] // CHECK: Identifier: "f" [75:27 - 75:28] OverloadedDeclRef=f[63:10, 64:10] // CHECK: Punctuation: "(" [75:28 - 75:29] CallExpr= // CHECK: Identifier: "t" [75:29 - 75:30] DeclRefExpr=t:74:12 // CHECK: Punctuation: ")" [75:30 - 75:31] CallExpr= -// CHECK: Punctuation: "::" [76:5 - 76:7] UnexposedExpr=[71:8, 72:8] +// CHECK: Punctuation: "::" [76:5 - 76:7] MemberRefExpr=[71:8, 72:8] // CHECK: Identifier: "X4" [76:7 - 76:9] TemplateRef=X4:69:8 -// CHECK: Punctuation: "<" [76:9 - 76:10] UnexposedExpr=[71:8, 72:8] +// CHECK: Punctuation: "<" [76:9 - 76:10] MemberRefExpr=[71:8, 72:8] // CHECK: Identifier: "type" [76:10 - 76:14] TypeRef=type:70:13 -// CHECK: Punctuation: ">" [76:14 - 76:15] UnexposedExpr=[71:8, 72:8] -// CHECK: Punctuation: "::" [76:15 - 76:17] UnexposedExpr=[71:8, 72:8] +// CHECK: Punctuation: ">" [76:14 - 76:15] MemberRefExpr=[71:8, 72:8] +// CHECK: Punctuation: "::" [76:15 - 76:17] MemberRefExpr=[71:8, 72:8] // CHECK: Identifier: "g" [76:17 - 76:18] OverloadedDeclRef=g[71:8, 72:8] // CHECK: Punctuation: "(" [76:18 - 76:19] CallExpr= // CHECK: Identifier: "t" [76:19 - 76:20] DeclRefExpr=t:74:12 // CHECK: Punctuation: ")" [76:20 - 76:21] CallExpr= -// CHECK: Punctuation: ";" [76:21 - 76:22] UnexposedStmt= -// CHECK: Keyword: "this" [77:5 - 77:9] UnexposedExpr= -// CHECK: Punctuation: "->" [77:9 - 77:11] UnexposedExpr= -// CHECK: Punctuation: "::" [77:11 - 77:13] UnexposedExpr= +// CHECK: Punctuation: ";" [76:21 - 76:22] CompoundStmt= +// CHECK: Keyword: "this" [77:5 - 77:9] CXXThisExpr= +// CHECK: Punctuation: "->" [77:9 - 77:11] MemberRefExpr= +// CHECK: Punctuation: "::" [77:11 - 77:13] MemberRefExpr= // CHECK: Identifier: "X4" [77:13 - 77:15] TemplateRef=X4:69:8 -// CHECK: Punctuation: "<" [77:15 - 77:16] UnexposedExpr= +// CHECK: Punctuation: "<" [77:15 - 77:16] MemberRefExpr= // CHECK: Identifier: "type" [77:16 - 77:20] TypeRef=type:70:13 -// CHECK: Punctuation: ">" [77:20 - 77:21] UnexposedExpr= -// CHECK: Punctuation: "::" [77:21 - 77:23] UnexposedExpr= -// CHECK: Identifier: "g" [77:23 - 77:24] UnexposedExpr= +// CHECK: Punctuation: ">" [77:20 - 77:21] MemberRefExpr= +// CHECK: Punctuation: "::" [77:21 - 77:23] MemberRefExpr= +// CHECK: Identifier: "g" [77:23 - 77:24] MemberRefExpr= // CHECK: Punctuation: "(" [77:24 - 77:25] CallExpr= // CHECK: Identifier: "t" [77:25 - 77:26] DeclRefExpr=t:74:12 // CHECK: Punctuation: ")" [77:26 - 77:27] CallExpr= @@ -314,7 +314,7 @@ struct X9 : X8 { // CHECK: Punctuation: "(" [90:28 - 90:29] CallExpr=f:63:10 // CHECK: Identifier: "t" [90:29 - 90:30] DeclRefExpr=t:89:15 // CHECK: Punctuation: ")" [90:30 - 90:31] CallExpr=f:63:10 -// CHECK: Punctuation: ";" [90:31 - 90:32] UnexposedStmt= +// CHECK: Punctuation: ";" [90:31 - 90:32] CompoundStmt= // CHECK: Punctuation: "::" [91:5 - 91:7] MemberRefExpr=g:86:8 // CHECK: Identifier: "X4" [91:7 - 91:9] TemplateRef=X4:69:8 // CHECK: Punctuation: "<" [91:9 - 91:10] MemberRefExpr=g:86:8 @@ -325,8 +325,8 @@ struct X9 : X8 { // CHECK: Punctuation: "(" [91:18 - 91:19] CallExpr=g:86:8 // CHECK: Identifier: "t" [91:19 - 91:20] DeclRefExpr=t:89:15 // CHECK: Punctuation: ")" [91:20 - 91:21] CallExpr=g:86:8 -// CHECK: Punctuation: ";" [91:21 - 91:22] UnexposedStmt= -// CHECK: Keyword: "this" [92:5 - 92:9] UnexposedExpr= +// CHECK: Punctuation: ";" [91:21 - 91:22] CompoundStmt= +// CHECK: Keyword: "this" [92:5 - 92:9] CXXThisExpr= // CHECK: Punctuation: "->" [92:9 - 92:11] MemberRefExpr=g:86:8 // CHECK: Punctuation: "::" [92:11 - 92:13] MemberRefExpr=g:86:8 // CHECK: Identifier: "X4" [92:13 - 92:15] TemplateRef=X4:69:8 diff --git a/test/Index/annotate-tokens-cxx0x.cpp b/test/Index/annotate-tokens-cxx0x.cpp index 5dea3514c2b8..89876b28eab3 100644 --- a/test/Index/annotate-tokens-cxx0x.cpp +++ b/test/Index/annotate-tokens-cxx0x.cpp @@ -3,6 +3,14 @@ int f(Args ...args) { return sizeof...(args) + sizeof...(Args); } -// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -std=c++0x %s | FileCheck %s -// CHECK: Identifier: "args" [3:20 - 3:24] UnexposedExpr=args:2:15 +void test() { + int a; + decltype(a) b; +} + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -fno-delayed-template-parsing -std=c++11 %s | FileCheck %s +// CHECK: Identifier: "args" [3:20 - 3:24] SizeOfPackExpr=args:2:15 // CHECK: Identifier: "Args" [3:38 - 3:42] TypeRef=Args:1:22 + +// RUN: c-index-test -test-annotate-tokens=%s:8:1:9:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-DECLTYPE %s +// CHECK-DECLTYPE: Identifier: "a" [8:12 - 8:13] DeclRefExpr=a:7:7 diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c index e6bb0869d0b1..45988270f0e6 100644 --- a/test/Index/annotate-tokens-pp.c +++ b/test/Index/annotate-tokens-pp.c @@ -28,7 +28,10 @@ void test() { #include "pragma-once.h" #include "guarded.h" -// RUN: c-index-test -test-annotate-tokens=%s:2:1:30:1 -I%S/Inputs %s | FileCheck %s +const char *fname = __FILE__; + +// RUN: c-index-test -test-annotate-tokens=%s:2:1:32:1 -I%S/Inputs %s | FileCheck %s +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:2:1:32:1 -I%S/Inputs %s | FileCheck %s // CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive= // CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive= // CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING @@ -101,45 +104,47 @@ void test() { // CHECK: Identifier: "test_macro_args" [13:6 - 13:21] FunctionDecl=test_macro_args:13:6 (Definition) // CHECK: Punctuation: "(" [13:21 - 13:22] FunctionDecl=test_macro_args:13:6 (Definition) // CHECK: Punctuation: ")" [13:22 - 13:23] FunctionDecl=test_macro_args:13:6 (Definition) -// CHECK: Punctuation: "{" [13:24 - 13:25] UnexposedStmt= +// CHECK: Punctuation: "{" [13:24 - 13:25] CompoundStmt= // CHECK: Keyword: "int" [14:3 - 14:6] VarDecl=z:14:7 (Definition) // CHECK: Identifier: "z" [14:7 - 14:8] VarDecl=z:14:7 (Definition) // CHECK: Punctuation: "=" [14:9 - 14:10] VarDecl=z:14:7 (Definition) -// CHECK: Literal: "1" [14:11 - 14:12] UnexposedExpr= -// CHECK: Punctuation: ";" [14:12 - 14:13] UnexposedStmt= +// CHECK: Literal: "1" [14:11 - 14:12] IntegerLiteral= +// CHECK: Punctuation: ";" [14:12 - 14:13] DeclStmt= // CHECK: Keyword: "int" [15:3 - 15:6] VarDecl=t:15:7 (Definition) // CHECK: Identifier: "t" [15:7 - 15:8] VarDecl=t:15:7 (Definition) // CHECK: Punctuation: "=" [15:9 - 15:10] VarDecl=t:15:7 (Definition) -// CHECK: Literal: "2" [15:11 - 15:12] UnexposedExpr= -// CHECK: Punctuation: ";" [15:12 - 15:13] UnexposedStmt= +// CHECK: Literal: "2" [15:11 - 15:12] IntegerLiteral= +// CHECK: Punctuation: ";" [15:12 - 15:13] DeclStmt= // CHECK: Keyword: "int" [16:3 - 16:6] VarDecl=k:16:7 (Definition) // CHECK: Identifier: "k" [16:7 - 16:8] VarDecl=k:16:7 (Definition) // CHECK: Punctuation: "=" [16:9 - 16:10] VarDecl=k:16:7 (Definition) // CHECK: Identifier: "REVERSE_MACRO" [16:11 - 16:24] macro expansion=REVERSE_MACRO:10:9 -// CHECK: Punctuation: "(" [16:24 - 16:25] UnexposedStmt= +// CHECK: Punctuation: "(" [16:24 - 16:25] // CHECK: Identifier: "t" [16:25 - 16:26] DeclRefExpr=t:15:7 -// CHECK: Punctuation: "," [16:26 - 16:27] UnexposedStmt= +// CHECK: Punctuation: "," [16:26 - 16:27] // CHECK: Identifier: "z" [16:27 - 16:28] DeclRefExpr=z:14:7 -// CHECK: Punctuation: ")" [16:28 - 16:29] UnexposedStmt= -// CHECK: Punctuation: ";" [16:29 - 16:30] UnexposedStmt= +// FIXME: The token below should really be annotated as "macro expansion=REVERSE_MACRO:10:9" +// CHECK: Punctuation: ")" [16:28 - 16:29] VarDecl=k:16:7 (Definition) +// CHECK: Punctuation: ";" [16:29 - 16:30] DeclStmt= // CHECK: Keyword: "int" [17:3 - 17:6] VarDecl=j:17:7 (Definition) // CHECK: Identifier: "j" [17:7 - 17:8] VarDecl=j:17:7 (Definition) // CHECK: Punctuation: "=" [17:9 - 17:10] VarDecl=j:17:7 (Definition) // CHECK: Identifier: "TWICE_MACRO" [17:11 - 17:22] macro expansion=TWICE_MACRO:11:9 -// CHECK: Punctuation: "(" [17:22 - 17:23] UnexposedStmt= +// CHECK: Punctuation: "(" [17:22 - 17:23] // CHECK: Identifier: "k" [17:23 - 17:24] DeclRefExpr=k:16:7 -// CHECK: Punctuation: "+" [17:25 - 17:26] UnexposedStmt= +// CHECK: Punctuation: "+" [17:25 - 17:26] BinaryOperator= // CHECK: Identifier: "k" [17:27 - 17:28] DeclRefExpr=k:16:7 -// CHECK: Punctuation: ")" [17:28 - 17:29] UnexposedStmt= -// CHECK: Punctuation: ";" [17:29 - 17:30] UnexposedStmt= +// FIXME: The token below should really be annotated as "macro expansion=TWICE_MACRO:11:9" +// CHECK: Punctuation: ")" [17:28 - 17:29] VarDecl=j:17:7 (Definition) +// CHECK: Punctuation: ";" [17:29 - 17:30] DeclStmt= // CHECK: Keyword: "int" [18:3 - 18:6] VarDecl=w:18:7 (Definition) // CHECK: Identifier: "w" [18:7 - 18:8] VarDecl=w:18:7 (Definition) // CHECK: Punctuation: "=" [18:9 - 18:10] VarDecl=w:18:7 (Definition) // CHECK: Identifier: "j" [18:11 - 18:12] DeclRefExpr=j:17:7 -// CHECK: Punctuation: "+" [18:13 - 18:14] UnexposedExpr= +// CHECK: Punctuation: "+" [18:13 - 18:14] BinaryOperator= // CHECK: Identifier: "j" [18:15 - 18:16] DeclRefExpr=j:17:7 -// CHECK: Punctuation: ";" [18:16 - 18:17] UnexposedStmt= -// CHECK: Punctuation: "}" [19:1 - 19:2] UnexposedStmt= +// CHECK: Punctuation: ";" [18:16 - 18:17] DeclStmt= +// CHECK: Punctuation: "}" [19:1 - 19:2] CompoundStmt= // CHECK: Punctuation: "#" [21:1 - 21:2] preprocessing directive= // CHECK: Identifier: "define" [21:2 - 21:8] preprocessing directive= // CHECK: Identifier: "fun_with_macro_bodies" [21:9 - 21:30] macro definition=fun_with_macro_bodies @@ -164,28 +169,29 @@ void test() { // CHECK: Identifier: "test" [23:6 - 23:10] FunctionDecl=test:23:6 (Definition) // CHECK: Punctuation: "(" [23:10 - 23:11] FunctionDecl=test:23:6 (Definition) // CHECK: Punctuation: ")" [23:11 - 23:12] FunctionDecl=test:23:6 (Definition) -// CHECK: Punctuation: "{" [23:13 - 23:14] UnexposedStmt= +// CHECK: Punctuation: "{" [23:13 - 23:14] CompoundStmt= // CHECK: Keyword: "int" [24:3 - 24:6] VarDecl=x:24:7 (Definition) // CHECK: Identifier: "x" [24:7 - 24:8] VarDecl=x:24:7 (Definition) // CHECK: Punctuation: "=" [24:9 - 24:10] VarDecl=x:24:7 (Definition) -// CHECK: Literal: "10" [24:11 - 24:13] UnexposedExpr= -// CHECK: Punctuation: ";" [24:13 - 24:14] UnexposedStmt= +// CHECK: Literal: "10" [24:11 - 24:13] IntegerLiteral= +// CHECK: Punctuation: ";" [24:13 - 24:14] DeclStmt= // CHECK: Identifier: "fun_with_macro_bodies" [25:3 - 25:24] macro expansion=fun_with_macro_bodies:21:9 -// CHECK: Punctuation: "(" [25:24 - 25:25] UnexposedStmt= +// CHECK: Punctuation: "(" [25:24 - 25:25] CompoundStmt= // CHECK: Identifier: "x" [25:25 - 25:26] DeclRefExpr=x:24:7 -// CHECK: Punctuation: "," [25:26 - 25:27] UnexposedStmt= -// CHECK: Punctuation: "{" [25:28 - 25:29] UnexposedStmt= -// CHECK: Keyword: "int" [25:30 - 25:33] UnexposedStmt= +// CHECK: Punctuation: "," [25:26 - 25:27] +// CHECK: Punctuation: "{" [25:28 - 25:29] CompoundStmt= +// CHECK: Keyword: "int" [25:30 - 25:33] DeclStmt= // CHECK: Identifier: "z" [25:34 - 25:35] VarDecl=z:25:34 (Definition) -// CHECK: Punctuation: "=" [25:36 - 25:37] UnexposedStmt= +// CHECK: Punctuation: "=" [25:36 - 25:37] VarDecl=z:25:34 (Definition) // CHECK: Identifier: "x" [25:38 - 25:39] DeclRefExpr=x:24:7 -// CHECK: Punctuation: ";" [25:39 - 25:40] UnexposedStmt= -// CHECK: Punctuation: "++" [25:41 - 25:43] UnexposedExpr= +// CHECK: Punctuation: ";" [25:39 - 25:40] DeclStmt= +// CHECK: Punctuation: "++" [25:41 - 25:43] UnaryOperator= // CHECK: Identifier: "z" [25:43 - 25:44] DeclRefExpr=z:25:3 -// CHECK: Punctuation: ";" [25:44 - 25:45] UnexposedStmt= -// CHECK: Punctuation: "}" [25:46 - 25:47] UnexposedStmt= -// CHECK: Punctuation: ")" [25:47 - 25:48] UnexposedStmt= -// CHECK: Punctuation: ";" [25:48 - 25:49] UnexposedStmt= -// CHECK: Punctuation: "}" [26:1 - 26:2] UnexposedStmt= +// CHECK: Punctuation: ";" [25:44 - 25:45] CompoundStmt= +// CHECK: Punctuation: "}" [25:46 - 25:47] CompoundStmt= +// CHECK: Punctuation: ")" [25:47 - 25:48] DoStmt= +// CHECK: Punctuation: ";" [25:48 - 25:49] CompoundStmt= +// CHECK: Punctuation: "}" [26:1 - 26:2] CompoundStmt= // CHECK: {{28:1.*inclusion directive=pragma-once.h.*multi-include guarded}} // CHECK: {{29:1.*inclusion directive=guarded.h.*multi-include guarded}} +// CHECK: Identifier: "__FILE__" [31:21 - 31:29] macro expansion=__FILE__ diff --git a/test/Index/annotate-tokens-preamble.c b/test/Index/annotate-tokens-preamble.c new file mode 100644 index 000000000000..aa222bdee32d --- /dev/null +++ b/test/Index/annotate-tokens-preamble.c @@ -0,0 +1,20 @@ +// A comment line. + +void f(void *ptr) { +} + + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 %s | FileCheck %s +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-annotate-tokens=%s:1:1:5:1 %s | FileCheck %s +// CHECK: Comment: "// A comment line." [1:1 - 1:19] +// CHECK: Keyword: "void" [3:1 - 3:5] FunctionDecl=f:3:6 (Definition) +// CHECK: Identifier: "f" [3:6 - 3:7] FunctionDecl=f:3:6 (Definition) +// CHECK: Punctuation: "(" [3:7 - 3:8] FunctionDecl=f:3:6 (Definition) +// CHECK: Keyword: "void" [3:8 - 3:12] ParmDecl=ptr:3:14 (Definition) +// CHECK: Punctuation: "*" [3:13 - 3:14] ParmDecl=ptr:3:14 (Definition) +// CHECK: Identifier: "ptr" [3:14 - 3:17] ParmDecl=ptr:3:14 (Definition) +// CHECK: Punctuation: ")" [3:17 - 3:18] FunctionDecl=f:3:6 (Definition) +// CHECK: Punctuation: "{" [3:19 - 3:20] CompoundStmt= +// CHECK: Punctuation: "}" [4:1 - 4:2] CompoundStmt= + + diff --git a/test/Index/annotate-tokens-with-default-args.cpp b/test/Index/annotate-tokens-with-default-args.cpp new file mode 100644 index 000000000000..d5ca7066e15c --- /dev/null +++ b/test/Index/annotate-tokens-with-default-args.cpp @@ -0,0 +1,16 @@ +#include "annotate-tokens-with-default-args.h" + +void Foo::m(Foo *f) {} + +// RUN: c-index-test -test-annotate-tokens=%s:3:1:4:1 %s | FileCheck %s +// CHECK: Keyword: "void" [3:1 - 3:5] CXXMethod=m:3:11 (Definition) +// CHECK: Identifier: "Foo" [3:6 - 3:9] TypeRef=struct Foo:1:8 +// CHECK: Punctuation: "::" [3:9 - 3:11] CXXMethod=m:3:11 (Definition) +// CHECK: Identifier: "m" [3:11 - 3:12] CXXMethod=m:3:11 (Definition) +// CHECK: Punctuation: "(" [3:12 - 3:13] CXXMethod=m:3:11 (Definition) +// CHECK: Identifier: "Foo" [3:13 - 3:16] TypeRef=struct Foo:1:8 +// CHECK: Punctuation: "*" [3:17 - 3:18] ParmDecl=f:3:18 (Definition) +// CHECK: Identifier: "f" [3:18 - 3:19] ParmDecl=f:3:18 (Definition) +// CHECK: Punctuation: ")" [3:19 - 3:20] CXXMethod=m:3:11 (Definition) +// CHECK: Punctuation: "{" [3:21 - 3:22] CompoundStmt= +// CHECK: Punctuation: "}" [3:22 - 3:23] CompoundStmt= diff --git a/test/Index/annotate-tokens-with-default-args.h b/test/Index/annotate-tokens-with-default-args.h new file mode 100644 index 000000000000..323c519351ff --- /dev/null +++ b/test/Index/annotate-tokens-with-default-args.h @@ -0,0 +1,3 @@ +struct Foo { + void m(Foo *f = 0); +}; diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c index 162a224ed684..0b5f3d477366 100644 --- a/test/Index/annotate-tokens.c +++ b/test/Index/annotate-tokens.c @@ -38,35 +38,32 @@ enum Color g(int i, ...) { // CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition) // CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition) // CHECK: Punctuation: "=" [4:12 - 4:13] VarDecl=t_ptr:4:6 (Definition) -// CHECK: Punctuation: "(" [4:14 - 4:15] UnexposedExpr=ptr:3:14 +// CHECK: Punctuation: "(" [4:14 - 4:15] CStyleCastExpr= // CHECK: Identifier: "T" [4:15 - 4:16] TypeRef=T:1:13 -// CHECK: Punctuation: "*" [4:17 - 4:18] UnexposedExpr=ptr:3:14 -// CHECK: Punctuation: ")" [4:18 - 4:19] UnexposedExpr=ptr:3:14 // CHECK: Identifier: "ptr" [4:19 - 4:22] DeclRefExpr=ptr:3:14 -// CHECK: Punctuation: ";" [4:22 - 4:23] UnexposedStmt= -// CHECK: Punctuation: "(" [5:3 - 5:4] UnexposedExpr= -// CHECK: Keyword: "void" [5:4 - 5:8] UnexposedExpr= -// CHECK: Punctuation: ")" [5:8 - 5:9] UnexposedExpr= +// CHECK: Punctuation: ";" [4:22 - 4:23] DeclStmt= +// CHECK: Punctuation: "(" [5:3 - 5:4] CStyleCastExpr= +// CHECK: Keyword: "void" [5:4 - 5:8] CStyleCastExpr= +// CHECK: Punctuation: ")" [5:8 - 5:9] CStyleCastExpr= // CHECK: Keyword: "sizeof" [5:9 - 5:15] UnexposedExpr= // CHECK: Punctuation: "(" [5:15 - 5:16] UnexposedExpr= // CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13 // CHECK: Punctuation: ")" [5:17 - 5:18] UnexposedExpr= -// CHECK: Punctuation: ";" [5:18 - 5:19] UnexposedStmt= -// CHECK: Comment: "/* A comment */" [6:3 - 6:18] UnexposedStmt= +// CHECK: Punctuation: ";" [5:18 - 5:19] CompoundStmt= // CHECK: Keyword: "struct" [7:3 - 7:9] VarDecl=x:7:12 (Definition) // CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8 // CHECK: Identifier: "x" [7:12 - 7:13] VarDecl=x:7:12 (Definition) // CHECK: Punctuation: "=" [7:14 - 7:15] VarDecl=x:7:12 (Definition) -// CHECK: Punctuation: "(" [7:16 - 7:17] UnexposedExpr= -// CHECK: Keyword: "struct" [7:17 - 7:23] UnexposedExpr= +// CHECK: Punctuation: "(" [7:16 - 7:17] CompoundLiteralExpr= +// CHECK: Keyword: "struct" [7:17 - 7:23] CompoundLiteralExpr= // CHECK: Identifier: "X" [7:24 - 7:25] TypeRef=struct X:2:8 -// CHECK: Punctuation: ")" [7:25 - 7:26] UnexposedExpr= -// CHECK: Punctuation: "{" [7:26 - 7:27] UnexposedExpr= -// CHECK: Literal: "1" [7:27 - 7:28] UnexposedExpr= -// CHECK: Punctuation: "," [7:28 - 7:29] UnexposedExpr= -// CHECK: Literal: "2" [7:30 - 7:31] UnexposedExpr= -// CHECK: Punctuation: "}" [7:31 - 7:32] UnexposedExpr= -// CHECK: Punctuation: ";" [7:32 - 7:33] UnexposedStmt= +// CHECK: Punctuation: ")" [7:25 - 7:26] CompoundLiteralExpr= +// CHECK: Punctuation: "{" [7:26 - 7:27] InitListExpr= +// CHECK: Literal: "1" [7:27 - 7:28] IntegerLiteral= +// CHECK: Punctuation: "," [7:28 - 7:29] InitListExpr= +// CHECK: Literal: "2" [7:30 - 7:31] IntegerLiteral= +// CHECK: Punctuation: "}" [7:31 - 7:32] InitListExpr= +// CHECK: Punctuation: ";" [7:32 - 7:33] DeclStmt= // CHECK: Keyword: "void" [8:3 - 8:7] VarDecl=xx:8:9 (Definition) // CHECK: Punctuation: "*" [8:8 - 8:9] VarDecl=xx:8:9 (Definition) // CHECK: Identifier: "xx" [8:9 - 8:11] VarDecl=xx:8:9 (Definition) @@ -74,17 +71,17 @@ enum Color g(int i, ...) { // CHECK: Identifier: "ptr" [8:14 - 8:17] DeclRefExpr=ptr:3:14 // CHECK: Punctuation: "?" [8:18 - 8:19] UnexposedExpr= // CHECK: Punctuation: ":" [8:20 - 8:21] UnexposedExpr= -// CHECK: Punctuation: "&" [8:22 - 8:23] UnexposedExpr= +// CHECK: Punctuation: "&" [8:22 - 8:23] UnaryOperator= // CHECK: Identifier: "x" [8:23 - 8:24] DeclRefExpr=x:7:12 -// CHECK: Punctuation: ";" [8:24 - 8:25] UnexposedStmt= -// CHECK: Keyword: "const" [9:3 - 9:8] UnexposedStmt= +// CHECK: Punctuation: ";" [8:24 - 8:25] DeclStmt= +// CHECK: Keyword: "const" [9:3 - 9:8] DeclStmt= // CHECK: Keyword: "char" [9:9 - 9:13] VarDecl=hello:9:16 (Definition) // CHECK: Punctuation: "*" [9:14 - 9:15] VarDecl=hello:9:16 (Definition) // CHECK: Identifier: "hello" [9:16 - 9:21] VarDecl=hello:9:16 (Definition) // CHECK: Punctuation: "=" [9:22 - 9:23] VarDecl=hello:9:16 (Definition) -// CHECK: Literal: ""Hello"" [9:24 - 9:31] UnexposedExpr= -// CHECK: Punctuation: ";" [9:31 - 9:32] UnexposedStmt= -// CHECK: Punctuation: "}" [10:1 - 10:2] UnexposedStmt= +// CHECK: Literal: ""Hello"" [9:24 - 9:31] StringLiteral= +// CHECK: Punctuation: ";" [9:31 - 9:32] DeclStmt= +// CHECK: Punctuation: "}" [10:1 - 10:2] CompoundStmt= // CHECK: Keyword: "__builtin_va_arg" [15:9 - 15:25] UnexposedExpr= // CHECK: Identifier: "Int" [15:30 - 15:33] TypeRef=Int:12:13 // CHECK: Keyword: "__builtin_types_compatible_p" [16:9 - 16:37] UnexposedExpr= @@ -94,15 +91,15 @@ enum Color g(int i, ...) { // CHECK: Keyword: "struct" [18:3 - 18:9] VarDecl=x:18:12 (Definition) // CHECK: Identifier: "X" [18:10 - 18:11] TypeRef=struct X:2:8 // CHECK: Identifier: "x" [18:12 - 18:13] VarDecl=x:18:12 (Definition) -// CHECK: Keyword: "do" [19:3 - 19:5] UnexposedStmt= +// CHECK: Keyword: "do" [19:3 - 19:5] DoStmt= // CHECK: Identifier: "x" [20:5 - 20:6] DeclRefExpr=x:18:12 // CHECK: Punctuation: "." [20:6 - 20:7] MemberRefExpr=a:2:16 // CHECK: Identifier: "a" [20:7 - 20:8] MemberRefExpr=a:2:16 -// CHECK: Punctuation: "++" [20:8 - 20:10] UnexposedExpr= -// CHECK: Punctuation: ";" [20:10 - 20:11] UnexposedStmt= -// CHECK: Punctuation: "}" [21:3 - 21:4] UnexposedStmt= -// CHECK: Keyword: "while" [21:5 - 21:10] UnexposedStmt= -// CHECK: Punctuation: "(" [21:11 - 21:12] UnexposedStmt= +// CHECK: Punctuation: "++" [20:8 - 20:10] UnaryOperator= +// CHECK: Punctuation: ";" [20:10 - 20:11] CompoundStmt= +// CHECK: Punctuation: "}" [21:3 - 21:4] CompoundStmt= +// CHECK: Keyword: "while" [21:5 - 21:10] DoStmt= +// CHECK: Punctuation: "(" [21:11 - 21:12] DoStmt= // CHECK: Identifier: "x" [21:12 - 21:13] DeclRefExpr=x:18:12 // CHECK: Punctuation: "." [21:13 - 21:14] MemberRefExpr=a:2:16 // CHECK: Identifier: "a" [21:14 - 21:15] MemberRefExpr=a:2:16 @@ -110,30 +107,30 @@ enum Color g(int i, ...) { // CHECK: Keyword: "enum" [23:3 - 23:7] VarDecl=c:23:14 (Definition) // CHECK: Identifier: "Color" [23:8 - 23:13] TypeRef=enum Color:11:6 // CHECK: Identifier: "c" [23:14 - 23:15] VarDecl=c:23:14 (Definition) -// CHECK: Punctuation: ";" [23:15 - 23:16] UnexposedStmt= -// CHECK: Keyword: "switch" [24:3 - 24:9] UnexposedStmt= -// CHECK: Punctuation: "(" [24:10 - 24:11] UnexposedStmt= +// CHECK: Punctuation: ";" [23:15 - 23:16] DeclStmt= +// CHECK: Keyword: "switch" [24:3 - 24:9] SwitchStmt= +// CHECK: Punctuation: "(" [24:10 - 24:11] SwitchStmt= // CHECK: Identifier: "c" [24:11 - 24:12] DeclRefExpr=c:23:14 -// CHECK: Punctuation: ")" [24:12 - 24:13] UnexposedStmt= -// CHECK: Punctuation: "{" [24:14 - 24:15] UnexposedStmt= -// CHECK: Keyword: "case" [25:3 - 25:7] UnexposedStmt= +// CHECK: Punctuation: ")" [24:12 - 24:13] SwitchStmt= +// CHECK: Punctuation: "{" [24:14 - 24:15] CompoundStmt= +// CHECK: Keyword: "case" [25:3 - 25:7] CaseStmt= // CHECK: Identifier: "Red" [25:8 - 25:11] DeclRefExpr=Red:11:14 -// CHECK: Punctuation: ":" [25:11 - 25:12] UnexposedStmt= -// CHECK: Keyword: "return" [26:5 - 26:11] UnexposedStmt= +// CHECK: Punctuation: ":" [25:11 - 25:12] CaseStmt= +// CHECK: Keyword: "return" [26:5 - 26:11] ReturnStmt= // CHECK: Identifier: "Green" [26:12 - 26:17] DeclRefExpr=Green:11:19 -// CHECK: Punctuation: ";" [26:17 - 26:18] UnexposedStmt= -// CHECK: Keyword: "case" [28:3 - 28:7] UnexposedStmt= +// CHECK: Punctuation: ";" [26:17 - 26:18] CompoundStmt= +// CHECK: Keyword: "case" [28:3 - 28:7] CaseStmt= // CHECK: Identifier: "Green" [28:8 - 28:13] DeclRefExpr=Green:11:19 -// CHECK: Punctuation: ":" [28:13 - 28:14] UnexposedStmt= -// CHECK: Keyword: "return" [29:5 - 29:11] UnexposedStmt= +// CHECK: Punctuation: ":" [28:13 - 28:14] CaseStmt= +// CHECK: Keyword: "return" [29:5 - 29:11] ReturnStmt= // CHECK: Identifier: "Blue" [29:12 - 29:16] DeclRefExpr=Blue:11:26 -// CHECK: Punctuation: ";" [29:16 - 29:17] UnexposedStmt= -// CHECK: Keyword: "case" [31:3 - 31:7] UnexposedStmt= +// CHECK: Punctuation: ";" [29:16 - 29:17] CompoundStmt= +// CHECK: Keyword: "case" [31:3 - 31:7] CaseStmt= // CHECK: Identifier: "Blue" [31:8 - 31:12] DeclRefExpr=Blue:11:26 -// CHECK: Punctuation: ":" [31:12 - 31:13] UnexposedStmt= -// CHECK: Keyword: "return" [32:5 - 32:11] UnexposedStmt= +// CHECK: Punctuation: ":" [31:12 - 31:13] CaseStmt= +// CHECK: Keyword: "return" [32:5 - 32:11] ReturnStmt= // CHECK: Identifier: "Red" [32:12 - 32:15] DeclRefExpr=Red:11:14 -// CHECK: Punctuation: ";" [32:15 - 32:16] UnexposedStmt= +// CHECK: Punctuation: ";" [32:15 - 32:16] CompoundStmt= // RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s // RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp index 165420ab39ce..5a8f5e201d0f 100644 --- a/test/Index/annotate-tokens.cpp +++ b/test/Index/annotate-tokens.cpp @@ -32,19 +32,19 @@ void test3(S2 s2) { // CHECK: Identifier: "bonk" [2:11 - 2:15] TypeRef=struct bonk:1:8 // CHECK: Identifier: "X" [2:16 - 2:17] ParmDecl=X:2:16 (Definition) // CHECK: Punctuation: ")" [2:17 - 2:18] FunctionDecl=test:2:6 (Definition) -// CHECK: Punctuation: "{" [2:19 - 2:20] UnexposedStmt= +// CHECK: Punctuation: "{" [2:19 - 2:20] CompoundStmt= // CHECK: Identifier: "X" [3:5 - 3:6] DeclRefExpr=X:2:16 // CHECK: Punctuation: "=" [3:7 - 3:8] CallExpr=operator=:1:8 // CHECK: Identifier: "X" [3:9 - 3:10] DeclRefExpr=X:2:16 -// CHECK: Punctuation: ";" [3:10 - 3:11] UnexposedStmt= +// CHECK: Punctuation: ";" [3:10 - 3:11] CompoundStmt= // CHECK: Keyword: "__is_base_of" [4:5 - 4:17] UnexposedExpr= // CHECK: Punctuation: "(" [4:17 - 4:18] UnexposedExpr= // CHECK: Identifier: "bonk" [4:18 - 4:22] TypeRef=struct bonk:1:8 // CHECK: Punctuation: "," [4:22 - 4:23] UnexposedExpr= // CHECK: Identifier: "bonk" [4:24 - 4:28] TypeRef=struct bonk:1:8 // CHECK: Punctuation: ")" [4:28 - 4:29] UnexposedExpr= -// CHECK: Punctuation: ";" [4:29 - 4:30] UnexposedStmt= -// CHECK: Punctuation: "}" [5:1 - 5:2] UnexposedStmt= +// CHECK: Punctuation: ";" [4:29 - 4:30] CompoundStmt= +// CHECK: Punctuation: "}" [5:1 - 5:2] CompoundStmt= // CHECK: Keyword: "struct" [7:1 - 7:7] StructDecl=X:7:8 (Definition) // CHECK: Identifier: "X" [7:8 - 7:9] StructDecl=X:7:8 (Definition) // CHECK: Punctuation: "{" [7:10 - 7:11] StructDecl=X:7:8 (Definition) @@ -69,18 +69,18 @@ void test3(S2 s2) { // CHECK: Identifier: "X" [11:12 - 11:13] TypeRef=struct X:7:8 // CHECK: Identifier: "x" [11:14 - 11:15] ParmDecl=x:11:14 (Definition) // CHECK: Punctuation: ")" [11:15 - 11:16] FunctionDecl=test2:11:6 (Definition) -// CHECK: Punctuation: "{" [11:17 - 11:18] UnexposedStmt= +// CHECK: Punctuation: "{" [11:17 - 11:18] CompoundStmt= // CHECK: Punctuation: "++" [12:3 - 12:5] CallExpr=operator++:8:5 -// CHECK: Punctuation: "(" [12:5 - 12:6] UnexposedExpr= +// CHECK: Punctuation: "(" [12:5 - 12:6] ParenExpr= // CHECK: Identifier: "x" [12:6 - 12:7] DeclRefExpr=x:11:14 -// CHECK: Punctuation: ")" [12:7 - 12:8] UnexposedExpr= -// CHECK: Punctuation: ";" [12:8 - 12:9] UnexposedStmt= -// CHECK: Punctuation: "(" [13:3 - 13:4] UnexposedExpr= +// CHECK: Punctuation: ")" [12:7 - 12:8] ParenExpr= +// CHECK: Punctuation: ";" [12:8 - 12:9] CompoundStmt= +// CHECK: Punctuation: "(" [13:3 - 13:4] ParenExpr= // CHECK: Identifier: "x" [13:4 - 13:5] DeclRefExpr=x:11:14 -// CHECK: Punctuation: ")" [13:5 - 13:6] UnexposedExpr= +// CHECK: Punctuation: ")" [13:5 - 13:6] ParenExpr= // CHECK: Punctuation: "++" [13:6 - 13:8] CallExpr=operator++:9:5 -// CHECK: Punctuation: ";" [13:8 - 13:9] UnexposedStmt= -// CHECK: Punctuation: "}" [14:1 - 14:2] UnexposedStmt= +// CHECK: Punctuation: ";" [13:8 - 13:9] CompoundStmt= +// CHECK: Punctuation: "}" [14:1 - 14:2] CompoundStmt= // CHECK: Keyword: "struct" [16:1 - 16:7] StructDecl=S1:16:8 (Definition) // CHECK: Identifier: "S1" [16:8 - 16:10] StructDecl=S1:16:8 (Definition) // CHECK: Punctuation: "{" [16:11 - 16:12] StructDecl=S1:16:8 (Definition) @@ -109,14 +109,14 @@ void test3(S2 s2) { // CHECK: Identifier: "S2" [18:12 - 18:14] TypeRef=struct S2:17:8 // CHECK: Identifier: "s2" [18:15 - 18:17] ParmDecl=s2:18:15 (Definition) // CHECK: Punctuation: ")" [18:17 - 18:18] FunctionDecl=test3:18:6 (Definition) -// CHECK: Punctuation: "{" [18:19 - 18:20] UnexposedStmt= +// CHECK: Punctuation: "{" [18:19 - 18:20] CompoundStmt= // CHECK: Identifier: "s2" [19:3 - 19:5] DeclRefExpr=s2:18:15 // CHECK: Punctuation: "->" [19:5 - 19:7] MemberRefExpr=f:16:18 // CHECK: Identifier: "f" [19:7 - 19:8] MemberRefExpr=f:16:18 // CHECK: Punctuation: "(" [19:8 - 19:9] CallExpr=f:16:18 // CHECK: Punctuation: ")" [19:9 - 19:10] CallExpr=f:16:18 -// CHECK: Punctuation: ";" [19:10 - 19:11] UnexposedStmt= +// CHECK: Punctuation: ";" [19:10 - 19:11] CompoundStmt= // CHECK: Identifier: "X" [20:3 - 20:4] TypeRef=struct X:7:8 // CHECK: Identifier: "foo" [20:5 - 20:8] VarDecl=foo:20:5 (Definition) -// CHECK: Punctuation: ";" [20:8 - 20:9] UnexposedStmt= -// CHECK: Punctuation: "}" [21:1 - 21:2] UnexposedStmt= +// CHECK: Punctuation: ";" [20:8 - 20:9] DeclStmt= +// CHECK: Punctuation: "}" [21:1 - 21:2] CompoundStmt= diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m index 1dc762123207..34115d6d54b3 100644 --- a/test/Index/annotate-tokens.m +++ b/test/Index/annotate-tokens.m @@ -137,6 +137,11 @@ static Rdar8595462_A * Rdar8595462_staticVar; @property (readonly, atomic) Foo *abah; @end +@interface rdar9535717 { + __weak Foo *foo; +} +@end + // RUN: c-index-test -test-annotate-tokens=%s:1:1:118:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s // CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12 // CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12 @@ -155,9 +160,9 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ";" [2:27 - 2:28] ObjCInstanceMethodDecl=compare::2:1 // CHECK: Punctuation: "@" [3:1 - 3:2] ObjCInterfaceDecl=Foo:1:12 // CHECK: Keyword: "end" [3:2 - 3:5] ObjCInterfaceDecl=Foo:1:12 -// CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:1 (Definition) -// CHECK: Keyword: "implementation" [5:2 - 5:16] ObjCImplementationDecl=Foo:5:1 (Definition) -// CHECK: Identifier: "Foo" [5:17 - 5:20] ObjCImplementationDecl=Foo:5:1 (Definition) +// CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:17 (Definition) +// CHECK: Keyword: "implementation" [5:2 - 5:16] ObjCImplementationDecl=Foo:5:17 (Definition) +// CHECK: Identifier: "Foo" [5:17 - 5:20] ObjCImplementationDecl=Foo:5:17 (Definition) // CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:1 (Definition) // CHECK: Punctuation: "(" [6:3 - 6:4] ObjCInstanceMethodDecl=compare::6:1 (Definition) // CHECK: Keyword: "int" [6:4 - 6:7] ObjCInstanceMethodDecl=compare::6:1 (Definition) @@ -169,21 +174,21 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "*" [6:20 - 6:21] ParmDecl=other:6:22 (Definition) // CHECK: Punctuation: ")" [6:21 - 6:22] ParmDecl=other:6:22 (Definition) // CHECK: Identifier: "other" [6:22 - 6:27] ParmDecl=other:6:22 (Definition) -// CHECK: Punctuation: "{" [6:28 - 6:29] UnexposedStmt= -// CHECK: Keyword: "return" [7:3 - 7:9] UnexposedStmt= -// CHECK: Literal: "0" [7:10 - 7:11] UnexposedExpr= -// CHECK: Punctuation: ";" [7:11 - 7:12] UnexposedStmt= -// CHECK: Punctuation: "(" [8:3 - 8:4] UnexposedExpr= -// CHECK: Keyword: "void" [8:4 - 8:8] UnexposedExpr= -// CHECK: Punctuation: ")" [8:8 - 8:9] UnexposedExpr= -// CHECK: Punctuation: "@" [8:9 - 8:10] UnexposedExpr= -// CHECK: Keyword: "encode" [8:10 - 8:16] UnexposedExpr= -// CHECK: Punctuation: "(" [8:16 - 8:17] UnexposedExpr= +// CHECK: Punctuation: "{" [6:28 - 6:29] CompoundStmt= +// CHECK: Keyword: "return" [7:3 - 7:9] ReturnStmt= +// CHECK: Literal: "0" [7:10 - 7:11] IntegerLiteral= +// CHECK: Punctuation: ";" [7:11 - 7:12] CompoundStmt= +// CHECK: Punctuation: "(" [8:3 - 8:4] CStyleCastExpr= +// CHECK: Keyword: "void" [8:4 - 8:8] CStyleCastExpr= +// CHECK: Punctuation: ")" [8:8 - 8:9] CStyleCastExpr= +// CHECK: Punctuation: "@" [8:9 - 8:10] ObjCEncodeExpr= +// CHECK: Keyword: "encode" [8:10 - 8:16] ObjCEncodeExpr= +// CHECK: Punctuation: "(" [8:16 - 8:17] ObjCEncodeExpr= // CHECK: Identifier: "Foo" [8:17 - 8:20] ObjCClassRef=Foo:1:12 -// CHECK: Punctuation: ")" [8:20 - 8:21] UnexposedExpr= -// CHECK: Punctuation: ";" [8:21 - 8:22] UnexposedStmt= -// CHECK: Punctuation: "}" [9:1 - 9:2] UnexposedStmt= -// CHECK: Punctuation: "@" [10:1 - 10:2] ObjCImplementationDecl=Foo:5:1 (Definition) +// CHECK: Punctuation: ")" [8:20 - 8:21] ObjCEncodeExpr= +// CHECK: Punctuation: ";" [8:21 - 8:22] CompoundStmt= +// CHECK: Punctuation: "}" [9:1 - 9:2] CompoundStmt= +// CHECK: Punctuation: "@" [10:1 - 10:2] ObjCImplementationDecl=Foo:5:17 (Definition) // CHECK: Keyword: "end" [10:2 - 10:5] // CHECK: Keyword: "typedef" [14:1 - 14:8] // CHECK: Keyword: "int" [14:9 - 14:12] @@ -205,22 +210,22 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "}" [19:1 - 19:2] ObjCInterfaceDecl=Bar:15:12 // CHECK: Punctuation: "@" [20:1 - 20:2] ObjCInterfaceDecl=Bar:15:12 // CHECK: Keyword: "end" [20:2 - 20:5] ObjCInterfaceDecl=Bar:15:12 -// CHECK: Punctuation: "@" [21:1 - 21:2] ObjCImplementationDecl=Bar:21:1 (Definition) -// CHECK: Keyword: "implementation" [21:2 - 21:16] ObjCImplementationDecl=Bar:21:1 (Definition) -// CHECK: Identifier: "Bar" [21:17 - 21:20] ObjCImplementationDecl=Bar:21:1 (Definition) +// CHECK: Punctuation: "@" [21:1 - 21:2] ObjCImplementationDecl=Bar:21:17 (Definition) +// CHECK: Keyword: "implementation" [21:2 - 21:16] ObjCImplementationDecl=Bar:21:17 (Definition) +// CHECK: Identifier: "Bar" [21:17 - 21:20] ObjCImplementationDecl=Bar:21:17 (Definition) // CHECK: Punctuation: "-" [22:1 - 22:2] ObjCInstanceMethodDecl=method:22:1 (Definition) // CHECK: Punctuation: "(" [22:3 - 22:4] ObjCInstanceMethodDecl=method:22:1 (Definition) // CHECK: Keyword: "void" [22:4 - 22:8] ObjCInstanceMethodDecl=method:22:1 (Definition) // CHECK: Punctuation: ")" [22:8 - 22:9] ObjCInstanceMethodDecl=method:22:1 (Definition) // CHECK: Identifier: "method" [22:10 - 22:16] ObjCInstanceMethodDecl=method:22:1 (Definition) -// CHECK: Punctuation: "{" [23:1 - 23:2] UnexposedStmt= +// CHECK: Punctuation: "{" [23:1 - 23:2] CompoundStmt= // CHECK: Identifier: "barType" [24:5 - 24:12] TypeRef=barType:14:15 // CHECK: Identifier: "local" [24:13 - 24:18] VarDecl=local:24:13 (Definition) // CHECK: Punctuation: "=" [24:19 - 24:20] VarDecl=local:24:13 (Definition) // CHECK: Identifier: "iVar" [24:21 - 24:25] MemberRefExpr=iVar:17:13 -// CHECK: Punctuation: ";" [24:25 - 24:26] UnexposedStmt= -// CHECK: Punctuation: "}" [25:1 - 25:2] UnexposedStmt= -// CHECK: Punctuation: "@" [26:1 - 26:2] ObjCImplementationDecl=Bar:21:1 (Definition) +// CHECK: Punctuation: ";" [24:25 - 24:26] DeclStmt= +// CHECK: Punctuation: "}" [25:1 - 25:2] CompoundStmt= +// CHECK: Punctuation: "@" [26:1 - 26:2] ObjCImplementationDecl=Bar:21:17 (Definition) // CHECK: Keyword: "end" [26:2 - 26:5] // CHECK: Punctuation: "@" [32:1 - 32:2] ObjCInterfaceDecl=IBActionTests:32:12 // CHECK: Keyword: "interface" [32:2 - 32:11] ObjCInterfaceDecl=IBActionTests:32:12 @@ -257,9 +262,9 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Keyword: "void" [36:26 - 36:30] FunctionDecl=ibaction_test:36:12 // CHECK: Punctuation: ")" [36:30 - 36:31] FunctionDecl=ibaction_test:36:12 // CHECK: Punctuation: ";" [36:31 - 36:32] -// CHECK: Punctuation: "@" [37:1 - 37:2] ObjCImplementationDecl=IBActionTests:37:1 (Definition) -// CHECK: Keyword: "implementation" [37:2 - 37:16] ObjCImplementationDecl=IBActionTests:37:1 (Definition) -// CHECK: Identifier: "IBActionTests" [37:17 - 37:30] ObjCImplementationDecl=IBActionTests:37:1 (Definition) +// CHECK: Punctuation: "@" [37:1 - 37:2] ObjCImplementationDecl=IBActionTests:37:17 (Definition) +// CHECK: Keyword: "implementation" [37:2 - 37:16] ObjCImplementationDecl=IBActionTests:37:17 (Definition) +// CHECK: Identifier: "IBActionTests" [37:17 - 37:30] ObjCImplementationDecl=IBActionTests:37:17 (Definition) // CHECK: Punctuation: "-" [38:1 - 38:2] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) // CHECK: Punctuation: "(" [38:3 - 38:4] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) // CHECK: Identifier: "IBAction" [38:4 - 38:12] macro expansion=IBAction @@ -270,19 +275,19 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "id" [38:31 - 38:33] TypeRef=id:0:0 // CHECK: Punctuation: ")" [38:33 - 38:34] ParmDecl=arg:38:34 (Definition) // CHECK: Identifier: "arg" [38:34 - 38:37] ParmDecl=arg:38:34 (Definition) -// CHECK: Punctuation: "{" [39:1 - 39:2] UnexposedStmt= +// CHECK: Punctuation: "{" [39:1 - 39:2] CompoundStmt= // CHECK: Identifier: "ibaction_test" [40:5 - 40:18] DeclRefExpr=ibaction_test:36:12 // CHECK: Punctuation: "(" [40:18 - 40:19] CallExpr=ibaction_test:36:12 // CHECK: Punctuation: ")" [40:19 - 40:20] CallExpr=ibaction_test:36:12 -// CHECK: Punctuation: ";" [40:20 - 40:21] UnexposedStmt= +// CHECK: Punctuation: ";" [40:20 - 40:21] CompoundStmt= // CHECK: Punctuation: "[" [41:5 - 41:6] ObjCMessageExpr=foo::34:1 // CHECK: Identifier: "self" [41:6 - 41:10] DeclRefExpr=self:0:0 // CHECK: Identifier: "foo" [41:11 - 41:14] ObjCMessageExpr=foo::34:1 // CHECK: Punctuation: ":" [41:14 - 41:15] ObjCMessageExpr=foo::34:1 -// CHECK: Literal: "0" [41:15 - 41:16] UnexposedExpr= +// CHECK: Literal: "0" [41:15 - 41:16] IntegerLiteral= // CHECK: Punctuation: "]" [41:16 - 41:17] ObjCMessageExpr=foo::34:1 -// CHECK: Punctuation: ";" [41:17 - 41:18] UnexposedStmt= -// CHECK: Punctuation: "}" [42:1 - 42:2] UnexposedStmt= +// CHECK: Punctuation: ";" [41:17 - 41:18] CompoundStmt= +// CHECK: Punctuation: "}" [42:1 - 42:2] CompoundStmt= // CHECK: Punctuation: "-" [43:1 - 43:2] ObjCInstanceMethodDecl=foo::43:1 (Definition) // CHECK: Punctuation: "(" [43:3 - 43:4] ObjCInstanceMethodDecl=foo::43:1 (Definition) // CHECK: Keyword: "void" [43:4 - 43:8] ObjCInstanceMethodDecl=foo::43:1 (Definition) @@ -293,14 +298,14 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Keyword: "int" [43:15 - 43:18] ParmDecl=x:43:19 (Definition) // CHECK: Punctuation: ")" [43:18 - 43:19] ParmDecl=x:43:19 (Definition) // CHECK: Identifier: "x" [43:19 - 43:20] ParmDecl=x:43:19 (Definition) -// CHECK: Punctuation: "{" [44:1 - 44:2] UnexposedStmt= -// CHECK: Punctuation: "(" [45:3 - 45:4] UnexposedExpr=x:43:19 -// CHECK: Keyword: "void" [45:4 - 45:8] UnexposedExpr=x:43:19 -// CHECK: Punctuation: ")" [45:8 - 45:9] UnexposedExpr=x:43:19 +// CHECK: Punctuation: "{" [44:1 - 44:2] CompoundStmt= +// CHECK: Punctuation: "(" [45:3 - 45:4] CStyleCastExpr= +// CHECK: Keyword: "void" [45:4 - 45:8] CStyleCastExpr= +// CHECK: Punctuation: ")" [45:8 - 45:9] CStyleCastExpr= // CHECK: Identifier: "x" [45:10 - 45:11] DeclRefExpr=x:43:19 -// CHECK: Punctuation: ";" [45:11 - 45:12] UnexposedStmt= -// CHECK: Punctuation: "}" [46:1 - 46:2] UnexposedStmt= -// CHECK: Punctuation: "@" [47:1 - 47:2] ObjCImplementationDecl=IBActionTests:37:1 (Definition) +// CHECK: Punctuation: ";" [45:11 - 45:12] CompoundStmt= +// CHECK: Punctuation: "}" [46:1 - 46:2] CompoundStmt= +// CHECK: Punctuation: "@" [47:1 - 47:2] ObjCImplementationDecl=IBActionTests:37:17 (Definition) // CHECK: Keyword: "end" [47:2 - 47:5] // CHECK: Punctuation: "@" [51:1 - 51:2] ObjCInterfaceDecl=IBOutletTests:51:12 // CHECK: Keyword: "interface" [51:2 - 51:11] ObjCInterfaceDecl=IBOutletTests:51:12 @@ -358,9 +363,9 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ";" [67:15 - 67:16] ObjCInstanceMethodDecl=method:67:1 // CHECK: Punctuation: "@" [68:1 - 68:2] ObjCInterfaceDecl=R7974151:65:12 // CHECK: Keyword: "end" [68:2 - 68:5] ObjCInterfaceDecl=R7974151:65:12 -// CHECK: Punctuation: "@" [70:1 - 70:2] ObjCImplementationDecl=R7974151:70:1 (Definition) -// CHECK: Keyword: "implementation" [70:2 - 70:16] ObjCImplementationDecl=R7974151:70:1 (Definition) -// CHECK: Identifier: "R7974151" [70:17 - 70:25] ObjCImplementationDecl=R7974151:70:1 (Definition) +// CHECK: Punctuation: "@" [70:1 - 70:2] ObjCImplementationDecl=R7974151:70:17 (Definition) +// CHECK: Keyword: "implementation" [70:2 - 70:16] ObjCImplementationDecl=R7974151:70:17 (Definition) +// CHECK: Identifier: "R7974151" [70:17 - 70:25] ObjCImplementationDecl=R7974151:70:17 (Definition) // CHECK: Punctuation: "-" [71:1 - 71:2] ObjCInstanceMethodDecl=foo::71:1 (Definition) // CHECK: Punctuation: "(" [71:3 - 71:4] ObjCInstanceMethodDecl=foo::71:1 (Definition) // CHECK: Keyword: "int" [71:4 - 71:7] ObjCInstanceMethodDecl=foo::71:1 (Definition) @@ -371,17 +376,17 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Keyword: "int" [71:14 - 71:17] ParmDecl=arg:71:18 (Definition) // CHECK: Punctuation: ")" [71:17 - 71:18] ParmDecl=arg:71:18 (Definition) // CHECK: Identifier: "arg" [71:18 - 71:21] ParmDecl=arg:71:18 (Definition) -// CHECK: Punctuation: "{" [71:22 - 71:23] UnexposedStmt= -// CHECK: Keyword: "return" [72:3 - 72:9] UnexposedStmt= +// CHECK: Punctuation: "{" [71:22 - 71:23] CompoundStmt= +// CHECK: Keyword: "return" [72:3 - 72:9] ReturnStmt= // CHECK: Identifier: "arg" [72:10 - 72:13] DeclRefExpr=arg:71:18 -// CHECK: Punctuation: ";" [72:13 - 72:14] UnexposedStmt= -// CHECK: Punctuation: "}" [73:1 - 73:2] UnexposedStmt= +// CHECK: Punctuation: ";" [72:13 - 72:14] CompoundStmt= +// CHECK: Punctuation: "}" [73:1 - 73:2] CompoundStmt= // CHECK: Punctuation: "-" [74:1 - 74:2] ObjCInstanceMethodDecl=method:74:1 (Definition) // CHECK: Punctuation: "(" [74:3 - 74:4] ObjCInstanceMethodDecl=method:74:1 (Definition) // CHECK: Keyword: "int" [74:4 - 74:7] ObjCInstanceMethodDecl=method:74:1 (Definition) // CHECK: Punctuation: ")" [74:7 - 74:8] ObjCInstanceMethodDecl=method:74:1 (Definition) // CHECK: Identifier: "method" [74:9 - 74:15] ObjCInstanceMethodDecl=method:74:1 (Definition) -// CHECK: Punctuation: "{" [75:1 - 75:2] UnexposedStmt= +// CHECK: Punctuation: "{" [75:1 - 75:2] CompoundStmt= // CHECK: Keyword: "int" [76:5 - 76:8] VarDecl=local:76:9 (Definition) // CHECK: Identifier: "local" [76:9 - 76:14] VarDecl=local:76:9 (Definition) // CHECK: Punctuation: "=" [76:15 - 76:16] VarDecl=local:76:9 (Definition) @@ -391,7 +396,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ":" [76:26 - 76:27] ObjCMessageExpr=foo::66:1 // CHECK: Identifier: "VAL" [76:27 - 76:30] macro expansion=VAL:63:9 // CHECK: Punctuation: "]" [76:30 - 76:31] ObjCMessageExpr=foo::66:1 -// CHECK: Punctuation: ";" [76:31 - 76:32] UnexposedStmt= +// CHECK: Punctuation: ";" [76:31 - 76:32] DeclStmt= // CHECK: Keyword: "int" [77:5 - 77:8] VarDecl=second:77:9 (Definition) // CHECK: Identifier: "second" [77:9 - 77:15] VarDecl=second:77:9 (Definition) // CHECK: Punctuation: "=" [77:16 - 77:17] VarDecl=second:77:9 (Definition) @@ -399,13 +404,13 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "self" [77:19 - 77:23] DeclRefExpr=self:0:0 // CHECK: Identifier: "foo" [77:24 - 77:27] ObjCMessageExpr=foo::66:1 // CHECK: Punctuation: ":" [77:27 - 77:28] ObjCMessageExpr=foo::66:1 -// CHECK: Literal: "0" [77:28 - 77:29] UnexposedExpr= +// CHECK: Literal: "0" [77:28 - 77:29] IntegerLiteral= // CHECK: Punctuation: "]" [77:29 - 77:30] ObjCMessageExpr=foo::66:1 -// CHECK: Punctuation: ";" [77:30 - 77:31] UnexposedStmt= -// CHECK: Keyword: "return" [78:5 - 78:11] UnexposedStmt= +// CHECK: Punctuation: ";" [77:30 - 77:31] DeclStmt= +// CHECK: Keyword: "return" [78:5 - 78:11] ReturnStmt= // CHECK: Identifier: "local" [78:12 - 78:17] DeclRefExpr=local:76:9 -// CHECK: Punctuation: ";" [78:17 - 78:18] UnexposedStmt= -// CHECK: Punctuation: "}" [79:1 - 79:2] UnexposedStmt= +// CHECK: Punctuation: ";" [78:17 - 78:18] CompoundStmt= +// CHECK: Punctuation: "}" [79:1 - 79:2] CompoundStmt= // CHECK: Punctuation: "-" [80:1 - 80:2] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) // CHECK: Punctuation: "(" [80:3 - 80:4] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) // CHECK: Keyword: "int" [80:4 - 80:7] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) @@ -417,36 +422,36 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "*" [80:35 - 80:36] ParmDecl=ibt:80:37 (Definition) // CHECK: Punctuation: ")" [80:36 - 80:37] ParmDecl=ibt:80:37 (Definition) // CHECK: Identifier: "ibt" [80:37 - 80:40] ParmDecl=ibt:80:37 (Definition) -// CHECK: Punctuation: "{" [80:41 - 80:42] UnexposedStmt= -// CHECK: Keyword: "return" [81:3 - 81:9] UnexposedStmt= -// CHECK: Punctuation: "*" [81:10 - 81:11] UnexposedExpr= +// CHECK: Punctuation: "{" [80:41 - 80:42] CompoundStmt= +// CHECK: Keyword: "return" [81:3 - 81:9] ReturnStmt= +// CHECK: Punctuation: "*" [81:10 - 81:11] UnaryOperator= // CHECK: Identifier: "ibt" [81:11 - 81:14] DeclRefExpr=ibt:80:37 // CHECK: Punctuation: "." [81:14 - 81:15] MemberRefExpr=aPropOutlet:56:26 // CHECK: Identifier: "aPropOutlet" [81:15 - 81:26] MemberRefExpr=aPropOutlet:56:26 -// CHECK: Punctuation: ";" [81:26 - 81:27] UnexposedStmt= -// CHECK: Punctuation: "}" [82:1 - 82:2] UnexposedStmt= -// CHECK: Punctuation: "@" [83:1 - 83:2] ObjCImplementationDecl=R7974151:70:1 (Definition) +// CHECK: Punctuation: ";" [81:26 - 81:27] CompoundStmt= +// CHECK: Punctuation: "}" [82:1 - 82:2] CompoundStmt= +// CHECK: Punctuation: "@" [83:1 - 83:2] ObjCImplementationDecl=R7974151:70:17 (Definition) // CHECK: Keyword: "end" [83:2 - 83:5] -// CHECK: Punctuation: "@" [85:1 - 85:2] ObjCProtocolDecl=Proto:85:1 (Definition) -// CHECK: Keyword: "protocol" [85:2 - 85:10] ObjCProtocolDecl=Proto:85:1 (Definition) -// CHECK: Identifier: "Proto" [85:11 - 85:16] ObjCProtocolDecl=Proto:85:1 (Definition) -// CHECK: Punctuation: "@" [85:17 - 85:18] ObjCProtocolDecl=Proto:85:1 (Definition) -// CHECK: Keyword: "end" [85:18 - 85:21] ObjCProtocolDecl=Proto:85:1 (Definition) +// CHECK: Punctuation: "@" [85:1 - 85:2] ObjCProtocolDecl=Proto:85:11 (Definition) +// CHECK: Keyword: "protocol" [85:2 - 85:10] ObjCProtocolDecl=Proto:85:11 (Definition) +// CHECK: Identifier: "Proto" [85:11 - 85:16] ObjCProtocolDecl=Proto:85:11 (Definition) +// CHECK: Punctuation: "@" [85:17 - 85:18] ObjCProtocolDecl=Proto:85:11 (Definition) +// CHECK: Keyword: "end" [85:18 - 85:21] ObjCProtocolDecl=Proto:85:11 (Definition) // CHECK: Keyword: "void" [87:1 - 87:5] FunctionDecl=f:87:6 (Definition) // CHECK: Identifier: "f" [87:6 - 87:7] FunctionDecl=f:87:6 (Definition) // CHECK: Punctuation: "(" [87:7 - 87:8] FunctionDecl=f:87:6 (Definition) // CHECK: Punctuation: ")" [87:8 - 87:9] FunctionDecl=f:87:6 (Definition) -// CHECK: Punctuation: "{" [87:10 - 87:11] UnexposedStmt= -// CHECK: Punctuation: "(" [88:3 - 88:4] UnexposedExpr=Proto:85:1 -// CHECK: Keyword: "void" [88:4 - 88:8] UnexposedExpr=Proto:85:1 -// CHECK: Punctuation: ")" [88:8 - 88:9] UnexposedExpr=Proto:85:1 -// CHECK: Punctuation: "@" [88:9 - 88:10] UnexposedExpr=Proto:85:1 -// CHECK: Keyword: "protocol" [88:10 - 88:18] UnexposedExpr=Proto:85:1 -// CHECK: Punctuation: "(" [88:18 - 88:19] UnexposedExpr=Proto:85:1 -// CHECK: Identifier: "Proto" [88:19 - 88:24] UnexposedExpr=Proto:85:1 -// CHECK: Punctuation: ")" [88:24 - 88:25] UnexposedExpr=Proto:85:1 -// CHECK: Punctuation: ";" [88:25 - 88:26] UnexposedStmt= -// CHECK: Punctuation: "}" [89:1 - 89:2] UnexposedStmt= +// CHECK: Punctuation: "{" [87:10 - 87:11] CompoundStmt= +// CHECK: Punctuation: "(" [88:3 - 88:4] CStyleCastExpr= +// CHECK: Keyword: "void" [88:4 - 88:8] CStyleCastExpr= +// CHECK: Punctuation: ")" [88:8 - 88:9] CStyleCastExpr= +// CHECK: Punctuation: "@" [88:9 - 88:10] ObjCProtocolExpr=Proto:85:1 +// CHECK: Keyword: "protocol" [88:10 - 88:18] ObjCProtocolExpr=Proto:85:1 +// CHECK: Punctuation: "(" [88:18 - 88:19] ObjCProtocolExpr=Proto:85:1 +// CHECK: Identifier: "Proto" [88:19 - 88:24] ObjCProtocolExpr=Proto:85:1 +// CHECK: Punctuation: ")" [88:24 - 88:25] ObjCProtocolExpr=Proto:85:1 +// CHECK: Punctuation: ";" [88:25 - 88:26] CompoundStmt= +// CHECK: Punctuation: "}" [89:1 - 89:2] CompoundStmt= // CHECK: Punctuation: "@" [93:1 - 93:2] UnexposedDecl=[93:8] // CHECK: Keyword: "class" [93:2 - 93:7] UnexposedDecl=[93:8] // CHECK: Identifier: "Rdar8595462_A" [93:8 - 93:21] ObjCClassRef=Rdar8595462_A:93:8 @@ -456,31 +461,31 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "Rdar8595462_B" [94:12 - 94:25] ObjCInterfaceDecl=Rdar8595462_B:94:12 // CHECK: Punctuation: "@" [95:1 - 95:2] ObjCInterfaceDecl=Rdar8595462_B:94:12 // CHECK: Keyword: "end" [95:2 - 95:5] ObjCInterfaceDecl=Rdar8595462_B:94:12 -// CHECK: Punctuation: "@" [97:1 - 97:2] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) -// CHECK: Keyword: "implementation" [97:2 - 97:16] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) -// CHECK: Identifier: "Rdar8595462_B" [97:17 - 97:30] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) +// CHECK: Punctuation: "@" [97:1 - 97:2] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) +// CHECK: Keyword: "implementation" [97:2 - 97:16] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) +// CHECK: Identifier: "Rdar8595462_B" [97:17 - 97:30] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) // CHECK: Identifier: "Rdar8595462_A" [98:1 - 98:14] ObjCClassRef=Rdar8595462_A:93:8 // CHECK: Punctuation: "*" [98:15 - 98:16] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition) // CHECK: Identifier: "Rdar8595462_aFunction" [98:17 - 98:38] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition) // CHECK: Punctuation: "(" [98:38 - 98:39] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition) // CHECK: Punctuation: ")" [98:39 - 98:40] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition) -// CHECK: Punctuation: "{" [98:41 - 98:42] UnexposedStmt= +// CHECK: Punctuation: "{" [98:41 - 98:42] CompoundStmt= // CHECK: Identifier: "Rdar8595462_A" [99:3 - 99:16] ObjCClassRef=Rdar8595462_A:93:8 // CHECK: Punctuation: "*" [99:17 - 99:18] VarDecl=localVar:99:19 (Definition) // CHECK: Identifier: "localVar" [99:19 - 99:27] VarDecl=localVar:99:19 (Definition) // CHECK: Punctuation: "=" [99:28 - 99:29] VarDecl=localVar:99:19 (Definition) -// CHECK: Literal: "0" [99:30 - 99:31] UnexposedExpr= -// CHECK: Punctuation: ";" [99:31 - 99:32] UnexposedStmt= -// CHECK: Keyword: "return" [100:3 - 100:9] UnexposedStmt= +// CHECK: Literal: "0" [99:30 - 99:31] IntegerLiteral= +// CHECK: Punctuation: ";" [99:31 - 99:32] DeclStmt= +// CHECK: Keyword: "return" [100:3 - 100:9] ReturnStmt= // CHECK: Identifier: "localVar" [100:10 - 100:18] DeclRefExpr=localVar:99:19 -// CHECK: Punctuation: ";" [100:18 - 100:19] UnexposedStmt= -// CHECK: Punctuation: "}" [101:1 - 101:2] UnexposedStmt= -// CHECK: Keyword: "static" [102:1 - 102:7] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) +// CHECK: Punctuation: ";" [100:18 - 100:19] CompoundStmt= +// CHECK: Punctuation: "}" [101:1 - 101:2] CompoundStmt= +// CHECK: Keyword: "static" [102:1 - 102:7] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) // CHECK: Identifier: "Rdar8595462_A" [102:8 - 102:21] ObjCClassRef=Rdar8595462_A:93:8 // CHECK: Punctuation: "*" [102:22 - 102:23] VarDecl=Rdar8595462_staticVar:102:24 // CHECK: Identifier: "Rdar8595462_staticVar" [102:24 - 102:45] VarDecl=Rdar8595462_staticVar:102:24 -// CHECK: Punctuation: ";" [102:45 - 102:46] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) -// CHECK: Punctuation: "@" [103:1 - 103:2] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition) +// CHECK: Punctuation: ";" [102:45 - 102:46] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) +// CHECK: Punctuation: "@" [103:1 - 103:2] ObjCImplementationDecl=Rdar8595462_B:97:17 (Definition) // CHECK: Keyword: "end" [103:2 - 103:5] // CHECK: Punctuation: "@" [110:1 - 110:2] ObjCPropertyDecl=foo:110:33 @@ -506,7 +511,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "foo" [115:13 - 115:16] ObjCSynthesizeDecl=foo:110:33 (Definition) // CHECK: Punctuation: "=" [115:17 - 115:18] ObjCSynthesizeDecl=foo:110:33 (Definition) // CHECK: Identifier: "_foo" [115:19 - 115:23] MemberRef=_foo:107:8 -// CHECK: Punctuation: ";" [115:23 - 115:24] ObjCImplementationDecl=Rdar8595386:114:1 (Definition) +// CHECK: Punctuation: ";" [115:23 - 115:24] ObjCImplementationDecl=Rdar8595386:114:17 (Definition) // RUN: c-index-test -test-annotate-tokens=%s:127:1:130:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-INSIDE_BLOCK %s // CHECK-INSIDE_BLOCK: Keyword: "int" [127:5 - 127:8] VarDecl=result:127:9 (Definition) @@ -516,11 +521,11 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-INSIDE_BLOCK: Identifier: "self" [127:19 - 127:23] DeclRefExpr=self:0:0 // CHECK-INSIDE_BLOCK: Identifier: "blah" [127:24 - 127:28] ObjCMessageExpr=blah::124:1 // CHECK-INSIDE_BLOCK: Punctuation: ":" [127:28 - 127:29] ObjCMessageExpr=blah::124:1 -// CHECK-INSIDE_BLOCK: Literal: "5" [127:29 - 127:30] UnexposedExpr= +// CHECK-INSIDE_BLOCK: Literal: "5" [127:29 - 127:30] IntegerLiteral= // CHECK-INSIDE_BLOCK: Punctuation: "," [127:30 - 127:31] ObjCMessageExpr=blah::124:1 // CHECK-INSIDE_BLOCK: Identifier: "x" [127:32 - 127:33] DeclRefExpr=x:125:19 // CHECK-INSIDE_BLOCK: Punctuation: "]" [127:33 - 127:34] ObjCMessageExpr=blah::124:1 -// CHECK-INSIDE_BLOCK: Punctuation: ";" [127:34 - 127:35] UnexposedStmt= +// CHECK-INSIDE_BLOCK: Punctuation: ";" [127:34 - 127:35] DeclStmt= // CHECK-INSIDE_BLOCK: Identifier: "Rdar8778404" [128:5 - 128:16] ObjCClassRef=Rdar8778404:120:12 // CHECK-INSIDE_BLOCK: Punctuation: "*" [128:17 - 128:18] VarDecl=a:128:18 (Definition) // CHECK-INSIDE_BLOCK: Identifier: "a" [128:18 - 128:19] VarDecl=a:128:18 (Definition) @@ -561,3 +566,11 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-PROP-AFTER-METHOD: Identifier: "abah" [137:35 - 137:39] ObjCPropertyDecl=abah:137:35 // CHECK-PROP-AFTER-METHOD: Punctuation: ";" [137:39 - 137:40] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [138:1 - 138:2] ObjCInterfaceDecl=Rdar8062781:134:12 + +// RUN: c-index-test -test-annotate-tokens=%s:141:1:142:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' -ccc-host-triple x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s +// CHECK-WITH-WEAK: Identifier: "__weak" [141:3 - 141:9] macro expansion +// CHECK-WITH-WEAK: Identifier: "Foo" [141:10 - 141:13] ObjCClassRef=Foo:1:12 +// CHECK-WITH-WEAK: Punctuation: "*" [141:14 - 141:15] ObjCIvarDecl=foo:141:15 (Definition) +// CHECK-WITH-WEAK: Identifier: "foo" [141:15 - 141:18] ObjCIvarDecl=foo:141:15 (Definition) +// CHECK-WITH-WEAK: Punctuation: ";" [141:18 - 141:19] ObjCInterfaceDecl=rdar9535717:140:12 +// CHECK-WITH-WEAK: Punctuation: "}" [142:1 - 142:2] ObjCInterfaceDecl=rdar9535717:140:12 diff --git a/test/Index/blocks.c b/test/Index/blocks.c index 633e171ffa37..3f33e48e4ced 100644 --- a/test/Index/blocks.c +++ b/test/Index/blocks.c @@ -10,25 +10,25 @@ void test() { } // CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:1 - 10:2] -// CHECK: blocks.c:6:13: UnexposedStmt= Extent=[6:13 - 10:2] -// CHECK: blocks.c:7:3: UnexposedStmt= Extent=[7:3 - 7:26] +// CHECK: blocks.c:6:13: CompoundStmt= Extent=[6:13 - 10:2] +// CHECK: blocks.c:7:3: DeclStmt= Extent=[7:3 - 7:26] // CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:3 - 7:25] // CHECK: blocks.c:7:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20] // CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:3 - 8:16] -// CHECK: blocks.c:8:15: UnexposedExpr= Extent=[8:15 - 8:16] +// CHECK: blocks.c:8:15: IntegerLiteral= Extent=[8:15 - 8:16] // CHECK: blocks.c:9:3: CallExpr= Extent=[9:3 - 9:65] -// CHECK: blocks.c:9:3: UnexposedExpr= Extent=[9:3 - 9:58] +// CHECK: blocks.c:9:3: BlockExpr= Extent=[9:3 - 9:58] // CHECK: blocks.c:9:5: TypeRef=int_t:3:13 Extent=[9:5 - 9:10] // CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:11 - 9:26] // CHECK: blocks.c:9:18: TypeRef=struct foo:4:8 Extent=[9:18 - 9:21] -// CHECK: blocks.c:9:28: UnexposedStmt= Extent=[9:28 - 9:58] -// CHECK: blocks.c:9:30: UnexposedStmt= Extent=[9:30 - 9:55] -// CHECK: blocks.c:9:37: UnexposedExpr= Extent=[9:37 - 9:55] -// CHECK: blocks.c:9:37: UnexposedExpr=x:4:19 Extent=[9:37 - 9:51] +// CHECK: blocks.c:9:28: CompoundStmt= Extent=[9:28 - 9:58] +// CHECK: blocks.c:9:30: ReturnStmt= Extent=[9:30 - 9:55] +// CHECK: blocks.c:9:37: BinaryOperator= Extent=[9:37 - 9:55] +// CHECK: blocks.c:9:37: CStyleCastExpr= Extent=[9:37 - 9:51] // CHECK: blocks.c:9:38: TypeRef=int_t:3:13 Extent=[9:38 - 9:43] -// CHECK: blocks.c:9:50: MemberRefExpr=x:4:19 Extent=[9:45 - 9:51] +// CHECK: blocks.c:9:50: MemberRefExpr=x:4:19 SingleRefName=[9:50 - 9:51] RefName=[9:50 - 9:51] Extent=[9:45 - 9:51] // CHECK: blocks.c:9:45: DeclRefExpr=foo:9:23 Extent=[9:45 - 9:48] // CHECK: blocks.c:9:54: DeclRefExpr=i:8:11 Extent=[9:54 - 9:55] -// CHECK: blocks.c:9:59: UnexposedExpr= Extent=[9:59 - 9:64] +// CHECK: blocks.c:9:59: UnaryOperator= Extent=[9:59 - 9:64] // CHECK: blocks.c:9:60: DeclRefExpr=_foo:7:21 Extent=[9:60 - 9:64] diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index ab5f9a9ed6f9..62cc4d422ca2 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-load-tu %t.ast all | FileCheck %s @interface Foo @@ -60,7 +60,7 @@ int main (int argc, const char * argv[]) { #define IBAction void)__attribute__((ibaction) @interface TestAttributes { - IBOutlet char * anOutlet; + IBOutlet id anOutlet; IBOutletCollection(id) id anOutletCollection; } - (IBAction) actionMethod:(id)arg; @@ -92,14 +92,14 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:21:1: ObjCInstanceMethodDecl=catMethodWithFloat::21:1 Extent=[21:1 - 21:41] // CHECK: c-index-api-loadTU-test.m:21:36: ParmDecl=fArg:21:36 (Definition) Extent=[21:29 - 21:40] // CHECK: c-index-api-loadTU-test.m:22:1: ObjCInstanceMethodDecl=floatMethod:22:1 Extent=[22:1 - 22:23] -// CHECK: c-index-api-loadTU-test.m:25:1: ObjCProtocolDecl=Proto:25:1 (Definition) Extent=[25:1 - 27:5] +// CHECK: c-index-api-loadTU-test.m:25:11: ObjCProtocolDecl=Proto:25:11 (Definition) Extent=[25:1 - 27:5] // CHECK: c-index-api-loadTU-test.m:26:1: ObjCInstanceMethodDecl=pMethod:26:1 Extent=[26:1 - 26:11] -// CHECK: c-index-api-loadTU-test.m:29:1: ObjCProtocolDecl=SubP:29:1 (Definition) Extent=[29:1 - 31:5] -// CHECK: c-index-api-loadTU-test.m:29:17: ObjCProtocolRef=Proto:25:1 Extent=[29:17 - 29:22] +// CHECK: c-index-api-loadTU-test.m:29:11: ObjCProtocolDecl=SubP:29:11 (Definition) Extent=[29:1 - 31:5] +// CHECK: c-index-api-loadTU-test.m:29:17: ObjCProtocolRef=Proto:25:11 Extent=[29:17 - 29:22] // CHECK: c-index-api-loadTU-test.m:30:1: ObjCInstanceMethodDecl=spMethod:30:1 Extent=[30:1 - 30:12] // CHECK: c-index-api-loadTU-test.m:33:12: ObjCInterfaceDecl=Baz:33:12 Extent=[33:1 - 40:5] // CHECK: c-index-api-loadTU-test.m:33:18: ObjCSuperClassRef=Bar:14:12 Extent=[33:18 - 33:21] -// CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:1 Extent=[33:23 - 33:27] +// CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:11 Extent=[33:23 - 33:27] // CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:5 - 35:16] // CHECK: c-index-api-loadTU-test.m:38:1: ObjCInstanceMethodDecl=bazMethod:38:1 Extent=[38:1 - 38:21] // CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7] @@ -116,14 +116,14 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:48:10: DeclRefExpr=bee:47:8 Extent=[48:10 - 48:13] // CHECK: c-index-api-loadTU-test.m:49:12: VarDecl=c:49:12 (Definition) Extent=[49:2 - 49:26] // CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:4] -// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=SubP:29:1 Extent=[49:6 - 49:10] +// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=SubP:29:11 Extent=[49:6 - 49:10] // CHECK: c-index-api-loadTU-test.m:49:16: UnexposedExpr=fooC:10:1 Extent=[49:16 - 49:26] // CHECK: c-index-api-loadTU-test.m:49:16: ObjCMessageExpr=fooC:10:1 Extent=[49:16 - 49:26] // CHECK: c-index-api-loadTU-test.m:49:17: ObjCClassRef=Foo:4:12 Extent=[49:17 - 49:20] // CHECK: c-index-api-loadTU-test.m:50:13: VarDecl=d:50:13 (Definition) Extent=[50:2 - 50:14] // CHECK: c-index-api-loadTU-test.m:50:2: TypeRef=id:0:0 Extent=[50:2 - 50:4] -// CHECK: c-index-api-loadTU-test.m:50:6: ObjCProtocolRef=Proto:25:1 Extent=[50:6 - 50:11] -// CHECK: c-index-api-loadTU-test.m:51:2: UnexposedExpr= Extent=[51:2 - 51:7] +// CHECK: c-index-api-loadTU-test.m:50:6: ObjCProtocolRef=Proto:25:11 Extent=[50:6 - 50:11] +// CHECK: c-index-api-loadTU-test.m:51:2: BinaryOperator= Extent=[51:2 - 51:7] // CHECK: c-index-api-loadTU-test.m:51:2: DeclRefExpr=d:50:13 Extent=[51:2 - 51:3] // CHECK: c-index-api-loadTU-test.m:51:6: UnexposedExpr=c:49:12 Extent=[51:6 - 51:7] // CHECK: c-index-api-loadTU-test.m:51:6: DeclRefExpr=c:49:12 Extent=[51:6 - 51:7] @@ -137,10 +137,10 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:54:3: UnexposedExpr=main:46:5 Extent=[54:3 - 54:7] // CHECK: c-index-api-loadTU-test.m:54:3: DeclRefExpr=main:46:5 Extent=[54:3 - 54:7] // CHECK: c-index-api-loadTU-test.m:54:8: DeclRefExpr=someEnum:43:3 Extent=[54:8 - 54:16] -// CHECK: c-index-api-loadTU-test.m:54:18: UnexposedExpr=bee:47:8 Extent=[54:18 - 54:36] +// CHECK: c-index-api-loadTU-test.m:54:18: CStyleCastExpr= Extent=[54:18 - 54:36] // CHECK: c-index-api-loadTU-test.m:54:33: DeclRefExpr=bee:47:8 Extent=[54:33 - 54:36] // CHECK: c-index-api-loadTU-test.m:62:12: ObjCInterfaceDecl=TestAttributes:62:12 Extent=[62:1 - 67:5] -// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[58:18 - 63:27] +// CHECK: c-index-api-loadTU-test.m:63:15: ObjCIvarDecl=anOutlet:63:15 (Definition) Extent=[58:18 - 63:23] // CHECK: <invalid loc>:0:0: attribute(iboutlet)= // CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[59:39 - 64:47] // CHECK: <invalid loc>:0:0: attribute(iboutletcollection)= [IBOutletCollection=ObjCObjectPointer] diff --git a/test/Index/c-index-getCursor-pp.c b/test/Index/c-index-getCursor-pp.c index df61ec0329e5..0a10450af5cd 100644 --- a/test/Index/c-index-getCursor-pp.c +++ b/test/Index/c-index-getCursor-pp.c @@ -13,6 +13,8 @@ void OBSCURE(func)(int x) { B(int x); +const char *fname = __FILE__; + // RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s // CHECK-1: macro definition=OBSCURE // RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s @@ -27,6 +29,8 @@ B(int x); // CHECK-6: inclusion directive=a.h // RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s // CHECK-7: macro expansion=B:12:9 +// RUN: c-index-test -cursor-at=%s:16:25 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-8 %s +// CHECK-8: macro expansion=__FILE__ // Same tests, but with "editing" optimizations // RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index 6df8c1abfeed..c7410c9bbfa3 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -detailed-preprocessing-record -o %t.ast +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -detailed-preprocessing-record -o %t.ast // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck %s @interface Foo { @@ -80,15 +80,15 @@ void f() { // CHECK: [20:1 - 20:23] ObjCInstanceMethodDecl=floatMethod:20:1 // CHECK: [20:23 - 21:5] ObjCCategoryDecl=FooCat:18:12 // CHECK: [21:5 - 23:1] Invalid Cursor => NoDeclFound -// CHECK: [23:1 - 24:1] ObjCProtocolDecl=Proto:23:1 (Definition) +// CHECK: [23:1 - 24:1] ObjCProtocolDecl=Proto:23:11 (Definition) // CHECK: [24:1 - 24:11] ObjCInstanceMethodDecl=pMethod:24:1 -// CHECK: [24:11 - 25:5] ObjCProtocolDecl=Proto:23:1 (Definition) +// CHECK: [24:11 - 25:5] ObjCProtocolDecl=Proto:23:11 (Definition) // CHECK: [25:5 - 27:1] Invalid Cursor => NoDeclFound -// CHECK: [27:1 - 27:17] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [27:1 - 27:17] ObjCProtocolDecl=SubP:27:11 (Definition) // CHECK: [27:17 - 27:22] ObjCProtocolRef=Proto:23:1 -// CHECK: [27:22 - 28:1] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [27:22 - 28:1] ObjCProtocolDecl=SubP:27:11 (Definition) // CHECK: [28:1 - 28:12] ObjCInstanceMethodDecl=spMethod:28:1 -// CHECK: [28:12 - 29:5] ObjCProtocolDecl=SubP:27:1 (Definition) +// CHECK: [28:12 - 29:5] ObjCProtocolDecl=SubP:27:11 (Definition) // CHECK: [29:5 - 31:1] Invalid Cursor => NoDeclFound // CHECK: [31:1 - 31:18] ObjCInterfaceDecl=Baz:31:12 // CHECK: [31:18 - 31:21] ObjCSuperClassRef=Bar:12:12 @@ -111,18 +111,18 @@ void f() { // CHECK: [44:19 - 44:21] FunctionDecl=main:44:5 (Definition) // CHECK: [44:21 - 44:40] ParmDecl=argv:44:34 (Definition) // CHECK: [44:40 - 44:42] FunctionDecl=main:44:5 (Definition) -// CHECK: [44:42 - 45:2] UnexposedStmt= +// CHECK: [44:42 - 45:2] CompoundStmt= // CHECK: [45:2 - 45:5] ObjCClassRef=Baz:31:12 // CHECK: [45:5 - 45:11] VarDecl=bee:45:8 (Definition) -// CHECK: [45:11 - 45:12] UnexposedStmt= -// CHECK: [45:12 - 46:2] UnexposedStmt= +// CHECK: [45:11 - 45:12] DeclStmt= +// CHECK: [45:12 - 46:2] CompoundStmt= // CHECK: [46:2 - 46:4] TypeRef=id:0:0 // CHECK: [46:4 - 46:9] VarDecl=a:46:5 (Definition) // CHECK: [46:9 - 46:10] ObjCMessageExpr=foo:7:1 // CHECK: [46:10 - 46:13] DeclRefExpr=bee:45:8 // CHECK: [46:13 - 46:18] ObjCMessageExpr=foo:7:1 -// CHECK: [46:18 - 46:19] UnexposedStmt= -// CHECK: [46:19 - 47:2] UnexposedStmt= +// CHECK: [46:18 - 46:19] DeclStmt= +// CHECK: [46:19 - 47:2] CompoundStmt= // CHECK: [47:2 - 47:4] TypeRef=id:0:0 // CHECK: [47:4 - 47:6] VarDecl=c:47:12 (Definition) // CHECK: [47:6 - 47:10] ObjCProtocolRef=SubP:27:1 @@ -130,22 +130,22 @@ void f() { // CHECK: [47:16 - 47:17] ObjCMessageExpr=fooC:8:1 // CHECK: [47:17 - 47:20] ObjCClassRef=Foo:3:12 // CHECK: [47:20 - 47:26] ObjCMessageExpr=fooC:8:1 -// CHECK: [47:26 - 47:27] UnexposedStmt= -// CHECK: [47:27 - 48:2] UnexposedStmt= +// CHECK: [47:26 - 47:27] DeclStmt= +// CHECK: [47:27 - 48:2] CompoundStmt= // CHECK: [48:2 - 48:4] TypeRef=id:0:0 // CHECK: [48:4 - 48:6] VarDecl=d:48:13 (Definition) // CHECK: [48:6 - 48:11] ObjCProtocolRef=Proto:23:1 // CHECK: [48:11 - 48:14] VarDecl=d:48:13 (Definition) -// CHECK: [48:14 - 48:15] UnexposedStmt= -// CHECK: [48:15 - 49:2] UnexposedStmt= +// CHECK: [48:14 - 48:15] DeclStmt= +// CHECK: [48:15 - 49:2] CompoundStmt= // CHECK: [49:2 - 49:3] DeclRefExpr=d:48:13 -// CHECK: [49:3 - 49:6] UnexposedExpr= +// CHECK: [49:3 - 49:6] BinaryOperator= // CHECK: [49:6 - 49:7] DeclRefExpr=c:47:12 -// CHECK: [49:7 - 50:2] UnexposedStmt= +// CHECK: [49:7 - 50:2] CompoundStmt= // CHECK: [50:2 - 50:3] ObjCMessageExpr=pMethod:24:1 // CHECK: [50:3 - 50:4] DeclRefExpr=d:48:13 // CHECK: [50:4 - 50:13] ObjCMessageExpr=pMethod:24:1 -// CHECK: [50:13 - 51:2] UnexposedStmt= +// CHECK: [50:13 - 51:2] CompoundStmt= // CHECK: [51:2 - 51:3] ObjCMessageExpr=catMethodWithFloat::19:1 // CHECK: [51:3 - 51:6] DeclRefExpr=bee:45:8 // CHECK: [51:6 - 51:26] ObjCMessageExpr=catMethodWithFloat::19:1 @@ -153,16 +153,16 @@ void f() { // CHECK: [51:27 - 51:30] DeclRefExpr=bee:45:8 // CHECK: [51:30 - 51:43] ObjCMessageExpr=floatMethod:20:1 // CHECK: [51:43 - 51:44] ObjCMessageExpr=catMethodWithFloat::19:1 -// CHECK: [51:44 - 52:3] UnexposedStmt= +// CHECK: [51:44 - 52:3] CompoundStmt= // CHECK: [52:3 - 52:7] DeclRefExpr=main:44:5 // CHECK: [52:7 - 52:8] CallExpr=main:44:5 // CHECK: [52:8 - 52:16] DeclRefExpr=someEnum:41:3 // CHECK: [52:16 - 52:18] CallExpr=main:44:5 -// CHECK: [52:18 - 52:33] UnexposedExpr=bee:45:8 +// CHECK: [52:18 - 52:33] CStyleCastExpr= // CHECK: [52:33 - 52:36] DeclRefExpr=bee:45:8 // CHECK: [52:36 - 52:37] CallExpr=main:44:5 -// CHECK: [52:37 - 53:2] UnexposedStmt= +// CHECK: [52:37 - 53:2] CompoundStmt= // CHECK: [55:9 - 55:26] macro definition=CONCAT // CHECK: [57:1 - 57:10] FunctionDecl=f:57:6 (Definition) // CHECK: [58:4 - 58:8] VarDecl=my_var:58:8 (Definition) -// CHECK: [58:8 - 58:14] macro expansion=CONCAT:55:9 +// CHECK: [58:8 - 58:15] macro expansion=CONCAT:55:9 diff --git a/test/Index/c-index-pch.c b/test/Index/c-index-pch.c index 2037fc58802c..313fae88f4f9 100644 --- a/test/Index/c-index-pch.c +++ b/test/Index/c-index-pch.c @@ -1,14 +1,9 @@ // RUN: %clang_cc1 -emit-pch -x c -o %t.pch %S/Inputs/c-index-pch.h // RUN: %clang_cc1 -include-pch %t.pch -x c -emit-pch -o %t.ast %s // RUN: c-index-test -test-load-tu %t.ast all | FileCheck -check-prefix=ALL %s -// RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=LOCAL %s // ALL: FunctionDecl=foo // ALL: VarDecl=bar // ALL: FunctionDecl=wibble // ALL: FunctionDecl=wonka -// LOCAL-NOT: FunctionDecl=foo -// LOCAL-NOT: VarDecl=bar -// LOCAL: FunctionDecl=wibble -// LOCAL: FunctionDecl=wonka void wibble(int i); void wonka(float); diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index f75d61f1b04b..5789d3b9fa07 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -54,6 +54,9 @@ Z::operator int() const { // CHECK-MEMBER: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} // CHECK-MEMBER: Completion contexts: // CHECK-MEMBER-NEXT: Dot member access +// CHECK-MEMBER-NEXT: Container Kind: StructDecl +// CHECK-MEMBER-NEXT: Container is complete +// CHECK-MEMBER-NEXT: Container USR: c:@S@Z // CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} diff --git a/test/Index/complete-access-checks.cpp b/test/Index/complete-access-checks.cpp new file mode 100644 index 000000000000..c77a5d656a97 --- /dev/null +++ b/test/Index/complete-access-checks.cpp @@ -0,0 +1,89 @@ +struct X { + int member1; + void func1(); +protected: + int member2; + void func2(); +private: + int member3; + void func3(); +}; + +struct Y: protected X { + void doSomething(); +}; + +class Z { +public: + int member1; + void func1(); +protected: + int member2; + void func2(); +private: + int member3; + void func3(); +}; + +void Y::doSomething() { + // RUN: c-index-test -code-completion-at=%s:30:9 %s | FileCheck -check-prefix=CHECK-SUPER-ACCESS %s + this->; + + Z that; + // RUN: c-index-test -code-completion-at=%s:34:8 %s | FileCheck -check-prefix=CHECK-ACCESS %s + that. +} + +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34) +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func1}{LeftParen (}{RightParen )} (36) +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func2}{LeftParen (}{RightParen )} (36) (inaccessible) +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func3}{LeftParen (}{RightParen )} (36) (inaccessible) +// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member1} (37) +// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member2} (37) (inaccessible) +// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member3} (37) (inaccessible) +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType Y &}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )} (34) +// CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (36) +// CHECK-SUPER-ACCESS: StructDecl:{TypedText X}{Text ::} (77) +// CHECK-SUPER-ACCESS: StructDecl:{TypedText Y}{Text ::} (75) +// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (36) +// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Y}{LeftParen (}{RightParen )} (34) + +// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (34) +// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) (inaccessible) +// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func3}{LeftParen (}{RightParen )} (34) (inaccessible) +// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member1} (35) +// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member2} (35) (inaccessible) +// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member3} (35) (inaccessible) +// CHECK-ACCESS: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )} (34) +// CHECK-ACCESS: ClassDecl:{TypedText Z}{Text ::} (75) +// CHECK-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} (34) + +class P { +protected: + int member; +}; + +class Q : public P { +public: + using P::member; +}; + +void f(P x, Q y) { + // RUN: c-index-test -code-completion-at=%s:73:5 %s | FileCheck -check-prefix=CHECK-USING-INACCESSIBLE %s + x.; // member is inaccessible + // RUN: c-index-test -code-completion-at=%s:75:5 %s | FileCheck -check-prefix=CHECK-USING-ACCESSIBLE %s + y.; // member is accessible +} + +// CHECK-USING-INACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible) +// CHECK-USING-INACCESSIBLE: CXXMethod:{ResultType P &}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (34) +// CHECK-USING-INACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (75) +// CHECK-USING-INACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~P}{LeftParen (}{RightParen )} (34) + +// CHECK-USING-ACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) +// CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType Q &}{TypedText operator=}{LeftParen (}{Placeholder const Q &}{RightParen )} (34) +// CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType P &}{Text P::}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (36) +// CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (77) +// CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText Q}{Text ::} (75) +// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (36) +// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~Q}{LeftParen (}{RightParen )} (34) diff --git a/test/Index/complete-cxx-inline-methods.cpp b/test/Index/complete-cxx-inline-methods.cpp new file mode 100644 index 000000000000..e25949df4cab --- /dev/null +++ b/test/Index/complete-cxx-inline-methods.cpp @@ -0,0 +1,24 @@ +class MyCls { + void in_foo() { + vec.x = 0; + } + void out_foo(); + + struct Vec { int x, y; }; + Vec vec; +}; + +void MyCls::out_foo() { + vec.x = 0; +} + +// RUN: c-index-test -code-completion-at=%s:3:9 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:12:7 %s | FileCheck %s +// CHECK: CXXMethod:{ResultType MyCls::Vec &}{TypedText operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (34) +// CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75) +// CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35) +// CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35) +// CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (34) +// CHECK-NEXT: Completion contexts: +// CHECK-NEXT: Dot member access +// CHECK-NEXT: Container Kind: StructDecl diff --git a/test/Index/complete-exprs.m b/test/Index/complete-exprs.m index dfa114dcc095..08ec019003f3 100644 --- a/test/Index/complete-exprs.m +++ b/test/Index/complete-exprs.m @@ -10,7 +10,7 @@ typedef signed char BOOL; __strong id global; @implementation A - (int)method:(id)param1 { - void foo(id (^block)(id x, A* y)); + void foo(bool (^block)(id x, A* y)); for(BOOL B = YES; ; ) { } } @end @@ -29,6 +29,6 @@ __strong id global; // CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s -// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^id(id x, A *y)block}{RightParen )} (34) +// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^bool(id x, A *y)block}{RightParen )} (34) // CHECK-CC3: VarDecl:{ResultType id}{TypedText global} (50) // CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (34) diff --git a/test/Index/complete-in-stringify.c b/test/Index/complete-in-stringify.c new file mode 100644 index 000000000000..d5185496f8b7 --- /dev/null +++ b/test/Index/complete-in-stringify.c @@ -0,0 +1,17 @@ +const char *func(const char *); + +#define MORE __FILE__ + +#define M(x) "1"#x +#define N(x) func("2"#x MORE) + +void foo(const char *); + +int test() { + foo(M(x())); + foo(N(x())); +} + +// RUN: c-index-test -code-completion-at=%s:11:11 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:12:11 %s | FileCheck %s +// CHECK: Natural language diff --git a/test/Index/complete-interfaces.m b/test/Index/complete-interfaces.m index 229ec2dcbe27..2f86c3d8f43c 100644 --- a/test/Index/complete-interfaces.m +++ b/test/Index/complete-interfaces.m @@ -27,6 +27,7 @@ // 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 Int3} // 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} @@ -41,3 +42,6 @@ // CHECK-CC5: ObjCInterfaceDecl:{TypedText Int1} // CHECK-CC5-NEXT: ObjCInterfaceDecl:{TypedText Int3} // CHECK-CC5-NEXT: ObjCInterfaceDecl:{TypedText Int4} + + +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:11:12 %s | FileCheck -check-prefix=CHECK-CC2 %s diff --git a/test/Index/complete-macro-args.c b/test/Index/complete-macro-args.c new file mode 100644 index 000000000000..ca36af1f1043 --- /dev/null +++ b/test/Index/complete-macro-args.c @@ -0,0 +1,22 @@ +struct Point { + float x; + float y; + float z; +}; + +#define MACRO2(x) x +#define MACRO(x) MACRO2(x) + +void test(struct Point *p) { + p->x; + MACRO(p->x); +} + +// RUN: c-index-test -code-completion-at=%s:11:12 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:12:12 %s | FileCheck %s +// CHECK: FieldDecl:{ResultType float}{TypedText x} (35) +// CHECK-NEXT: FieldDecl:{ResultType float}{TypedText y} (35) +// CHECK-NEXT: FieldDecl:{ResultType float}{TypedText z} (35) +// CHECK-NEXT: Completion contexts: +// CHECK-NEXT: Arrow member access +// CHECK-NEXT: Container Kind: StructDecl diff --git a/test/Index/complete-macros.c b/test/Index/complete-macros.c index eff42cad75a1..f1c1346a7db8 100644 --- a/test/Index/complete-macros.c +++ b/test/Index/complete-macros.c @@ -15,6 +15,15 @@ void f2() { g(nil); } +#define variadic1(...) +#define variadic2(args...) +#define variadic3(args, ...) +#define variadic4(first, second, args, ...) + +void test_variadic() { + +} + // RUN: c-index-test -code-completion-at=%s:7:1 %s | FileCheck -check-prefix=CHECK-CC1 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: macro definition:{TypedText FOO}{LeftParen (}{Placeholder Arg1}{Comma , }{Placeholder Arg2}{RightParen )} @@ -25,3 +34,8 @@ void f2() { // RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: macro definition:{TypedText nil} (65) +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:24:2 %s | FileCheck -check-prefix=CHECK-VARIADIC %s +// CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70) +// CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70) +// CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70) +// CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second...}{Placeholder first, second...}{RightParen )} (70) diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m index bd68deb5d115..48156d93ffba 100644 --- a/test/Index/complete-member-access.m +++ b/test/Index/complete-member-access.m @@ -37,11 +37,26 @@ int test_more_props(Sub *s) { // RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1} // CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} +// CHECK-CC1: Completion contexts: +// CHECK-CC1-NEXT: Objective-C property access +// CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl +// CHECK-CC1-NEXT: Container is complete +// CHECK-CC1-NEXT: Container USR: c:objc(cs)Int // RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (35) // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (37) +// CHECK-CC2: Completion contexts: +// CHECK-CC2-NEXT: Arrow member access +// CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl +// CHECK-CC2-NEXT: Container is complete +// CHECK-CC2-NEXT: Container USR: c:objc(cs)Int // RUN: c-index-test -code-completion-at=%s:34:12 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText myOtherPropLikeThing} (37) // CHECK-CC3: ObjCPropertyDecl:{ResultType int}{TypedText myProp} (35) // CHECK-CC3: ObjCPropertyDecl:{ResultType int}{TypedText prop1} (35) // CHECK-CC3: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35) +// CHECK-CC3: Completion contexts: +// CHECK-CC3-NEXT: Objective-C property access +// CHECK-CC3-NEXT: Container Kind: ObjCInterfaceDecl +// CHECK-CC3-NEXT: Container is complete +// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub
\ No newline at end of file diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 0ea33850560e..955ab6f144f9 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -181,16 +181,34 @@ void test_block_invoke(A *(^block1)(int), [block1(5) init]; } +@interface DO +- (void)method:(in bycopy A*)ain result:(out byref A**)aout; +@end + +void test_DO(DO *d, A* a) { + [d method:a aout:&a]; +} + // 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)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)} // CHECK-CC1: {TypedText classMethod2} // CHECK-CC1: {TypedText new} // CHECK-CC1: {TypedText protocolClassMethod} +// CHECK-CC1: Completion contexts: +// CHECK-CC1-NEXT: Objective-C class method +// CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl +// CHECK-CC1-NEXT: Container is complete +// CHECK-CC1-NEXT: Container USR: c:objc(cs)Foo // RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: {TypedText categoryInstanceMethod} // CHECK-CC2: {TypedText instanceMethod1} // CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)} +// CHECK-CC2: Completion contexts: +// CHECK-CC2-NEXT: Objective-C instance method +// CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl +// CHECK-CC2-NEXT: Container is complete +// CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo // RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)} // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod} @@ -218,6 +236,7 @@ void test_block_invoke(A *(^block1)(int), // RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)} // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)} +// CHECK-CC9: Objective-C selector: Method:Arg1: // RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s // CHECK-CCA: TypedefDecl:{TypedText Class} // CHECK-CCA-NEXT: ObjCInterfaceDecl:{TypedText Foo} @@ -243,6 +262,7 @@ void test_block_invoke(A *(^block1)(int), // CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)} // CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)} // CHECK-CCD-NOT: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText } +// CHECK-CCD: Objective-C selector: Method: // RUN: c-index-test -code-completion-at=%s:116:30 %s | FileCheck -check-prefix=CHECK-CCE %s // CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)} // CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)} @@ -311,3 +331,6 @@ void test_block_invoke(A *(^block1)(int), // RUN: c-index-test -code-completion-at=%s:141:30 %s | FileCheck -check-prefix=CHECK-CCE %s // RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s + +// RUN: c-index-test -code-completion-at=%s:189:6 %s | FileCheck -check-prefix=CHECK-DISTRIB-OBJECTS %s +// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopyA *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byrefA **)} (35) diff --git a/test/Index/complete-qualified.cpp b/test/Index/complete-qualified.cpp new file mode 100644 index 000000000000..20f5105a8c1c --- /dev/null +++ b/test/Index/complete-qualified.cpp @@ -0,0 +1,20 @@ +template <typename X, typename Y> +class C +{ +}; + +class Foo +{ +public: + C<Foo, class Bar> c; +}; + +void foo() +{ + Foo:: + +// RUN: c-index-test -code-completion-at=%s:14:8 %s -o - | FileCheck -check-prefix=CC1 %s +// CHECK-CC1: FieldDecl:{ResultType C<Foo, class Bar>}{TypedText c} (35) +// CHECK-CC1: ClassDecl:{TypedText Foo} (35) +// CHECK-CC1: CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder const Foo &}{RightParen )} (35) +// CHECK-CC1: CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (35) diff --git a/test/Index/complete-stmt.c b/test/Index/complete-stmt.c new file mode 100644 index 000000000000..98fa9df44db3 --- /dev/null +++ b/test/Index/complete-stmt.c @@ -0,0 +1,12 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + + +void f(int x) { + if (x) { + } +} + +// RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE %s +// CHECK-IF-ELSE: NotImplemented:{TypedText else}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Placeholder statements}{VerticalSpace }{RightBrace }} (40) +// CHECK-IF-ELSE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Placeholder statements}{VerticalSpace }{RightBrace }} (40) diff --git a/test/Index/complete-synthesized.m b/test/Index/complete-synthesized.m index 1a4858449f42..81f1ba186f1d 100644 --- a/test/Index/complete-synthesized.m +++ b/test/Index/complete-synthesized.m @@ -27,7 +27,7 @@ @dynamic prop3; - (short)method2 { - return prop4; + return _prop4; } - (short)method3 { @@ -35,22 +35,12 @@ } @end -// RUN: c-index-test -code-completion-at=%s:24:1 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: NotImplemented:{TypedText _Bool} (50) -// CHECK-CC1: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35) -// CHECK-CC1-NOT: prop2 -// CHECK-CC1: ObjCPropertyDecl:{ResultType short}{TypedText prop3} (35) -// CHECK-CC1: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35) - -// RUN: c-index-test -code-completion-at=%s:30:2 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC2 %s -// CHECK-CC2: NotImplemented:{TypedText _Bool} (50) -// CHECK-CC2: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35) -// CHECK-CC2-NOT: prop3 -// CHECK-CC2: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35) - -// RUN: c-index-test -code-completion-at=%s:34:2 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s -// CHECK-CC3: NotImplemented:{TypedText _Bool} (50) -// CHECK-CC3: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35) -// CHECK-CC3: ObjCPropertyDecl:{ResultType double}{TypedText prop4} -// CHECK-CC3-NOT: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35) -// CHECK-CC1: restrict +// RUN: c-index-test -code-completion-at=%s:24:1 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:30:2 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:34:2 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s + +// CHECK: NotImplemented:{TypedText _Bool} (50) +// CHECK: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35) +// CHECK-NOT: prop2 +// CHECK-NOT: prop3 +// CHECK: ObjCIvarDecl:{ResultType double}{TypedText _prop4} (37) diff --git a/test/Index/complete-with-annotations.cpp b/test/Index/complete-with-annotations.cpp new file mode 100644 index 000000000000..afa8d9ed6607 --- /dev/null +++ b/test/Index/complete-with-annotations.cpp @@ -0,0 +1,23 @@ +class X { + void doSomething(); + + int field __attribute((annotate("one"), annotate("two"), annotate("three"))); + +public __attribute__((annotate("some annotation"))): + void func2(); + int member2 __attribute__((annotate("another annotation"))); +}; + +void X::doSomething() { + // RUN: c-index-test -code-completion-at=%s:13:9 %s | FileCheck %s + this->; +} + +// CHECK: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34) +// CHECK: FieldDecl:{ResultType int}{TypedText field} (35) ("three", "two", "one") +// CHECK: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) ("some annotation") +// CHECK: FieldDecl:{ResultType int}{TypedText member2} (35) ("another annotation", "some annotation") +// CHECK: CXXMethod:{ResultType X &}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (34) +// CHECK: ClassDecl:{TypedText X}{Text ::} (75) +// CHECK: CXXDestructor:{ResultType void}{TypedText ~X}{LeftParen (}{RightParen )} (34) + diff --git a/test/Index/cursor-ref-names.cpp b/test/Index/cursor-ref-names.cpp new file mode 100644 index 000000000000..26174bca1afa --- /dev/null +++ b/test/Index/cursor-ref-names.cpp @@ -0,0 +1,47 @@ +template <typename T> +struct Base { + void func(); + int operator[](T); +}; + +struct Sub: public Base<int> { + void func(); +}; + +template <typename T> +inline T myMax(T a, T b) +{ return (a > b) ? a : b; } + +int main() +{ + Sub inst; + inst.func(); + inst[1]; + inst.operator[](1); + + inst.Base<int>::operator[](1); + myMax<int>(1, 2); + + return 0; +} + +// RUN: c-index-test -test-load-source all %s | FileCheck %s +// CHECK: cursor-ref-names.cpp:17:5: DeclStmt= Extent=[17:5 - 17:14] +// CHECK: cursor-ref-names.cpp:17:9: VarDecl=inst:17:9 (Definition) Extent=[17:5 - 17:13] +// CHECK: cursor-ref-names.cpp:17:5: TypeRef=struct Sub:7:8 Extent=[17:5 - 17:8] +// CHECK: cursor-ref-names.cpp:17:9: CallExpr=Sub:7:8 Extent=[17:9 - 17:13] +// CHECK: cursor-ref-names.cpp:18:5: CallExpr=func:8:10 Extent=[18:5 - 18:16] +// CHECK: cursor-ref-names.cpp:18:10: MemberRefExpr=func:8:10 SingleRefName=[18:10 - 18:14] RefName=[18:10 - 18:14] Extent=[18:5 - 18:14] +// CHECK: cursor-ref-names.cpp:18:5: DeclRefExpr=inst:17:9 Extent=[18:5 - 18:9] +// CHECK: cursor-ref-names.cpp:19:5: CallExpr=operator[]:4:9 SingleRefName=[19:9 - 19:12] RefName=[19:9 - 19:10] RefName=[19:11 - 19:12] Extent=[19:5 - 19:12] +// CHECK: cursor-ref-names.cpp:19:5: DeclRefExpr=inst:17:9 Extent=[19:5 - 19:9] +// CHECK: cursor-ref-names.cpp:19:9: DeclRefExpr=operator[]:4:9 RefName=[19:9 - 19:10] RefName=[19:11 - 19:12] Extent=[19:9 - 19:12] +// CHECK: cursor-ref-names.cpp:20:5: CallExpr=operator[]:4:9 Extent=[20:5 - 20:23] +// CHECK: cursor-ref-names.cpp:20:10: MemberRefExpr=operator[]:4:9 SingleRefName=[20:10 - 20:20] RefName=[20:10 - 20:18] RefName=[20:18 - 20:19] RefName=[20:19 - 20:20] Extent=[20:5 - 20:20] +// CHECK: cursor-ref-names.cpp:20:5: DeclRefExpr=inst:17:9 Extent=[20:5 - 20:9] +// CHECK: cursor-ref-names.cpp:22:5: CallExpr=operator[]:4:9 Extent=[22:5 - 22:34] +// CHECK: cursor-ref-names.cpp:22:21: MemberRefExpr=operator[]:4:9 SingleRefName=[22:10 - 22:31] RefName=[22:10 - 22:21] RefName=[22:21 - 22:29] RefName=[22:29 - 22:30] RefName=[22:30 - 22:31] Extent=[22:5 - 22:31] +// CHECK: cursor-ref-names.cpp:22:5: DeclRefExpr=inst:17:9 Extent=[22:5 - 22:9] +// CHECK: cursor-ref-names.cpp:22:10: TemplateRef=Base:2:8 Extent=[22:10 - 22:14] +// CHECK: cursor-ref-names.cpp:23:5: CallExpr=myMax:12:10 Extent=[23:5 - 23:21] +// CHECK: cursor-ref-names.cpp:23:5: DeclRefExpr=myMax:12:10 RefName=[23:5 - 23:10] RefName=[23:10 - 23:15] Extent=[23:5 - 23:15] diff --git a/test/Index/file-refs.c b/test/Index/file-refs.c new file mode 100644 index 000000000000..23042ea06f69 --- /dev/null +++ b/test/Index/file-refs.c @@ -0,0 +1,57 @@ +enum { + VALUE = 3 +}; + +extern int glob_x; + +int f(int x) { + return x+glob_x+VALUE; +} + +typedef struct { + int x; + int y; +} Vector; + +int vector_get_x(Vector v) { + int x = v.x; + return x; +} + +int f(int); +int f(int); + +// RUN: c-index-test \ + +// RUN: -file-refs-at=%s:2:5 \ +// CHECK: EnumConstantDecl=VALUE:2:3 (Definition) +// CHECK-NEXT: EnumConstantDecl=VALUE:2:3 (Definition) =[2:3 - 2:8] +// CHECK-NEXT: DeclRefExpr=VALUE:2:3 =[8:19 - 8:24] + +// RUN: -file-refs-at=%s:8:15 \ +// CHECK-NEXT: DeclRefExpr=glob_x:5:12 +// CHECK-NEXT: VarDecl=glob_x:5:12 =[5:12 - 5:18] +// CHECK-NEXT: DeclRefExpr=glob_x:5:12 =[8:12 - 8:18] + +// RUN: -file-refs-at=%s:8:10 \ +// CHECK-NEXT: DeclRefExpr=x:7:11 +// CHECK-NEXT: ParmDecl=x:7:11 (Definition) =[7:11 - 7:12] +// CHECK-NEXT: DeclRefExpr=x:7:11 =[8:10 - 8:11] + +// RUN: -file-refs-at=%s:12:7 \ +// CHECK-NEXT: FieldDecl=x:12:7 (Definition) +// CHECK-NEXT: FieldDecl=x:12:7 (Definition) =[12:7 - 12:8] +// CHECK-NEXT: MemberRefExpr=x:12:7 {{.*}} =[17:13 - 17:14] + +// RUN: -file-refs-at=%s:16:21 \ +// CHECK-NEXT: TypeRef=Vector:14:3 +// CHECK-NEXT: TypedefDecl=Vector:14:3 (Definition) =[14:3 - 14:9] +// CHECK-NEXT: TypeRef=Vector:14:3 =[16:18 - 16:24] + +// RUN: -file-refs-at=%s:21:5 \ +// CHECK-NEXT: FunctionDecl=f:21:5 +// CHECK-NEXT: FunctionDecl=f:7:5 (Definition) =[7:5 - 7:6] +// CHECK-NEXT: FunctionDecl=f:21:5 =[21:5 - 21:6] +// CHECK-NEXT: FunctionDecl=f:22:5 =[22:5 - 22:6] + +// RUN: %s | FileCheck %s diff --git a/test/Index/file-refs.cpp b/test/Index/file-refs.cpp new file mode 100644 index 000000000000..a96d27c63071 --- /dev/null +++ b/test/Index/file-refs.cpp @@ -0,0 +1,104 @@ +namespace NS { + class C { + public: + C() { } + void m(); + }; +} + +void NS::C::m() { + C c; + c.m(); +} + +void f() { + NS::C c1(); + NS::C c2 = NS::C(); +} + +void over(int); +void over(float); + +void test_over() { + over(0); + over(0.0f); +} + +template <typename T> +T tf(T t) { + return t; +} + +namespace Test2 { + +struct S { + S(int x, int y); + S(); +}; + +typedef S Cake; + +void f() { + Cake p; + p = Test2::S(0,2); + p = Test2::Cake(0,2); +} + +} + +// RUN: c-index-test \ + +// RUN: -file-refs-at=%s:9:7 \ +// CHECK: NamespaceRef=NS:1:11 +// CHECK-NEXT: Namespace=NS:1:11 (Definition) =[1:11 - 1:13] +// CHECK-NEXT: NamespaceRef=NS:1:11 =[9:6 - 9:8] +// CHECK-NEXT: NamespaceRef=NS:1:11 =[15:3 - 15:5] +// CHECK-NEXT: NamespaceRef=NS:1:11 =[16:3 - 16:5] +// CHECK-NEXT: NamespaceRef=NS:1:11 =[16:14 - 16:16] + +// RUN: -file-refs-at=%s:2:9 \ +// CHECK-NEXT: ClassDecl=C:2:9 (Definition) +// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10] +// CHECK-NEXT: CXXConstructor=C:4:5 (Definition) =[4:5 - 4:6] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19] + +// RUN: -file-refs-at=%s:16:18 \ +// CHECK-NEXT: CallExpr=C:4:5 +// CHECK-NEXT: ClassDecl=C:2:9 (Definition) =[2:9 - 2:10] +// CHECK-NEXT: CXXConstructor=C:4:5 (Definition) =[4:5 - 4:6] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[9:10 - 9:11] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[10:3 - 10:4] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[15:7 - 15:8] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:7 - 16:8] +// CHECK-NEXT: TypeRef=class NS::C:2:9 =[16:18 - 16:19] + +// RUN: -file-refs-at=%s:20:8 \ +// CHECK-NEXT: FunctionDecl=over:20:6 +// CHECK-NEXT: FunctionDecl=over:20:6 =[20:6 - 20:10] +// CHECK-NEXT: DeclRefExpr=over:20:6 =[24:3 - 24:7] + +// RUN: -file-refs-at=%s:28:1 \ +// CHECK-NEXT: TypeRef=T:27:20 +// FIXME: Missing TemplateTypeParameter=T:27:20 (Definition) +// CHECK-NEXT: TypeRef=T:27:20 =[28:1 - 28:2] +// CHECK-NEXT: TypeRef=T:27:20 =[28:6 - 28:7] + +// RUN: -file-refs-at=%s:43:14 \ +// CHECK-NEXT: CallExpr=S:35:3 +// CHECK-NEXT: StructDecl=S:34:8 (Definition) =[34:8 - 34:9] +// CHECK-NEXT: CXXConstructor=S:35:3 =[35:3 - 35:4] +// CHECK-NEXT: CXXConstructor=S:36:3 =[36:3 - 36:4] +// CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[39:9 - 39:10] +// CHECK-NEXT: TypeRef=struct Test2::S:34:8 =[43:14 - 43:15] + +// RUN: -file-refs-at=%s:44:16 \ +// CHECK-NEXT: CallExpr=S:35:3 +// CHECK-NEXT: TypedefDecl=Cake:39:11 (Definition) =[39:11 - 39:15] +// CHECK-NEXT: TypeRef=Cake:39:11 =[42:3 - 42:7] +// CHECK-NEXT: TypeRef=Cake:39:11 =[44:14 - 44:18] + +// RUN: %s | FileCheck %s diff --git a/test/Index/file-refs.m b/test/Index/file-refs.m new file mode 100644 index 000000000000..2267259d58a2 --- /dev/null +++ b/test/Index/file-refs.m @@ -0,0 +1,87 @@ +@class Foo; + +@interface Foo +-(id)setWithInt:(int)i andFloat:(float)f; +@end + +@implementation Foo +-(id)setWithInt:(int)i andFloat:(float)f { + return self; +} +@end + +void test(Foo *foo) { + [foo setWithInt:0 andFloat:0]; + [foo setWithInt: 2 andFloat: 3]; +} + +@protocol Prot1 +-(void)protMeth; +@end + +@protocol Prot2<Prot1> +@end + +@interface Base<Prot2> +@end + +@interface Sub : Base +-(void)protMeth; +@end + +@implementation Sub +-(void)protMeth {} +@end + +void test2(Sub *s, id<Prot1> p) { + [s protMeth]; + [p protMeth]; +} + + +// RUN: c-index-test \ + +// RUN: -file-refs-at=%s:7:18 \ +// CHECK: ObjCImplementationDecl=Foo:7:17 (Definition) +// CHECK-NEXT: ObjCClassRef=Foo:3:12 =[1:8 - 1:11] +// CHECK-NEXT: ObjCInterfaceDecl=Foo:3:12 =[3:12 - 3:15] +// CHECK-NEXT: ObjCImplementationDecl=Foo:7:17 (Definition) =[7:17 - 7:20] +// CHECK-NEXT: ObjCClassRef=Foo:3:12 =[13:11 - 13:14] + +// RUN: -file-refs-at=%s:4:10 \ +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:6 - 4:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:6 - 8:16] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:8 - 14:18] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:8 - 15:18] + +// RUN: -file-refs-at=%s:15:27 \ +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:24 - 4:32] +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:24 - 8:32] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:21 - 14:29] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:22 - 15:30] + +// RUN: -file-refs-at=%s:18:13 \ +// CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition) +// CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition) =[18:11 - 18:16] +// CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[22:17 - 22:22] +// CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[36:23 - 36:28] + +// RUN: -file-refs-at=%s:38:10 \ +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16] +// CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14] +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14] + +// RUN: -file-refs-at=%s:33:12 \ +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16] +// CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14] +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14] + +// RUN: %s | FileCheck %s diff --git a/test/Index/get-cursor-macro-args.h b/test/Index/get-cursor-macro-args.h new file mode 100644 index 000000000000..40ec8dc0b81f --- /dev/null +++ b/test/Index/get-cursor-macro-args.h @@ -0,0 +1,16 @@ +@interface MyClass ++(void)meth; +@end + +#define MACRO2(x) x +#define MACRO(x) MACRO2(x) + +void test() { + MACRO([MyClass meth]); +} + +#define INVOKE(METHOD, CLASS) [CLASS METHOD] + +void test2() { + INVOKE(meth, MyClass); +} diff --git a/test/Index/get-cursor-macro-args.m b/test/Index/get-cursor-macro-args.m new file mode 100644 index 000000000000..4e0ac78fe059 --- /dev/null +++ b/test/Index/get-cursor-macro-args.m @@ -0,0 +1,19 @@ +// Test without PCH +// RUN: c-index-test -cursor-at=%S/get-cursor-macro-args.h:9:12 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:21 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \ +// RUN: %s -include get-cursor-macro-args.h | FileCheck %s + +// Test with PCH +// RUN: c-index-test -write-pch %t.pch -x objective-c-header %S/get-cursor-macro-args.h +// RUN: c-index-test -cursor-at=%S/get-cursor-macro-args.h:9:12 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:9:21 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:12 \ +// RUN: -cursor-at=%S/get-cursor-macro-args.h:15:20 \ +// RUN: %s -include-pch %t.pch | FileCheck %s + +// CHECK: ObjCClassRef=MyClass:1:12 +// CHECK-NEXT: ObjCMessageExpr=meth:2:1 +// CHECK-NEXT: ObjCMessageExpr=meth:2:1 +// CHECK-NEXT: ObjCClassRef=MyClass:1:12 diff --git a/test/Index/get-cursor.c b/test/Index/get-cursor.c new file mode 100644 index 000000000000..23a4b5cb5370 --- /dev/null +++ b/test/Index/get-cursor.c @@ -0,0 +1,14 @@ +struct _MyS { + int foo; +} MyS; + +struct _MyS ww; + +// RUN: c-index-test -cursor-at=%s:1:9 \ +// RUN: -cursor-at=%s:2:9 \ +// RUN: -cursor-at=%s:5:9 \ +// RUN: %s | FileCheck %s + +// CHECK: StructDecl=_MyS:1:8 (Definition) +// CHECK: FieldDecl=foo:2:7 (Definition) +// CHECK: TypeRef=struct _MyS:1:8 diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index 2aa76c472569..441ed1cdabe6 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -35,6 +35,14 @@ void test() { X foo; } +// RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s +// CHECK-COMPLETION-1: CXXConstructor=X:6:3 +// CHECK-COMPLETION-1-NEXT: Completion string: {TypedText X}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{RightParen )} + +// RUN: c-index-test -cursor-at=%s:31:16 %s | FileCheck -check-prefix=CHECK-COMPLETION-2 %s +// CHECK-COMPLETION-2: CXXMethod=getAnotherX:31:5 (Definition) +// CHECK-COMPLETION-2-NEXT: Completion string: {ResultType X}{TypedText getAnotherX}{LeftParen (}{RightParen )} + // RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s // RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s @@ -68,3 +76,7 @@ void test() { // RUN: c-index-test -cursor-at=%s:35:5 %s | FileCheck -check-prefix=CHECK-DECL %s // CHECK-DECL: VarDecl=foo:35:5 + +// RUN: c-index-test -cursor-at=%s:21:3 %s | FileCheck -check-prefix=CHECK-MEMBER %s +// CHECK-MEMBER: FieldDecl=member:21:7 (Definition) +// CHECK-MEMBER-NEXT: Completion string: {ResultType int}{TypedText member} diff --git a/test/Index/get-cursor.m b/test/Index/get-cursor.m new file mode 100644 index 000000000000..69e4f251e821 --- /dev/null +++ b/test/Index/get-cursor.m @@ -0,0 +1,37 @@ +// Test is line- and column-sensitive. Run lines are below. + +@interface rdar9771715 +@property (readonly) int foo1; +@property (readwrite) int foo2; +@end + +@class Foo; + +@interface rdar9535717 { + __weak Foo *foo; +} +@end + +@interface Test1 { + id _name; +} +@end +@interface Test1 () +- (id)name; +@end +@interface Test1 () +@property (copy) id name; +@end +@implementation Test1 +@synthesize name = _name; +@end + +// RUN: c-index-test -cursor-at=%s:4:28 -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP %s +// CHECK-PROP: ObjCPropertyDecl=foo1:4:26 +// CHECK-PROP: ObjCPropertyDecl=foo2:5:27 + +// RUN: c-index-test -cursor-at=%s:11:11 %s -ccc-host-triple x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s +// CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8 + +// RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s +// CHECK-METHOD: ObjCInstanceMethodDecl=name:20:1 diff --git a/test/Index/getcursor-pp-pch.c b/test/Index/getcursor-pp-pch.c new file mode 100644 index 000000000000..d68384c66067 --- /dev/null +++ b/test/Index/getcursor-pp-pch.c @@ -0,0 +1,43 @@ + + + +typedef int T; +void OBSCURE(func)(int x) { + OBSCURE(T) DECORATION value; +} + + +// Without PCH +// RUN: c-index-test -cursor-at=%s.h:1:11 \ +// RUN: -cursor-at=%s.h:2:14 \ +// RUN: -cursor-at=%s.h:4:5 \ +// RUN: -cursor-at=%s.h:5:5 \ +// RUN: -cursor-at=%s.h:5:14 \ +// RUN: -cursor-at=%s:5:7 \ +// RUN: -cursor-at=%s:6:6 \ +// RUN: -cursor-at=%s:6:19 \ +// RUN: -include %s.h %s | FileCheck %s + +// With PCH +// RUN: c-index-test -write-pch %t.h.pch %s.h -Xclang -detailed-preprocessing-record +// RUN: c-index-test -cursor-at=%s.h:1:11 \ +// RUN: -cursor-at=%s.h:2:14 \ +// RUN: -cursor-at=%s.h:4:5 \ +// RUN: -cursor-at=%s.h:5:5 \ +// RUN: -cursor-at=%s.h:5:14 \ +// RUN: -cursor-at=%s:5:7 \ +// RUN: -cursor-at=%s:6:6 \ +// RUN: -cursor-at=%s:6:19 \ +// RUN: -include %t.h %s | FileCheck %s + +// From header +// CHECK: macro definition=OBSCURE +// CHECK: macro definition=DECORATION +// CHECK: macro expansion=DECORATION:2:9 +// CHECK: macro expansion=OBSCURE:1:9 +// CHECK: macro expansion=DECORATION:2:9 + +// From main file +// CHECK: macro expansion=OBSCURE:1:9 +// CHECK: macro expansion=OBSCURE:1:9 +// CHECK: macro expansion=DECORATION:2:9 diff --git a/test/Index/getcursor-pp-pch.c.h b/test/Index/getcursor-pp-pch.c.h new file mode 100644 index 000000000000..c24a39c0e9db --- /dev/null +++ b/test/Index/getcursor-pp-pch.c.h @@ -0,0 +1,5 @@ +#define OBSCURE(X) X +#define DECORATION + +DECORATION +OBSCURE(DECORATION) diff --git a/test/Index/in-class-init.cpp b/test/Index/in-class-init.cpp new file mode 100644 index 000000000000..61431caafd75 --- /dev/null +++ b/test/Index/in-class-init.cpp @@ -0,0 +1,6 @@ +struct S { + int field = 2; +}; + +// RUN: c-index-test -test-load-source all -std=c++11 %s | FileCheck %s +// CHECK: 2:7: FieldDecl=field:2:7 (Definition) Extent=[2:3 - 2:16] diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp index abc95545c53b..05068df5c599 100644 --- a/test/Index/index-templates.cpp +++ b/test/Index/index-templates.cpp @@ -100,7 +100,7 @@ template class Pair<int, int>; template<typename T, typename U> struct SuperPair : Pair<int, int>, Pair<T, U> { }; -// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-LOAD %s +// RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-LOAD %s // CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22] // CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:10 - 3:20] // CHECK-LOAD: index-templates.cpp:3:24: NonTypeTemplateParameter=Value:3:24 (Definition) Extent=[3:22 - 3:29] @@ -135,7 +135,7 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { }; // CHECK-LOAD: index-templates.cpp:30:21: TypeRef=struct Z2:20:8 Extent=[30:21 - 30:23] // CHECK-LOAD: index-templates.cpp:35:16: VarDecl=OneDimension:35:16 (Definition) Extent=[35:1 - 35:32] // CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32] -// CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32] +// CHECK-LOAD: index-templates.cpp:35:31: IntegerLiteral= Extent=[35:31 - 35:32] // CHECK-LOAD: index-templates.cpp:37:8: ClassTemplate=array:37:8 (Definition) Extent=[36:1 - 37:17] // CHECK-LOAD: index-templates.cpp:36:19: TemplateTypeParameter=T:36:19 (Definition) Extent=[36:10 - 36:20] // CHECK-LOAD: index-templates.cpp:36:31: NonTypeTemplateParameter=Dimensions:36:31 (Definition) Extent=[36:22 - 36:56] @@ -157,11 +157,11 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { }; // CHECK-LOAD: index-templates.cpp:53:6: FunctionDecl=template_exprs:53:6 (Definition) // CHECK-LOAD: index-templates.cpp:54:3: CallExpr=f:4:6 Extent=[54:3 - 54:68] // CHECK-LOAD: index-templates.cpp:54:3: UnexposedExpr=f:4:6 Extent=[54:3 - 54:35] -// CHECK-LOAD: index-templates.cpp:54:3: DeclRefExpr=f:4:6 Extent=[54:3 - 54:35] +// CHECK-LOAD: index-templates.cpp:54:3: DeclRefExpr=f:4:6 RefName=[54:3 - 54:4] RefName=[54:4 - 54:35] Extent=[54:3 - 54:35] // CHECK-LOAD: index-templates.cpp:54:5: TypeRef=Unsigned:42:18 Extent=[54:5 - 54:13] // CHECK-LOAD: index-templates.cpp:54:15: DeclRefExpr=OneDimension:35:16 Extent=[54:15 - 54:27] // CHECK-LOAD: index-templates.cpp:54:29: TemplateRef=array:37:8 Extent=[54:29 - 54:34] -// CHECK-LOAD: index-templates.cpp:55:8: MemberRefExpr=getAs:50:26 Extent=[55:3 - 55:23] +// CHECK-LOAD: index-templates.cpp:55:8: MemberRefExpr=getAs:50:26 SingleRefName=[55:8 - 55:13] RefName=[55:8 - 55:13] Extent=[55:3 - 55:23] // CHECK-LOAD: index-templates.cpp:55:3: CallExpr=Z4:49:8 Extent=[55:3 - 55:7] // CHECK-LOAD: index-templates.cpp:55:14: TypeRef=Unsigned:42:18 Extent=[55:14 - 55:22] // CHECK-LOAD: index-templates.cpp:68:6: FunctionTemplate=unresolved_exprs:68:6 (Definition) @@ -180,7 +180,7 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { }; // CHECK-LOAD: index-templates.cpp:101:36: C++ base class specifier=Pair<T, U>:76:8 [access=public isVirtual=false] Extent=[101:36 - 101:46] -// RUN: c-index-test -test-load-source-usrs all %s | FileCheck -check-prefix=CHECK-USRS %s +// RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-USRS %s // CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_# Extent=[3:1 - 4:22] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@70 Extent=[3:10 - 3:20] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@82 Extent=[3:22 - 3:29] diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp index cb9d3f2b609f..ed0debdd762b 100644 --- a/test/Index/load-stmts.cpp +++ b/test/Index/load-stmts.cpp @@ -117,7 +117,7 @@ void casts(int *ip) { (void)reinterpret_cast<float *>(ip); } -// RUN: c-index-test -test-load-source all %s | FileCheck %s +// RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck %s // CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14] // CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23] // CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17] @@ -132,17 +132,17 @@ void casts(int *ip) { // CHECK: load-stmts.cpp:4:23: DeclRefExpr=x:3:12 Extent=[4:23 - 4:24] // CHECK: load-stmts.cpp:4:19: UnexposedExpr=z:4:19 Extent=[4:19 - 4:20] // CHECK: load-stmts.cpp:4:19: DeclRefExpr=z:4:19 Extent=[4:19 - 4:20] -// CHECK: load-stmts.cpp:4:26: UnexposedExpr= Extent=[4:26 - 4:29] +// CHECK: load-stmts.cpp:4:26: UnaryOperator= Extent=[4:26 - 4:29] // CHECK: load-stmts.cpp:4:28: DeclRefExpr=x:3:12 Extent=[4:28 - 4:29] // CHECK: load-stmts.cpp:6:10: VarDecl=z2:6:10 (Definition) Extent=[6:7 - 6:17] // CHECK: load-stmts.cpp:6:7: TypeRef=T:1:13 Extent=[6:7 - 6:8] -// CHECK: load-stmts.cpp:6:15: UnexposedExpr= Extent=[6:15 - 6:17] +// CHECK: load-stmts.cpp:6:15: UnaryOperator= Extent=[6:15 - 6:17] // CHECK: load-stmts.cpp:6:16: DeclRefExpr=x:3:12 Extent=[6:16 - 6:17] // CHECK: load-stmts.cpp:6:10: UnexposedExpr=z2:6:10 Extent=[6:10 - 6:12] // CHECK: load-stmts.cpp:6:10: DeclRefExpr=z2:6:10 Extent=[6:10 - 6:12] // CHECK: load-stmts.cpp:7:13: VarDecl=z3:7:13 (Definition) Extent=[7:10 - 7:20] // CHECK: load-stmts.cpp:7:10: TypeRef=T:1:13 Extent=[7:10 - 7:11] -// CHECK: load-stmts.cpp:7:18: UnexposedExpr= Extent=[7:18 - 7:20] +// CHECK: load-stmts.cpp:7:18: UnaryOperator= Extent=[7:18 - 7:20] // CHECK: load-stmts.cpp:7:19: DeclRefExpr=x:3:12 Extent=[7:19 - 7:20] // CHECK: load-stmts.cpp:7:13: UnexposedExpr=z3:7:13 Extent=[7:13 - 7:15] // CHECK: load-stmts.cpp:7:13: DeclRefExpr=z3:7:13 Extent=[7:13 - 7:15] @@ -150,7 +150,7 @@ void casts(int *ip) { // CHECK: load-stmts.cpp:8:11: TypeRef=T:1:13 Extent=[8:11 - 8:12] // CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:19] // CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15] -// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10] +// CHECK: load-stmts.cpp:9:8: IntegerLiteral= Extent=[9:8 - 9:10] // CHECK: load-stmts.cpp:14:7: ClassDecl=A:14:7 (Definition) Extent=[14:1 - 16:2] // CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:3 - 15:13] // CHECK: load-stmts.cpp:18:7: ClassDecl=B:18:7 (Definition) Extent=[18:1 - 20:2] @@ -202,8 +202,9 @@ void casts(int *ip) { // CHECK: load-stmts.cpp:80:21: DeclRefExpr=j:79:44 Extent=[80:21 - 80:22] // CHECK: load-stmts.cpp:82:9: TypeRef=Integer:81:15 Extent=[82:9 - 82:16] // CHECK: load-stmts.cpp:82:17: DeclRefExpr=i:79:37 Extent=[82:17 - 82:18] -// CHECK: load-stmts.cpp:83:3: UnexposedExpr=i:79:37 Extent=[83:3 - 83:13] +// CHECK: load-stmts.cpp:83:3: CStyleCastExpr= Extent=[83:3 - 83:13] // CHECK: load-stmts.cpp:83:4: TypeRef=Integer:81:15 Extent=[83:4 - 83:11] +// CHECK: load-stmts.cpp:83:12: UnexposedExpr=i:79:37 Extent=[83:12 - 83:13] // CHECK: load-stmts.cpp:83:12: DeclRefExpr=i:79:37 Extent=[83:12 - 83:13] // CHECK: load-stmts.cpp:84:3: UnexposedExpr= Extent=[84:3 - 84:12] // CHECK: load-stmts.cpp:84:3: TypeRef=Integer:81:15 Extent=[84:3 - 84:10] @@ -225,5 +226,6 @@ void casts(int *ip) { // CHECK: load-stmts.cpp:108:2: LabelStmt=start_over Extent=[108:2 - 109:28] // CHECK: load-stmts.cpp:109:17: LabelRef=start_over:108:2 Extent=[109:17 - 109:27] // CHECK: load-stmts.cpp:113:10: LabelRef=start_over:108:2 Extent=[113:10 - 113:20] -// CHECK: load-stmts.cpp:117:9: UnexposedExpr=ip:116:17 Extent=[117:9 - 117:38] +// CHECK: load-stmts.cpp:117:35: UnexposedExpr=ip:116:17 Extent=[117:35 - 117:37] +// CHECK: load-stmts.cpp:117:35: DeclRefExpr=ip:116:17 Extent=[117:35 - 117:37] diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m index 3a479522944e..01c8305c2af3 100644 --- a/test/Index/local-symbols.m +++ b/test/Index/local-symbols.m @@ -31,14 +31,14 @@ // CHECK: local-symbols.m:7:3: TypeRef=id:0:0 Extent=[7:3 - 7:5] // CHECK: local-symbols.m:9:1: ObjCInstanceMethodDecl=bar:9:1 Extent=[9:1 - 9:12] // CHECK: local-symbols.m:9:4: TypeRef=id:0:0 Extent=[9:4 - 9:6] -// CHECK: local-symbols.m:12:1: ObjCImplementationDecl=Foo:12:1 (Definition) Extent=[12:1 - 16:2] +// CHECK: local-symbols.m:12:17: ObjCImplementationDecl=Foo:12:17 (Definition) Extent=[12:1 - 16:2] // CHECK: local-symbols.m:13:1: ObjCInstanceMethodDecl=bar:13:1 (Definition) [Overrides @9:1] Extent=[13:1 - 15:2] // CHECK: local-symbols.m:13:4: TypeRef=id:0:0 Extent=[13:4 - 13:6] // CHECK: local-symbols.m:14:10: UnexposedExpr= Extent=[14:10 - 14:11] -// CHECK: local-symbols.m:14:10: UnexposedExpr= Extent=[14:10 - 14:11] -// CHECK: local-symbols.m:20:1: ObjCProtocolDecl=Prot8380046:20:1 (Definition) Extent=[20:1 - 21:5] +// CHECK: local-symbols.m:14:10: IntegerLiteral= Extent=[14:10 - 14:11] +// CHECK: local-symbols.m:20:11: ObjCProtocolDecl=Prot8380046:20:11 (Definition) Extent=[20:1 - 21:5] // CHECK: local-symbols.m:23:12: ObjCInterfaceDecl=R8380046:23:12 Extent=[23:1 - 24:5] // CHECK: local-symbols.m:26:12: ObjCCategoryDecl=:26:12 Extent=[26:1 - 27:5] // CHECK: local-symbols.m:26:12: ObjCClassRef=R8380046:23:12 Extent=[26:12 - 26:20] -// CHECK: local-symbols.m:26:25: ObjCProtocolRef=Prot8380046:20:1 Extent=[26:25 - 26:36] +// CHECK: local-symbols.m:26:25: ObjCProtocolRef=Prot8380046:20:11 Extent=[26:25 - 26:36] diff --git a/test/Index/nested-binaryoperators.cpp b/test/Index/nested-binaryoperators.cpp index db5efe2cc8c2..57adc6b54664 100644 --- a/test/Index/nested-binaryoperators.cpp +++ b/test/Index/nested-binaryoperators.cpp @@ -165,1818 +165,1819 @@ int foo(uint c) { // CHECK: 2:5: FunctionDecl=foo:2:5 (Definition) Extent=[2:1 - 161:2] // CHECK: 2:14: ParmDecl=c:2:14 (Definition) Extent=[2:9 - 2:15] // CHECK: 2:9: TypeRef=uint:1:22 Extent=[2:9 - 2:13] -// CHECK: 2:17: UnexposedStmt= Extent=[2:17 - 161:2] -// CHECK: 3:3: UnexposedStmt= Extent=[3:3 - 160:52] +// CHECK: 2:17: CompoundStmt= Extent=[2:17 - 161:2] +// CHECK: 3:3: ReturnStmt= Extent=[3:3 - 160:52] // CHECK: 3:10: UnexposedExpr= Extent=[3:10 - 160:52] -// CHECK: 3:10: UnexposedExpr= Extent=[3:10 - 160:52] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 160:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 160:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 159:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 158:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 158:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 157:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 156:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 155:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 154:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 153:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 152:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 152:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 151:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 151:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 150:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 149:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 148:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 147:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 146:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 145:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 144:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 144:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 143:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 142:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:81] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:49] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 140:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 139:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 138:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 137:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 136:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 135:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:81] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:49] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 133:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 133:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 132:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 131:33] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:64] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:49] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 129:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 128:33] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:64] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:49] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 126:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 126:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:63] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:31] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:16] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:64] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:49] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 123:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 122:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 122:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 121:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 120:51] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 120:19] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 119:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 118:36] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 117:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 116:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 115:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 115:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 114:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 114:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 113:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:62] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 111:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 110:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:62] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 108:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 108:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 107:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 106:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 105:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 105:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 104:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 103:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 102:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 101:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 100:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 99:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 98:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 98:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 97:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 96:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 95:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 94:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 93:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 92:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 91:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 90:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 89:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 88:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 87:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 86:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 85:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 84:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 83:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 82:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 82:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 81:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 80:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 79:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 78:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 77:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 76:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 76:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 75:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 74:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 73:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 72:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 71:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:62] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 69:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 68:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 67:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 66:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 65:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 65:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 64:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 63:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 63:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 62:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 61:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 60:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 59:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 58:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 57:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 56:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 55:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 54:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 53:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 52:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 51:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 51:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 50:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 49:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 48:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 47:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 46:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 46:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 45:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 44:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 44:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 43:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 42:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 41:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 40:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 39:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 38:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 37:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 36:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 35:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 35:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 34:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 33:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 32:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 31:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 30:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 29:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 28:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 27:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 26:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 25:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 24:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 23:45] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 23:15] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:46] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 21:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 20:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 19:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 19:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 18:48] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 18:18] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 17:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 16:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 15:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 14:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 13:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 12:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 11:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 10:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 9:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 8:34] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 7:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 6:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 5:32] -// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 4:32] -// CHECK: 3:12: UnexposedExpr= Extent=[3:12 - 3:34] -// CHECK: 3:12: UnexposedExpr= Extent=[3:12 - 3:21] +// CHECK: 3:10: ParenExpr= Extent=[3:10 - 160:52] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 160:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 160:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 159:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 158:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 158:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 157:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 156:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 155:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 154:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 153:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 152:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 152:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 151:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 151:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 150:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 149:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 148:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 147:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 146:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 145:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 144:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 144:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 143:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 142:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 141:81] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 141:49] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 141:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 141:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 140:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 139:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 138:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 137:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 136:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 135:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 134:81] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 134:49] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 134:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 134:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 133:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 133:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 132:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 131:33] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 130:64] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 130:49] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 130:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 130:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 129:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 128:33] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 127:64] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 127:49] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 127:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 127:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 126:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 126:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 125:63] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 125:31] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 125:16] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 124:64] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 124:49] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 124:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 124:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 123:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 122:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 122:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 121:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 120:51] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 120:19] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 119:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 118:36] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 117:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 116:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 115:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 115:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 114:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 114:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 113:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 112:62] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 112:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 112:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 111:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 110:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 109:62] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 109:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 109:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 108:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 108:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 107:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 106:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 105:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 105:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 104:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 103:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 102:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 101:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 100:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 99:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 98:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 98:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 97:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 96:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 95:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 94:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 93:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 92:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 91:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 90:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 89:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 88:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 87:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 86:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 85:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 84:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 83:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 82:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 82:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 81:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 80:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 79:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 78:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 77:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 76:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 76:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 75:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 74:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 73:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 72:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 71:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 70:62] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 70:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 70:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 69:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 68:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 67:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 66:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 65:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 65:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 64:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 63:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 63:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 62:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 61:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 60:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 59:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 58:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 57:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 56:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 55:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 54:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 53:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 52:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 51:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 51:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 50:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 49:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 48:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 47:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 46:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 46:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 45:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 44:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 44:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 43:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 42:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 41:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 40:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 39:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 38:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 37:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 36:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 35:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 35:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 34:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 33:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 32:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 31:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 30:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 29:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 28:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 27:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 26:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 25:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 24:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 23:45] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 23:15] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 22:46] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 22:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 22:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 21:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 20:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 19:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 19:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 18:48] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 18:18] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 17:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 16:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 15:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 14:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 13:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 12:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 11:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 10:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 9:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 8:34] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 7:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 6:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 5:32] +// CHECK: 3:11: BinaryOperator= Extent=[3:11 - 4:32] +// CHECK: 3:12: BinaryOperator= Extent=[3:12 - 3:34] +// CHECK: 3:12: BinaryOperator= Extent=[3:12 - 3:21] // CHECK: 3:12: DeclRefExpr=c:2:14 Extent=[3:12 - 3:13] // CHECK: 3:17: UnexposedExpr= Extent=[3:17 - 3:21] -// CHECK: 3:17: UnexposedExpr= Extent=[3:17 - 3:21] -// CHECK: 3:25: UnexposedExpr= Extent=[3:25 - 3:34] +// CHECK: 3:17: IntegerLiteral= Extent=[3:17 - 3:21] +// CHECK: 3:25: BinaryOperator= Extent=[3:25 - 3:34] // CHECK: 3:25: DeclRefExpr=c:2:14 Extent=[3:25 - 3:26] // CHECK: 3:30: UnexposedExpr= Extent=[3:30 - 3:34] -// CHECK: 3:30: UnexposedExpr= Extent=[3:30 - 3:34] -// CHECK: 4:9: UnexposedExpr= Extent=[4:9 - 4:31] -// CHECK: 4:9: UnexposedExpr= Extent=[4:9 - 4:18] +// CHECK: 3:30: IntegerLiteral= Extent=[3:30 - 3:34] +// CHECK: 4:9: BinaryOperator= Extent=[4:9 - 4:31] +// CHECK: 4:9: BinaryOperator= Extent=[4:9 - 4:18] // CHECK: 4:9: DeclRefExpr=c:2:14 Extent=[4:9 - 4:10] // CHECK: 4:14: UnexposedExpr= Extent=[4:14 - 4:18] -// CHECK: 4:14: UnexposedExpr= Extent=[4:14 - 4:18] -// CHECK: 4:22: UnexposedExpr= Extent=[4:22 - 4:31] +// CHECK: 4:14: IntegerLiteral= Extent=[4:14 - 4:18] +// CHECK: 4:22: BinaryOperator= Extent=[4:22 - 4:31] // CHECK: 4:22: DeclRefExpr=c:2:14 Extent=[4:22 - 4:23] // CHECK: 4:27: UnexposedExpr= Extent=[4:27 - 4:31] -// CHECK: 4:27: UnexposedExpr= Extent=[4:27 - 4:31] -// CHECK: 5:9: UnexposedExpr= Extent=[5:9 - 5:31] -// CHECK: 5:9: UnexposedExpr= Extent=[5:9 - 5:18] +// CHECK: 4:27: IntegerLiteral= Extent=[4:27 - 4:31] +// CHECK: 5:8: ParenExpr= Extent=[5:8 - 5:32] +// CHECK: 5:9: BinaryOperator= Extent=[5:9 - 5:31] +// CHECK: 5:9: BinaryOperator= Extent=[5:9 - 5:18] // CHECK: 5:9: DeclRefExpr=c:2:14 Extent=[5:9 - 5:10] // CHECK: 5:14: UnexposedExpr= Extent=[5:14 - 5:18] -// CHECK: 5:14: UnexposedExpr= Extent=[5:14 - 5:18] -// CHECK: 5:22: UnexposedExpr= Extent=[5:22 - 5:31] +// CHECK: 5:14: IntegerLiteral= Extent=[5:14 - 5:18] +// CHECK: 5:22: BinaryOperator= Extent=[5:22 - 5:31] // CHECK: 5:22: DeclRefExpr=c:2:14 Extent=[5:22 - 5:23] // CHECK: 5:27: UnexposedExpr= Extent=[5:27 - 5:31] -// CHECK: 5:27: UnexposedExpr= Extent=[5:27 - 5:31] -// CHECK: 6:9: UnexposedExpr= Extent=[6:9 - 6:31] -// CHECK: 6:9: UnexposedExpr= Extent=[6:9 - 6:18] +// CHECK: 5:27: IntegerLiteral= Extent=[5:27 - 5:31] +// CHECK: 6:9: BinaryOperator= Extent=[6:9 - 6:31] +// CHECK: 6:9: BinaryOperator= Extent=[6:9 - 6:18] // CHECK: 6:9: DeclRefExpr=c:2:14 Extent=[6:9 - 6:10] // CHECK: 6:14: UnexposedExpr= Extent=[6:14 - 6:18] -// CHECK: 6:14: UnexposedExpr= Extent=[6:14 - 6:18] -// CHECK: 6:22: UnexposedExpr= Extent=[6:22 - 6:31] +// CHECK: 6:14: IntegerLiteral= Extent=[6:14 - 6:18] +// CHECK: 6:22: BinaryOperator= Extent=[6:22 - 6:31] // CHECK: 6:22: DeclRefExpr=c:2:14 Extent=[6:22 - 6:23] // CHECK: 6:27: UnexposedExpr= Extent=[6:27 - 6:31] -// CHECK: 6:27: UnexposedExpr= Extent=[6:27 - 6:31] -// CHECK: 7:9: UnexposedExpr= Extent=[7:9 - 7:31] -// CHECK: 7:9: UnexposedExpr= Extent=[7:9 - 7:18] +// CHECK: 6:27: IntegerLiteral= Extent=[6:27 - 6:31] +// CHECK: 7:9: BinaryOperator= Extent=[7:9 - 7:31] +// CHECK: 7:9: BinaryOperator= Extent=[7:9 - 7:18] // CHECK: 7:9: DeclRefExpr=c:2:14 Extent=[7:9 - 7:10] // CHECK: 7:14: UnexposedExpr= Extent=[7:14 - 7:18] -// CHECK: 7:14: UnexposedExpr= Extent=[7:14 - 7:18] -// CHECK: 7:22: UnexposedExpr= Extent=[7:22 - 7:31] +// CHECK: 7:14: IntegerLiteral= Extent=[7:14 - 7:18] +// CHECK: 7:22: BinaryOperator= Extent=[7:22 - 7:31] // CHECK: 7:22: DeclRefExpr=c:2:14 Extent=[7:22 - 7:23] // CHECK: 7:27: UnexposedExpr= Extent=[7:27 - 7:31] -// CHECK: 7:27: UnexposedExpr= Extent=[7:27 - 7:31] -// CHECK: 8:9: UnexposedExpr= Extent=[8:9 - 8:33] -// CHECK: 8:9: UnexposedExpr= Extent=[8:9 - 8:19] +// CHECK: 7:27: IntegerLiteral= Extent=[7:27 - 7:31] +// CHECK: 8:9: BinaryOperator= Extent=[8:9 - 8:33] +// CHECK: 8:9: BinaryOperator= Extent=[8:9 - 8:19] // CHECK: 8:9: DeclRefExpr=c:2:14 Extent=[8:9 - 8:10] // CHECK: 8:14: UnexposedExpr= Extent=[8:14 - 8:19] -// CHECK: 8:14: UnexposedExpr= Extent=[8:14 - 8:19] -// CHECK: 8:23: UnexposedExpr= Extent=[8:23 - 8:33] +// CHECK: 8:14: IntegerLiteral= Extent=[8:14 - 8:19] +// CHECK: 8:23: BinaryOperator= Extent=[8:23 - 8:33] // CHECK: 8:23: DeclRefExpr=c:2:14 Extent=[8:23 - 8:24] // CHECK: 8:28: UnexposedExpr= Extent=[8:28 - 8:33] -// CHECK: 8:28: UnexposedExpr= Extent=[8:28 - 8:33] -// CHECK: 9:9: UnexposedExpr= Extent=[9:9 - 9:33] -// CHECK: 9:9: UnexposedExpr= Extent=[9:9 - 9:19] +// CHECK: 8:28: IntegerLiteral= Extent=[8:28 - 8:33] +// CHECK: 9:9: BinaryOperator= Extent=[9:9 - 9:33] +// CHECK: 9:9: BinaryOperator= Extent=[9:9 - 9:19] // CHECK: 9:9: DeclRefExpr=c:2:14 Extent=[9:9 - 9:10] // CHECK: 9:14: UnexposedExpr= Extent=[9:14 - 9:19] -// CHECK: 9:14: UnexposedExpr= Extent=[9:14 - 9:19] -// CHECK: 9:23: UnexposedExpr= Extent=[9:23 - 9:33] +// CHECK: 9:14: IntegerLiteral= Extent=[9:14 - 9:19] +// CHECK: 9:23: BinaryOperator= Extent=[9:23 - 9:33] // CHECK: 9:23: DeclRefExpr=c:2:14 Extent=[9:23 - 9:24] // CHECK: 9:28: UnexposedExpr= Extent=[9:28 - 9:33] -// CHECK: 9:28: UnexposedExpr= Extent=[9:28 - 9:33] -// CHECK: 10:9: UnexposedExpr= Extent=[10:9 - 10:33] -// CHECK: 10:9: UnexposedExpr= Extent=[10:9 - 10:19] +// CHECK: 9:28: IntegerLiteral= Extent=[9:28 - 9:33] +// CHECK: 10:9: BinaryOperator= Extent=[10:9 - 10:33] +// CHECK: 10:9: BinaryOperator= Extent=[10:9 - 10:19] // CHECK: 10:9: DeclRefExpr=c:2:14 Extent=[10:9 - 10:10] // CHECK: 10:14: UnexposedExpr= Extent=[10:14 - 10:19] -// CHECK: 10:14: UnexposedExpr= Extent=[10:14 - 10:19] -// CHECK: 10:23: UnexposedExpr= Extent=[10:23 - 10:33] +// CHECK: 10:14: IntegerLiteral= Extent=[10:14 - 10:19] +// CHECK: 10:23: BinaryOperator= Extent=[10:23 - 10:33] // CHECK: 10:23: DeclRefExpr=c:2:14 Extent=[10:23 - 10:24] // CHECK: 10:28: UnexposedExpr= Extent=[10:28 - 10:33] -// CHECK: 10:28: UnexposedExpr= Extent=[10:28 - 10:33] -// CHECK: 11:9: UnexposedExpr= Extent=[11:9 - 11:33] -// CHECK: 11:9: UnexposedExpr= Extent=[11:9 - 11:19] +// CHECK: 10:28: IntegerLiteral= Extent=[10:28 - 10:33] +// CHECK: 11:9: BinaryOperator= Extent=[11:9 - 11:33] +// CHECK: 11:9: BinaryOperator= Extent=[11:9 - 11:19] // CHECK: 11:9: DeclRefExpr=c:2:14 Extent=[11:9 - 11:10] // CHECK: 11:14: UnexposedExpr= Extent=[11:14 - 11:19] -// CHECK: 11:14: UnexposedExpr= Extent=[11:14 - 11:19] -// CHECK: 11:23: UnexposedExpr= Extent=[11:23 - 11:33] +// CHECK: 11:14: IntegerLiteral= Extent=[11:14 - 11:19] +// CHECK: 11:23: BinaryOperator= Extent=[11:23 - 11:33] // CHECK: 11:23: DeclRefExpr=c:2:14 Extent=[11:23 - 11:24] // CHECK: 11:28: UnexposedExpr= Extent=[11:28 - 11:33] -// CHECK: 11:28: UnexposedExpr= Extent=[11:28 - 11:33] -// CHECK: 12:9: UnexposedExpr= Extent=[12:9 - 12:33] -// CHECK: 12:9: UnexposedExpr= Extent=[12:9 - 12:19] +// CHECK: 11:28: IntegerLiteral= Extent=[11:28 - 11:33] +// CHECK: 12:9: BinaryOperator= Extent=[12:9 - 12:33] +// CHECK: 12:9: BinaryOperator= Extent=[12:9 - 12:19] // CHECK: 12:9: DeclRefExpr=c:2:14 Extent=[12:9 - 12:10] // CHECK: 12:14: UnexposedExpr= Extent=[12:14 - 12:19] -// CHECK: 12:14: UnexposedExpr= Extent=[12:14 - 12:19] -// CHECK: 12:23: UnexposedExpr= Extent=[12:23 - 12:33] +// CHECK: 12:14: IntegerLiteral= Extent=[12:14 - 12:19] +// CHECK: 12:23: BinaryOperator= Extent=[12:23 - 12:33] // CHECK: 12:23: DeclRefExpr=c:2:14 Extent=[12:23 - 12:24] // CHECK: 12:28: UnexposedExpr= Extent=[12:28 - 12:33] -// CHECK: 12:28: UnexposedExpr= Extent=[12:28 - 12:33] -// CHECK: 13:9: UnexposedExpr= Extent=[13:9 - 13:33] -// CHECK: 13:9: UnexposedExpr= Extent=[13:9 - 13:19] +// CHECK: 12:28: IntegerLiteral= Extent=[12:28 - 12:33] +// CHECK: 13:9: BinaryOperator= Extent=[13:9 - 13:33] +// CHECK: 13:9: BinaryOperator= Extent=[13:9 - 13:19] // CHECK: 13:9: DeclRefExpr=c:2:14 Extent=[13:9 - 13:10] // CHECK: 13:14: UnexposedExpr= Extent=[13:14 - 13:19] -// CHECK: 13:14: UnexposedExpr= Extent=[13:14 - 13:19] -// CHECK: 13:23: UnexposedExpr= Extent=[13:23 - 13:33] +// CHECK: 13:14: IntegerLiteral= Extent=[13:14 - 13:19] +// CHECK: 13:23: BinaryOperator= Extent=[13:23 - 13:33] // CHECK: 13:23: DeclRefExpr=c:2:14 Extent=[13:23 - 13:24] // CHECK: 13:28: UnexposedExpr= Extent=[13:28 - 13:33] -// CHECK: 13:28: UnexposedExpr= Extent=[13:28 - 13:33] -// CHECK: 14:9: UnexposedExpr= Extent=[14:9 - 14:33] -// CHECK: 14:9: UnexposedExpr= Extent=[14:9 - 14:19] +// CHECK: 13:28: IntegerLiteral= Extent=[13:28 - 13:33] +// CHECK: 14:9: BinaryOperator= Extent=[14:9 - 14:33] +// CHECK: 14:9: BinaryOperator= Extent=[14:9 - 14:19] // CHECK: 14:9: DeclRefExpr=c:2:14 Extent=[14:9 - 14:10] // CHECK: 14:14: UnexposedExpr= Extent=[14:14 - 14:19] -// CHECK: 14:14: UnexposedExpr= Extent=[14:14 - 14:19] -// CHECK: 14:23: UnexposedExpr= Extent=[14:23 - 14:33] +// CHECK: 14:14: IntegerLiteral= Extent=[14:14 - 14:19] +// CHECK: 14:23: BinaryOperator= Extent=[14:23 - 14:33] // CHECK: 14:23: DeclRefExpr=c:2:14 Extent=[14:23 - 14:24] // CHECK: 14:28: UnexposedExpr= Extent=[14:28 - 14:33] -// CHECK: 14:28: UnexposedExpr= Extent=[14:28 - 14:33] -// CHECK: 15:9: UnexposedExpr= Extent=[15:9 - 15:33] -// CHECK: 15:9: UnexposedExpr= Extent=[15:9 - 15:19] +// CHECK: 14:28: IntegerLiteral= Extent=[14:28 - 14:33] +// CHECK: 15:9: BinaryOperator= Extent=[15:9 - 15:33] +// CHECK: 15:9: BinaryOperator= Extent=[15:9 - 15:19] // CHECK: 15:9: DeclRefExpr=c:2:14 Extent=[15:9 - 15:10] // CHECK: 15:14: UnexposedExpr= Extent=[15:14 - 15:19] -// CHECK: 15:14: UnexposedExpr= Extent=[15:14 - 15:19] -// CHECK: 15:23: UnexposedExpr= Extent=[15:23 - 15:33] +// CHECK: 15:14: IntegerLiteral= Extent=[15:14 - 15:19] +// CHECK: 15:23: BinaryOperator= Extent=[15:23 - 15:33] // CHECK: 15:23: DeclRefExpr=c:2:14 Extent=[15:23 - 15:24] // CHECK: 15:28: UnexposedExpr= Extent=[15:28 - 15:33] -// CHECK: 15:28: UnexposedExpr= Extent=[15:28 - 15:33] -// CHECK: 16:9: UnexposedExpr= Extent=[16:9 - 16:33] -// CHECK: 16:9: UnexposedExpr= Extent=[16:9 - 16:19] +// CHECK: 15:28: IntegerLiteral= Extent=[15:28 - 15:33] +// CHECK: 16:9: BinaryOperator= Extent=[16:9 - 16:33] +// CHECK: 16:9: BinaryOperator= Extent=[16:9 - 16:19] // CHECK: 16:9: DeclRefExpr=c:2:14 Extent=[16:9 - 16:10] // CHECK: 16:14: UnexposedExpr= Extent=[16:14 - 16:19] -// CHECK: 16:14: UnexposedExpr= Extent=[16:14 - 16:19] -// CHECK: 16:23: UnexposedExpr= Extent=[16:23 - 16:33] +// CHECK: 16:14: IntegerLiteral= Extent=[16:14 - 16:19] +// CHECK: 16:23: BinaryOperator= Extent=[16:23 - 16:33] // CHECK: 16:23: DeclRefExpr=c:2:14 Extent=[16:23 - 16:24] // CHECK: 16:28: UnexposedExpr= Extent=[16:28 - 16:33] -// CHECK: 16:28: UnexposedExpr= Extent=[16:28 - 16:33] -// CHECK: 17:9: UnexposedExpr= Extent=[17:9 - 17:33] -// CHECK: 17:9: UnexposedExpr= Extent=[17:9 - 17:19] +// CHECK: 16:28: IntegerLiteral= Extent=[16:28 - 16:33] +// CHECK: 17:9: BinaryOperator= Extent=[17:9 - 17:33] +// CHECK: 17:9: BinaryOperator= Extent=[17:9 - 17:19] // CHECK: 17:9: DeclRefExpr=c:2:14 Extent=[17:9 - 17:10] // CHECK: 17:14: UnexposedExpr= Extent=[17:14 - 17:19] -// CHECK: 17:14: UnexposedExpr= Extent=[17:14 - 17:19] -// CHECK: 17:23: UnexposedExpr= Extent=[17:23 - 17:33] +// CHECK: 17:14: IntegerLiteral= Extent=[17:14 - 17:19] +// CHECK: 17:23: BinaryOperator= Extent=[17:23 - 17:33] // CHECK: 17:23: DeclRefExpr=c:2:14 Extent=[17:23 - 17:24] // CHECK: 17:28: UnexposedExpr= Extent=[17:28 - 17:33] -// CHECK: 17:28: UnexposedExpr= Extent=[17:28 - 17:33] -// CHECK: 18:8: UnexposedExpr= Extent=[18:8 - 18:18] +// CHECK: 17:28: IntegerLiteral= Extent=[17:28 - 17:33] +// CHECK: 18:8: BinaryOperator= Extent=[18:8 - 18:18] // CHECK: 18:8: DeclRefExpr=c:2:14 Extent=[18:8 - 18:9] // CHECK: 18:13: UnexposedExpr= Extent=[18:13 - 18:18] -// CHECK: 18:13: UnexposedExpr= Extent=[18:13 - 18:18] -// CHECK: 18:23: UnexposedExpr= Extent=[18:23 - 18:47] -// CHECK: 18:23: UnexposedExpr= Extent=[18:23 - 18:33] +// CHECK: 18:13: IntegerLiteral= Extent=[18:13 - 18:18] +// CHECK: 18:23: BinaryOperator= Extent=[18:23 - 18:47] +// CHECK: 18:23: BinaryOperator= Extent=[18:23 - 18:33] // CHECK: 18:23: DeclRefExpr=c:2:14 Extent=[18:23 - 18:24] // CHECK: 18:28: UnexposedExpr= Extent=[18:28 - 18:33] -// CHECK: 18:28: UnexposedExpr= Extent=[18:28 - 18:33] -// CHECK: 18:37: UnexposedExpr= Extent=[18:37 - 18:47] +// CHECK: 18:28: IntegerLiteral= Extent=[18:28 - 18:33] +// CHECK: 18:37: BinaryOperator= Extent=[18:37 - 18:47] // CHECK: 18:37: DeclRefExpr=c:2:14 Extent=[18:37 - 18:38] // CHECK: 18:42: UnexposedExpr= Extent=[18:42 - 18:47] -// CHECK: 18:42: UnexposedExpr= Extent=[18:42 - 18:47] -// CHECK: 19:8: UnexposedExpr= Extent=[19:8 - 19:18] +// CHECK: 18:42: IntegerLiteral= Extent=[18:42 - 18:47] +// CHECK: 19:8: BinaryOperator= Extent=[19:8 - 19:18] // CHECK: 19:8: DeclRefExpr=c:2:14 Extent=[19:8 - 19:9] // CHECK: 19:13: UnexposedExpr= Extent=[19:13 - 19:18] -// CHECK: 19:13: UnexposedExpr= Extent=[19:13 - 19:18] -// CHECK: 19:23: UnexposedExpr= Extent=[19:23 - 19:47] -// CHECK: 19:23: UnexposedExpr= Extent=[19:23 - 19:33] +// CHECK: 19:13: IntegerLiteral= Extent=[19:13 - 19:18] +// CHECK: 19:23: BinaryOperator= Extent=[19:23 - 19:47] +// CHECK: 19:23: BinaryOperator= Extent=[19:23 - 19:33] // CHECK: 19:23: DeclRefExpr=c:2:14 Extent=[19:23 - 19:24] // CHECK: 19:28: UnexposedExpr= Extent=[19:28 - 19:33] -// CHECK: 19:28: UnexposedExpr= Extent=[19:28 - 19:33] -// CHECK: 19:37: UnexposedExpr= Extent=[19:37 - 19:47] +// CHECK: 19:28: IntegerLiteral= Extent=[19:28 - 19:33] +// CHECK: 19:37: BinaryOperator= Extent=[19:37 - 19:47] // CHECK: 19:37: DeclRefExpr=c:2:14 Extent=[19:37 - 19:38] // CHECK: 19:42: UnexposedExpr= Extent=[19:42 - 19:47] -// CHECK: 19:42: UnexposedExpr= Extent=[19:42 - 19:47] -// CHECK: 20:9: UnexposedExpr= Extent=[20:9 - 20:33] -// CHECK: 20:9: UnexposedExpr= Extent=[20:9 - 20:19] +// CHECK: 19:42: IntegerLiteral= Extent=[19:42 - 19:47] +// CHECK: 20:9: BinaryOperator= Extent=[20:9 - 20:33] +// CHECK: 20:9: BinaryOperator= Extent=[20:9 - 20:19] // CHECK: 20:9: DeclRefExpr=c:2:14 Extent=[20:9 - 20:10] // CHECK: 20:14: UnexposedExpr= Extent=[20:14 - 20:19] -// CHECK: 20:14: UnexposedExpr= Extent=[20:14 - 20:19] -// CHECK: 20:23: UnexposedExpr= Extent=[20:23 - 20:33] +// CHECK: 20:14: IntegerLiteral= Extent=[20:14 - 20:19] +// CHECK: 20:23: BinaryOperator= Extent=[20:23 - 20:33] // CHECK: 20:23: DeclRefExpr=c:2:14 Extent=[20:23 - 20:24] // CHECK: 20:28: UnexposedExpr= Extent=[20:28 - 20:33] -// CHECK: 20:28: UnexposedExpr= Extent=[20:28 - 20:33] -// CHECK: 21:9: UnexposedExpr= Extent=[21:9 - 21:33] -// CHECK: 21:9: UnexposedExpr= Extent=[21:9 - 21:19] +// CHECK: 20:28: IntegerLiteral= Extent=[20:28 - 20:33] +// CHECK: 21:9: BinaryOperator= Extent=[21:9 - 21:33] +// CHECK: 21:9: BinaryOperator= Extent=[21:9 - 21:19] // CHECK: 21:9: DeclRefExpr=c:2:14 Extent=[21:9 - 21:10] // CHECK: 21:14: UnexposedExpr= Extent=[21:14 - 21:19] -// CHECK: 21:14: UnexposedExpr= Extent=[21:14 - 21:19] -// CHECK: 21:23: UnexposedExpr= Extent=[21:23 - 21:33] +// CHECK: 21:14: IntegerLiteral= Extent=[21:14 - 21:19] +// CHECK: 21:23: BinaryOperator= Extent=[21:23 - 21:33] // CHECK: 21:23: DeclRefExpr=c:2:14 Extent=[21:23 - 21:24] // CHECK: 21:28: UnexposedExpr= Extent=[21:28 - 21:33] -// CHECK: 21:28: UnexposedExpr= Extent=[21:28 - 21:33] -// CHECK: 22:8: UnexposedExpr= Extent=[22:8 - 22:18] +// CHECK: 21:28: IntegerLiteral= Extent=[21:28 - 21:33] +// CHECK: 22:8: BinaryOperator= Extent=[22:8 - 22:18] // CHECK: 22:8: DeclRefExpr=c:2:14 Extent=[22:8 - 22:9] // CHECK: 22:13: UnexposedExpr= Extent=[22:13 - 22:18] -// CHECK: 22:13: UnexposedExpr= Extent=[22:13 - 22:18] -// CHECK: 22:22: UnexposedExpr= Extent=[22:22 - 22:32] +// CHECK: 22:13: IntegerLiteral= Extent=[22:13 - 22:18] +// CHECK: 22:22: BinaryOperator= Extent=[22:22 - 22:32] // CHECK: 22:22: DeclRefExpr=c:2:14 Extent=[22:22 - 22:23] // CHECK: 22:27: UnexposedExpr= Extent=[22:27 - 22:32] -// CHECK: 22:27: UnexposedExpr= Extent=[22:27 - 22:32] -// CHECK: 22:36: UnexposedExpr= Extent=[22:36 - 22:46] +// CHECK: 22:27: IntegerLiteral= Extent=[22:27 - 22:32] +// CHECK: 22:36: BinaryOperator= Extent=[22:36 - 22:46] // CHECK: 22:36: DeclRefExpr=c:2:14 Extent=[22:36 - 22:37] // CHECK: 22:41: UnexposedExpr= Extent=[22:41 - 22:46] -// CHECK: 22:41: UnexposedExpr= Extent=[22:41 - 22:46] -// CHECK: 23:5: UnexposedExpr= Extent=[23:5 - 23:15] +// CHECK: 22:41: IntegerLiteral= Extent=[22:41 - 22:46] +// CHECK: 23:5: BinaryOperator= Extent=[23:5 - 23:15] // CHECK: 23:5: DeclRefExpr=c:2:14 Extent=[23:5 - 23:6] // CHECK: 23:10: UnexposedExpr= Extent=[23:10 - 23:15] -// CHECK: 23:10: UnexposedExpr= Extent=[23:10 - 23:15] -// CHECK: 23:20: UnexposedExpr= Extent=[23:20 - 23:44] -// CHECK: 23:20: UnexposedExpr= Extent=[23:20 - 23:30] +// CHECK: 23:10: IntegerLiteral= Extent=[23:10 - 23:15] +// CHECK: 23:20: BinaryOperator= Extent=[23:20 - 23:44] +// CHECK: 23:20: BinaryOperator= Extent=[23:20 - 23:30] // CHECK: 23:20: DeclRefExpr=c:2:14 Extent=[23:20 - 23:21] // CHECK: 23:25: UnexposedExpr= Extent=[23:25 - 23:30] -// CHECK: 23:25: UnexposedExpr= Extent=[23:25 - 23:30] -// CHECK: 23:34: UnexposedExpr= Extent=[23:34 - 23:44] +// CHECK: 23:25: IntegerLiteral= Extent=[23:25 - 23:30] +// CHECK: 23:34: BinaryOperator= Extent=[23:34 - 23:44] // CHECK: 23:34: DeclRefExpr=c:2:14 Extent=[23:34 - 23:35] // CHECK: 23:39: UnexposedExpr= Extent=[23:39 - 23:44] -// CHECK: 23:39: UnexposedExpr= Extent=[23:39 - 23:44] -// CHECK: 24:9: UnexposedExpr= Extent=[24:9 - 24:33] -// CHECK: 24:9: UnexposedExpr= Extent=[24:9 - 24:19] +// CHECK: 23:39: IntegerLiteral= Extent=[23:39 - 23:44] +// CHECK: 24:9: BinaryOperator= Extent=[24:9 - 24:33] +// CHECK: 24:9: BinaryOperator= Extent=[24:9 - 24:19] // CHECK: 24:9: DeclRefExpr=c:2:14 Extent=[24:9 - 24:10] // CHECK: 24:14: UnexposedExpr= Extent=[24:14 - 24:19] -// CHECK: 24:14: UnexposedExpr= Extent=[24:14 - 24:19] -// CHECK: 24:23: UnexposedExpr= Extent=[24:23 - 24:33] +// CHECK: 24:14: IntegerLiteral= Extent=[24:14 - 24:19] +// CHECK: 24:23: BinaryOperator= Extent=[24:23 - 24:33] // CHECK: 24:23: DeclRefExpr=c:2:14 Extent=[24:23 - 24:24] // CHECK: 24:28: UnexposedExpr= Extent=[24:28 - 24:33] -// CHECK: 24:28: UnexposedExpr= Extent=[24:28 - 24:33] -// CHECK: 25:9: UnexposedExpr= Extent=[25:9 - 25:33] -// CHECK: 25:9: UnexposedExpr= Extent=[25:9 - 25:19] +// CHECK: 24:28: IntegerLiteral= Extent=[24:28 - 24:33] +// CHECK: 25:9: BinaryOperator= Extent=[25:9 - 25:33] +// CHECK: 25:9: BinaryOperator= Extent=[25:9 - 25:19] // CHECK: 25:9: DeclRefExpr=c:2:14 Extent=[25:9 - 25:10] // CHECK: 25:14: UnexposedExpr= Extent=[25:14 - 25:19] -// CHECK: 25:14: UnexposedExpr= Extent=[25:14 - 25:19] -// CHECK: 25:23: UnexposedExpr= Extent=[25:23 - 25:33] +// CHECK: 25:14: IntegerLiteral= Extent=[25:14 - 25:19] +// CHECK: 25:23: BinaryOperator= Extent=[25:23 - 25:33] // CHECK: 25:23: DeclRefExpr=c:2:14 Extent=[25:23 - 25:24] // CHECK: 25:28: UnexposedExpr= Extent=[25:28 - 25:33] -// CHECK: 25:28: UnexposedExpr= Extent=[25:28 - 25:33] -// CHECK: 26:9: UnexposedExpr= Extent=[26:9 - 26:33] -// CHECK: 26:9: UnexposedExpr= Extent=[26:9 - 26:19] +// CHECK: 25:28: IntegerLiteral= Extent=[25:28 - 25:33] +// CHECK: 26:9: BinaryOperator= Extent=[26:9 - 26:33] +// CHECK: 26:9: BinaryOperator= Extent=[26:9 - 26:19] // CHECK: 26:9: DeclRefExpr=c:2:14 Extent=[26:9 - 26:10] // CHECK: 26:14: UnexposedExpr= Extent=[26:14 - 26:19] -// CHECK: 26:14: UnexposedExpr= Extent=[26:14 - 26:19] -// CHECK: 26:23: UnexposedExpr= Extent=[26:23 - 26:33] +// CHECK: 26:14: IntegerLiteral= Extent=[26:14 - 26:19] +// CHECK: 26:23: BinaryOperator= Extent=[26:23 - 26:33] // CHECK: 26:23: DeclRefExpr=c:2:14 Extent=[26:23 - 26:24] // CHECK: 26:28: UnexposedExpr= Extent=[26:28 - 26:33] -// CHECK: 26:28: UnexposedExpr= Extent=[26:28 - 26:33] -// CHECK: 27:9: UnexposedExpr= Extent=[27:9 - 27:33] -// CHECK: 27:9: UnexposedExpr= Extent=[27:9 - 27:19] +// CHECK: 26:28: IntegerLiteral= Extent=[26:28 - 26:33] +// CHECK: 27:9: BinaryOperator= Extent=[27:9 - 27:33] +// CHECK: 27:9: BinaryOperator= Extent=[27:9 - 27:19] // CHECK: 27:9: DeclRefExpr=c:2:14 Extent=[27:9 - 27:10] // CHECK: 27:14: UnexposedExpr= Extent=[27:14 - 27:19] -// CHECK: 27:14: UnexposedExpr= Extent=[27:14 - 27:19] -// CHECK: 27:23: UnexposedExpr= Extent=[27:23 - 27:33] +// CHECK: 27:14: IntegerLiteral= Extent=[27:14 - 27:19] +// CHECK: 27:23: BinaryOperator= Extent=[27:23 - 27:33] // CHECK: 27:23: DeclRefExpr=c:2:14 Extent=[27:23 - 27:24] // CHECK: 27:28: UnexposedExpr= Extent=[27:28 - 27:33] -// CHECK: 27:28: UnexposedExpr= Extent=[27:28 - 27:33] -// CHECK: 28:9: UnexposedExpr= Extent=[28:9 - 28:33] -// CHECK: 28:9: UnexposedExpr= Extent=[28:9 - 28:19] +// CHECK: 27:28: IntegerLiteral= Extent=[27:28 - 27:33] +// CHECK: 28:9: BinaryOperator= Extent=[28:9 - 28:33] +// CHECK: 28:9: BinaryOperator= Extent=[28:9 - 28:19] // CHECK: 28:9: DeclRefExpr=c:2:14 Extent=[28:9 - 28:10] // CHECK: 28:14: UnexposedExpr= Extent=[28:14 - 28:19] -// CHECK: 28:14: UnexposedExpr= Extent=[28:14 - 28:19] -// CHECK: 28:23: UnexposedExpr= Extent=[28:23 - 28:33] +// CHECK: 28:14: IntegerLiteral= Extent=[28:14 - 28:19] +// CHECK: 28:23: BinaryOperator= Extent=[28:23 - 28:33] // CHECK: 28:23: DeclRefExpr=c:2:14 Extent=[28:23 - 28:24] // CHECK: 28:28: UnexposedExpr= Extent=[28:28 - 28:33] -// CHECK: 28:28: UnexposedExpr= Extent=[28:28 - 28:33] -// CHECK: 29:9: UnexposedExpr= Extent=[29:9 - 29:33] -// CHECK: 29:9: UnexposedExpr= Extent=[29:9 - 29:19] +// CHECK: 28:28: IntegerLiteral= Extent=[28:28 - 28:33] +// CHECK: 29:9: BinaryOperator= Extent=[29:9 - 29:33] +// CHECK: 29:9: BinaryOperator= Extent=[29:9 - 29:19] // CHECK: 29:9: DeclRefExpr=c:2:14 Extent=[29:9 - 29:10] // CHECK: 29:14: UnexposedExpr= Extent=[29:14 - 29:19] -// CHECK: 29:14: UnexposedExpr= Extent=[29:14 - 29:19] -// CHECK: 29:23: UnexposedExpr= Extent=[29:23 - 29:33] +// CHECK: 29:14: IntegerLiteral= Extent=[29:14 - 29:19] +// CHECK: 29:23: BinaryOperator= Extent=[29:23 - 29:33] // CHECK: 29:23: DeclRefExpr=c:2:14 Extent=[29:23 - 29:24] // CHECK: 29:28: UnexposedExpr= Extent=[29:28 - 29:33] -// CHECK: 29:28: UnexposedExpr= Extent=[29:28 - 29:33] -// CHECK: 30:9: UnexposedExpr= Extent=[30:9 - 30:33] -// CHECK: 30:9: UnexposedExpr= Extent=[30:9 - 30:19] +// CHECK: 29:28: IntegerLiteral= Extent=[29:28 - 29:33] +// CHECK: 30:9: BinaryOperator= Extent=[30:9 - 30:33] +// CHECK: 30:9: BinaryOperator= Extent=[30:9 - 30:19] // CHECK: 30:9: DeclRefExpr=c:2:14 Extent=[30:9 - 30:10] // CHECK: 30:14: UnexposedExpr= Extent=[30:14 - 30:19] -// CHECK: 30:14: UnexposedExpr= Extent=[30:14 - 30:19] -// CHECK: 30:23: UnexposedExpr= Extent=[30:23 - 30:33] +// CHECK: 30:14: IntegerLiteral= Extent=[30:14 - 30:19] +// CHECK: 30:23: BinaryOperator= Extent=[30:23 - 30:33] // CHECK: 30:23: DeclRefExpr=c:2:14 Extent=[30:23 - 30:24] // CHECK: 30:28: UnexposedExpr= Extent=[30:28 - 30:33] -// CHECK: 30:28: UnexposedExpr= Extent=[30:28 - 30:33] -// CHECK: 31:9: UnexposedExpr= Extent=[31:9 - 31:33] -// CHECK: 31:9: UnexposedExpr= Extent=[31:9 - 31:19] +// CHECK: 30:28: IntegerLiteral= Extent=[30:28 - 30:33] +// CHECK: 31:9: BinaryOperator= Extent=[31:9 - 31:33] +// CHECK: 31:9: BinaryOperator= Extent=[31:9 - 31:19] // CHECK: 31:9: DeclRefExpr=c:2:14 Extent=[31:9 - 31:10] // CHECK: 31:14: UnexposedExpr= Extent=[31:14 - 31:19] -// CHECK: 31:14: UnexposedExpr= Extent=[31:14 - 31:19] -// CHECK: 31:23: UnexposedExpr= Extent=[31:23 - 31:33] +// CHECK: 31:14: IntegerLiteral= Extent=[31:14 - 31:19] +// CHECK: 31:23: BinaryOperator= Extent=[31:23 - 31:33] // CHECK: 31:23: DeclRefExpr=c:2:14 Extent=[31:23 - 31:24] // CHECK: 31:28: UnexposedExpr= Extent=[31:28 - 31:33] -// CHECK: 31:28: UnexposedExpr= Extent=[31:28 - 31:33] -// CHECK: 32:9: UnexposedExpr= Extent=[32:9 - 32:33] -// CHECK: 32:9: UnexposedExpr= Extent=[32:9 - 32:19] +// CHECK: 31:28: IntegerLiteral= Extent=[31:28 - 31:33] +// CHECK: 32:9: BinaryOperator= Extent=[32:9 - 32:33] +// CHECK: 32:9: BinaryOperator= Extent=[32:9 - 32:19] // CHECK: 32:9: DeclRefExpr=c:2:14 Extent=[32:9 - 32:10] // CHECK: 32:14: UnexposedExpr= Extent=[32:14 - 32:19] -// CHECK: 32:14: UnexposedExpr= Extent=[32:14 - 32:19] -// CHECK: 32:23: UnexposedExpr= Extent=[32:23 - 32:33] +// CHECK: 32:14: IntegerLiteral= Extent=[32:14 - 32:19] +// CHECK: 32:23: BinaryOperator= Extent=[32:23 - 32:33] // CHECK: 32:23: DeclRefExpr=c:2:14 Extent=[32:23 - 32:24] // CHECK: 32:28: UnexposedExpr= Extent=[32:28 - 32:33] -// CHECK: 32:28: UnexposedExpr= Extent=[32:28 - 32:33] -// CHECK: 33:9: UnexposedExpr= Extent=[33:9 - 33:33] -// CHECK: 33:9: UnexposedExpr= Extent=[33:9 - 33:19] +// CHECK: 32:28: IntegerLiteral= Extent=[32:28 - 32:33] +// CHECK: 33:9: BinaryOperator= Extent=[33:9 - 33:33] +// CHECK: 33:9: BinaryOperator= Extent=[33:9 - 33:19] // CHECK: 33:9: DeclRefExpr=c:2:14 Extent=[33:9 - 33:10] // CHECK: 33:14: UnexposedExpr= Extent=[33:14 - 33:19] -// CHECK: 33:14: UnexposedExpr= Extent=[33:14 - 33:19] -// CHECK: 33:23: UnexposedExpr= Extent=[33:23 - 33:33] +// CHECK: 33:14: IntegerLiteral= Extent=[33:14 - 33:19] +// CHECK: 33:23: BinaryOperator= Extent=[33:23 - 33:33] // CHECK: 33:23: DeclRefExpr=c:2:14 Extent=[33:23 - 33:24] // CHECK: 33:28: UnexposedExpr= Extent=[33:28 - 33:33] -// CHECK: 33:28: UnexposedExpr= Extent=[33:28 - 33:33] -// CHECK: 34:9: UnexposedExpr= Extent=[34:9 - 34:33] -// CHECK: 34:9: UnexposedExpr= Extent=[34:9 - 34:19] +// CHECK: 33:28: IntegerLiteral= Extent=[33:28 - 33:33] +// CHECK: 34:9: BinaryOperator= Extent=[34:9 - 34:33] +// CHECK: 34:9: BinaryOperator= Extent=[34:9 - 34:19] // CHECK: 34:9: DeclRefExpr=c:2:14 Extent=[34:9 - 34:10] // CHECK: 34:14: UnexposedExpr= Extent=[34:14 - 34:19] -// CHECK: 34:14: UnexposedExpr= Extent=[34:14 - 34:19] -// CHECK: 34:23: UnexposedExpr= Extent=[34:23 - 34:33] +// CHECK: 34:14: IntegerLiteral= Extent=[34:14 - 34:19] +// CHECK: 34:23: BinaryOperator= Extent=[34:23 - 34:33] // CHECK: 34:23: DeclRefExpr=c:2:14 Extent=[34:23 - 34:24] // CHECK: 34:28: UnexposedExpr= Extent=[34:28 - 34:33] -// CHECK: 34:28: UnexposedExpr= Extent=[34:28 - 34:33] -// CHECK: 35:8: UnexposedExpr= Extent=[35:8 - 35:18] +// CHECK: 34:28: IntegerLiteral= Extent=[34:28 - 34:33] +// CHECK: 35:8: BinaryOperator= Extent=[35:8 - 35:18] // CHECK: 35:8: DeclRefExpr=c:2:14 Extent=[35:8 - 35:9] // CHECK: 35:13: UnexposedExpr= Extent=[35:13 - 35:18] -// CHECK: 35:13: UnexposedExpr= Extent=[35:13 - 35:18] -// CHECK: 35:23: UnexposedExpr= Extent=[35:23 - 35:47] -// CHECK: 35:23: UnexposedExpr= Extent=[35:23 - 35:33] +// CHECK: 35:13: IntegerLiteral= Extent=[35:13 - 35:18] +// CHECK: 35:23: BinaryOperator= Extent=[35:23 - 35:47] +// CHECK: 35:23: BinaryOperator= Extent=[35:23 - 35:33] // CHECK: 35:23: DeclRefExpr=c:2:14 Extent=[35:23 - 35:24] // CHECK: 35:28: UnexposedExpr= Extent=[35:28 - 35:33] -// CHECK: 35:28: UnexposedExpr= Extent=[35:28 - 35:33] -// CHECK: 35:37: UnexposedExpr= Extent=[35:37 - 35:47] +// CHECK: 35:28: IntegerLiteral= Extent=[35:28 - 35:33] +// CHECK: 35:37: BinaryOperator= Extent=[35:37 - 35:47] // CHECK: 35:37: DeclRefExpr=c:2:14 Extent=[35:37 - 35:38] // CHECK: 35:42: UnexposedExpr= Extent=[35:42 - 35:47] -// CHECK: 35:42: UnexposedExpr= Extent=[35:42 - 35:47] -// CHECK: 36:9: UnexposedExpr= Extent=[36:9 - 36:33] -// CHECK: 36:9: UnexposedExpr= Extent=[36:9 - 36:19] +// CHECK: 35:42: IntegerLiteral= Extent=[35:42 - 35:47] +// CHECK: 36:9: BinaryOperator= Extent=[36:9 - 36:33] +// CHECK: 36:9: BinaryOperator= Extent=[36:9 - 36:19] // CHECK: 36:9: DeclRefExpr=c:2:14 Extent=[36:9 - 36:10] // CHECK: 36:14: UnexposedExpr= Extent=[36:14 - 36:19] -// CHECK: 36:14: UnexposedExpr= Extent=[36:14 - 36:19] -// CHECK: 36:23: UnexposedExpr= Extent=[36:23 - 36:33] +// CHECK: 36:14: IntegerLiteral= Extent=[36:14 - 36:19] +// CHECK: 36:23: BinaryOperator= Extent=[36:23 - 36:33] // CHECK: 36:23: DeclRefExpr=c:2:14 Extent=[36:23 - 36:24] // CHECK: 36:28: UnexposedExpr= Extent=[36:28 - 36:33] -// CHECK: 36:28: UnexposedExpr= Extent=[36:28 - 36:33] -// CHECK: 37:9: UnexposedExpr= Extent=[37:9 - 37:33] -// CHECK: 37:9: UnexposedExpr= Extent=[37:9 - 37:19] +// CHECK: 36:28: IntegerLiteral= Extent=[36:28 - 36:33] +// CHECK: 37:9: BinaryOperator= Extent=[37:9 - 37:33] +// CHECK: 37:9: BinaryOperator= Extent=[37:9 - 37:19] // CHECK: 37:9: DeclRefExpr=c:2:14 Extent=[37:9 - 37:10] // CHECK: 37:14: UnexposedExpr= Extent=[37:14 - 37:19] -// CHECK: 37:14: UnexposedExpr= Extent=[37:14 - 37:19] -// CHECK: 37:23: UnexposedExpr= Extent=[37:23 - 37:33] +// CHECK: 37:14: IntegerLiteral= Extent=[37:14 - 37:19] +// CHECK: 37:23: BinaryOperator= Extent=[37:23 - 37:33] // CHECK: 37:23: DeclRefExpr=c:2:14 Extent=[37:23 - 37:24] // CHECK: 37:28: UnexposedExpr= Extent=[37:28 - 37:33] -// CHECK: 37:28: UnexposedExpr= Extent=[37:28 - 37:33] -// CHECK: 38:9: UnexposedExpr= Extent=[38:9 - 38:33] -// CHECK: 38:9: UnexposedExpr= Extent=[38:9 - 38:19] +// CHECK: 37:28: IntegerLiteral= Extent=[37:28 - 37:33] +// CHECK: 38:9: BinaryOperator= Extent=[38:9 - 38:33] +// CHECK: 38:9: BinaryOperator= Extent=[38:9 - 38:19] // CHECK: 38:9: DeclRefExpr=c:2:14 Extent=[38:9 - 38:10] // CHECK: 38:14: UnexposedExpr= Extent=[38:14 - 38:19] -// CHECK: 38:14: UnexposedExpr= Extent=[38:14 - 38:19] -// CHECK: 38:23: UnexposedExpr= Extent=[38:23 - 38:33] +// CHECK: 38:14: IntegerLiteral= Extent=[38:14 - 38:19] +// CHECK: 38:23: BinaryOperator= Extent=[38:23 - 38:33] // CHECK: 38:23: DeclRefExpr=c:2:14 Extent=[38:23 - 38:24] // CHECK: 38:28: UnexposedExpr= Extent=[38:28 - 38:33] -// CHECK: 38:28: UnexposedExpr= Extent=[38:28 - 38:33] -// CHECK: 39:9: UnexposedExpr= Extent=[39:9 - 39:33] -// CHECK: 39:9: UnexposedExpr= Extent=[39:9 - 39:19] +// CHECK: 38:28: IntegerLiteral= Extent=[38:28 - 38:33] +// CHECK: 39:9: BinaryOperator= Extent=[39:9 - 39:33] +// CHECK: 39:9: BinaryOperator= Extent=[39:9 - 39:19] // CHECK: 39:9: DeclRefExpr=c:2:14 Extent=[39:9 - 39:10] // CHECK: 39:14: UnexposedExpr= Extent=[39:14 - 39:19] -// CHECK: 39:14: UnexposedExpr= Extent=[39:14 - 39:19] -// CHECK: 39:23: UnexposedExpr= Extent=[39:23 - 39:33] +// CHECK: 39:14: IntegerLiteral= Extent=[39:14 - 39:19] +// CHECK: 39:23: BinaryOperator= Extent=[39:23 - 39:33] // CHECK: 39:23: DeclRefExpr=c:2:14 Extent=[39:23 - 39:24] // CHECK: 39:28: UnexposedExpr= Extent=[39:28 - 39:33] -// CHECK: 39:28: UnexposedExpr= Extent=[39:28 - 39:33] -// CHECK: 40:9: UnexposedExpr= Extent=[40:9 - 40:33] -// CHECK: 40:9: UnexposedExpr= Extent=[40:9 - 40:19] +// CHECK: 39:28: IntegerLiteral= Extent=[39:28 - 39:33] +// CHECK: 40:9: BinaryOperator= Extent=[40:9 - 40:33] +// CHECK: 40:9: BinaryOperator= Extent=[40:9 - 40:19] // CHECK: 40:9: DeclRefExpr=c:2:14 Extent=[40:9 - 40:10] // CHECK: 40:14: UnexposedExpr= Extent=[40:14 - 40:19] -// CHECK: 40:14: UnexposedExpr= Extent=[40:14 - 40:19] -// CHECK: 40:23: UnexposedExpr= Extent=[40:23 - 40:33] +// CHECK: 40:14: IntegerLiteral= Extent=[40:14 - 40:19] +// CHECK: 40:23: BinaryOperator= Extent=[40:23 - 40:33] // CHECK: 40:23: DeclRefExpr=c:2:14 Extent=[40:23 - 40:24] // CHECK: 40:28: UnexposedExpr= Extent=[40:28 - 40:33] -// CHECK: 40:28: UnexposedExpr= Extent=[40:28 - 40:33] -// CHECK: 41:9: UnexposedExpr= Extent=[41:9 - 41:33] -// CHECK: 41:9: UnexposedExpr= Extent=[41:9 - 41:19] +// CHECK: 40:28: IntegerLiteral= Extent=[40:28 - 40:33] +// CHECK: 41:9: BinaryOperator= Extent=[41:9 - 41:33] +// CHECK: 41:9: BinaryOperator= Extent=[41:9 - 41:19] // CHECK: 41:9: DeclRefExpr=c:2:14 Extent=[41:9 - 41:10] // CHECK: 41:14: UnexposedExpr= Extent=[41:14 - 41:19] -// CHECK: 41:14: UnexposedExpr= Extent=[41:14 - 41:19] -// CHECK: 41:23: UnexposedExpr= Extent=[41:23 - 41:33] +// CHECK: 41:14: IntegerLiteral= Extent=[41:14 - 41:19] +// CHECK: 41:23: BinaryOperator= Extent=[41:23 - 41:33] // CHECK: 41:23: DeclRefExpr=c:2:14 Extent=[41:23 - 41:24] // CHECK: 41:28: UnexposedExpr= Extent=[41:28 - 41:33] -// CHECK: 41:28: UnexposedExpr= Extent=[41:28 - 41:33] -// CHECK: 42:9: UnexposedExpr= Extent=[42:9 - 42:33] -// CHECK: 42:9: UnexposedExpr= Extent=[42:9 - 42:19] +// CHECK: 41:28: IntegerLiteral= Extent=[41:28 - 41:33] +// CHECK: 42:9: BinaryOperator= Extent=[42:9 - 42:33] +// CHECK: 42:9: BinaryOperator= Extent=[42:9 - 42:19] // CHECK: 42:9: DeclRefExpr=c:2:14 Extent=[42:9 - 42:10] // CHECK: 42:14: UnexposedExpr= Extent=[42:14 - 42:19] -// CHECK: 42:14: UnexposedExpr= Extent=[42:14 - 42:19] -// CHECK: 42:23: UnexposedExpr= Extent=[42:23 - 42:33] +// CHECK: 42:14: IntegerLiteral= Extent=[42:14 - 42:19] +// CHECK: 42:23: BinaryOperator= Extent=[42:23 - 42:33] // CHECK: 42:23: DeclRefExpr=c:2:14 Extent=[42:23 - 42:24] // CHECK: 42:28: UnexposedExpr= Extent=[42:28 - 42:33] -// CHECK: 42:28: UnexposedExpr= Extent=[42:28 - 42:33] -// CHECK: 43:9: UnexposedExpr= Extent=[43:9 - 43:33] -// CHECK: 43:9: UnexposedExpr= Extent=[43:9 - 43:19] +// CHECK: 42:28: IntegerLiteral= Extent=[42:28 - 42:33] +// CHECK: 43:9: BinaryOperator= Extent=[43:9 - 43:33] +// CHECK: 43:9: BinaryOperator= Extent=[43:9 - 43:19] // CHECK: 43:9: DeclRefExpr=c:2:14 Extent=[43:9 - 43:10] // CHECK: 43:14: UnexposedExpr= Extent=[43:14 - 43:19] -// CHECK: 43:14: UnexposedExpr= Extent=[43:14 - 43:19] -// CHECK: 43:23: UnexposedExpr= Extent=[43:23 - 43:33] +// CHECK: 43:14: IntegerLiteral= Extent=[43:14 - 43:19] +// CHECK: 43:23: BinaryOperator= Extent=[43:23 - 43:33] // CHECK: 43:23: DeclRefExpr=c:2:14 Extent=[43:23 - 43:24] // CHECK: 43:28: UnexposedExpr= Extent=[43:28 - 43:33] -// CHECK: 43:28: UnexposedExpr= Extent=[43:28 - 43:33] -// CHECK: 44:8: UnexposedExpr= Extent=[44:8 - 44:18] +// CHECK: 43:28: IntegerLiteral= Extent=[43:28 - 43:33] +// CHECK: 44:8: BinaryOperator= Extent=[44:8 - 44:18] // CHECK: 44:8: DeclRefExpr=c:2:14 Extent=[44:8 - 44:9] // CHECK: 44:13: UnexposedExpr= Extent=[44:13 - 44:18] -// CHECK: 44:13: UnexposedExpr= Extent=[44:13 - 44:18] -// CHECK: 44:23: UnexposedExpr= Extent=[44:23 - 44:47] -// CHECK: 44:23: UnexposedExpr= Extent=[44:23 - 44:33] +// CHECK: 44:13: IntegerLiteral= Extent=[44:13 - 44:18] +// CHECK: 44:23: BinaryOperator= Extent=[44:23 - 44:47] +// CHECK: 44:23: BinaryOperator= Extent=[44:23 - 44:33] // CHECK: 44:23: DeclRefExpr=c:2:14 Extent=[44:23 - 44:24] // CHECK: 44:28: UnexposedExpr= Extent=[44:28 - 44:33] -// CHECK: 44:28: UnexposedExpr= Extent=[44:28 - 44:33] -// CHECK: 44:37: UnexposedExpr= Extent=[44:37 - 44:47] +// CHECK: 44:28: IntegerLiteral= Extent=[44:28 - 44:33] +// CHECK: 44:37: BinaryOperator= Extent=[44:37 - 44:47] // CHECK: 44:37: DeclRefExpr=c:2:14 Extent=[44:37 - 44:38] // CHECK: 44:42: UnexposedExpr= Extent=[44:42 - 44:47] -// CHECK: 44:42: UnexposedExpr= Extent=[44:42 - 44:47] -// CHECK: 45:9: UnexposedExpr= Extent=[45:9 - 45:33] -// CHECK: 45:9: UnexposedExpr= Extent=[45:9 - 45:19] +// CHECK: 44:42: IntegerLiteral= Extent=[44:42 - 44:47] +// CHECK: 45:9: BinaryOperator= Extent=[45:9 - 45:33] +// CHECK: 45:9: BinaryOperator= Extent=[45:9 - 45:19] // CHECK: 45:9: DeclRefExpr=c:2:14 Extent=[45:9 - 45:10] // CHECK: 45:14: UnexposedExpr= Extent=[45:14 - 45:19] -// CHECK: 45:14: UnexposedExpr= Extent=[45:14 - 45:19] -// CHECK: 45:23: UnexposedExpr= Extent=[45:23 - 45:33] +// CHECK: 45:14: IntegerLiteral= Extent=[45:14 - 45:19] +// CHECK: 45:23: BinaryOperator= Extent=[45:23 - 45:33] // CHECK: 45:23: DeclRefExpr=c:2:14 Extent=[45:23 - 45:24] // CHECK: 45:28: UnexposedExpr= Extent=[45:28 - 45:33] -// CHECK: 45:28: UnexposedExpr= Extent=[45:28 - 45:33] -// CHECK: 46:8: UnexposedExpr= Extent=[46:8 - 46:18] +// CHECK: 45:28: IntegerLiteral= Extent=[45:28 - 45:33] +// CHECK: 46:8: BinaryOperator= Extent=[46:8 - 46:18] // CHECK: 46:8: DeclRefExpr=c:2:14 Extent=[46:8 - 46:9] // CHECK: 46:13: UnexposedExpr= Extent=[46:13 - 46:18] -// CHECK: 46:13: UnexposedExpr= Extent=[46:13 - 46:18] -// CHECK: 46:23: UnexposedExpr= Extent=[46:23 - 46:47] -// CHECK: 46:23: UnexposedExpr= Extent=[46:23 - 46:33] +// CHECK: 46:13: IntegerLiteral= Extent=[46:13 - 46:18] +// CHECK: 46:23: BinaryOperator= Extent=[46:23 - 46:47] +// CHECK: 46:23: BinaryOperator= Extent=[46:23 - 46:33] // CHECK: 46:23: DeclRefExpr=c:2:14 Extent=[46:23 - 46:24] // CHECK: 46:28: UnexposedExpr= Extent=[46:28 - 46:33] -// CHECK: 46:28: UnexposedExpr= Extent=[46:28 - 46:33] -// CHECK: 46:37: UnexposedExpr= Extent=[46:37 - 46:47] +// CHECK: 46:28: IntegerLiteral= Extent=[46:28 - 46:33] +// CHECK: 46:37: BinaryOperator= Extent=[46:37 - 46:47] // CHECK: 46:37: DeclRefExpr=c:2:14 Extent=[46:37 - 46:38] // CHECK: 46:42: UnexposedExpr= Extent=[46:42 - 46:47] -// CHECK: 46:42: UnexposedExpr= Extent=[46:42 - 46:47] -// CHECK: 47:9: UnexposedExpr= Extent=[47:9 - 47:33] -// CHECK: 47:9: UnexposedExpr= Extent=[47:9 - 47:19] +// CHECK: 46:42: IntegerLiteral= Extent=[46:42 - 46:47] +// CHECK: 47:9: BinaryOperator= Extent=[47:9 - 47:33] +// CHECK: 47:9: BinaryOperator= Extent=[47:9 - 47:19] // CHECK: 47:9: DeclRefExpr=c:2:14 Extent=[47:9 - 47:10] // CHECK: 47:14: UnexposedExpr= Extent=[47:14 - 47:19] -// CHECK: 47:14: UnexposedExpr= Extent=[47:14 - 47:19] -// CHECK: 47:23: UnexposedExpr= Extent=[47:23 - 47:33] +// CHECK: 47:14: IntegerLiteral= Extent=[47:14 - 47:19] +// CHECK: 47:23: BinaryOperator= Extent=[47:23 - 47:33] // CHECK: 47:23: DeclRefExpr=c:2:14 Extent=[47:23 - 47:24] // CHECK: 47:28: UnexposedExpr= Extent=[47:28 - 47:33] -// CHECK: 47:28: UnexposedExpr= Extent=[47:28 - 47:33] -// CHECK: 48:9: UnexposedExpr= Extent=[48:9 - 48:33] -// CHECK: 48:9: UnexposedExpr= Extent=[48:9 - 48:19] +// CHECK: 47:28: IntegerLiteral= Extent=[47:28 - 47:33] +// CHECK: 48:9: BinaryOperator= Extent=[48:9 - 48:33] +// CHECK: 48:9: BinaryOperator= Extent=[48:9 - 48:19] // CHECK: 48:9: DeclRefExpr=c:2:14 Extent=[48:9 - 48:10] // CHECK: 48:14: UnexposedExpr= Extent=[48:14 - 48:19] -// CHECK: 48:14: UnexposedExpr= Extent=[48:14 - 48:19] -// CHECK: 48:23: UnexposedExpr= Extent=[48:23 - 48:33] +// CHECK: 48:14: IntegerLiteral= Extent=[48:14 - 48:19] +// CHECK: 48:23: BinaryOperator= Extent=[48:23 - 48:33] // CHECK: 48:23: DeclRefExpr=c:2:14 Extent=[48:23 - 48:24] // CHECK: 48:28: UnexposedExpr= Extent=[48:28 - 48:33] -// CHECK: 48:28: UnexposedExpr= Extent=[48:28 - 48:33] -// CHECK: 49:9: UnexposedExpr= Extent=[49:9 - 49:33] -// CHECK: 49:9: UnexposedExpr= Extent=[49:9 - 49:19] +// CHECK: 48:28: IntegerLiteral= Extent=[48:28 - 48:33] +// CHECK: 49:9: BinaryOperator= Extent=[49:9 - 49:33] +// CHECK: 49:9: BinaryOperator= Extent=[49:9 - 49:19] // CHECK: 49:9: DeclRefExpr=c:2:14 Extent=[49:9 - 49:10] // CHECK: 49:14: UnexposedExpr= Extent=[49:14 - 49:19] -// CHECK: 49:14: UnexposedExpr= Extent=[49:14 - 49:19] -// CHECK: 49:23: UnexposedExpr= Extent=[49:23 - 49:33] +// CHECK: 49:14: IntegerLiteral= Extent=[49:14 - 49:19] +// CHECK: 49:23: BinaryOperator= Extent=[49:23 - 49:33] // CHECK: 49:23: DeclRefExpr=c:2:14 Extent=[49:23 - 49:24] // CHECK: 49:28: UnexposedExpr= Extent=[49:28 - 49:33] -// CHECK: 49:28: UnexposedExpr= Extent=[49:28 - 49:33] -// CHECK: 50:9: UnexposedExpr= Extent=[50:9 - 50:33] -// CHECK: 50:9: UnexposedExpr= Extent=[50:9 - 50:19] +// CHECK: 49:28: IntegerLiteral= Extent=[49:28 - 49:33] +// CHECK: 50:9: BinaryOperator= Extent=[50:9 - 50:33] +// CHECK: 50:9: BinaryOperator= Extent=[50:9 - 50:19] // CHECK: 50:9: DeclRefExpr=c:2:14 Extent=[50:9 - 50:10] // CHECK: 50:14: UnexposedExpr= Extent=[50:14 - 50:19] -// CHECK: 50:14: UnexposedExpr= Extent=[50:14 - 50:19] -// CHECK: 50:23: UnexposedExpr= Extent=[50:23 - 50:33] +// CHECK: 50:14: IntegerLiteral= Extent=[50:14 - 50:19] +// CHECK: 50:23: BinaryOperator= Extent=[50:23 - 50:33] // CHECK: 50:23: DeclRefExpr=c:2:14 Extent=[50:23 - 50:24] // CHECK: 50:28: UnexposedExpr= Extent=[50:28 - 50:33] -// CHECK: 50:28: UnexposedExpr= Extent=[50:28 - 50:33] -// CHECK: 51:8: UnexposedExpr= Extent=[51:8 - 51:18] +// CHECK: 50:28: IntegerLiteral= Extent=[50:28 - 50:33] +// CHECK: 51:8: BinaryOperator= Extent=[51:8 - 51:18] // CHECK: 51:8: DeclRefExpr=c:2:14 Extent=[51:8 - 51:9] // CHECK: 51:13: UnexposedExpr= Extent=[51:13 - 51:18] -// CHECK: 51:13: UnexposedExpr= Extent=[51:13 - 51:18] -// CHECK: 51:23: UnexposedExpr= Extent=[51:23 - 51:47] -// CHECK: 51:23: UnexposedExpr= Extent=[51:23 - 51:33] +// CHECK: 51:13: IntegerLiteral= Extent=[51:13 - 51:18] +// CHECK: 51:23: BinaryOperator= Extent=[51:23 - 51:47] +// CHECK: 51:23: BinaryOperator= Extent=[51:23 - 51:33] // CHECK: 51:23: DeclRefExpr=c:2:14 Extent=[51:23 - 51:24] // CHECK: 51:28: UnexposedExpr= Extent=[51:28 - 51:33] -// CHECK: 51:28: UnexposedExpr= Extent=[51:28 - 51:33] -// CHECK: 51:37: UnexposedExpr= Extent=[51:37 - 51:47] +// CHECK: 51:28: IntegerLiteral= Extent=[51:28 - 51:33] +// CHECK: 51:37: BinaryOperator= Extent=[51:37 - 51:47] // CHECK: 51:37: DeclRefExpr=c:2:14 Extent=[51:37 - 51:38] // CHECK: 51:42: UnexposedExpr= Extent=[51:42 - 51:47] -// CHECK: 51:42: UnexposedExpr= Extent=[51:42 - 51:47] -// CHECK: 52:9: UnexposedExpr= Extent=[52:9 - 52:33] -// CHECK: 52:9: UnexposedExpr= Extent=[52:9 - 52:19] +// CHECK: 51:42: IntegerLiteral= Extent=[51:42 - 51:47] +// CHECK: 52:9: BinaryOperator= Extent=[52:9 - 52:33] +// CHECK: 52:9: BinaryOperator= Extent=[52:9 - 52:19] // CHECK: 52:9: DeclRefExpr=c:2:14 Extent=[52:9 - 52:10] // CHECK: 52:14: UnexposedExpr= Extent=[52:14 - 52:19] -// CHECK: 52:14: UnexposedExpr= Extent=[52:14 - 52:19] -// CHECK: 52:23: UnexposedExpr= Extent=[52:23 - 52:33] +// CHECK: 52:14: IntegerLiteral= Extent=[52:14 - 52:19] +// CHECK: 52:23: BinaryOperator= Extent=[52:23 - 52:33] // CHECK: 52:23: DeclRefExpr=c:2:14 Extent=[52:23 - 52:24] // CHECK: 52:28: UnexposedExpr= Extent=[52:28 - 52:33] -// CHECK: 52:28: UnexposedExpr= Extent=[52:28 - 52:33] -// CHECK: 53:9: UnexposedExpr= Extent=[53:9 - 53:33] -// CHECK: 53:9: UnexposedExpr= Extent=[53:9 - 53:19] +// CHECK: 52:28: IntegerLiteral= Extent=[52:28 - 52:33] +// CHECK: 53:9: BinaryOperator= Extent=[53:9 - 53:33] +// CHECK: 53:9: BinaryOperator= Extent=[53:9 - 53:19] // CHECK: 53:9: DeclRefExpr=c:2:14 Extent=[53:9 - 53:10] // CHECK: 53:14: UnexposedExpr= Extent=[53:14 - 53:19] -// CHECK: 53:14: UnexposedExpr= Extent=[53:14 - 53:19] -// CHECK: 53:23: UnexposedExpr= Extent=[53:23 - 53:33] +// CHECK: 53:14: IntegerLiteral= Extent=[53:14 - 53:19] +// CHECK: 53:23: BinaryOperator= Extent=[53:23 - 53:33] // CHECK: 53:23: DeclRefExpr=c:2:14 Extent=[53:23 - 53:24] // CHECK: 53:28: UnexposedExpr= Extent=[53:28 - 53:33] -// CHECK: 53:28: UnexposedExpr= Extent=[53:28 - 53:33] -// CHECK: 54:9: UnexposedExpr= Extent=[54:9 - 54:33] -// CHECK: 54:9: UnexposedExpr= Extent=[54:9 - 54:19] +// CHECK: 53:28: IntegerLiteral= Extent=[53:28 - 53:33] +// CHECK: 54:9: BinaryOperator= Extent=[54:9 - 54:33] +// CHECK: 54:9: BinaryOperator= Extent=[54:9 - 54:19] // CHECK: 54:9: DeclRefExpr=c:2:14 Extent=[54:9 - 54:10] // CHECK: 54:14: UnexposedExpr= Extent=[54:14 - 54:19] -// CHECK: 54:14: UnexposedExpr= Extent=[54:14 - 54:19] -// CHECK: 54:23: UnexposedExpr= Extent=[54:23 - 54:33] +// CHECK: 54:14: IntegerLiteral= Extent=[54:14 - 54:19] +// CHECK: 54:23: BinaryOperator= Extent=[54:23 - 54:33] // CHECK: 54:23: DeclRefExpr=c:2:14 Extent=[54:23 - 54:24] // CHECK: 54:28: UnexposedExpr= Extent=[54:28 - 54:33] -// CHECK: 54:28: UnexposedExpr= Extent=[54:28 - 54:33] -// CHECK: 55:9: UnexposedExpr= Extent=[55:9 - 55:33] -// CHECK: 55:9: UnexposedExpr= Extent=[55:9 - 55:19] +// CHECK: 54:28: IntegerLiteral= Extent=[54:28 - 54:33] +// CHECK: 55:9: BinaryOperator= Extent=[55:9 - 55:33] +// CHECK: 55:9: BinaryOperator= Extent=[55:9 - 55:19] // CHECK: 55:9: DeclRefExpr=c:2:14 Extent=[55:9 - 55:10] // CHECK: 55:14: UnexposedExpr= Extent=[55:14 - 55:19] -// CHECK: 55:14: UnexposedExpr= Extent=[55:14 - 55:19] -// CHECK: 55:23: UnexposedExpr= Extent=[55:23 - 55:33] +// CHECK: 55:14: IntegerLiteral= Extent=[55:14 - 55:19] +// CHECK: 55:23: BinaryOperator= Extent=[55:23 - 55:33] // CHECK: 55:23: DeclRefExpr=c:2:14 Extent=[55:23 - 55:24] // CHECK: 55:28: UnexposedExpr= Extent=[55:28 - 55:33] -// CHECK: 55:28: UnexposedExpr= Extent=[55:28 - 55:33] -// CHECK: 56:9: UnexposedExpr= Extent=[56:9 - 56:33] -// CHECK: 56:9: UnexposedExpr= Extent=[56:9 - 56:19] +// CHECK: 55:28: IntegerLiteral= Extent=[55:28 - 55:33] +// CHECK: 56:9: BinaryOperator= Extent=[56:9 - 56:33] +// CHECK: 56:9: BinaryOperator= Extent=[56:9 - 56:19] // CHECK: 56:9: DeclRefExpr=c:2:14 Extent=[56:9 - 56:10] // CHECK: 56:14: UnexposedExpr= Extent=[56:14 - 56:19] -// CHECK: 56:14: UnexposedExpr= Extent=[56:14 - 56:19] -// CHECK: 56:23: UnexposedExpr= Extent=[56:23 - 56:33] +// CHECK: 56:14: IntegerLiteral= Extent=[56:14 - 56:19] +// CHECK: 56:23: BinaryOperator= Extent=[56:23 - 56:33] // CHECK: 56:23: DeclRefExpr=c:2:14 Extent=[56:23 - 56:24] // CHECK: 56:28: UnexposedExpr= Extent=[56:28 - 56:33] -// CHECK: 56:28: UnexposedExpr= Extent=[56:28 - 56:33] -// CHECK: 57:9: UnexposedExpr= Extent=[57:9 - 57:33] -// CHECK: 57:9: UnexposedExpr= Extent=[57:9 - 57:19] +// CHECK: 56:28: IntegerLiteral= Extent=[56:28 - 56:33] +// CHECK: 57:9: BinaryOperator= Extent=[57:9 - 57:33] +// CHECK: 57:9: BinaryOperator= Extent=[57:9 - 57:19] // CHECK: 57:9: DeclRefExpr=c:2:14 Extent=[57:9 - 57:10] // CHECK: 57:14: UnexposedExpr= Extent=[57:14 - 57:19] -// CHECK: 57:14: UnexposedExpr= Extent=[57:14 - 57:19] -// CHECK: 57:23: UnexposedExpr= Extent=[57:23 - 57:33] +// CHECK: 57:14: IntegerLiteral= Extent=[57:14 - 57:19] +// CHECK: 57:23: BinaryOperator= Extent=[57:23 - 57:33] // CHECK: 57:23: DeclRefExpr=c:2:14 Extent=[57:23 - 57:24] // CHECK: 57:28: UnexposedExpr= Extent=[57:28 - 57:33] -// CHECK: 57:28: UnexposedExpr= Extent=[57:28 - 57:33] -// CHECK: 58:9: UnexposedExpr= Extent=[58:9 - 58:33] -// CHECK: 58:9: UnexposedExpr= Extent=[58:9 - 58:19] +// CHECK: 57:28: IntegerLiteral= Extent=[57:28 - 57:33] +// CHECK: 58:9: BinaryOperator= Extent=[58:9 - 58:33] +// CHECK: 58:9: BinaryOperator= Extent=[58:9 - 58:19] // CHECK: 58:9: DeclRefExpr=c:2:14 Extent=[58:9 - 58:10] // CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:19] -// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:19] -// CHECK: 58:23: UnexposedExpr= Extent=[58:23 - 58:33] +// CHECK: 58:14: IntegerLiteral= Extent=[58:14 - 58:19] +// CHECK: 58:23: BinaryOperator= Extent=[58:23 - 58:33] // CHECK: 58:23: DeclRefExpr=c:2:14 Extent=[58:23 - 58:24] // CHECK: 58:28: UnexposedExpr= Extent=[58:28 - 58:33] -// CHECK: 58:28: UnexposedExpr= Extent=[58:28 - 58:33] -// CHECK: 59:9: UnexposedExpr= Extent=[59:9 - 59:33] -// CHECK: 59:9: UnexposedExpr= Extent=[59:9 - 59:19] +// CHECK: 58:28: IntegerLiteral= Extent=[58:28 - 58:33] +// CHECK: 59:9: BinaryOperator= Extent=[59:9 - 59:33] +// CHECK: 59:9: BinaryOperator= Extent=[59:9 - 59:19] // CHECK: 59:9: DeclRefExpr=c:2:14 Extent=[59:9 - 59:10] // CHECK: 59:14: UnexposedExpr= Extent=[59:14 - 59:19] -// CHECK: 59:14: UnexposedExpr= Extent=[59:14 - 59:19] -// CHECK: 59:23: UnexposedExpr= Extent=[59:23 - 59:33] +// CHECK: 59:14: IntegerLiteral= Extent=[59:14 - 59:19] +// CHECK: 59:23: BinaryOperator= Extent=[59:23 - 59:33] // CHECK: 59:23: DeclRefExpr=c:2:14 Extent=[59:23 - 59:24] // CHECK: 59:28: UnexposedExpr= Extent=[59:28 - 59:33] -// CHECK: 59:28: UnexposedExpr= Extent=[59:28 - 59:33] -// CHECK: 60:9: UnexposedExpr= Extent=[60:9 - 60:33] -// CHECK: 60:9: UnexposedExpr= Extent=[60:9 - 60:19] +// CHECK: 59:28: IntegerLiteral= Extent=[59:28 - 59:33] +// CHECK: 60:9: BinaryOperator= Extent=[60:9 - 60:33] +// CHECK: 60:9: BinaryOperator= Extent=[60:9 - 60:19] // CHECK: 60:9: DeclRefExpr=c:2:14 Extent=[60:9 - 60:10] // CHECK: 60:14: UnexposedExpr= Extent=[60:14 - 60:19] -// CHECK: 60:14: UnexposedExpr= Extent=[60:14 - 60:19] -// CHECK: 60:23: UnexposedExpr= Extent=[60:23 - 60:33] +// CHECK: 60:14: IntegerLiteral= Extent=[60:14 - 60:19] +// CHECK: 60:23: BinaryOperator= Extent=[60:23 - 60:33] // CHECK: 60:23: DeclRefExpr=c:2:14 Extent=[60:23 - 60:24] // CHECK: 60:28: UnexposedExpr= Extent=[60:28 - 60:33] -// CHECK: 60:28: UnexposedExpr= Extent=[60:28 - 60:33] -// CHECK: 61:9: UnexposedExpr= Extent=[61:9 - 61:33] -// CHECK: 61:9: UnexposedExpr= Extent=[61:9 - 61:19] +// CHECK: 60:28: IntegerLiteral= Extent=[60:28 - 60:33] +// CHECK: 61:9: BinaryOperator= Extent=[61:9 - 61:33] +// CHECK: 61:9: BinaryOperator= Extent=[61:9 - 61:19] // CHECK: 61:9: DeclRefExpr=c:2:14 Extent=[61:9 - 61:10] // CHECK: 61:14: UnexposedExpr= Extent=[61:14 - 61:19] -// CHECK: 61:14: UnexposedExpr= Extent=[61:14 - 61:19] -// CHECK: 61:23: UnexposedExpr= Extent=[61:23 - 61:33] +// CHECK: 61:14: IntegerLiteral= Extent=[61:14 - 61:19] +// CHECK: 61:23: BinaryOperator= Extent=[61:23 - 61:33] // CHECK: 61:23: DeclRefExpr=c:2:14 Extent=[61:23 - 61:24] // CHECK: 61:28: UnexposedExpr= Extent=[61:28 - 61:33] -// CHECK: 61:28: UnexposedExpr= Extent=[61:28 - 61:33] -// CHECK: 62:9: UnexposedExpr= Extent=[62:9 - 62:33] -// CHECK: 62:9: UnexposedExpr= Extent=[62:9 - 62:19] +// CHECK: 61:28: IntegerLiteral= Extent=[61:28 - 61:33] +// CHECK: 62:9: BinaryOperator= Extent=[62:9 - 62:33] +// CHECK: 62:9: BinaryOperator= Extent=[62:9 - 62:19] // CHECK: 62:9: DeclRefExpr=c:2:14 Extent=[62:9 - 62:10] // CHECK: 62:14: UnexposedExpr= Extent=[62:14 - 62:19] -// CHECK: 62:14: UnexposedExpr= Extent=[62:14 - 62:19] -// CHECK: 62:23: UnexposedExpr= Extent=[62:23 - 62:33] +// CHECK: 62:14: IntegerLiteral= Extent=[62:14 - 62:19] +// CHECK: 62:23: BinaryOperator= Extent=[62:23 - 62:33] // CHECK: 62:23: DeclRefExpr=c:2:14 Extent=[62:23 - 62:24] // CHECK: 62:28: UnexposedExpr= Extent=[62:28 - 62:33] -// CHECK: 62:28: UnexposedExpr= Extent=[62:28 - 62:33] -// CHECK: 63:8: UnexposedExpr= Extent=[63:8 - 63:18] +// CHECK: 62:28: IntegerLiteral= Extent=[62:28 - 62:33] +// CHECK: 63:8: BinaryOperator= Extent=[63:8 - 63:18] // CHECK: 63:8: DeclRefExpr=c:2:14 Extent=[63:8 - 63:9] // CHECK: 63:13: UnexposedExpr= Extent=[63:13 - 63:18] -// CHECK: 63:13: UnexposedExpr= Extent=[63:13 - 63:18] -// CHECK: 63:23: UnexposedExpr= Extent=[63:23 - 63:47] -// CHECK: 63:23: UnexposedExpr= Extent=[63:23 - 63:33] +// CHECK: 63:13: IntegerLiteral= Extent=[63:13 - 63:18] +// CHECK: 63:23: BinaryOperator= Extent=[63:23 - 63:47] +// CHECK: 63:23: BinaryOperator= Extent=[63:23 - 63:33] // CHECK: 63:23: DeclRefExpr=c:2:14 Extent=[63:23 - 63:24] // CHECK: 63:28: UnexposedExpr= Extent=[63:28 - 63:33] -// CHECK: 63:28: UnexposedExpr= Extent=[63:28 - 63:33] -// CHECK: 63:37: UnexposedExpr= Extent=[63:37 - 63:47] +// CHECK: 63:28: IntegerLiteral= Extent=[63:28 - 63:33] +// CHECK: 63:37: BinaryOperator= Extent=[63:37 - 63:47] // CHECK: 63:37: DeclRefExpr=c:2:14 Extent=[63:37 - 63:38] // CHECK: 63:42: UnexposedExpr= Extent=[63:42 - 63:47] -// CHECK: 63:42: UnexposedExpr= Extent=[63:42 - 63:47] -// CHECK: 64:9: UnexposedExpr= Extent=[64:9 - 64:33] -// CHECK: 64:9: UnexposedExpr= Extent=[64:9 - 64:19] +// CHECK: 63:42: IntegerLiteral= Extent=[63:42 - 63:47] +// CHECK: 64:9: BinaryOperator= Extent=[64:9 - 64:33] +// CHECK: 64:9: BinaryOperator= Extent=[64:9 - 64:19] // CHECK: 64:9: DeclRefExpr=c:2:14 Extent=[64:9 - 64:10] // CHECK: 64:14: UnexposedExpr= Extent=[64:14 - 64:19] -// CHECK: 64:14: UnexposedExpr= Extent=[64:14 - 64:19] -// CHECK: 64:23: UnexposedExpr= Extent=[64:23 - 64:33] +// CHECK: 64:14: IntegerLiteral= Extent=[64:14 - 64:19] +// CHECK: 64:23: BinaryOperator= Extent=[64:23 - 64:33] // CHECK: 64:23: DeclRefExpr=c:2:14 Extent=[64:23 - 64:24] // CHECK: 64:28: UnexposedExpr= Extent=[64:28 - 64:33] -// CHECK: 64:28: UnexposedExpr= Extent=[64:28 - 64:33] -// CHECK: 65:8: UnexposedExpr= Extent=[65:8 - 65:18] +// CHECK: 64:28: IntegerLiteral= Extent=[64:28 - 64:33] +// CHECK: 65:8: BinaryOperator= Extent=[65:8 - 65:18] // CHECK: 65:8: DeclRefExpr=c:2:14 Extent=[65:8 - 65:9] // CHECK: 65:13: UnexposedExpr= Extent=[65:13 - 65:18] -// CHECK: 65:13: UnexposedExpr= Extent=[65:13 - 65:18] -// CHECK: 65:23: UnexposedExpr= Extent=[65:23 - 65:47] -// CHECK: 65:23: UnexposedExpr= Extent=[65:23 - 65:33] +// CHECK: 65:13: IntegerLiteral= Extent=[65:13 - 65:18] +// CHECK: 65:23: BinaryOperator= Extent=[65:23 - 65:47] +// CHECK: 65:23: BinaryOperator= Extent=[65:23 - 65:33] // CHECK: 65:23: DeclRefExpr=c:2:14 Extent=[65:23 - 65:24] // CHECK: 65:28: UnexposedExpr= Extent=[65:28 - 65:33] -// CHECK: 65:28: UnexposedExpr= Extent=[65:28 - 65:33] -// CHECK: 65:37: UnexposedExpr= Extent=[65:37 - 65:47] +// CHECK: 65:28: IntegerLiteral= Extent=[65:28 - 65:33] +// CHECK: 65:37: BinaryOperator= Extent=[65:37 - 65:47] // CHECK: 65:37: DeclRefExpr=c:2:14 Extent=[65:37 - 65:38] // CHECK: 65:42: UnexposedExpr= Extent=[65:42 - 65:47] -// CHECK: 65:42: UnexposedExpr= Extent=[65:42 - 65:47] -// CHECK: 66:9: UnexposedExpr= Extent=[66:9 - 66:33] -// CHECK: 66:9: UnexposedExpr= Extent=[66:9 - 66:19] +// CHECK: 65:42: IntegerLiteral= Extent=[65:42 - 65:47] +// CHECK: 66:9: BinaryOperator= Extent=[66:9 - 66:33] +// CHECK: 66:9: BinaryOperator= Extent=[66:9 - 66:19] // CHECK: 66:9: DeclRefExpr=c:2:14 Extent=[66:9 - 66:10] // CHECK: 66:14: UnexposedExpr= Extent=[66:14 - 66:19] -// CHECK: 66:14: UnexposedExpr= Extent=[66:14 - 66:19] -// CHECK: 66:23: UnexposedExpr= Extent=[66:23 - 66:33] +// CHECK: 66:14: IntegerLiteral= Extent=[66:14 - 66:19] +// CHECK: 66:23: BinaryOperator= Extent=[66:23 - 66:33] // CHECK: 66:23: DeclRefExpr=c:2:14 Extent=[66:23 - 66:24] // CHECK: 66:28: UnexposedExpr= Extent=[66:28 - 66:33] -// CHECK: 66:28: UnexposedExpr= Extent=[66:28 - 66:33] -// CHECK: 67:9: UnexposedExpr= Extent=[67:9 - 67:33] -// CHECK: 67:9: UnexposedExpr= Extent=[67:9 - 67:19] +// CHECK: 66:28: IntegerLiteral= Extent=[66:28 - 66:33] +// CHECK: 67:9: BinaryOperator= Extent=[67:9 - 67:33] +// CHECK: 67:9: BinaryOperator= Extent=[67:9 - 67:19] // CHECK: 67:9: DeclRefExpr=c:2:14 Extent=[67:9 - 67:10] // CHECK: 67:14: UnexposedExpr= Extent=[67:14 - 67:19] -// CHECK: 67:14: UnexposedExpr= Extent=[67:14 - 67:19] -// CHECK: 67:23: UnexposedExpr= Extent=[67:23 - 67:33] +// CHECK: 67:14: IntegerLiteral= Extent=[67:14 - 67:19] +// CHECK: 67:23: BinaryOperator= Extent=[67:23 - 67:33] // CHECK: 67:23: DeclRefExpr=c:2:14 Extent=[67:23 - 67:24] // CHECK: 67:28: UnexposedExpr= Extent=[67:28 - 67:33] -// CHECK: 67:28: UnexposedExpr= Extent=[67:28 - 67:33] -// CHECK: 68:9: UnexposedExpr= Extent=[68:9 - 68:33] -// CHECK: 68:9: UnexposedExpr= Extent=[68:9 - 68:19] +// CHECK: 67:28: IntegerLiteral= Extent=[67:28 - 67:33] +// CHECK: 68:9: BinaryOperator= Extent=[68:9 - 68:33] +// CHECK: 68:9: BinaryOperator= Extent=[68:9 - 68:19] // CHECK: 68:9: DeclRefExpr=c:2:14 Extent=[68:9 - 68:10] // CHECK: 68:14: UnexposedExpr= Extent=[68:14 - 68:19] -// CHECK: 68:14: UnexposedExpr= Extent=[68:14 - 68:19] -// CHECK: 68:23: UnexposedExpr= Extent=[68:23 - 68:33] +// CHECK: 68:14: IntegerLiteral= Extent=[68:14 - 68:19] +// CHECK: 68:23: BinaryOperator= Extent=[68:23 - 68:33] // CHECK: 68:23: DeclRefExpr=c:2:14 Extent=[68:23 - 68:24] // CHECK: 68:28: UnexposedExpr= Extent=[68:28 - 68:33] -// CHECK: 68:28: UnexposedExpr= Extent=[68:28 - 68:33] -// CHECK: 69:9: UnexposedExpr= Extent=[69:9 - 69:33] -// CHECK: 69:9: UnexposedExpr= Extent=[69:9 - 69:19] +// CHECK: 68:28: IntegerLiteral= Extent=[68:28 - 68:33] +// CHECK: 69:9: BinaryOperator= Extent=[69:9 - 69:33] +// CHECK: 69:9: BinaryOperator= Extent=[69:9 - 69:19] // CHECK: 69:9: DeclRefExpr=c:2:14 Extent=[69:9 - 69:10] // CHECK: 69:14: UnexposedExpr= Extent=[69:14 - 69:19] -// CHECK: 69:14: UnexposedExpr= Extent=[69:14 - 69:19] -// CHECK: 69:23: UnexposedExpr= Extent=[69:23 - 69:33] +// CHECK: 69:14: IntegerLiteral= Extent=[69:14 - 69:19] +// CHECK: 69:23: BinaryOperator= Extent=[69:23 - 69:33] // CHECK: 69:23: DeclRefExpr=c:2:14 Extent=[69:23 - 69:24] // CHECK: 69:28: UnexposedExpr= Extent=[69:28 - 69:33] -// CHECK: 69:28: UnexposedExpr= Extent=[69:28 - 69:33] -// CHECK: 70:8: UnexposedExpr= Extent=[70:8 - 70:18] +// CHECK: 69:28: IntegerLiteral= Extent=[69:28 - 69:33] +// CHECK: 70:8: BinaryOperator= Extent=[70:8 - 70:18] // CHECK: 70:8: DeclRefExpr=c:2:14 Extent=[70:8 - 70:9] // CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:18] -// CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:18] -// CHECK: 70:22: UnexposedExpr= Extent=[70:22 - 70:32] +// CHECK: 70:13: IntegerLiteral= Extent=[70:13 - 70:18] +// CHECK: 70:22: BinaryOperator= Extent=[70:22 - 70:32] // CHECK: 70:22: DeclRefExpr=c:2:14 Extent=[70:22 - 70:23] // CHECK: 70:27: UnexposedExpr= Extent=[70:27 - 70:32] -// CHECK: 70:27: UnexposedExpr= Extent=[70:27 - 70:32] -// CHECK: 70:37: UnexposedExpr= Extent=[70:37 - 70:61] -// CHECK: 70:37: UnexposedExpr= Extent=[70:37 - 70:47] +// CHECK: 70:27: IntegerLiteral= Extent=[70:27 - 70:32] +// CHECK: 70:37: BinaryOperator= Extent=[70:37 - 70:61] +// CHECK: 70:37: BinaryOperator= Extent=[70:37 - 70:47] // CHECK: 70:37: DeclRefExpr=c:2:14 Extent=[70:37 - 70:38] // CHECK: 70:42: UnexposedExpr= Extent=[70:42 - 70:47] -// CHECK: 70:42: UnexposedExpr= Extent=[70:42 - 70:47] -// CHECK: 70:51: UnexposedExpr= Extent=[70:51 - 70:61] +// CHECK: 70:42: IntegerLiteral= Extent=[70:42 - 70:47] +// CHECK: 70:51: BinaryOperator= Extent=[70:51 - 70:61] // CHECK: 70:51: DeclRefExpr=c:2:14 Extent=[70:51 - 70:52] // CHECK: 70:56: UnexposedExpr= Extent=[70:56 - 70:61] -// CHECK: 70:56: UnexposedExpr= Extent=[70:56 - 70:61] -// CHECK: 71:9: UnexposedExpr= Extent=[71:9 - 71:33] -// CHECK: 71:9: UnexposedExpr= Extent=[71:9 - 71:19] +// CHECK: 70:56: IntegerLiteral= Extent=[70:56 - 70:61] +// CHECK: 71:9: BinaryOperator= Extent=[71:9 - 71:33] +// CHECK: 71:9: BinaryOperator= Extent=[71:9 - 71:19] // CHECK: 71:9: DeclRefExpr=c:2:14 Extent=[71:9 - 71:10] // CHECK: 71:14: UnexposedExpr= Extent=[71:14 - 71:19] -// CHECK: 71:14: UnexposedExpr= Extent=[71:14 - 71:19] -// CHECK: 71:23: UnexposedExpr= Extent=[71:23 - 71:33] +// CHECK: 71:14: IntegerLiteral= Extent=[71:14 - 71:19] +// CHECK: 71:23: BinaryOperator= Extent=[71:23 - 71:33] // CHECK: 71:23: DeclRefExpr=c:2:14 Extent=[71:23 - 71:24] // CHECK: 71:28: UnexposedExpr= Extent=[71:28 - 71:33] -// CHECK: 71:28: UnexposedExpr= Extent=[71:28 - 71:33] -// CHECK: 72:9: UnexposedExpr= Extent=[72:9 - 72:33] -// CHECK: 72:9: UnexposedExpr= Extent=[72:9 - 72:19] +// CHECK: 71:28: IntegerLiteral= Extent=[71:28 - 71:33] +// CHECK: 72:9: BinaryOperator= Extent=[72:9 - 72:33] +// CHECK: 72:9: BinaryOperator= Extent=[72:9 - 72:19] // CHECK: 72:9: DeclRefExpr=c:2:14 Extent=[72:9 - 72:10] // CHECK: 72:14: UnexposedExpr= Extent=[72:14 - 72:19] -// CHECK: 72:14: UnexposedExpr= Extent=[72:14 - 72:19] -// CHECK: 72:23: UnexposedExpr= Extent=[72:23 - 72:33] +// CHECK: 72:14: IntegerLiteral= Extent=[72:14 - 72:19] +// CHECK: 72:23: BinaryOperator= Extent=[72:23 - 72:33] // CHECK: 72:23: DeclRefExpr=c:2:14 Extent=[72:23 - 72:24] // CHECK: 72:28: UnexposedExpr= Extent=[72:28 - 72:33] -// CHECK: 72:28: UnexposedExpr= Extent=[72:28 - 72:33] -// CHECK: 73:9: UnexposedExpr= Extent=[73:9 - 73:33] -// CHECK: 73:9: UnexposedExpr= Extent=[73:9 - 73:19] +// CHECK: 72:28: IntegerLiteral= Extent=[72:28 - 72:33] +// CHECK: 73:9: BinaryOperator= Extent=[73:9 - 73:33] +// CHECK: 73:9: BinaryOperator= Extent=[73:9 - 73:19] // CHECK: 73:9: DeclRefExpr=c:2:14 Extent=[73:9 - 73:10] // CHECK: 73:14: UnexposedExpr= Extent=[73:14 - 73:19] -// CHECK: 73:14: UnexposedExpr= Extent=[73:14 - 73:19] -// CHECK: 73:23: UnexposedExpr= Extent=[73:23 - 73:33] +// CHECK: 73:14: IntegerLiteral= Extent=[73:14 - 73:19] +// CHECK: 73:23: BinaryOperator= Extent=[73:23 - 73:33] // CHECK: 73:23: DeclRefExpr=c:2:14 Extent=[73:23 - 73:24] // CHECK: 73:28: UnexposedExpr= Extent=[73:28 - 73:33] -// CHECK: 73:28: UnexposedExpr= Extent=[73:28 - 73:33] -// CHECK: 74:9: UnexposedExpr= Extent=[74:9 - 74:33] -// CHECK: 74:9: UnexposedExpr= Extent=[74:9 - 74:19] +// CHECK: 73:28: IntegerLiteral= Extent=[73:28 - 73:33] +// CHECK: 74:9: BinaryOperator= Extent=[74:9 - 74:33] +// CHECK: 74:9: BinaryOperator= Extent=[74:9 - 74:19] // CHECK: 74:9: DeclRefExpr=c:2:14 Extent=[74:9 - 74:10] // CHECK: 74:14: UnexposedExpr= Extent=[74:14 - 74:19] -// CHECK: 74:14: UnexposedExpr= Extent=[74:14 - 74:19] -// CHECK: 74:23: UnexposedExpr= Extent=[74:23 - 74:33] +// CHECK: 74:14: IntegerLiteral= Extent=[74:14 - 74:19] +// CHECK: 74:23: BinaryOperator= Extent=[74:23 - 74:33] // CHECK: 74:23: DeclRefExpr=c:2:14 Extent=[74:23 - 74:24] // CHECK: 74:28: UnexposedExpr= Extent=[74:28 - 74:33] -// CHECK: 74:28: UnexposedExpr= Extent=[74:28 - 74:33] -// CHECK: 75:9: UnexposedExpr= Extent=[75:9 - 75:33] -// CHECK: 75:9: UnexposedExpr= Extent=[75:9 - 75:19] +// CHECK: 74:28: IntegerLiteral= Extent=[74:28 - 74:33] +// CHECK: 75:9: BinaryOperator= Extent=[75:9 - 75:33] +// CHECK: 75:9: BinaryOperator= Extent=[75:9 - 75:19] // CHECK: 75:9: DeclRefExpr=c:2:14 Extent=[75:9 - 75:10] // CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:19] -// CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:19] -// CHECK: 75:23: UnexposedExpr= Extent=[75:23 - 75:33] +// CHECK: 75:14: IntegerLiteral= Extent=[75:14 - 75:19] +// CHECK: 75:23: BinaryOperator= Extent=[75:23 - 75:33] // CHECK: 75:23: DeclRefExpr=c:2:14 Extent=[75:23 - 75:24] // CHECK: 75:28: UnexposedExpr= Extent=[75:28 - 75:33] -// CHECK: 75:28: UnexposedExpr= Extent=[75:28 - 75:33] -// CHECK: 76:8: UnexposedExpr= Extent=[76:8 - 76:18] +// CHECK: 75:28: IntegerLiteral= Extent=[75:28 - 75:33] +// CHECK: 76:8: BinaryOperator= Extent=[76:8 - 76:18] // CHECK: 76:8: DeclRefExpr=c:2:14 Extent=[76:8 - 76:9] // CHECK: 76:13: UnexposedExpr= Extent=[76:13 - 76:18] -// CHECK: 76:13: UnexposedExpr= Extent=[76:13 - 76:18] -// CHECK: 76:23: UnexposedExpr= Extent=[76:23 - 76:47] -// CHECK: 76:23: UnexposedExpr= Extent=[76:23 - 76:33] +// CHECK: 76:13: IntegerLiteral= Extent=[76:13 - 76:18] +// CHECK: 76:23: BinaryOperator= Extent=[76:23 - 76:47] +// CHECK: 76:23: BinaryOperator= Extent=[76:23 - 76:33] // CHECK: 76:23: DeclRefExpr=c:2:14 Extent=[76:23 - 76:24] // CHECK: 76:28: UnexposedExpr= Extent=[76:28 - 76:33] -// CHECK: 76:28: UnexposedExpr= Extent=[76:28 - 76:33] -// CHECK: 76:37: UnexposedExpr= Extent=[76:37 - 76:47] +// CHECK: 76:28: IntegerLiteral= Extent=[76:28 - 76:33] +// CHECK: 76:37: BinaryOperator= Extent=[76:37 - 76:47] // CHECK: 76:37: DeclRefExpr=c:2:14 Extent=[76:37 - 76:38] // CHECK: 76:42: UnexposedExpr= Extent=[76:42 - 76:47] -// CHECK: 76:42: UnexposedExpr= Extent=[76:42 - 76:47] -// CHECK: 77:9: UnexposedExpr= Extent=[77:9 - 77:33] -// CHECK: 77:9: UnexposedExpr= Extent=[77:9 - 77:19] +// CHECK: 76:42: IntegerLiteral= Extent=[76:42 - 76:47] +// CHECK: 77:9: BinaryOperator= Extent=[77:9 - 77:33] +// CHECK: 77:9: BinaryOperator= Extent=[77:9 - 77:19] // CHECK: 77:9: DeclRefExpr=c:2:14 Extent=[77:9 - 77:10] // CHECK: 77:14: UnexposedExpr= Extent=[77:14 - 77:19] -// CHECK: 77:14: UnexposedExpr= Extent=[77:14 - 77:19] -// CHECK: 77:23: UnexposedExpr= Extent=[77:23 - 77:33] +// CHECK: 77:14: IntegerLiteral= Extent=[77:14 - 77:19] +// CHECK: 77:23: BinaryOperator= Extent=[77:23 - 77:33] // CHECK: 77:23: DeclRefExpr=c:2:14 Extent=[77:23 - 77:24] // CHECK: 77:28: UnexposedExpr= Extent=[77:28 - 77:33] -// CHECK: 77:28: UnexposedExpr= Extent=[77:28 - 77:33] -// CHECK: 78:9: UnexposedExpr= Extent=[78:9 - 78:33] -// CHECK: 78:9: UnexposedExpr= Extent=[78:9 - 78:19] +// CHECK: 77:28: IntegerLiteral= Extent=[77:28 - 77:33] +// CHECK: 78:9: BinaryOperator= Extent=[78:9 - 78:33] +// CHECK: 78:9: BinaryOperator= Extent=[78:9 - 78:19] // CHECK: 78:9: DeclRefExpr=c:2:14 Extent=[78:9 - 78:10] // CHECK: 78:14: UnexposedExpr= Extent=[78:14 - 78:19] -// CHECK: 78:14: UnexposedExpr= Extent=[78:14 - 78:19] -// CHECK: 78:23: UnexposedExpr= Extent=[78:23 - 78:33] +// CHECK: 78:14: IntegerLiteral= Extent=[78:14 - 78:19] +// CHECK: 78:23: BinaryOperator= Extent=[78:23 - 78:33] // CHECK: 78:23: DeclRefExpr=c:2:14 Extent=[78:23 - 78:24] // CHECK: 78:28: UnexposedExpr= Extent=[78:28 - 78:33] -// CHECK: 78:28: UnexposedExpr= Extent=[78:28 - 78:33] -// CHECK: 79:9: UnexposedExpr= Extent=[79:9 - 79:33] -// CHECK: 79:9: UnexposedExpr= Extent=[79:9 - 79:19] +// CHECK: 78:28: IntegerLiteral= Extent=[78:28 - 78:33] +// CHECK: 79:9: BinaryOperator= Extent=[79:9 - 79:33] +// CHECK: 79:9: BinaryOperator= Extent=[79:9 - 79:19] // CHECK: 79:9: DeclRefExpr=c:2:14 Extent=[79:9 - 79:10] // CHECK: 79:14: UnexposedExpr= Extent=[79:14 - 79:19] -// CHECK: 79:14: UnexposedExpr= Extent=[79:14 - 79:19] -// CHECK: 79:23: UnexposedExpr= Extent=[79:23 - 79:33] +// CHECK: 79:14: IntegerLiteral= Extent=[79:14 - 79:19] +// CHECK: 79:23: BinaryOperator= Extent=[79:23 - 79:33] // CHECK: 79:23: DeclRefExpr=c:2:14 Extent=[79:23 - 79:24] // CHECK: 79:28: UnexposedExpr= Extent=[79:28 - 79:33] -// CHECK: 79:28: UnexposedExpr= Extent=[79:28 - 79:33] -// CHECK: 80:9: UnexposedExpr= Extent=[80:9 - 80:33] -// CHECK: 80:9: UnexposedExpr= Extent=[80:9 - 80:19] +// CHECK: 79:28: IntegerLiteral= Extent=[79:28 - 79:33] +// CHECK: 80:9: BinaryOperator= Extent=[80:9 - 80:33] +// CHECK: 80:9: BinaryOperator= Extent=[80:9 - 80:19] // CHECK: 80:9: DeclRefExpr=c:2:14 Extent=[80:9 - 80:10] // CHECK: 80:14: UnexposedExpr= Extent=[80:14 - 80:19] -// CHECK: 80:14: UnexposedExpr= Extent=[80:14 - 80:19] -// CHECK: 80:23: UnexposedExpr= Extent=[80:23 - 80:33] +// CHECK: 80:14: IntegerLiteral= Extent=[80:14 - 80:19] +// CHECK: 80:23: BinaryOperator= Extent=[80:23 - 80:33] // CHECK: 80:23: DeclRefExpr=c:2:14 Extent=[80:23 - 80:24] // CHECK: 80:28: UnexposedExpr= Extent=[80:28 - 80:33] -// CHECK: 80:28: UnexposedExpr= Extent=[80:28 - 80:33] -// CHECK: 81:9: UnexposedExpr= Extent=[81:9 - 81:33] -// CHECK: 81:9: UnexposedExpr= Extent=[81:9 - 81:19] +// CHECK: 80:28: IntegerLiteral= Extent=[80:28 - 80:33] +// CHECK: 81:9: BinaryOperator= Extent=[81:9 - 81:33] +// CHECK: 81:9: BinaryOperator= Extent=[81:9 - 81:19] // CHECK: 81:9: DeclRefExpr=c:2:14 Extent=[81:9 - 81:10] // CHECK: 81:14: UnexposedExpr= Extent=[81:14 - 81:19] -// CHECK: 81:14: UnexposedExpr= Extent=[81:14 - 81:19] -// CHECK: 81:23: UnexposedExpr= Extent=[81:23 - 81:33] +// CHECK: 81:14: IntegerLiteral= Extent=[81:14 - 81:19] +// CHECK: 81:23: BinaryOperator= Extent=[81:23 - 81:33] // CHECK: 81:23: DeclRefExpr=c:2:14 Extent=[81:23 - 81:24] // CHECK: 81:28: UnexposedExpr= Extent=[81:28 - 81:33] -// CHECK: 81:28: UnexposedExpr= Extent=[81:28 - 81:33] -// CHECK: 82:8: UnexposedExpr= Extent=[82:8 - 82:18] +// CHECK: 81:28: IntegerLiteral= Extent=[81:28 - 81:33] +// CHECK: 82:8: BinaryOperator= Extent=[82:8 - 82:18] // CHECK: 82:8: DeclRefExpr=c:2:14 Extent=[82:8 - 82:9] // CHECK: 82:13: UnexposedExpr= Extent=[82:13 - 82:18] -// CHECK: 82:13: UnexposedExpr= Extent=[82:13 - 82:18] -// CHECK: 82:23: UnexposedExpr= Extent=[82:23 - 82:47] -// CHECK: 82:23: UnexposedExpr= Extent=[82:23 - 82:33] +// CHECK: 82:13: IntegerLiteral= Extent=[82:13 - 82:18] +// CHECK: 82:23: BinaryOperator= Extent=[82:23 - 82:47] +// CHECK: 82:23: BinaryOperator= Extent=[82:23 - 82:33] // CHECK: 82:23: DeclRefExpr=c:2:14 Extent=[82:23 - 82:24] // CHECK: 82:28: UnexposedExpr= Extent=[82:28 - 82:33] -// CHECK: 82:28: UnexposedExpr= Extent=[82:28 - 82:33] -// CHECK: 82:37: UnexposedExpr= Extent=[82:37 - 82:47] +// CHECK: 82:28: IntegerLiteral= Extent=[82:28 - 82:33] +// CHECK: 82:37: BinaryOperator= Extent=[82:37 - 82:47] // CHECK: 82:37: DeclRefExpr=c:2:14 Extent=[82:37 - 82:38] // CHECK: 82:42: UnexposedExpr= Extent=[82:42 - 82:47] -// CHECK: 82:42: UnexposedExpr= Extent=[82:42 - 82:47] -// CHECK: 83:9: UnexposedExpr= Extent=[83:9 - 83:33] -// CHECK: 83:9: UnexposedExpr= Extent=[83:9 - 83:19] +// CHECK: 82:42: IntegerLiteral= Extent=[82:42 - 82:47] +// CHECK: 83:9: BinaryOperator= Extent=[83:9 - 83:33] +// CHECK: 83:9: BinaryOperator= Extent=[83:9 - 83:19] // CHECK: 83:9: DeclRefExpr=c:2:14 Extent=[83:9 - 83:10] // CHECK: 83:14: UnexposedExpr= Extent=[83:14 - 83:19] -// CHECK: 83:14: UnexposedExpr= Extent=[83:14 - 83:19] -// CHECK: 83:23: UnexposedExpr= Extent=[83:23 - 83:33] +// CHECK: 83:14: IntegerLiteral= Extent=[83:14 - 83:19] +// CHECK: 83:23: BinaryOperator= Extent=[83:23 - 83:33] // CHECK: 83:23: DeclRefExpr=c:2:14 Extent=[83:23 - 83:24] // CHECK: 83:28: UnexposedExpr= Extent=[83:28 - 83:33] -// CHECK: 83:28: UnexposedExpr= Extent=[83:28 - 83:33] -// CHECK: 84:9: UnexposedExpr= Extent=[84:9 - 84:33] -// CHECK: 84:9: UnexposedExpr= Extent=[84:9 - 84:19] +// CHECK: 83:28: IntegerLiteral= Extent=[83:28 - 83:33] +// CHECK: 84:9: BinaryOperator= Extent=[84:9 - 84:33] +// CHECK: 84:9: BinaryOperator= Extent=[84:9 - 84:19] // CHECK: 84:9: DeclRefExpr=c:2:14 Extent=[84:9 - 84:10] // CHECK: 84:14: UnexposedExpr= Extent=[84:14 - 84:19] -// CHECK: 84:14: UnexposedExpr= Extent=[84:14 - 84:19] -// CHECK: 84:23: UnexposedExpr= Extent=[84:23 - 84:33] +// CHECK: 84:14: IntegerLiteral= Extent=[84:14 - 84:19] +// CHECK: 84:23: BinaryOperator= Extent=[84:23 - 84:33] // CHECK: 84:23: DeclRefExpr=c:2:14 Extent=[84:23 - 84:24] // CHECK: 84:28: UnexposedExpr= Extent=[84:28 - 84:33] -// CHECK: 84:28: UnexposedExpr= Extent=[84:28 - 84:33] -// CHECK: 85:9: UnexposedExpr= Extent=[85:9 - 85:33] -// CHECK: 85:9: UnexposedExpr= Extent=[85:9 - 85:19] +// CHECK: 84:28: IntegerLiteral= Extent=[84:28 - 84:33] +// CHECK: 85:9: BinaryOperator= Extent=[85:9 - 85:33] +// CHECK: 85:9: BinaryOperator= Extent=[85:9 - 85:19] // CHECK: 85:9: DeclRefExpr=c:2:14 Extent=[85:9 - 85:10] // CHECK: 85:14: UnexposedExpr= Extent=[85:14 - 85:19] -// CHECK: 85:14: UnexposedExpr= Extent=[85:14 - 85:19] -// CHECK: 85:23: UnexposedExpr= Extent=[85:23 - 85:33] +// CHECK: 85:14: IntegerLiteral= Extent=[85:14 - 85:19] +// CHECK: 85:23: BinaryOperator= Extent=[85:23 - 85:33] // CHECK: 85:23: DeclRefExpr=c:2:14 Extent=[85:23 - 85:24] // CHECK: 85:28: UnexposedExpr= Extent=[85:28 - 85:33] -// CHECK: 85:28: UnexposedExpr= Extent=[85:28 - 85:33] -// CHECK: 86:9: UnexposedExpr= Extent=[86:9 - 86:33] -// CHECK: 86:9: UnexposedExpr= Extent=[86:9 - 86:19] +// CHECK: 85:28: IntegerLiteral= Extent=[85:28 - 85:33] +// CHECK: 86:9: BinaryOperator= Extent=[86:9 - 86:33] +// CHECK: 86:9: BinaryOperator= Extent=[86:9 - 86:19] // CHECK: 86:9: DeclRefExpr=c:2:14 Extent=[86:9 - 86:10] // CHECK: 86:14: UnexposedExpr= Extent=[86:14 - 86:19] -// CHECK: 86:14: UnexposedExpr= Extent=[86:14 - 86:19] -// CHECK: 86:23: UnexposedExpr= Extent=[86:23 - 86:33] +// CHECK: 86:14: IntegerLiteral= Extent=[86:14 - 86:19] +// CHECK: 86:23: BinaryOperator= Extent=[86:23 - 86:33] // CHECK: 86:23: DeclRefExpr=c:2:14 Extent=[86:23 - 86:24] // CHECK: 86:28: UnexposedExpr= Extent=[86:28 - 86:33] -// CHECK: 86:28: UnexposedExpr= Extent=[86:28 - 86:33] -// CHECK: 87:9: UnexposedExpr= Extent=[87:9 - 87:33] -// CHECK: 87:9: UnexposedExpr= Extent=[87:9 - 87:19] +// CHECK: 86:28: IntegerLiteral= Extent=[86:28 - 86:33] +// CHECK: 87:9: BinaryOperator= Extent=[87:9 - 87:33] +// CHECK: 87:9: BinaryOperator= Extent=[87:9 - 87:19] // CHECK: 87:9: DeclRefExpr=c:2:14 Extent=[87:9 - 87:10] // CHECK: 87:14: UnexposedExpr= Extent=[87:14 - 87:19] -// CHECK: 87:14: UnexposedExpr= Extent=[87:14 - 87:19] -// CHECK: 87:23: UnexposedExpr= Extent=[87:23 - 87:33] +// CHECK: 87:14: IntegerLiteral= Extent=[87:14 - 87:19] +// CHECK: 87:23: BinaryOperator= Extent=[87:23 - 87:33] // CHECK: 87:23: DeclRefExpr=c:2:14 Extent=[87:23 - 87:24] // CHECK: 87:28: UnexposedExpr= Extent=[87:28 - 87:33] -// CHECK: 87:28: UnexposedExpr= Extent=[87:28 - 87:33] -// CHECK: 88:9: UnexposedExpr= Extent=[88:9 - 88:33] -// CHECK: 88:9: UnexposedExpr= Extent=[88:9 - 88:19] +// CHECK: 87:28: IntegerLiteral= Extent=[87:28 - 87:33] +// CHECK: 88:9: BinaryOperator= Extent=[88:9 - 88:33] +// CHECK: 88:9: BinaryOperator= Extent=[88:9 - 88:19] // CHECK: 88:9: DeclRefExpr=c:2:14 Extent=[88:9 - 88:10] // CHECK: 88:14: UnexposedExpr= Extent=[88:14 - 88:19] -// CHECK: 88:14: UnexposedExpr= Extent=[88:14 - 88:19] -// CHECK: 88:23: UnexposedExpr= Extent=[88:23 - 88:33] +// CHECK: 88:14: IntegerLiteral= Extent=[88:14 - 88:19] +// CHECK: 88:23: BinaryOperator= Extent=[88:23 - 88:33] // CHECK: 88:23: DeclRefExpr=c:2:14 Extent=[88:23 - 88:24] // CHECK: 88:28: UnexposedExpr= Extent=[88:28 - 88:33] -// CHECK: 88:28: UnexposedExpr= Extent=[88:28 - 88:33] -// CHECK: 89:9: UnexposedExpr= Extent=[89:9 - 89:33] -// CHECK: 89:9: UnexposedExpr= Extent=[89:9 - 89:19] +// CHECK: 88:28: IntegerLiteral= Extent=[88:28 - 88:33] +// CHECK: 89:9: BinaryOperator= Extent=[89:9 - 89:33] +// CHECK: 89:9: BinaryOperator= Extent=[89:9 - 89:19] // CHECK: 89:9: DeclRefExpr=c:2:14 Extent=[89:9 - 89:10] // CHECK: 89:14: UnexposedExpr= Extent=[89:14 - 89:19] -// CHECK: 89:14: UnexposedExpr= Extent=[89:14 - 89:19] -// CHECK: 89:23: UnexposedExpr= Extent=[89:23 - 89:33] +// CHECK: 89:14: IntegerLiteral= Extent=[89:14 - 89:19] +// CHECK: 89:23: BinaryOperator= Extent=[89:23 - 89:33] // CHECK: 89:23: DeclRefExpr=c:2:14 Extent=[89:23 - 89:24] // CHECK: 89:28: UnexposedExpr= Extent=[89:28 - 89:33] -// CHECK: 89:28: UnexposedExpr= Extent=[89:28 - 89:33] -// CHECK: 90:9: UnexposedExpr= Extent=[90:9 - 90:33] -// CHECK: 90:9: UnexposedExpr= Extent=[90:9 - 90:19] +// CHECK: 89:28: IntegerLiteral= Extent=[89:28 - 89:33] +// CHECK: 90:9: BinaryOperator= Extent=[90:9 - 90:33] +// CHECK: 90:9: BinaryOperator= Extent=[90:9 - 90:19] // CHECK: 90:9: DeclRefExpr=c:2:14 Extent=[90:9 - 90:10] // CHECK: 90:14: UnexposedExpr= Extent=[90:14 - 90:19] -// CHECK: 90:14: UnexposedExpr= Extent=[90:14 - 90:19] -// CHECK: 90:23: UnexposedExpr= Extent=[90:23 - 90:33] +// CHECK: 90:14: IntegerLiteral= Extent=[90:14 - 90:19] +// CHECK: 90:23: BinaryOperator= Extent=[90:23 - 90:33] // CHECK: 90:23: DeclRefExpr=c:2:14 Extent=[90:23 - 90:24] // CHECK: 90:28: UnexposedExpr= Extent=[90:28 - 90:33] -// CHECK: 90:28: UnexposedExpr= Extent=[90:28 - 90:33] -// CHECK: 91:9: UnexposedExpr= Extent=[91:9 - 91:33] -// CHECK: 91:9: UnexposedExpr= Extent=[91:9 - 91:19] +// CHECK: 90:28: IntegerLiteral= Extent=[90:28 - 90:33] +// CHECK: 91:9: BinaryOperator= Extent=[91:9 - 91:33] +// CHECK: 91:9: BinaryOperator= Extent=[91:9 - 91:19] // CHECK: 91:9: DeclRefExpr=c:2:14 Extent=[91:9 - 91:10] // CHECK: 91:14: UnexposedExpr= Extent=[91:14 - 91:19] -// CHECK: 91:14: UnexposedExpr= Extent=[91:14 - 91:19] -// CHECK: 91:23: UnexposedExpr= Extent=[91:23 - 91:33] +// CHECK: 91:14: IntegerLiteral= Extent=[91:14 - 91:19] +// CHECK: 91:23: BinaryOperator= Extent=[91:23 - 91:33] // CHECK: 91:23: DeclRefExpr=c:2:14 Extent=[91:23 - 91:24] // CHECK: 91:28: UnexposedExpr= Extent=[91:28 - 91:33] -// CHECK: 91:28: UnexposedExpr= Extent=[91:28 - 91:33] -// CHECK: 92:9: UnexposedExpr= Extent=[92:9 - 92:33] -// CHECK: 92:9: UnexposedExpr= Extent=[92:9 - 92:19] +// CHECK: 91:28: IntegerLiteral= Extent=[91:28 - 91:33] +// CHECK: 92:9: BinaryOperator= Extent=[92:9 - 92:33] +// CHECK: 92:9: BinaryOperator= Extent=[92:9 - 92:19] // CHECK: 92:9: DeclRefExpr=c:2:14 Extent=[92:9 - 92:10] // CHECK: 92:14: UnexposedExpr= Extent=[92:14 - 92:19] -// CHECK: 92:14: UnexposedExpr= Extent=[92:14 - 92:19] -// CHECK: 92:23: UnexposedExpr= Extent=[92:23 - 92:33] +// CHECK: 92:14: IntegerLiteral= Extent=[92:14 - 92:19] +// CHECK: 92:23: BinaryOperator= Extent=[92:23 - 92:33] // CHECK: 92:23: DeclRefExpr=c:2:14 Extent=[92:23 - 92:24] // CHECK: 92:28: UnexposedExpr= Extent=[92:28 - 92:33] -// CHECK: 92:28: UnexposedExpr= Extent=[92:28 - 92:33] -// CHECK: 93:9: UnexposedExpr= Extent=[93:9 - 93:33] -// CHECK: 93:9: UnexposedExpr= Extent=[93:9 - 93:19] +// CHECK: 92:28: IntegerLiteral= Extent=[92:28 - 92:33] +// CHECK: 93:9: BinaryOperator= Extent=[93:9 - 93:33] +// CHECK: 93:9: BinaryOperator= Extent=[93:9 - 93:19] // CHECK: 93:9: DeclRefExpr=c:2:14 Extent=[93:9 - 93:10] // CHECK: 93:14: UnexposedExpr= Extent=[93:14 - 93:19] -// CHECK: 93:14: UnexposedExpr= Extent=[93:14 - 93:19] -// CHECK: 93:23: UnexposedExpr= Extent=[93:23 - 93:33] +// CHECK: 93:14: IntegerLiteral= Extent=[93:14 - 93:19] +// CHECK: 93:23: BinaryOperator= Extent=[93:23 - 93:33] // CHECK: 93:23: DeclRefExpr=c:2:14 Extent=[93:23 - 93:24] // CHECK: 93:28: UnexposedExpr= Extent=[93:28 - 93:33] -// CHECK: 93:28: UnexposedExpr= Extent=[93:28 - 93:33] -// CHECK: 94:9: UnexposedExpr= Extent=[94:9 - 94:33] -// CHECK: 94:9: UnexposedExpr= Extent=[94:9 - 94:19] +// CHECK: 93:28: IntegerLiteral= Extent=[93:28 - 93:33] +// CHECK: 94:9: BinaryOperator= Extent=[94:9 - 94:33] +// CHECK: 94:9: BinaryOperator= Extent=[94:9 - 94:19] // CHECK: 94:9: DeclRefExpr=c:2:14 Extent=[94:9 - 94:10] // CHECK: 94:14: UnexposedExpr= Extent=[94:14 - 94:19] -// CHECK: 94:14: UnexposedExpr= Extent=[94:14 - 94:19] -// CHECK: 94:23: UnexposedExpr= Extent=[94:23 - 94:33] +// CHECK: 94:14: IntegerLiteral= Extent=[94:14 - 94:19] +// CHECK: 94:23: BinaryOperator= Extent=[94:23 - 94:33] // CHECK: 94:23: DeclRefExpr=c:2:14 Extent=[94:23 - 94:24] // CHECK: 94:28: UnexposedExpr= Extent=[94:28 - 94:33] -// CHECK: 94:28: UnexposedExpr= Extent=[94:28 - 94:33] -// CHECK: 95:9: UnexposedExpr= Extent=[95:9 - 95:33] -// CHECK: 95:9: UnexposedExpr= Extent=[95:9 - 95:19] +// CHECK: 94:28: IntegerLiteral= Extent=[94:28 - 94:33] +// CHECK: 95:9: BinaryOperator= Extent=[95:9 - 95:33] +// CHECK: 95:9: BinaryOperator= Extent=[95:9 - 95:19] // CHECK: 95:9: DeclRefExpr=c:2:14 Extent=[95:9 - 95:10] // CHECK: 95:14: UnexposedExpr= Extent=[95:14 - 95:19] -// CHECK: 95:14: UnexposedExpr= Extent=[95:14 - 95:19] -// CHECK: 95:23: UnexposedExpr= Extent=[95:23 - 95:33] +// CHECK: 95:14: IntegerLiteral= Extent=[95:14 - 95:19] +// CHECK: 95:23: BinaryOperator= Extent=[95:23 - 95:33] // CHECK: 95:23: DeclRefExpr=c:2:14 Extent=[95:23 - 95:24] // CHECK: 95:28: UnexposedExpr= Extent=[95:28 - 95:33] -// CHECK: 95:28: UnexposedExpr= Extent=[95:28 - 95:33] -// CHECK: 96:9: UnexposedExpr= Extent=[96:9 - 96:33] -// CHECK: 96:9: UnexposedExpr= Extent=[96:9 - 96:19] +// CHECK: 95:28: IntegerLiteral= Extent=[95:28 - 95:33] +// CHECK: 96:9: BinaryOperator= Extent=[96:9 - 96:33] +// CHECK: 96:9: BinaryOperator= Extent=[96:9 - 96:19] // CHECK: 96:9: DeclRefExpr=c:2:14 Extent=[96:9 - 96:10] // CHECK: 96:14: UnexposedExpr= Extent=[96:14 - 96:19] -// CHECK: 96:14: UnexposedExpr= Extent=[96:14 - 96:19] -// CHECK: 96:23: UnexposedExpr= Extent=[96:23 - 96:33] +// CHECK: 96:14: IntegerLiteral= Extent=[96:14 - 96:19] +// CHECK: 96:23: BinaryOperator= Extent=[96:23 - 96:33] // CHECK: 96:23: DeclRefExpr=c:2:14 Extent=[96:23 - 96:24] // CHECK: 96:28: UnexposedExpr= Extent=[96:28 - 96:33] -// CHECK: 96:28: UnexposedExpr= Extent=[96:28 - 96:33] -// CHECK: 97:9: UnexposedExpr= Extent=[97:9 - 97:33] -// CHECK: 97:9: UnexposedExpr= Extent=[97:9 - 97:19] +// CHECK: 96:28: IntegerLiteral= Extent=[96:28 - 96:33] +// CHECK: 97:9: BinaryOperator= Extent=[97:9 - 97:33] +// CHECK: 97:9: BinaryOperator= Extent=[97:9 - 97:19] // CHECK: 97:9: DeclRefExpr=c:2:14 Extent=[97:9 - 97:10] // CHECK: 97:14: UnexposedExpr= Extent=[97:14 - 97:19] -// CHECK: 97:14: UnexposedExpr= Extent=[97:14 - 97:19] -// CHECK: 97:23: UnexposedExpr= Extent=[97:23 - 97:33] +// CHECK: 97:14: IntegerLiteral= Extent=[97:14 - 97:19] +// CHECK: 97:23: BinaryOperator= Extent=[97:23 - 97:33] // CHECK: 97:23: DeclRefExpr=c:2:14 Extent=[97:23 - 97:24] // CHECK: 97:28: UnexposedExpr= Extent=[97:28 - 97:33] -// CHECK: 97:28: UnexposedExpr= Extent=[97:28 - 97:33] -// CHECK: 98:8: UnexposedExpr= Extent=[98:8 - 98:18] +// CHECK: 97:28: IntegerLiteral= Extent=[97:28 - 97:33] +// CHECK: 98:8: BinaryOperator= Extent=[98:8 - 98:18] // CHECK: 98:8: DeclRefExpr=c:2:14 Extent=[98:8 - 98:9] // CHECK: 98:13: UnexposedExpr= Extent=[98:13 - 98:18] -// CHECK: 98:13: UnexposedExpr= Extent=[98:13 - 98:18] -// CHECK: 98:23: UnexposedExpr= Extent=[98:23 - 98:47] -// CHECK: 98:23: UnexposedExpr= Extent=[98:23 - 98:33] +// CHECK: 98:13: IntegerLiteral= Extent=[98:13 - 98:18] +// CHECK: 98:23: BinaryOperator= Extent=[98:23 - 98:47] +// CHECK: 98:23: BinaryOperator= Extent=[98:23 - 98:33] // CHECK: 98:23: DeclRefExpr=c:2:14 Extent=[98:23 - 98:24] // CHECK: 98:28: UnexposedExpr= Extent=[98:28 - 98:33] -// CHECK: 98:28: UnexposedExpr= Extent=[98:28 - 98:33] -// CHECK: 98:37: UnexposedExpr= Extent=[98:37 - 98:47] +// CHECK: 98:28: IntegerLiteral= Extent=[98:28 - 98:33] +// CHECK: 98:37: BinaryOperator= Extent=[98:37 - 98:47] // CHECK: 98:37: DeclRefExpr=c:2:14 Extent=[98:37 - 98:38] // CHECK: 98:42: UnexposedExpr= Extent=[98:42 - 98:47] -// CHECK: 98:42: UnexposedExpr= Extent=[98:42 - 98:47] -// CHECK: 99:9: UnexposedExpr= Extent=[99:9 - 99:33] -// CHECK: 99:9: UnexposedExpr= Extent=[99:9 - 99:19] +// CHECK: 98:42: IntegerLiteral= Extent=[98:42 - 98:47] +// CHECK: 99:9: BinaryOperator= Extent=[99:9 - 99:33] +// CHECK: 99:9: BinaryOperator= Extent=[99:9 - 99:19] // CHECK: 99:9: DeclRefExpr=c:2:14 Extent=[99:9 - 99:10] // CHECK: 99:14: UnexposedExpr= Extent=[99:14 - 99:19] -// CHECK: 99:14: UnexposedExpr= Extent=[99:14 - 99:19] -// CHECK: 99:23: UnexposedExpr= Extent=[99:23 - 99:33] +// CHECK: 99:14: IntegerLiteral= Extent=[99:14 - 99:19] +// CHECK: 99:23: BinaryOperator= Extent=[99:23 - 99:33] // CHECK: 99:23: DeclRefExpr=c:2:14 Extent=[99:23 - 99:24] // CHECK: 99:28: UnexposedExpr= Extent=[99:28 - 99:33] -// CHECK: 99:28: UnexposedExpr= Extent=[99:28 - 99:33] -// CHECK: 100:9: UnexposedExpr= Extent=[100:9 - 100:33] -// CHECK: 100:9: UnexposedExpr= Extent=[100:9 - 100:19] +// CHECK: 99:28: IntegerLiteral= Extent=[99:28 - 99:33] +// CHECK: 100:9: BinaryOperator= Extent=[100:9 - 100:33] +// CHECK: 100:9: BinaryOperator= Extent=[100:9 - 100:19] // CHECK: 100:9: DeclRefExpr=c:2:14 Extent=[100:9 - 100:10] // CHECK: 100:14: UnexposedExpr= Extent=[100:14 - 100:19] -// CHECK: 100:14: UnexposedExpr= Extent=[100:14 - 100:19] -// CHECK: 100:23: UnexposedExpr= Extent=[100:23 - 100:33] +// CHECK: 100:14: IntegerLiteral= Extent=[100:14 - 100:19] +// CHECK: 100:23: BinaryOperator= Extent=[100:23 - 100:33] // CHECK: 100:23: DeclRefExpr=c:2:14 Extent=[100:23 - 100:24] // CHECK: 100:28: UnexposedExpr= Extent=[100:28 - 100:33] -// CHECK: 100:28: UnexposedExpr= Extent=[100:28 - 100:33] -// CHECK: 101:9: UnexposedExpr= Extent=[101:9 - 101:33] -// CHECK: 101:9: UnexposedExpr= Extent=[101:9 - 101:19] +// CHECK: 100:28: IntegerLiteral= Extent=[100:28 - 100:33] +// CHECK: 101:9: BinaryOperator= Extent=[101:9 - 101:33] +// CHECK: 101:9: BinaryOperator= Extent=[101:9 - 101:19] // CHECK: 101:9: DeclRefExpr=c:2:14 Extent=[101:9 - 101:10] // CHECK: 101:14: UnexposedExpr= Extent=[101:14 - 101:19] -// CHECK: 101:14: UnexposedExpr= Extent=[101:14 - 101:19] -// CHECK: 101:23: UnexposedExpr= Extent=[101:23 - 101:33] +// CHECK: 101:14: IntegerLiteral= Extent=[101:14 - 101:19] +// CHECK: 101:23: BinaryOperator= Extent=[101:23 - 101:33] // CHECK: 101:23: DeclRefExpr=c:2:14 Extent=[101:23 - 101:24] // CHECK: 101:28: UnexposedExpr= Extent=[101:28 - 101:33] -// CHECK: 101:28: UnexposedExpr= Extent=[101:28 - 101:33] -// CHECK: 102:9: UnexposedExpr= Extent=[102:9 - 102:33] -// CHECK: 102:9: UnexposedExpr= Extent=[102:9 - 102:19] +// CHECK: 101:28: IntegerLiteral= Extent=[101:28 - 101:33] +// CHECK: 102:9: BinaryOperator= Extent=[102:9 - 102:33] +// CHECK: 102:9: BinaryOperator= Extent=[102:9 - 102:19] // CHECK: 102:9: DeclRefExpr=c:2:14 Extent=[102:9 - 102:10] // CHECK: 102:14: UnexposedExpr= Extent=[102:14 - 102:19] -// CHECK: 102:14: UnexposedExpr= Extent=[102:14 - 102:19] -// CHECK: 102:23: UnexposedExpr= Extent=[102:23 - 102:33] +// CHECK: 102:14: IntegerLiteral= Extent=[102:14 - 102:19] +// CHECK: 102:23: BinaryOperator= Extent=[102:23 - 102:33] // CHECK: 102:23: DeclRefExpr=c:2:14 Extent=[102:23 - 102:24] // CHECK: 102:28: UnexposedExpr= Extent=[102:28 - 102:33] -// CHECK: 102:28: UnexposedExpr= Extent=[102:28 - 102:33] -// CHECK: 103:9: UnexposedExpr= Extent=[103:9 - 103:33] -// CHECK: 103:9: UnexposedExpr= Extent=[103:9 - 103:19] +// CHECK: 102:28: IntegerLiteral= Extent=[102:28 - 102:33] +// CHECK: 103:9: BinaryOperator= Extent=[103:9 - 103:33] +// CHECK: 103:9: BinaryOperator= Extent=[103:9 - 103:19] // CHECK: 103:9: DeclRefExpr=c:2:14 Extent=[103:9 - 103:10] // CHECK: 103:14: UnexposedExpr= Extent=[103:14 - 103:19] -// CHECK: 103:14: UnexposedExpr= Extent=[103:14 - 103:19] -// CHECK: 103:23: UnexposedExpr= Extent=[103:23 - 103:33] +// CHECK: 103:14: IntegerLiteral= Extent=[103:14 - 103:19] +// CHECK: 103:23: BinaryOperator= Extent=[103:23 - 103:33] // CHECK: 103:23: DeclRefExpr=c:2:14 Extent=[103:23 - 103:24] // CHECK: 103:28: UnexposedExpr= Extent=[103:28 - 103:33] -// CHECK: 103:28: UnexposedExpr= Extent=[103:28 - 103:33] -// CHECK: 104:9: UnexposedExpr= Extent=[104:9 - 104:33] -// CHECK: 104:9: UnexposedExpr= Extent=[104:9 - 104:19] +// CHECK: 103:28: IntegerLiteral= Extent=[103:28 - 103:33] +// CHECK: 104:9: BinaryOperator= Extent=[104:9 - 104:33] +// CHECK: 104:9: BinaryOperator= Extent=[104:9 - 104:19] // CHECK: 104:9: DeclRefExpr=c:2:14 Extent=[104:9 - 104:10] // CHECK: 104:14: UnexposedExpr= Extent=[104:14 - 104:19] -// CHECK: 104:14: UnexposedExpr= Extent=[104:14 - 104:19] -// CHECK: 104:23: UnexposedExpr= Extent=[104:23 - 104:33] +// CHECK: 104:14: IntegerLiteral= Extent=[104:14 - 104:19] +// CHECK: 104:23: BinaryOperator= Extent=[104:23 - 104:33] // CHECK: 104:23: DeclRefExpr=c:2:14 Extent=[104:23 - 104:24] // CHECK: 104:28: UnexposedExpr= Extent=[104:28 - 104:33] -// CHECK: 104:28: UnexposedExpr= Extent=[104:28 - 104:33] -// CHECK: 105:8: UnexposedExpr= Extent=[105:8 - 105:18] +// CHECK: 104:28: IntegerLiteral= Extent=[104:28 - 104:33] +// CHECK: 105:8: BinaryOperator= Extent=[105:8 - 105:18] // CHECK: 105:8: DeclRefExpr=c:2:14 Extent=[105:8 - 105:9] // CHECK: 105:13: UnexposedExpr= Extent=[105:13 - 105:18] -// CHECK: 105:13: UnexposedExpr= Extent=[105:13 - 105:18] -// CHECK: 105:23: UnexposedExpr= Extent=[105:23 - 105:47] -// CHECK: 105:23: UnexposedExpr= Extent=[105:23 - 105:33] +// CHECK: 105:13: IntegerLiteral= Extent=[105:13 - 105:18] +// CHECK: 105:23: BinaryOperator= Extent=[105:23 - 105:47] +// CHECK: 105:23: BinaryOperator= Extent=[105:23 - 105:33] // CHECK: 105:23: DeclRefExpr=c:2:14 Extent=[105:23 - 105:24] // CHECK: 105:28: UnexposedExpr= Extent=[105:28 - 105:33] -// CHECK: 105:28: UnexposedExpr= Extent=[105:28 - 105:33] -// CHECK: 105:37: UnexposedExpr= Extent=[105:37 - 105:47] +// CHECK: 105:28: IntegerLiteral= Extent=[105:28 - 105:33] +// CHECK: 105:37: BinaryOperator= Extent=[105:37 - 105:47] // CHECK: 105:37: DeclRefExpr=c:2:14 Extent=[105:37 - 105:38] // CHECK: 105:42: UnexposedExpr= Extent=[105:42 - 105:47] -// CHECK: 105:42: UnexposedExpr= Extent=[105:42 - 105:47] -// CHECK: 106:9: UnexposedExpr= Extent=[106:9 - 106:33] -// CHECK: 106:9: UnexposedExpr= Extent=[106:9 - 106:19] +// CHECK: 105:42: IntegerLiteral= Extent=[105:42 - 105:47] +// CHECK: 106:9: BinaryOperator= Extent=[106:9 - 106:33] +// CHECK: 106:9: BinaryOperator= Extent=[106:9 - 106:19] // CHECK: 106:9: DeclRefExpr=c:2:14 Extent=[106:9 - 106:10] // CHECK: 106:14: UnexposedExpr= Extent=[106:14 - 106:19] -// CHECK: 106:14: UnexposedExpr= Extent=[106:14 - 106:19] -// CHECK: 106:23: UnexposedExpr= Extent=[106:23 - 106:33] +// CHECK: 106:14: IntegerLiteral= Extent=[106:14 - 106:19] +// CHECK: 106:23: BinaryOperator= Extent=[106:23 - 106:33] // CHECK: 106:23: DeclRefExpr=c:2:14 Extent=[106:23 - 106:24] // CHECK: 106:28: UnexposedExpr= Extent=[106:28 - 106:33] -// CHECK: 106:28: UnexposedExpr= Extent=[106:28 - 106:33] -// CHECK: 107:9: UnexposedExpr= Extent=[107:9 - 107:33] -// CHECK: 107:9: UnexposedExpr= Extent=[107:9 - 107:19] +// CHECK: 106:28: IntegerLiteral= Extent=[106:28 - 106:33] +// CHECK: 107:9: BinaryOperator= Extent=[107:9 - 107:33] +// CHECK: 107:9: BinaryOperator= Extent=[107:9 - 107:19] // CHECK: 107:9: DeclRefExpr=c:2:14 Extent=[107:9 - 107:10] // CHECK: 107:14: UnexposedExpr= Extent=[107:14 - 107:19] -// CHECK: 107:14: UnexposedExpr= Extent=[107:14 - 107:19] -// CHECK: 107:23: UnexposedExpr= Extent=[107:23 - 107:33] +// CHECK: 107:14: IntegerLiteral= Extent=[107:14 - 107:19] +// CHECK: 107:23: BinaryOperator= Extent=[107:23 - 107:33] // CHECK: 107:23: DeclRefExpr=c:2:14 Extent=[107:23 - 107:24] // CHECK: 107:28: UnexposedExpr= Extent=[107:28 - 107:33] -// CHECK: 107:28: UnexposedExpr= Extent=[107:28 - 107:33] -// CHECK: 108:8: UnexposedExpr= Extent=[108:8 - 108:18] +// CHECK: 107:28: IntegerLiteral= Extent=[107:28 - 107:33] +// CHECK: 108:8: BinaryOperator= Extent=[108:8 - 108:18] // CHECK: 108:8: DeclRefExpr=c:2:14 Extent=[108:8 - 108:9] // CHECK: 108:13: UnexposedExpr= Extent=[108:13 - 108:18] -// CHECK: 108:13: UnexposedExpr= Extent=[108:13 - 108:18] -// CHECK: 108:23: UnexposedExpr= Extent=[108:23 - 108:47] -// CHECK: 108:23: UnexposedExpr= Extent=[108:23 - 108:33] +// CHECK: 108:13: IntegerLiteral= Extent=[108:13 - 108:18] +// CHECK: 108:23: BinaryOperator= Extent=[108:23 - 108:47] +// CHECK: 108:23: BinaryOperator= Extent=[108:23 - 108:33] // CHECK: 108:23: DeclRefExpr=c:2:14 Extent=[108:23 - 108:24] // CHECK: 108:28: UnexposedExpr= Extent=[108:28 - 108:33] -// CHECK: 108:28: UnexposedExpr= Extent=[108:28 - 108:33] -// CHECK: 108:37: UnexposedExpr= Extent=[108:37 - 108:47] +// CHECK: 108:28: IntegerLiteral= Extent=[108:28 - 108:33] +// CHECK: 108:37: BinaryOperator= Extent=[108:37 - 108:47] // CHECK: 108:37: DeclRefExpr=c:2:14 Extent=[108:37 - 108:38] // CHECK: 108:42: UnexposedExpr= Extent=[108:42 - 108:47] -// CHECK: 108:42: UnexposedExpr= Extent=[108:42 - 108:47] -// CHECK: 109:8: UnexposedExpr= Extent=[109:8 - 109:18] +// CHECK: 108:42: IntegerLiteral= Extent=[108:42 - 108:47] +// CHECK: 109:8: BinaryOperator= Extent=[109:8 - 109:18] // CHECK: 109:8: DeclRefExpr=c:2:14 Extent=[109:8 - 109:9] // CHECK: 109:13: UnexposedExpr= Extent=[109:13 - 109:18] -// CHECK: 109:13: UnexposedExpr= Extent=[109:13 - 109:18] -// CHECK: 109:22: UnexposedExpr= Extent=[109:22 - 109:32] +// CHECK: 109:13: IntegerLiteral= Extent=[109:13 - 109:18] +// CHECK: 109:22: BinaryOperator= Extent=[109:22 - 109:32] // CHECK: 109:22: DeclRefExpr=c:2:14 Extent=[109:22 - 109:23] // CHECK: 109:27: UnexposedExpr= Extent=[109:27 - 109:32] -// CHECK: 109:27: UnexposedExpr= Extent=[109:27 - 109:32] -// CHECK: 109:37: UnexposedExpr= Extent=[109:37 - 109:61] -// CHECK: 109:37: UnexposedExpr= Extent=[109:37 - 109:47] +// CHECK: 109:27: IntegerLiteral= Extent=[109:27 - 109:32] +// CHECK: 109:37: BinaryOperator= Extent=[109:37 - 109:61] +// CHECK: 109:37: BinaryOperator= Extent=[109:37 - 109:47] // CHECK: 109:37: DeclRefExpr=c:2:14 Extent=[109:37 - 109:38] // CHECK: 109:42: UnexposedExpr= Extent=[109:42 - 109:47] -// CHECK: 109:42: UnexposedExpr= Extent=[109:42 - 109:47] -// CHECK: 109:51: UnexposedExpr= Extent=[109:51 - 109:61] +// CHECK: 109:42: IntegerLiteral= Extent=[109:42 - 109:47] +// CHECK: 109:51: BinaryOperator= Extent=[109:51 - 109:61] // CHECK: 109:51: DeclRefExpr=c:2:14 Extent=[109:51 - 109:52] // CHECK: 109:56: UnexposedExpr= Extent=[109:56 - 109:61] -// CHECK: 109:56: UnexposedExpr= Extent=[109:56 - 109:61] -// CHECK: 110:9: UnexposedExpr= Extent=[110:9 - 110:33] -// CHECK: 110:9: UnexposedExpr= Extent=[110:9 - 110:19] +// CHECK: 109:56: IntegerLiteral= Extent=[109:56 - 109:61] +// CHECK: 110:9: BinaryOperator= Extent=[110:9 - 110:33] +// CHECK: 110:9: BinaryOperator= Extent=[110:9 - 110:19] // CHECK: 110:9: DeclRefExpr=c:2:14 Extent=[110:9 - 110:10] // CHECK: 110:14: UnexposedExpr= Extent=[110:14 - 110:19] -// CHECK: 110:14: UnexposedExpr= Extent=[110:14 - 110:19] -// CHECK: 110:23: UnexposedExpr= Extent=[110:23 - 110:33] +// CHECK: 110:14: IntegerLiteral= Extent=[110:14 - 110:19] +// CHECK: 110:23: BinaryOperator= Extent=[110:23 - 110:33] // CHECK: 110:23: DeclRefExpr=c:2:14 Extent=[110:23 - 110:24] // CHECK: 110:28: UnexposedExpr= Extent=[110:28 - 110:33] -// CHECK: 110:28: UnexposedExpr= Extent=[110:28 - 110:33] -// CHECK: 111:9: UnexposedExpr= Extent=[111:9 - 111:33] -// CHECK: 111:9: UnexposedExpr= Extent=[111:9 - 111:19] +// CHECK: 110:28: IntegerLiteral= Extent=[110:28 - 110:33] +// CHECK: 111:9: BinaryOperator= Extent=[111:9 - 111:33] +// CHECK: 111:9: BinaryOperator= Extent=[111:9 - 111:19] // CHECK: 111:9: DeclRefExpr=c:2:14 Extent=[111:9 - 111:10] // CHECK: 111:14: UnexposedExpr= Extent=[111:14 - 111:19] -// CHECK: 111:14: UnexposedExpr= Extent=[111:14 - 111:19] -// CHECK: 111:23: UnexposedExpr= Extent=[111:23 - 111:33] +// CHECK: 111:14: IntegerLiteral= Extent=[111:14 - 111:19] +// CHECK: 111:23: BinaryOperator= Extent=[111:23 - 111:33] // CHECK: 111:23: DeclRefExpr=c:2:14 Extent=[111:23 - 111:24] // CHECK: 111:28: UnexposedExpr= Extent=[111:28 - 111:33] -// CHECK: 111:28: UnexposedExpr= Extent=[111:28 - 111:33] -// CHECK: 112:8: UnexposedExpr= Extent=[112:8 - 112:18] +// CHECK: 111:28: IntegerLiteral= Extent=[111:28 - 111:33] +// CHECK: 112:8: BinaryOperator= Extent=[112:8 - 112:18] // CHECK: 112:8: DeclRefExpr=c:2:14 Extent=[112:8 - 112:9] // CHECK: 112:13: UnexposedExpr= Extent=[112:13 - 112:18] -// CHECK: 112:13: UnexposedExpr= Extent=[112:13 - 112:18] -// CHECK: 112:22: UnexposedExpr= Extent=[112:22 - 112:32] +// CHECK: 112:13: IntegerLiteral= Extent=[112:13 - 112:18] +// CHECK: 112:22: BinaryOperator= Extent=[112:22 - 112:32] // CHECK: 112:22: DeclRefExpr=c:2:14 Extent=[112:22 - 112:23] // CHECK: 112:27: UnexposedExpr= Extent=[112:27 - 112:32] -// CHECK: 112:27: UnexposedExpr= Extent=[112:27 - 112:32] -// CHECK: 112:37: UnexposedExpr= Extent=[112:37 - 112:61] -// CHECK: 112:37: UnexposedExpr= Extent=[112:37 - 112:47] +// CHECK: 112:27: IntegerLiteral= Extent=[112:27 - 112:32] +// CHECK: 112:37: BinaryOperator= Extent=[112:37 - 112:61] +// CHECK: 112:37: BinaryOperator= Extent=[112:37 - 112:47] // CHECK: 112:37: DeclRefExpr=c:2:14 Extent=[112:37 - 112:38] // CHECK: 112:42: UnexposedExpr= Extent=[112:42 - 112:47] -// CHECK: 112:42: UnexposedExpr= Extent=[112:42 - 112:47] -// CHECK: 112:51: UnexposedExpr= Extent=[112:51 - 112:61] +// CHECK: 112:42: IntegerLiteral= Extent=[112:42 - 112:47] +// CHECK: 112:51: BinaryOperator= Extent=[112:51 - 112:61] // CHECK: 112:51: DeclRefExpr=c:2:14 Extent=[112:51 - 112:52] // CHECK: 112:56: UnexposedExpr= Extent=[112:56 - 112:61] -// CHECK: 112:56: UnexposedExpr= Extent=[112:56 - 112:61] -// CHECK: 113:9: UnexposedExpr= Extent=[113:9 - 113:33] -// CHECK: 113:9: UnexposedExpr= Extent=[113:9 - 113:19] +// CHECK: 112:56: IntegerLiteral= Extent=[112:56 - 112:61] +// CHECK: 113:9: BinaryOperator= Extent=[113:9 - 113:33] +// CHECK: 113:9: BinaryOperator= Extent=[113:9 - 113:19] // CHECK: 113:9: DeclRefExpr=c:2:14 Extent=[113:9 - 113:10] // CHECK: 113:14: UnexposedExpr= Extent=[113:14 - 113:19] -// CHECK: 113:14: UnexposedExpr= Extent=[113:14 - 113:19] -// CHECK: 113:23: UnexposedExpr= Extent=[113:23 - 113:33] +// CHECK: 113:14: IntegerLiteral= Extent=[113:14 - 113:19] +// CHECK: 113:23: BinaryOperator= Extent=[113:23 - 113:33] // CHECK: 113:23: DeclRefExpr=c:2:14 Extent=[113:23 - 113:24] // CHECK: 113:28: UnexposedExpr= Extent=[113:28 - 113:33] -// CHECK: 113:28: UnexposedExpr= Extent=[113:28 - 113:33] -// CHECK: 114:8: UnexposedExpr= Extent=[114:8 - 114:18] +// CHECK: 113:28: IntegerLiteral= Extent=[113:28 - 113:33] +// CHECK: 114:8: BinaryOperator= Extent=[114:8 - 114:18] // CHECK: 114:8: DeclRefExpr=c:2:14 Extent=[114:8 - 114:9] // CHECK: 114:13: UnexposedExpr= Extent=[114:13 - 114:18] -// CHECK: 114:13: UnexposedExpr= Extent=[114:13 - 114:18] -// CHECK: 114:23: UnexposedExpr= Extent=[114:23 - 114:47] -// CHECK: 114:23: UnexposedExpr= Extent=[114:23 - 114:33] +// CHECK: 114:13: IntegerLiteral= Extent=[114:13 - 114:18] +// CHECK: 114:23: BinaryOperator= Extent=[114:23 - 114:47] +// CHECK: 114:23: BinaryOperator= Extent=[114:23 - 114:33] // CHECK: 114:23: DeclRefExpr=c:2:14 Extent=[114:23 - 114:24] // CHECK: 114:28: UnexposedExpr= Extent=[114:28 - 114:33] -// CHECK: 114:28: UnexposedExpr= Extent=[114:28 - 114:33] -// CHECK: 114:37: UnexposedExpr= Extent=[114:37 - 114:47] +// CHECK: 114:28: IntegerLiteral= Extent=[114:28 - 114:33] +// CHECK: 114:37: BinaryOperator= Extent=[114:37 - 114:47] // CHECK: 114:37: DeclRefExpr=c:2:14 Extent=[114:37 - 114:38] // CHECK: 114:42: UnexposedExpr= Extent=[114:42 - 114:47] -// CHECK: 114:42: UnexposedExpr= Extent=[114:42 - 114:47] -// CHECK: 115:8: UnexposedExpr= Extent=[115:8 - 115:18] +// CHECK: 114:42: IntegerLiteral= Extent=[114:42 - 114:47] +// CHECK: 115:8: BinaryOperator= Extent=[115:8 - 115:18] // CHECK: 115:8: DeclRefExpr=c:2:14 Extent=[115:8 - 115:9] // CHECK: 115:13: UnexposedExpr= Extent=[115:13 - 115:18] -// CHECK: 115:13: UnexposedExpr= Extent=[115:13 - 115:18] -// CHECK: 115:23: UnexposedExpr= Extent=[115:23 - 115:47] -// CHECK: 115:23: UnexposedExpr= Extent=[115:23 - 115:33] +// CHECK: 115:13: IntegerLiteral= Extent=[115:13 - 115:18] +// CHECK: 115:23: BinaryOperator= Extent=[115:23 - 115:47] +// CHECK: 115:23: BinaryOperator= Extent=[115:23 - 115:33] // CHECK: 115:23: DeclRefExpr=c:2:14 Extent=[115:23 - 115:24] // CHECK: 115:28: UnexposedExpr= Extent=[115:28 - 115:33] -// CHECK: 115:28: UnexposedExpr= Extent=[115:28 - 115:33] -// CHECK: 115:37: UnexposedExpr= Extent=[115:37 - 115:47] +// CHECK: 115:28: IntegerLiteral= Extent=[115:28 - 115:33] +// CHECK: 115:37: BinaryOperator= Extent=[115:37 - 115:47] // CHECK: 115:37: DeclRefExpr=c:2:14 Extent=[115:37 - 115:38] // CHECK: 115:42: UnexposedExpr= Extent=[115:42 - 115:47] -// CHECK: 115:42: UnexposedExpr= Extent=[115:42 - 115:47] -// CHECK: 116:9: UnexposedExpr= Extent=[116:9 - 116:33] -// CHECK: 116:9: UnexposedExpr= Extent=[116:9 - 116:19] +// CHECK: 115:42: IntegerLiteral= Extent=[115:42 - 115:47] +// CHECK: 116:9: BinaryOperator= Extent=[116:9 - 116:33] +// CHECK: 116:9: BinaryOperator= Extent=[116:9 - 116:19] // CHECK: 116:9: DeclRefExpr=c:2:14 Extent=[116:9 - 116:10] // CHECK: 116:14: UnexposedExpr= Extent=[116:14 - 116:19] -// CHECK: 116:14: UnexposedExpr= Extent=[116:14 - 116:19] -// CHECK: 116:23: UnexposedExpr= Extent=[116:23 - 116:33] +// CHECK: 116:14: IntegerLiteral= Extent=[116:14 - 116:19] +// CHECK: 116:23: BinaryOperator= Extent=[116:23 - 116:33] // CHECK: 116:23: DeclRefExpr=c:2:14 Extent=[116:23 - 116:24] // CHECK: 116:28: UnexposedExpr= Extent=[116:28 - 116:33] -// CHECK: 116:28: UnexposedExpr= Extent=[116:28 - 116:33] -// CHECK: 117:9: UnexposedExpr= Extent=[117:9 - 117:33] -// CHECK: 117:9: UnexposedExpr= Extent=[117:9 - 117:19] +// CHECK: 116:28: IntegerLiteral= Extent=[116:28 - 116:33] +// CHECK: 117:9: BinaryOperator= Extent=[117:9 - 117:33] +// CHECK: 117:9: BinaryOperator= Extent=[117:9 - 117:19] // CHECK: 117:9: DeclRefExpr=c:2:14 Extent=[117:9 - 117:10] // CHECK: 117:14: UnexposedExpr= Extent=[117:14 - 117:19] -// CHECK: 117:14: UnexposedExpr= Extent=[117:14 - 117:19] -// CHECK: 117:23: UnexposedExpr= Extent=[117:23 - 117:33] +// CHECK: 117:14: IntegerLiteral= Extent=[117:14 - 117:19] +// CHECK: 117:23: BinaryOperator= Extent=[117:23 - 117:33] // CHECK: 117:23: DeclRefExpr=c:2:14 Extent=[117:23 - 117:24] // CHECK: 117:28: UnexposedExpr= Extent=[117:28 - 117:33] -// CHECK: 117:28: UnexposedExpr= Extent=[117:28 - 117:33] -// CHECK: 118:9: UnexposedExpr= Extent=[118:9 - 118:35] -// CHECK: 118:9: UnexposedExpr= Extent=[118:9 - 118:20] +// CHECK: 117:28: IntegerLiteral= Extent=[117:28 - 117:33] +// CHECK: 118:9: BinaryOperator= Extent=[118:9 - 118:35] +// CHECK: 118:9: BinaryOperator= Extent=[118:9 - 118:20] // CHECK: 118:9: DeclRefExpr=c:2:14 Extent=[118:9 - 118:10] // CHECK: 118:14: UnexposedExpr= Extent=[118:14 - 118:20] -// CHECK: 118:14: UnexposedExpr= Extent=[118:14 - 118:20] -// CHECK: 118:24: UnexposedExpr= Extent=[118:24 - 118:35] +// CHECK: 118:14: IntegerLiteral= Extent=[118:14 - 118:20] +// CHECK: 118:24: BinaryOperator= Extent=[118:24 - 118:35] // CHECK: 118:24: DeclRefExpr=c:2:14 Extent=[118:24 - 118:25] // CHECK: 118:29: UnexposedExpr= Extent=[118:29 - 118:35] -// CHECK: 118:29: UnexposedExpr= Extent=[118:29 - 118:35] -// CHECK: 119:9: UnexposedExpr= Extent=[119:9 - 119:35] -// CHECK: 119:9: UnexposedExpr= Extent=[119:9 - 119:20] +// CHECK: 118:29: IntegerLiteral= Extent=[118:29 - 118:35] +// CHECK: 119:9: BinaryOperator= Extent=[119:9 - 119:35] +// CHECK: 119:9: BinaryOperator= Extent=[119:9 - 119:20] // CHECK: 119:9: DeclRefExpr=c:2:14 Extent=[119:9 - 119:10] // CHECK: 119:14: UnexposedExpr= Extent=[119:14 - 119:20] -// CHECK: 119:14: UnexposedExpr= Extent=[119:14 - 119:20] -// CHECK: 119:24: UnexposedExpr= Extent=[119:24 - 119:35] +// CHECK: 119:14: IntegerLiteral= Extent=[119:14 - 119:20] +// CHECK: 119:24: BinaryOperator= Extent=[119:24 - 119:35] // CHECK: 119:24: DeclRefExpr=c:2:14 Extent=[119:24 - 119:25] // CHECK: 119:29: UnexposedExpr= Extent=[119:29 - 119:35] -// CHECK: 119:29: UnexposedExpr= Extent=[119:29 - 119:35] -// CHECK: 120:8: UnexposedExpr= Extent=[120:8 - 120:19] +// CHECK: 119:29: IntegerLiteral= Extent=[119:29 - 119:35] +// CHECK: 120:8: BinaryOperator= Extent=[120:8 - 120:19] // CHECK: 120:8: DeclRefExpr=c:2:14 Extent=[120:8 - 120:9] // CHECK: 120:13: UnexposedExpr= Extent=[120:13 - 120:19] -// CHECK: 120:13: UnexposedExpr= Extent=[120:13 - 120:19] -// CHECK: 120:24: UnexposedExpr= Extent=[120:24 - 120:50] -// CHECK: 120:24: UnexposedExpr= Extent=[120:24 - 120:35] +// CHECK: 120:13: IntegerLiteral= Extent=[120:13 - 120:19] +// CHECK: 120:24: BinaryOperator= Extent=[120:24 - 120:50] +// CHECK: 120:24: BinaryOperator= Extent=[120:24 - 120:35] // CHECK: 120:24: DeclRefExpr=c:2:14 Extent=[120:24 - 120:25] // CHECK: 120:29: UnexposedExpr= Extent=[120:29 - 120:35] -// CHECK: 120:29: UnexposedExpr= Extent=[120:29 - 120:35] -// CHECK: 120:39: UnexposedExpr= Extent=[120:39 - 120:50] +// CHECK: 120:29: IntegerLiteral= Extent=[120:29 - 120:35] +// CHECK: 120:39: BinaryOperator= Extent=[120:39 - 120:50] // CHECK: 120:39: DeclRefExpr=c:2:14 Extent=[120:39 - 120:40] // CHECK: 120:44: UnexposedExpr= Extent=[120:44 - 120:50] -// CHECK: 120:44: UnexposedExpr= Extent=[120:44 - 120:50] -// CHECK: 121:9: UnexposedExpr= Extent=[121:9 - 121:35] -// CHECK: 121:9: UnexposedExpr= Extent=[121:9 - 121:20] +// CHECK: 120:44: IntegerLiteral= Extent=[120:44 - 120:50] +// CHECK: 121:9: BinaryOperator= Extent=[121:9 - 121:35] +// CHECK: 121:9: BinaryOperator= Extent=[121:9 - 121:20] // CHECK: 121:9: DeclRefExpr=c:2:14 Extent=[121:9 - 121:10] // CHECK: 121:14: UnexposedExpr= Extent=[121:14 - 121:20] -// CHECK: 121:14: UnexposedExpr= Extent=[121:14 - 121:20] -// CHECK: 121:24: UnexposedExpr= Extent=[121:24 - 121:35] +// CHECK: 121:14: IntegerLiteral= Extent=[121:14 - 121:20] +// CHECK: 121:24: BinaryOperator= Extent=[121:24 - 121:35] // CHECK: 121:24: DeclRefExpr=c:2:14 Extent=[121:24 - 121:25] // CHECK: 121:29: UnexposedExpr= Extent=[121:29 - 121:35] -// CHECK: 121:29: UnexposedExpr= Extent=[121:29 - 121:35] -// CHECK: 122:8: UnexposedExpr= Extent=[122:8 - 122:19] +// CHECK: 121:29: IntegerLiteral= Extent=[121:29 - 121:35] +// CHECK: 122:8: BinaryOperator= Extent=[122:8 - 122:19] // CHECK: 122:8: DeclRefExpr=c:2:14 Extent=[122:8 - 122:9] // CHECK: 122:13: UnexposedExpr= Extent=[122:13 - 122:19] -// CHECK: 122:13: UnexposedExpr= Extent=[122:13 - 122:19] -// CHECK: 122:24: UnexposedExpr= Extent=[122:24 - 122:50] -// CHECK: 122:24: UnexposedExpr= Extent=[122:24 - 122:35] +// CHECK: 122:13: IntegerLiteral= Extent=[122:13 - 122:19] +// CHECK: 122:24: BinaryOperator= Extent=[122:24 - 122:50] +// CHECK: 122:24: BinaryOperator= Extent=[122:24 - 122:35] // CHECK: 122:24: DeclRefExpr=c:2:14 Extent=[122:24 - 122:25] // CHECK: 122:29: UnexposedExpr= Extent=[122:29 - 122:35] -// CHECK: 122:29: UnexposedExpr= Extent=[122:29 - 122:35] -// CHECK: 122:39: UnexposedExpr= Extent=[122:39 - 122:50] +// CHECK: 122:29: IntegerLiteral= Extent=[122:29 - 122:35] +// CHECK: 122:39: BinaryOperator= Extent=[122:39 - 122:50] // CHECK: 122:39: DeclRefExpr=c:2:14 Extent=[122:39 - 122:40] // CHECK: 122:44: UnexposedExpr= Extent=[122:44 - 122:50] -// CHECK: 122:44: UnexposedExpr= Extent=[122:44 - 122:50] -// CHECK: 123:9: UnexposedExpr= Extent=[123:9 - 123:35] -// CHECK: 123:9: UnexposedExpr= Extent=[123:9 - 123:20] +// CHECK: 122:44: IntegerLiteral= Extent=[122:44 - 122:50] +// CHECK: 123:9: BinaryOperator= Extent=[123:9 - 123:35] +// CHECK: 123:9: BinaryOperator= Extent=[123:9 - 123:20] // CHECK: 123:9: DeclRefExpr=c:2:14 Extent=[123:9 - 123:10] // CHECK: 123:14: UnexposedExpr= Extent=[123:14 - 123:20] -// CHECK: 123:14: UnexposedExpr= Extent=[123:14 - 123:20] -// CHECK: 123:24: UnexposedExpr= Extent=[123:24 - 123:35] +// CHECK: 123:14: IntegerLiteral= Extent=[123:14 - 123:20] +// CHECK: 123:24: BinaryOperator= Extent=[123:24 - 123:35] // CHECK: 123:24: DeclRefExpr=c:2:14 Extent=[123:24 - 123:25] // CHECK: 123:29: UnexposedExpr= Extent=[123:29 - 123:35] -// CHECK: 123:29: UnexposedExpr= Extent=[123:29 - 123:35] -// CHECK: 124:8: UnexposedExpr= Extent=[124:8 - 124:19] +// CHECK: 123:29: IntegerLiteral= Extent=[123:29 - 123:35] +// CHECK: 124:8: BinaryOperator= Extent=[124:8 - 124:19] // CHECK: 124:8: DeclRefExpr=c:2:14 Extent=[124:8 - 124:9] // CHECK: 124:13: UnexposedExpr= Extent=[124:13 - 124:19] -// CHECK: 124:13: UnexposedExpr= Extent=[124:13 - 124:19] -// CHECK: 124:23: UnexposedExpr= Extent=[124:23 - 124:34] +// CHECK: 124:13: IntegerLiteral= Extent=[124:13 - 124:19] +// CHECK: 124:23: BinaryOperator= Extent=[124:23 - 124:34] // CHECK: 124:23: DeclRefExpr=c:2:14 Extent=[124:23 - 124:24] // CHECK: 124:28: UnexposedExpr= Extent=[124:28 - 124:34] -// CHECK: 124:28: UnexposedExpr= Extent=[124:28 - 124:34] -// CHECK: 124:38: UnexposedExpr= Extent=[124:38 - 124:49] +// CHECK: 124:28: IntegerLiteral= Extent=[124:28 - 124:34] +// CHECK: 124:38: BinaryOperator= Extent=[124:38 - 124:49] // CHECK: 124:38: DeclRefExpr=c:2:14 Extent=[124:38 - 124:39] // CHECK: 124:43: UnexposedExpr= Extent=[124:43 - 124:49] -// CHECK: 124:43: UnexposedExpr= Extent=[124:43 - 124:49] -// CHECK: 124:53: UnexposedExpr= Extent=[124:53 - 124:64] +// CHECK: 124:43: IntegerLiteral= Extent=[124:43 - 124:49] +// CHECK: 124:53: BinaryOperator= Extent=[124:53 - 124:64] // CHECK: 124:53: DeclRefExpr=c:2:14 Extent=[124:53 - 124:54] // CHECK: 124:58: UnexposedExpr= Extent=[124:58 - 124:64] -// CHECK: 124:58: UnexposedExpr= Extent=[124:58 - 124:64] -// CHECK: 125:5: UnexposedExpr= Extent=[125:5 - 125:16] +// CHECK: 124:58: IntegerLiteral= Extent=[124:58 - 124:64] +// CHECK: 125:5: BinaryOperator= Extent=[125:5 - 125:16] // CHECK: 125:5: DeclRefExpr=c:2:14 Extent=[125:5 - 125:6] // CHECK: 125:10: UnexposedExpr= Extent=[125:10 - 125:16] -// CHECK: 125:10: UnexposedExpr= Extent=[125:10 - 125:16] -// CHECK: 125:20: UnexposedExpr= Extent=[125:20 - 125:31] +// CHECK: 125:10: IntegerLiteral= Extent=[125:10 - 125:16] +// CHECK: 125:20: BinaryOperator= Extent=[125:20 - 125:31] // CHECK: 125:20: DeclRefExpr=c:2:14 Extent=[125:20 - 125:21] // CHECK: 125:25: UnexposedExpr= Extent=[125:25 - 125:31] -// CHECK: 125:25: UnexposedExpr= Extent=[125:25 - 125:31] -// CHECK: 125:36: UnexposedExpr= Extent=[125:36 - 125:62] -// CHECK: 125:36: UnexposedExpr= Extent=[125:36 - 125:47] +// CHECK: 125:25: IntegerLiteral= Extent=[125:25 - 125:31] +// CHECK: 125:36: BinaryOperator= Extent=[125:36 - 125:62] +// CHECK: 125:36: BinaryOperator= Extent=[125:36 - 125:47] // CHECK: 125:36: DeclRefExpr=c:2:14 Extent=[125:36 - 125:37] // CHECK: 125:41: UnexposedExpr= Extent=[125:41 - 125:47] -// CHECK: 125:41: UnexposedExpr= Extent=[125:41 - 125:47] -// CHECK: 125:51: UnexposedExpr= Extent=[125:51 - 125:62] +// CHECK: 125:41: IntegerLiteral= Extent=[125:41 - 125:47] +// CHECK: 125:51: BinaryOperator= Extent=[125:51 - 125:62] // CHECK: 125:51: DeclRefExpr=c:2:14 Extent=[125:51 - 125:52] // CHECK: 125:56: UnexposedExpr= Extent=[125:56 - 125:62] -// CHECK: 125:56: UnexposedExpr= Extent=[125:56 - 125:62] -// CHECK: 126:8: UnexposedExpr= Extent=[126:8 - 126:19] +// CHECK: 125:56: IntegerLiteral= Extent=[125:56 - 125:62] +// CHECK: 126:8: BinaryOperator= Extent=[126:8 - 126:19] // CHECK: 126:8: DeclRefExpr=c:2:14 Extent=[126:8 - 126:9] // CHECK: 126:13: UnexposedExpr= Extent=[126:13 - 126:19] -// CHECK: 126:13: UnexposedExpr= Extent=[126:13 - 126:19] -// CHECK: 126:24: UnexposedExpr= Extent=[126:24 - 126:50] -// CHECK: 126:24: UnexposedExpr= Extent=[126:24 - 126:35] +// CHECK: 126:13: IntegerLiteral= Extent=[126:13 - 126:19] +// CHECK: 126:24: BinaryOperator= Extent=[126:24 - 126:50] +// CHECK: 126:24: BinaryOperator= Extent=[126:24 - 126:35] // CHECK: 126:24: DeclRefExpr=c:2:14 Extent=[126:24 - 126:25] // CHECK: 126:29: UnexposedExpr= Extent=[126:29 - 126:35] -// CHECK: 126:29: UnexposedExpr= Extent=[126:29 - 126:35] -// CHECK: 126:39: UnexposedExpr= Extent=[126:39 - 126:50] +// CHECK: 126:29: IntegerLiteral= Extent=[126:29 - 126:35] +// CHECK: 126:39: BinaryOperator= Extent=[126:39 - 126:50] // CHECK: 126:39: DeclRefExpr=c:2:14 Extent=[126:39 - 126:40] // CHECK: 126:44: UnexposedExpr= Extent=[126:44 - 126:50] -// CHECK: 126:44: UnexposedExpr= Extent=[126:44 - 126:50] -// CHECK: 127:8: UnexposedExpr= Extent=[127:8 - 127:19] +// CHECK: 126:44: IntegerLiteral= Extent=[126:44 - 126:50] +// CHECK: 127:8: BinaryOperator= Extent=[127:8 - 127:19] // CHECK: 127:8: DeclRefExpr=c:2:14 Extent=[127:8 - 127:9] // CHECK: 127:13: UnexposedExpr= Extent=[127:13 - 127:19] -// CHECK: 127:13: UnexposedExpr= Extent=[127:13 - 127:19] -// CHECK: 127:23: UnexposedExpr= Extent=[127:23 - 127:34] +// CHECK: 127:13: IntegerLiteral= Extent=[127:13 - 127:19] +// CHECK: 127:23: BinaryOperator= Extent=[127:23 - 127:34] // CHECK: 127:23: DeclRefExpr=c:2:14 Extent=[127:23 - 127:24] // CHECK: 127:28: UnexposedExpr= Extent=[127:28 - 127:34] -// CHECK: 127:28: UnexposedExpr= Extent=[127:28 - 127:34] -// CHECK: 127:38: UnexposedExpr= Extent=[127:38 - 127:49] +// CHECK: 127:28: IntegerLiteral= Extent=[127:28 - 127:34] +// CHECK: 127:38: BinaryOperator= Extent=[127:38 - 127:49] // CHECK: 127:38: DeclRefExpr=c:2:14 Extent=[127:38 - 127:39] // CHECK: 127:43: UnexposedExpr= Extent=[127:43 - 127:49] -// CHECK: 127:43: UnexposedExpr= Extent=[127:43 - 127:49] -// CHECK: 127:53: UnexposedExpr= Extent=[127:53 - 127:64] +// CHECK: 127:43: IntegerLiteral= Extent=[127:43 - 127:49] +// CHECK: 127:53: BinaryOperator= Extent=[127:53 - 127:64] // CHECK: 127:53: DeclRefExpr=c:2:14 Extent=[127:53 - 127:54] // CHECK: 127:58: UnexposedExpr= Extent=[127:58 - 127:64] -// CHECK: 127:58: UnexposedExpr= Extent=[127:58 - 127:64] -// CHECK: 128:6: UnexposedExpr= Extent=[128:6 - 128:32] -// CHECK: 128:6: UnexposedExpr= Extent=[128:6 - 128:17] +// CHECK: 127:58: IntegerLiteral= Extent=[127:58 - 127:64] +// CHECK: 128:6: BinaryOperator= Extent=[128:6 - 128:32] +// CHECK: 128:6: BinaryOperator= Extent=[128:6 - 128:17] // CHECK: 128:6: DeclRefExpr=c:2:14 Extent=[128:6 - 128:7] // CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:17] -// CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:17] -// CHECK: 128:21: UnexposedExpr= Extent=[128:21 - 128:32] +// CHECK: 128:11: IntegerLiteral= Extent=[128:11 - 128:17] +// CHECK: 128:21: BinaryOperator= Extent=[128:21 - 128:32] // CHECK: 128:21: DeclRefExpr=c:2:14 Extent=[128:21 - 128:22] // CHECK: 128:26: UnexposedExpr= Extent=[128:26 - 128:32] -// CHECK: 128:26: UnexposedExpr= Extent=[128:26 - 128:32] -// CHECK: 129:9: UnexposedExpr= Extent=[129:9 - 129:35] -// CHECK: 129:9: UnexposedExpr= Extent=[129:9 - 129:20] +// CHECK: 128:26: IntegerLiteral= Extent=[128:26 - 128:32] +// CHECK: 129:9: BinaryOperator= Extent=[129:9 - 129:35] +// CHECK: 129:9: BinaryOperator= Extent=[129:9 - 129:20] // CHECK: 129:9: DeclRefExpr=c:2:14 Extent=[129:9 - 129:10] // CHECK: 129:14: UnexposedExpr= Extent=[129:14 - 129:20] -// CHECK: 129:14: UnexposedExpr= Extent=[129:14 - 129:20] -// CHECK: 129:24: UnexposedExpr= Extent=[129:24 - 129:35] +// CHECK: 129:14: IntegerLiteral= Extent=[129:14 - 129:20] +// CHECK: 129:24: BinaryOperator= Extent=[129:24 - 129:35] // CHECK: 129:24: DeclRefExpr=c:2:14 Extent=[129:24 - 129:25] // CHECK: 129:29: UnexposedExpr= Extent=[129:29 - 129:35] -// CHECK: 129:29: UnexposedExpr= Extent=[129:29 - 129:35] -// CHECK: 130:8: UnexposedExpr= Extent=[130:8 - 130:19] +// CHECK: 129:29: IntegerLiteral= Extent=[129:29 - 129:35] +// CHECK: 130:8: BinaryOperator= Extent=[130:8 - 130:19] // CHECK: 130:8: DeclRefExpr=c:2:14 Extent=[130:8 - 130:9] // CHECK: 130:13: UnexposedExpr= Extent=[130:13 - 130:19] -// CHECK: 130:13: UnexposedExpr= Extent=[130:13 - 130:19] -// CHECK: 130:23: UnexposedExpr= Extent=[130:23 - 130:34] +// CHECK: 130:13: IntegerLiteral= Extent=[130:13 - 130:19] +// CHECK: 130:23: BinaryOperator= Extent=[130:23 - 130:34] // CHECK: 130:23: DeclRefExpr=c:2:14 Extent=[130:23 - 130:24] // CHECK: 130:28: UnexposedExpr= Extent=[130:28 - 130:34] -// CHECK: 130:28: UnexposedExpr= Extent=[130:28 - 130:34] -// CHECK: 130:38: UnexposedExpr= Extent=[130:38 - 130:49] +// CHECK: 130:28: IntegerLiteral= Extent=[130:28 - 130:34] +// CHECK: 130:38: BinaryOperator= Extent=[130:38 - 130:49] // CHECK: 130:38: DeclRefExpr=c:2:14 Extent=[130:38 - 130:39] // CHECK: 130:43: UnexposedExpr= Extent=[130:43 - 130:49] -// CHECK: 130:43: UnexposedExpr= Extent=[130:43 - 130:49] -// CHECK: 130:53: UnexposedExpr= Extent=[130:53 - 130:64] +// CHECK: 130:43: IntegerLiteral= Extent=[130:43 - 130:49] +// CHECK: 130:53: BinaryOperator= Extent=[130:53 - 130:64] // CHECK: 130:53: DeclRefExpr=c:2:14 Extent=[130:53 - 130:54] // CHECK: 130:58: UnexposedExpr= Extent=[130:58 - 130:64] -// CHECK: 130:58: UnexposedExpr= Extent=[130:58 - 130:64] -// CHECK: 131:6: UnexposedExpr= Extent=[131:6 - 131:32] -// CHECK: 131:6: UnexposedExpr= Extent=[131:6 - 131:17] +// CHECK: 130:58: IntegerLiteral= Extent=[130:58 - 130:64] +// CHECK: 131:6: BinaryOperator= Extent=[131:6 - 131:32] +// CHECK: 131:6: BinaryOperator= Extent=[131:6 - 131:17] // CHECK: 131:6: DeclRefExpr=c:2:14 Extent=[131:6 - 131:7] // CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:17] -// CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:17] -// CHECK: 131:21: UnexposedExpr= Extent=[131:21 - 131:32] +// CHECK: 131:11: IntegerLiteral= Extent=[131:11 - 131:17] +// CHECK: 131:21: BinaryOperator= Extent=[131:21 - 131:32] // CHECK: 131:21: DeclRefExpr=c:2:14 Extent=[131:21 - 131:22] // CHECK: 131:26: UnexposedExpr= Extent=[131:26 - 131:32] -// CHECK: 131:26: UnexposedExpr= Extent=[131:26 - 131:32] -// CHECK: 132:9: UnexposedExpr= Extent=[132:9 - 132:35] -// CHECK: 132:9: UnexposedExpr= Extent=[132:9 - 132:20] +// CHECK: 131:26: IntegerLiteral= Extent=[131:26 - 131:32] +// CHECK: 132:9: BinaryOperator= Extent=[132:9 - 132:35] +// CHECK: 132:9: BinaryOperator= Extent=[132:9 - 132:20] // CHECK: 132:9: DeclRefExpr=c:2:14 Extent=[132:9 - 132:10] // CHECK: 132:14: UnexposedExpr= Extent=[132:14 - 132:20] -// CHECK: 132:14: UnexposedExpr= Extent=[132:14 - 132:20] -// CHECK: 132:24: UnexposedExpr= Extent=[132:24 - 132:35] +// CHECK: 132:14: IntegerLiteral= Extent=[132:14 - 132:20] +// CHECK: 132:24: BinaryOperator= Extent=[132:24 - 132:35] // CHECK: 132:24: DeclRefExpr=c:2:14 Extent=[132:24 - 132:25] // CHECK: 132:29: UnexposedExpr= Extent=[132:29 - 132:35] -// CHECK: 132:29: UnexposedExpr= Extent=[132:29 - 132:35] -// CHECK: 133:8: UnexposedExpr= Extent=[133:8 - 133:19] +// CHECK: 132:29: IntegerLiteral= Extent=[132:29 - 132:35] +// CHECK: 133:8: BinaryOperator= Extent=[133:8 - 133:19] // CHECK: 133:8: DeclRefExpr=c:2:14 Extent=[133:8 - 133:9] // CHECK: 133:13: UnexposedExpr= Extent=[133:13 - 133:19] -// CHECK: 133:13: UnexposedExpr= Extent=[133:13 - 133:19] -// CHECK: 133:24: UnexposedExpr= Extent=[133:24 - 133:50] -// CHECK: 133:24: UnexposedExpr= Extent=[133:24 - 133:35] +// CHECK: 133:13: IntegerLiteral= Extent=[133:13 - 133:19] +// CHECK: 133:24: BinaryOperator= Extent=[133:24 - 133:50] +// CHECK: 133:24: BinaryOperator= Extent=[133:24 - 133:35] // CHECK: 133:24: DeclRefExpr=c:2:14 Extent=[133:24 - 133:25] // CHECK: 133:29: UnexposedExpr= Extent=[133:29 - 133:35] -// CHECK: 133:29: UnexposedExpr= Extent=[133:29 - 133:35] -// CHECK: 133:39: UnexposedExpr= Extent=[133:39 - 133:50] +// CHECK: 133:29: IntegerLiteral= Extent=[133:29 - 133:35] +// CHECK: 133:39: BinaryOperator= Extent=[133:39 - 133:50] // CHECK: 133:39: DeclRefExpr=c:2:14 Extent=[133:39 - 133:40] // CHECK: 133:44: UnexposedExpr= Extent=[133:44 - 133:50] -// CHECK: 133:44: UnexposedExpr= Extent=[133:44 - 133:50] -// CHECK: 134:8: UnexposedExpr= Extent=[134:8 - 134:19] +// CHECK: 133:44: IntegerLiteral= Extent=[133:44 - 133:50] +// CHECK: 134:8: BinaryOperator= Extent=[134:8 - 134:19] // CHECK: 134:8: DeclRefExpr=c:2:14 Extent=[134:8 - 134:9] // CHECK: 134:13: UnexposedExpr= Extent=[134:13 - 134:19] -// CHECK: 134:13: UnexposedExpr= Extent=[134:13 - 134:19] -// CHECK: 134:23: UnexposedExpr= Extent=[134:23 - 134:34] +// CHECK: 134:13: IntegerLiteral= Extent=[134:13 - 134:19] +// CHECK: 134:23: BinaryOperator= Extent=[134:23 - 134:34] // CHECK: 134:23: DeclRefExpr=c:2:14 Extent=[134:23 - 134:24] // CHECK: 134:28: UnexposedExpr= Extent=[134:28 - 134:34] -// CHECK: 134:28: UnexposedExpr= Extent=[134:28 - 134:34] -// CHECK: 134:38: UnexposedExpr= Extent=[134:38 - 134:49] +// CHECK: 134:28: IntegerLiteral= Extent=[134:28 - 134:34] +// CHECK: 134:38: BinaryOperator= Extent=[134:38 - 134:49] // CHECK: 134:38: DeclRefExpr=c:2:14 Extent=[134:38 - 134:39] // CHECK: 134:43: UnexposedExpr= Extent=[134:43 - 134:49] -// CHECK: 134:43: UnexposedExpr= Extent=[134:43 - 134:49] -// CHECK: 134:54: UnexposedExpr= Extent=[134:54 - 134:80] -// CHECK: 134:54: UnexposedExpr= Extent=[134:54 - 134:65] +// CHECK: 134:43: IntegerLiteral= Extent=[134:43 - 134:49] +// CHECK: 134:54: BinaryOperator= Extent=[134:54 - 134:80] +// CHECK: 134:54: BinaryOperator= Extent=[134:54 - 134:65] // CHECK: 134:54: DeclRefExpr=c:2:14 Extent=[134:54 - 134:55] // CHECK: 134:59: UnexposedExpr= Extent=[134:59 - 134:65] -// CHECK: 134:59: UnexposedExpr= Extent=[134:59 - 134:65] -// CHECK: 134:69: UnexposedExpr= Extent=[134:69 - 134:80] +// CHECK: 134:59: IntegerLiteral= Extent=[134:59 - 134:65] +// CHECK: 134:69: BinaryOperator= Extent=[134:69 - 134:80] // CHECK: 134:69: DeclRefExpr=c:2:14 Extent=[134:69 - 134:70] // CHECK: 134:74: UnexposedExpr= Extent=[134:74 - 134:80] -// CHECK: 134:74: UnexposedExpr= Extent=[134:74 - 134:80] -// CHECK: 135:9: UnexposedExpr= Extent=[135:9 - 135:35] -// CHECK: 135:9: UnexposedExpr= Extent=[135:9 - 135:20] +// CHECK: 134:74: IntegerLiteral= Extent=[134:74 - 134:80] +// CHECK: 135:9: BinaryOperator= Extent=[135:9 - 135:35] +// CHECK: 135:9: BinaryOperator= Extent=[135:9 - 135:20] // CHECK: 135:9: DeclRefExpr=c:2:14 Extent=[135:9 - 135:10] // CHECK: 135:14: UnexposedExpr= Extent=[135:14 - 135:20] -// CHECK: 135:14: UnexposedExpr= Extent=[135:14 - 135:20] -// CHECK: 135:24: UnexposedExpr= Extent=[135:24 - 135:35] +// CHECK: 135:14: IntegerLiteral= Extent=[135:14 - 135:20] +// CHECK: 135:24: BinaryOperator= Extent=[135:24 - 135:35] // CHECK: 135:24: DeclRefExpr=c:2:14 Extent=[135:24 - 135:25] // CHECK: 135:29: UnexposedExpr= Extent=[135:29 - 135:35] -// CHECK: 135:29: UnexposedExpr= Extent=[135:29 - 135:35] -// CHECK: 136:9: UnexposedExpr= Extent=[136:9 - 136:35] -// CHECK: 136:9: UnexposedExpr= Extent=[136:9 - 136:20] +// CHECK: 135:29: IntegerLiteral= Extent=[135:29 - 135:35] +// CHECK: 136:9: BinaryOperator= Extent=[136:9 - 136:35] +// CHECK: 136:9: BinaryOperator= Extent=[136:9 - 136:20] // CHECK: 136:9: DeclRefExpr=c:2:14 Extent=[136:9 - 136:10] // CHECK: 136:14: UnexposedExpr= Extent=[136:14 - 136:20] -// CHECK: 136:14: UnexposedExpr= Extent=[136:14 - 136:20] -// CHECK: 136:24: UnexposedExpr= Extent=[136:24 - 136:35] +// CHECK: 136:14: IntegerLiteral= Extent=[136:14 - 136:20] +// CHECK: 136:24: BinaryOperator= Extent=[136:24 - 136:35] // CHECK: 136:24: DeclRefExpr=c:2:14 Extent=[136:24 - 136:25] // CHECK: 136:29: UnexposedExpr= Extent=[136:29 - 136:35] -// CHECK: 136:29: UnexposedExpr= Extent=[136:29 - 136:35] -// CHECK: 137:9: UnexposedExpr= Extent=[137:9 - 137:35] -// CHECK: 137:9: UnexposedExpr= Extent=[137:9 - 137:20] +// CHECK: 136:29: IntegerLiteral= Extent=[136:29 - 136:35] +// CHECK: 137:9: BinaryOperator= Extent=[137:9 - 137:35] +// CHECK: 137:9: BinaryOperator= Extent=[137:9 - 137:20] // CHECK: 137:9: DeclRefExpr=c:2:14 Extent=[137:9 - 137:10] // CHECK: 137:14: UnexposedExpr= Extent=[137:14 - 137:20] -// CHECK: 137:14: UnexposedExpr= Extent=[137:14 - 137:20] -// CHECK: 137:24: UnexposedExpr= Extent=[137:24 - 137:35] +// CHECK: 137:14: IntegerLiteral= Extent=[137:14 - 137:20] +// CHECK: 137:24: BinaryOperator= Extent=[137:24 - 137:35] // CHECK: 137:24: DeclRefExpr=c:2:14 Extent=[137:24 - 137:25] // CHECK: 137:29: UnexposedExpr= Extent=[137:29 - 137:35] -// CHECK: 137:29: UnexposedExpr= Extent=[137:29 - 137:35] -// CHECK: 138:9: UnexposedExpr= Extent=[138:9 - 138:35] -// CHECK: 138:9: UnexposedExpr= Extent=[138:9 - 138:20] +// CHECK: 137:29: IntegerLiteral= Extent=[137:29 - 137:35] +// CHECK: 138:9: BinaryOperator= Extent=[138:9 - 138:35] +// CHECK: 138:9: BinaryOperator= Extent=[138:9 - 138:20] // CHECK: 138:9: DeclRefExpr=c:2:14 Extent=[138:9 - 138:10] // CHECK: 138:14: UnexposedExpr= Extent=[138:14 - 138:20] -// CHECK: 138:14: UnexposedExpr= Extent=[138:14 - 138:20] -// CHECK: 138:24: UnexposedExpr= Extent=[138:24 - 138:35] +// CHECK: 138:14: IntegerLiteral= Extent=[138:14 - 138:20] +// CHECK: 138:24: BinaryOperator= Extent=[138:24 - 138:35] // CHECK: 138:24: DeclRefExpr=c:2:14 Extent=[138:24 - 138:25] // CHECK: 138:29: UnexposedExpr= Extent=[138:29 - 138:35] -// CHECK: 138:29: UnexposedExpr= Extent=[138:29 - 138:35] -// CHECK: 139:9: UnexposedExpr= Extent=[139:9 - 139:35] -// CHECK: 139:9: UnexposedExpr= Extent=[139:9 - 139:20] +// CHECK: 138:29: IntegerLiteral= Extent=[138:29 - 138:35] +// CHECK: 139:9: BinaryOperator= Extent=[139:9 - 139:35] +// CHECK: 139:9: BinaryOperator= Extent=[139:9 - 139:20] // CHECK: 139:9: DeclRefExpr=c:2:14 Extent=[139:9 - 139:10] // CHECK: 139:14: UnexposedExpr= Extent=[139:14 - 139:20] -// CHECK: 139:14: UnexposedExpr= Extent=[139:14 - 139:20] -// CHECK: 139:24: UnexposedExpr= Extent=[139:24 - 139:35] +// CHECK: 139:14: IntegerLiteral= Extent=[139:14 - 139:20] +// CHECK: 139:24: BinaryOperator= Extent=[139:24 - 139:35] // CHECK: 139:24: DeclRefExpr=c:2:14 Extent=[139:24 - 139:25] // CHECK: 139:29: UnexposedExpr= Extent=[139:29 - 139:35] -// CHECK: 139:29: UnexposedExpr= Extent=[139:29 - 139:35] -// CHECK: 140:9: UnexposedExpr= Extent=[140:9 - 140:35] -// CHECK: 140:9: UnexposedExpr= Extent=[140:9 - 140:20] +// CHECK: 139:29: IntegerLiteral= Extent=[139:29 - 139:35] +// CHECK: 140:9: BinaryOperator= Extent=[140:9 - 140:35] +// CHECK: 140:9: BinaryOperator= Extent=[140:9 - 140:20] // CHECK: 140:9: DeclRefExpr=c:2:14 Extent=[140:9 - 140:10] // CHECK: 140:14: UnexposedExpr= Extent=[140:14 - 140:20] -// CHECK: 140:14: UnexposedExpr= Extent=[140:14 - 140:20] -// CHECK: 140:24: UnexposedExpr= Extent=[140:24 - 140:35] +// CHECK: 140:14: IntegerLiteral= Extent=[140:14 - 140:20] +// CHECK: 140:24: BinaryOperator= Extent=[140:24 - 140:35] // CHECK: 140:24: DeclRefExpr=c:2:14 Extent=[140:24 - 140:25] // CHECK: 140:29: UnexposedExpr= Extent=[140:29 - 140:35] -// CHECK: 140:29: UnexposedExpr= Extent=[140:29 - 140:35] -// CHECK: 141:8: UnexposedExpr= Extent=[141:8 - 141:19] +// CHECK: 140:29: IntegerLiteral= Extent=[140:29 - 140:35] +// CHECK: 141:8: BinaryOperator= Extent=[141:8 - 141:19] // CHECK: 141:8: DeclRefExpr=c:2:14 Extent=[141:8 - 141:9] // CHECK: 141:13: UnexposedExpr= Extent=[141:13 - 141:19] -// CHECK: 141:13: UnexposedExpr= Extent=[141:13 - 141:19] -// CHECK: 141:23: UnexposedExpr= Extent=[141:23 - 141:34] +// CHECK: 141:13: IntegerLiteral= Extent=[141:13 - 141:19] +// CHECK: 141:23: BinaryOperator= Extent=[141:23 - 141:34] // CHECK: 141:23: DeclRefExpr=c:2:14 Extent=[141:23 - 141:24] // CHECK: 141:28: UnexposedExpr= Extent=[141:28 - 141:34] -// CHECK: 141:28: UnexposedExpr= Extent=[141:28 - 141:34] -// CHECK: 141:38: UnexposedExpr= Extent=[141:38 - 141:49] +// CHECK: 141:28: IntegerLiteral= Extent=[141:28 - 141:34] +// CHECK: 141:38: BinaryOperator= Extent=[141:38 - 141:49] // CHECK: 141:38: DeclRefExpr=c:2:14 Extent=[141:38 - 141:39] // CHECK: 141:43: UnexposedExpr= Extent=[141:43 - 141:49] -// CHECK: 141:43: UnexposedExpr= Extent=[141:43 - 141:49] -// CHECK: 141:54: UnexposedExpr= Extent=[141:54 - 141:80] -// CHECK: 141:54: UnexposedExpr= Extent=[141:54 - 141:65] +// CHECK: 141:43: IntegerLiteral= Extent=[141:43 - 141:49] +// CHECK: 141:54: BinaryOperator= Extent=[141:54 - 141:80] +// CHECK: 141:54: BinaryOperator= Extent=[141:54 - 141:65] // CHECK: 141:54: DeclRefExpr=c:2:14 Extent=[141:54 - 141:55] // CHECK: 141:59: UnexposedExpr= Extent=[141:59 - 141:65] -// CHECK: 141:59: UnexposedExpr= Extent=[141:59 - 141:65] -// CHECK: 141:69: UnexposedExpr= Extent=[141:69 - 141:80] +// CHECK: 141:59: IntegerLiteral= Extent=[141:59 - 141:65] +// CHECK: 141:69: BinaryOperator= Extent=[141:69 - 141:80] // CHECK: 141:69: DeclRefExpr=c:2:14 Extent=[141:69 - 141:70] // CHECK: 141:74: UnexposedExpr= Extent=[141:74 - 141:80] -// CHECK: 141:74: UnexposedExpr= Extent=[141:74 - 141:80] -// CHECK: 142:9: UnexposedExpr= Extent=[142:9 - 142:35] -// CHECK: 142:9: UnexposedExpr= Extent=[142:9 - 142:20] +// CHECK: 141:74: IntegerLiteral= Extent=[141:74 - 141:80] +// CHECK: 142:9: BinaryOperator= Extent=[142:9 - 142:35] +// CHECK: 142:9: BinaryOperator= Extent=[142:9 - 142:20] // CHECK: 142:9: DeclRefExpr=c:2:14 Extent=[142:9 - 142:10] // CHECK: 142:14: UnexposedExpr= Extent=[142:14 - 142:20] -// CHECK: 142:14: UnexposedExpr= Extent=[142:14 - 142:20] -// CHECK: 142:24: UnexposedExpr= Extent=[142:24 - 142:35] +// CHECK: 142:14: IntegerLiteral= Extent=[142:14 - 142:20] +// CHECK: 142:24: BinaryOperator= Extent=[142:24 - 142:35] // CHECK: 142:24: DeclRefExpr=c:2:14 Extent=[142:24 - 142:25] // CHECK: 142:29: UnexposedExpr= Extent=[142:29 - 142:35] -// CHECK: 142:29: UnexposedExpr= Extent=[142:29 - 142:35] -// CHECK: 143:9: UnexposedExpr= Extent=[143:9 - 143:35] -// CHECK: 143:9: UnexposedExpr= Extent=[143:9 - 143:20] +// CHECK: 142:29: IntegerLiteral= Extent=[142:29 - 142:35] +// CHECK: 143:9: BinaryOperator= Extent=[143:9 - 143:35] +// CHECK: 143:9: BinaryOperator= Extent=[143:9 - 143:20] // CHECK: 143:9: DeclRefExpr=c:2:14 Extent=[143:9 - 143:10] // CHECK: 143:14: UnexposedExpr= Extent=[143:14 - 143:20] -// CHECK: 143:14: UnexposedExpr= Extent=[143:14 - 143:20] -// CHECK: 143:24: UnexposedExpr= Extent=[143:24 - 143:35] +// CHECK: 143:14: IntegerLiteral= Extent=[143:14 - 143:20] +// CHECK: 143:24: BinaryOperator= Extent=[143:24 - 143:35] // CHECK: 143:24: DeclRefExpr=c:2:14 Extent=[143:24 - 143:25] // CHECK: 143:29: UnexposedExpr= Extent=[143:29 - 143:35] -// CHECK: 143:29: UnexposedExpr= Extent=[143:29 - 143:35] -// CHECK: 144:8: UnexposedExpr= Extent=[144:8 - 144:19] +// CHECK: 143:29: IntegerLiteral= Extent=[143:29 - 143:35] +// CHECK: 144:8: BinaryOperator= Extent=[144:8 - 144:19] // CHECK: 144:8: DeclRefExpr=c:2:14 Extent=[144:8 - 144:9] // CHECK: 144:13: UnexposedExpr= Extent=[144:13 - 144:19] -// CHECK: 144:13: UnexposedExpr= Extent=[144:13 - 144:19] -// CHECK: 144:24: UnexposedExpr= Extent=[144:24 - 144:50] -// CHECK: 144:24: UnexposedExpr= Extent=[144:24 - 144:35] +// CHECK: 144:13: IntegerLiteral= Extent=[144:13 - 144:19] +// CHECK: 144:24: BinaryOperator= Extent=[144:24 - 144:50] +// CHECK: 144:24: BinaryOperator= Extent=[144:24 - 144:35] // CHECK: 144:24: DeclRefExpr=c:2:14 Extent=[144:24 - 144:25] // CHECK: 144:29: UnexposedExpr= Extent=[144:29 - 144:35] -// CHECK: 144:29: UnexposedExpr= Extent=[144:29 - 144:35] -// CHECK: 144:39: UnexposedExpr= Extent=[144:39 - 144:50] +// CHECK: 144:29: IntegerLiteral= Extent=[144:29 - 144:35] +// CHECK: 144:39: BinaryOperator= Extent=[144:39 - 144:50] // CHECK: 144:39: DeclRefExpr=c:2:14 Extent=[144:39 - 144:40] // CHECK: 144:44: UnexposedExpr= Extent=[144:44 - 144:50] -// CHECK: 144:44: UnexposedExpr= Extent=[144:44 - 144:50] -// CHECK: 145:9: UnexposedExpr= Extent=[145:9 - 145:35] -// CHECK: 145:9: UnexposedExpr= Extent=[145:9 - 145:20] +// CHECK: 144:44: IntegerLiteral= Extent=[144:44 - 144:50] +// CHECK: 145:9: BinaryOperator= Extent=[145:9 - 145:35] +// CHECK: 145:9: BinaryOperator= Extent=[145:9 - 145:20] // CHECK: 145:9: DeclRefExpr=c:2:14 Extent=[145:9 - 145:10] // CHECK: 145:14: UnexposedExpr= Extent=[145:14 - 145:20] -// CHECK: 145:14: UnexposedExpr= Extent=[145:14 - 145:20] -// CHECK: 145:24: UnexposedExpr= Extent=[145:24 - 145:35] +// CHECK: 145:14: IntegerLiteral= Extent=[145:14 - 145:20] +// CHECK: 145:24: BinaryOperator= Extent=[145:24 - 145:35] // CHECK: 145:24: DeclRefExpr=c:2:14 Extent=[145:24 - 145:25] // CHECK: 145:29: UnexposedExpr= Extent=[145:29 - 145:35] -// CHECK: 145:29: UnexposedExpr= Extent=[145:29 - 145:35] -// CHECK: 146:9: UnexposedExpr= Extent=[146:9 - 146:35] -// CHECK: 146:9: UnexposedExpr= Extent=[146:9 - 146:20] +// CHECK: 145:29: IntegerLiteral= Extent=[145:29 - 145:35] +// CHECK: 146:9: BinaryOperator= Extent=[146:9 - 146:35] +// CHECK: 146:9: BinaryOperator= Extent=[146:9 - 146:20] // CHECK: 146:9: DeclRefExpr=c:2:14 Extent=[146:9 - 146:10] // CHECK: 146:14: UnexposedExpr= Extent=[146:14 - 146:20] -// CHECK: 146:14: UnexposedExpr= Extent=[146:14 - 146:20] -// CHECK: 146:24: UnexposedExpr= Extent=[146:24 - 146:35] +// CHECK: 146:14: IntegerLiteral= Extent=[146:14 - 146:20] +// CHECK: 146:24: BinaryOperator= Extent=[146:24 - 146:35] // CHECK: 146:24: DeclRefExpr=c:2:14 Extent=[146:24 - 146:25] // CHECK: 146:29: UnexposedExpr= Extent=[146:29 - 146:35] -// CHECK: 146:29: UnexposedExpr= Extent=[146:29 - 146:35] -// CHECK: 147:9: UnexposedExpr= Extent=[147:9 - 147:35] -// CHECK: 147:9: UnexposedExpr= Extent=[147:9 - 147:20] +// CHECK: 146:29: IntegerLiteral= Extent=[146:29 - 146:35] +// CHECK: 147:9: BinaryOperator= Extent=[147:9 - 147:35] +// CHECK: 147:9: BinaryOperator= Extent=[147:9 - 147:20] // CHECK: 147:9: DeclRefExpr=c:2:14 Extent=[147:9 - 147:10] // CHECK: 147:14: UnexposedExpr= Extent=[147:14 - 147:20] -// CHECK: 147:14: UnexposedExpr= Extent=[147:14 - 147:20] -// CHECK: 147:24: UnexposedExpr= Extent=[147:24 - 147:35] +// CHECK: 147:14: IntegerLiteral= Extent=[147:14 - 147:20] +// CHECK: 147:24: BinaryOperator= Extent=[147:24 - 147:35] // CHECK: 147:24: DeclRefExpr=c:2:14 Extent=[147:24 - 147:25] // CHECK: 147:29: UnexposedExpr= Extent=[147:29 - 147:35] -// CHECK: 147:29: UnexposedExpr= Extent=[147:29 - 147:35] -// CHECK: 148:9: UnexposedExpr= Extent=[148:9 - 148:35] -// CHECK: 148:9: UnexposedExpr= Extent=[148:9 - 148:20] +// CHECK: 147:29: IntegerLiteral= Extent=[147:29 - 147:35] +// CHECK: 148:9: BinaryOperator= Extent=[148:9 - 148:35] +// CHECK: 148:9: BinaryOperator= Extent=[148:9 - 148:20] // CHECK: 148:9: DeclRefExpr=c:2:14 Extent=[148:9 - 148:10] // CHECK: 148:14: UnexposedExpr= Extent=[148:14 - 148:20] -// CHECK: 148:14: UnexposedExpr= Extent=[148:14 - 148:20] -// CHECK: 148:24: UnexposedExpr= Extent=[148:24 - 148:35] +// CHECK: 148:14: IntegerLiteral= Extent=[148:14 - 148:20] +// CHECK: 148:24: BinaryOperator= Extent=[148:24 - 148:35] // CHECK: 148:24: DeclRefExpr=c:2:14 Extent=[148:24 - 148:25] // CHECK: 148:29: UnexposedExpr= Extent=[148:29 - 148:35] -// CHECK: 148:29: UnexposedExpr= Extent=[148:29 - 148:35] -// CHECK: 149:9: UnexposedExpr= Extent=[149:9 - 149:35] -// CHECK: 149:9: UnexposedExpr= Extent=[149:9 - 149:20] +// CHECK: 148:29: IntegerLiteral= Extent=[148:29 - 148:35] +// CHECK: 149:9: BinaryOperator= Extent=[149:9 - 149:35] +// CHECK: 149:9: BinaryOperator= Extent=[149:9 - 149:20] // CHECK: 149:9: DeclRefExpr=c:2:14 Extent=[149:9 - 149:10] // CHECK: 149:14: UnexposedExpr= Extent=[149:14 - 149:20] -// CHECK: 149:14: UnexposedExpr= Extent=[149:14 - 149:20] -// CHECK: 149:24: UnexposedExpr= Extent=[149:24 - 149:35] +// CHECK: 149:14: IntegerLiteral= Extent=[149:14 - 149:20] +// CHECK: 149:24: BinaryOperator= Extent=[149:24 - 149:35] // CHECK: 149:24: DeclRefExpr=c:2:14 Extent=[149:24 - 149:25] // CHECK: 149:29: UnexposedExpr= Extent=[149:29 - 149:35] -// CHECK: 149:29: UnexposedExpr= Extent=[149:29 - 149:35] -// CHECK: 150:9: UnexposedExpr= Extent=[150:9 - 150:35] -// CHECK: 150:9: UnexposedExpr= Extent=[150:9 - 150:20] +// CHECK: 149:29: IntegerLiteral= Extent=[149:29 - 149:35] +// CHECK: 150:9: BinaryOperator= Extent=[150:9 - 150:35] +// CHECK: 150:9: BinaryOperator= Extent=[150:9 - 150:20] // CHECK: 150:9: DeclRefExpr=c:2:14 Extent=[150:9 - 150:10] // CHECK: 150:14: UnexposedExpr= Extent=[150:14 - 150:20] -// CHECK: 150:14: UnexposedExpr= Extent=[150:14 - 150:20] -// CHECK: 150:24: UnexposedExpr= Extent=[150:24 - 150:35] +// CHECK: 150:14: IntegerLiteral= Extent=[150:14 - 150:20] +// CHECK: 150:24: BinaryOperator= Extent=[150:24 - 150:35] // CHECK: 150:24: DeclRefExpr=c:2:14 Extent=[150:24 - 150:25] // CHECK: 150:29: UnexposedExpr= Extent=[150:29 - 150:35] -// CHECK: 150:29: UnexposedExpr= Extent=[150:29 - 150:35] -// CHECK: 151:8: UnexposedExpr= Extent=[151:8 - 151:19] +// CHECK: 150:29: IntegerLiteral= Extent=[150:29 - 150:35] +// CHECK: 151:8: BinaryOperator= Extent=[151:8 - 151:19] // CHECK: 151:8: DeclRefExpr=c:2:14 Extent=[151:8 - 151:9] // CHECK: 151:13: UnexposedExpr= Extent=[151:13 - 151:19] -// CHECK: 151:13: UnexposedExpr= Extent=[151:13 - 151:19] -// CHECK: 151:24: UnexposedExpr= Extent=[151:24 - 151:50] -// CHECK: 151:24: UnexposedExpr= Extent=[151:24 - 151:35] +// CHECK: 151:13: IntegerLiteral= Extent=[151:13 - 151:19] +// CHECK: 151:24: BinaryOperator= Extent=[151:24 - 151:50] +// CHECK: 151:24: BinaryOperator= Extent=[151:24 - 151:35] // CHECK: 151:24: DeclRefExpr=c:2:14 Extent=[151:24 - 151:25] // CHECK: 151:29: UnexposedExpr= Extent=[151:29 - 151:35] -// CHECK: 151:29: UnexposedExpr= Extent=[151:29 - 151:35] -// CHECK: 151:39: UnexposedExpr= Extent=[151:39 - 151:50] +// CHECK: 151:29: IntegerLiteral= Extent=[151:29 - 151:35] +// CHECK: 151:39: BinaryOperator= Extent=[151:39 - 151:50] // CHECK: 151:39: DeclRefExpr=c:2:14 Extent=[151:39 - 151:40] // CHECK: 151:44: UnexposedExpr= Extent=[151:44 - 151:50] -// CHECK: 151:44: UnexposedExpr= Extent=[151:44 - 151:50] -// CHECK: 152:8: UnexposedExpr= Extent=[152:8 - 152:19] +// CHECK: 151:44: IntegerLiteral= Extent=[151:44 - 151:50] +// CHECK: 152:8: BinaryOperator= Extent=[152:8 - 152:19] // CHECK: 152:8: DeclRefExpr=c:2:14 Extent=[152:8 - 152:9] // CHECK: 152:13: UnexposedExpr= Extent=[152:13 - 152:19] -// CHECK: 152:13: UnexposedExpr= Extent=[152:13 - 152:19] -// CHECK: 152:24: UnexposedExpr= Extent=[152:24 - 152:50] -// CHECK: 152:24: UnexposedExpr= Extent=[152:24 - 152:35] +// CHECK: 152:13: IntegerLiteral= Extent=[152:13 - 152:19] +// CHECK: 152:24: BinaryOperator= Extent=[152:24 - 152:50] +// CHECK: 152:24: BinaryOperator= Extent=[152:24 - 152:35] // CHECK: 152:24: DeclRefExpr=c:2:14 Extent=[152:24 - 152:25] // CHECK: 152:29: UnexposedExpr= Extent=[152:29 - 152:35] -// CHECK: 152:29: UnexposedExpr= Extent=[152:29 - 152:35] -// CHECK: 152:39: UnexposedExpr= Extent=[152:39 - 152:50] +// CHECK: 152:29: IntegerLiteral= Extent=[152:29 - 152:35] +// CHECK: 152:39: BinaryOperator= Extent=[152:39 - 152:50] // CHECK: 152:39: DeclRefExpr=c:2:14 Extent=[152:39 - 152:40] // CHECK: 152:44: UnexposedExpr= Extent=[152:44 - 152:50] -// CHECK: 152:44: UnexposedExpr= Extent=[152:44 - 152:50] -// CHECK: 153:9: UnexposedExpr= Extent=[153:9 - 153:35] -// CHECK: 153:9: UnexposedExpr= Extent=[153:9 - 153:20] +// CHECK: 152:44: IntegerLiteral= Extent=[152:44 - 152:50] +// CHECK: 153:9: BinaryOperator= Extent=[153:9 - 153:35] +// CHECK: 153:9: BinaryOperator= Extent=[153:9 - 153:20] // CHECK: 153:9: DeclRefExpr=c:2:14 Extent=[153:9 - 153:10] // CHECK: 153:14: UnexposedExpr= Extent=[153:14 - 153:20] -// CHECK: 153:14: UnexposedExpr= Extent=[153:14 - 153:20] -// CHECK: 153:24: UnexposedExpr= Extent=[153:24 - 153:35] +// CHECK: 153:14: IntegerLiteral= Extent=[153:14 - 153:20] +// CHECK: 153:24: BinaryOperator= Extent=[153:24 - 153:35] // CHECK: 153:24: DeclRefExpr=c:2:14 Extent=[153:24 - 153:25] // CHECK: 153:29: UnexposedExpr= Extent=[153:29 - 153:35] -// CHECK: 153:29: UnexposedExpr= Extent=[153:29 - 153:35] -// CHECK: 154:9: UnexposedExpr= Extent=[154:9 - 154:35] -// CHECK: 154:9: UnexposedExpr= Extent=[154:9 - 154:20] +// CHECK: 153:29: IntegerLiteral= Extent=[153:29 - 153:35] +// CHECK: 154:9: BinaryOperator= Extent=[154:9 - 154:35] +// CHECK: 154:9: BinaryOperator= Extent=[154:9 - 154:20] // CHECK: 154:9: DeclRefExpr=c:2:14 Extent=[154:9 - 154:10] // CHECK: 154:14: UnexposedExpr= Extent=[154:14 - 154:20] -// CHECK: 154:14: UnexposedExpr= Extent=[154:14 - 154:20] -// CHECK: 154:24: UnexposedExpr= Extent=[154:24 - 154:35] +// CHECK: 154:14: IntegerLiteral= Extent=[154:14 - 154:20] +// CHECK: 154:24: BinaryOperator= Extent=[154:24 - 154:35] // CHECK: 154:24: DeclRefExpr=c:2:14 Extent=[154:24 - 154:25] // CHECK: 154:29: UnexposedExpr= Extent=[154:29 - 154:35] -// CHECK: 154:29: UnexposedExpr= Extent=[154:29 - 154:35] -// CHECK: 155:9: UnexposedExpr= Extent=[155:9 - 155:35] -// CHECK: 155:9: UnexposedExpr= Extent=[155:9 - 155:20] +// CHECK: 154:29: IntegerLiteral= Extent=[154:29 - 154:35] +// CHECK: 155:9: BinaryOperator= Extent=[155:9 - 155:35] +// CHECK: 155:9: BinaryOperator= Extent=[155:9 - 155:20] // CHECK: 155:9: DeclRefExpr=c:2:14 Extent=[155:9 - 155:10] // CHECK: 155:14: UnexposedExpr= Extent=[155:14 - 155:20] -// CHECK: 155:14: UnexposedExpr= Extent=[155:14 - 155:20] -// CHECK: 155:24: UnexposedExpr= Extent=[155:24 - 155:35] +// CHECK: 155:14: IntegerLiteral= Extent=[155:14 - 155:20] +// CHECK: 155:24: BinaryOperator= Extent=[155:24 - 155:35] // CHECK: 155:24: DeclRefExpr=c:2:14 Extent=[155:24 - 155:25] // CHECK: 155:29: UnexposedExpr= Extent=[155:29 - 155:35] -// CHECK: 155:29: UnexposedExpr= Extent=[155:29 - 155:35] -// CHECK: 156:9: UnexposedExpr= Extent=[156:9 - 156:35] -// CHECK: 156:9: UnexposedExpr= Extent=[156:9 - 156:20] +// CHECK: 155:29: IntegerLiteral= Extent=[155:29 - 155:35] +// CHECK: 156:9: BinaryOperator= Extent=[156:9 - 156:35] +// CHECK: 156:9: BinaryOperator= Extent=[156:9 - 156:20] // CHECK: 156:9: DeclRefExpr=c:2:14 Extent=[156:9 - 156:10] // CHECK: 156:14: UnexposedExpr= Extent=[156:14 - 156:20] -// CHECK: 156:14: UnexposedExpr= Extent=[156:14 - 156:20] -// CHECK: 156:24: UnexposedExpr= Extent=[156:24 - 156:35] +// CHECK: 156:14: IntegerLiteral= Extent=[156:14 - 156:20] +// CHECK: 156:24: BinaryOperator= Extent=[156:24 - 156:35] // CHECK: 156:24: DeclRefExpr=c:2:14 Extent=[156:24 - 156:25] // CHECK: 156:29: UnexposedExpr= Extent=[156:29 - 156:35] -// CHECK: 156:29: UnexposedExpr= Extent=[156:29 - 156:35] -// CHECK: 157:9: UnexposedExpr= Extent=[157:9 - 157:35] -// CHECK: 157:9: UnexposedExpr= Extent=[157:9 - 157:20] +// CHECK: 156:29: IntegerLiteral= Extent=[156:29 - 156:35] +// CHECK: 157:9: BinaryOperator= Extent=[157:9 - 157:35] +// CHECK: 157:9: BinaryOperator= Extent=[157:9 - 157:20] // CHECK: 157:9: DeclRefExpr=c:2:14 Extent=[157:9 - 157:10] // CHECK: 157:14: UnexposedExpr= Extent=[157:14 - 157:20] -// CHECK: 157:14: UnexposedExpr= Extent=[157:14 - 157:20] -// CHECK: 157:24: UnexposedExpr= Extent=[157:24 - 157:35] +// CHECK: 157:14: IntegerLiteral= Extent=[157:14 - 157:20] +// CHECK: 157:24: BinaryOperator= Extent=[157:24 - 157:35] // CHECK: 157:24: DeclRefExpr=c:2:14 Extent=[157:24 - 157:25] // CHECK: 157:29: UnexposedExpr= Extent=[157:29 - 157:35] -// CHECK: 157:29: UnexposedExpr= Extent=[157:29 - 157:35] -// CHECK: 158:8: UnexposedExpr= Extent=[158:8 - 158:19] +// CHECK: 157:29: IntegerLiteral= Extent=[157:29 - 157:35] +// CHECK: 158:8: BinaryOperator= Extent=[158:8 - 158:19] // CHECK: 158:8: DeclRefExpr=c:2:14 Extent=[158:8 - 158:9] // CHECK: 158:13: UnexposedExpr= Extent=[158:13 - 158:19] -// CHECK: 158:13: UnexposedExpr= Extent=[158:13 - 158:19] -// CHECK: 158:24: UnexposedExpr= Extent=[158:24 - 158:50] -// CHECK: 158:24: UnexposedExpr= Extent=[158:24 - 158:35] +// CHECK: 158:13: IntegerLiteral= Extent=[158:13 - 158:19] +// CHECK: 158:24: BinaryOperator= Extent=[158:24 - 158:50] +// CHECK: 158:24: BinaryOperator= Extent=[158:24 - 158:35] // CHECK: 158:24: DeclRefExpr=c:2:14 Extent=[158:24 - 158:25] // CHECK: 158:29: UnexposedExpr= Extent=[158:29 - 158:35] -// CHECK: 158:29: UnexposedExpr= Extent=[158:29 - 158:35] -// CHECK: 158:39: UnexposedExpr= Extent=[158:39 - 158:50] +// CHECK: 158:29: IntegerLiteral= Extent=[158:29 - 158:35] +// CHECK: 158:39: BinaryOperator= Extent=[158:39 - 158:50] // CHECK: 158:39: DeclRefExpr=c:2:14 Extent=[158:39 - 158:40] // CHECK: 158:44: UnexposedExpr= Extent=[158:44 - 158:50] -// CHECK: 158:44: UnexposedExpr= Extent=[158:44 - 158:50] -// CHECK: 159:9: UnexposedExpr= Extent=[159:9 - 159:35] -// CHECK: 159:9: UnexposedExpr= Extent=[159:9 - 159:20] +// CHECK: 158:44: IntegerLiteral= Extent=[158:44 - 158:50] +// CHECK: 159:9: BinaryOperator= Extent=[159:9 - 159:35] +// CHECK: 159:9: BinaryOperator= Extent=[159:9 - 159:20] // CHECK: 159:9: DeclRefExpr=c:2:14 Extent=[159:9 - 159:10] // CHECK: 159:14: UnexposedExpr= Extent=[159:14 - 159:20] -// CHECK: 159:14: UnexposedExpr= Extent=[159:14 - 159:20] -// CHECK: 159:24: UnexposedExpr= Extent=[159:24 - 159:35] +// CHECK: 159:14: IntegerLiteral= Extent=[159:14 - 159:20] +// CHECK: 159:24: BinaryOperator= Extent=[159:24 - 159:35] // CHECK: 159:24: DeclRefExpr=c:2:14 Extent=[159:24 - 159:25] // CHECK: 159:29: UnexposedExpr= Extent=[159:29 - 159:35] -// CHECK: 159:29: UnexposedExpr= Extent=[159:29 - 159:35] -// CHECK: 160:8: UnexposedExpr= Extent=[160:8 - 160:19] +// CHECK: 159:29: IntegerLiteral= Extent=[159:29 - 159:35] +// CHECK: 160:8: BinaryOperator= Extent=[160:8 - 160:19] // CHECK: 160:8: DeclRefExpr=c:2:14 Extent=[160:8 - 160:9] // CHECK: 160:13: UnexposedExpr= Extent=[160:13 - 160:19] -// CHECK: 160:13: UnexposedExpr= Extent=[160:13 - 160:19] -// CHECK: 160:23: UnexposedExpr= Extent=[160:23 - 160:51] -// CHECK: 160:24: UnexposedExpr= Extent=[160:24 - 160:50] -// CHECK: 160:24: UnexposedExpr= Extent=[160:24 - 160:35] +// CHECK: 160:13: IntegerLiteral= Extent=[160:13 - 160:19] +// CHECK: 160:23: ParenExpr= Extent=[160:23 - 160:51] +// CHECK: 160:24: BinaryOperator= Extent=[160:24 - 160:50] +// CHECK: 160:24: BinaryOperator= Extent=[160:24 - 160:35] // CHECK: 160:24: DeclRefExpr=c:2:14 Extent=[160:24 - 160:25] // CHECK: 160:29: UnexposedExpr= Extent=[160:29 - 160:35] -// CHECK: 160:29: UnexposedExpr= Extent=[160:29 - 160:35] -// CHECK: 160:39: UnexposedExpr= Extent=[160:39 - 160:50] +// CHECK: 160:29: IntegerLiteral= Extent=[160:29 - 160:35] +// CHECK: 160:39: BinaryOperator= Extent=[160:39 - 160:50] // CHECK: 160:39: DeclRefExpr=c:2:14 Extent=[160:39 - 160:40] // CHECK: 160:44: UnexposedExpr= Extent=[160:44 - 160:50] -// CHECK: 160:44: UnexposedExpr= Extent=[160:44 - 160:50] +// CHECK: 160:44: IntegerLiteral= Extent=[160:44 - 160:50] diff --git a/test/Index/nested-macro-instantiations.cpp b/test/Index/nested-macro-instantiations.cpp index 9d0c0521f404..0ed84dd00800 100644 --- a/test/Index/nested-macro-instantiations.cpp +++ b/test/Index/nested-macro-instantiations.cpp @@ -7,7 +7,7 @@ WIBBLE(int x); // RUN: env CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:7] +// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:14] // CHECK-WITH-NESTED: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] // CHECK-WITH-NESTED: nested-macro-instantiations.cpp:2:16: macro expansion=FOO:1:9 Extent=[2:16 - 5:14] // CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] @@ -15,6 +15,6 @@ WIBBLE(int x); // RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s -// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:7] +// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:14] // CHECK-WITHOUT-NESTED-NOT: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] // CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] diff --git a/test/Index/preamble-reparse-cmd-define.c b/test/Index/preamble-reparse-cmd-define.c new file mode 100644 index 000000000000..67ffde1a0cb8 --- /dev/null +++ b/test/Index/preamble-reparse-cmd-define.c @@ -0,0 +1,9 @@ +// RUN: c-index-test -write-pch %t.h.pch %s.h +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_REMAP_AFTER_TRIAL=1 c-index-test -test-load-source-reparse 3 local \ +// RUN: "-remap-file=%s;%s.remap" %s -include %t.h -D CMD_MACRO=1 2>&1 | FileCheck %s + +// CHECK-NOT: error: + +int foo() { + return x; +} diff --git a/test/Index/preamble-reparse-cmd-define.c.h b/test/Index/preamble-reparse-cmd-define.c.h new file mode 100644 index 000000000000..2497af651c2e --- /dev/null +++ b/test/Index/preamble-reparse-cmd-define.c.h @@ -0,0 +1 @@ +extern int x; diff --git a/test/Index/preamble-reparse-cmd-define.c.remap b/test/Index/preamble-reparse-cmd-define.c.remap new file mode 100644 index 000000000000..35c140d08211 --- /dev/null +++ b/test/Index/preamble-reparse-cmd-define.c.remap @@ -0,0 +1,8 @@ + +#ifndef CMD_MACRO +#error CMD_MACRO undefined +#endif + +int foo() { + return x; +} diff --git a/test/Index/preamble.c b/test/Index/preamble.c index 119bdb58e759..8a158e9b30ce 100644 --- a/test/Index/preamble.c +++ b/test/Index/preamble.c @@ -9,11 +9,11 @@ void f(int x) { // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -I %S/Inputs -include %t %s 2> %t.stderr.txt | FileCheck %s // RUN: FileCheck -check-prefix CHECK-DIAG %s < %t.stderr.txt // CHECK: preamble.h:1:12: FunctionDecl=bar:1:12 (Definition) Extent=[1:1 - 6:2] -// CHECK: preamble.h:4:3: UnexposedExpr= Extent=[4:3 - 4:13] +// CHECK: preamble.h:4:3: BinaryOperator= Extent=[4:3 - 4:13] // CHECK: preamble.h:4:3: DeclRefExpr=ptr:2:8 Extent=[4:3 - 4:6] // CHECK: preamble.h:4:9: UnexposedExpr=ptr1:3:10 Extent=[4:9 - 4:13] // CHECK: preamble.h:4:9: DeclRefExpr=ptr1:3:10 Extent=[4:9 - 4:13] -// CHECK: preamble.h:5:10: UnexposedExpr= Extent=[5:10 - 5:11] +// CHECK: preamble.h:5:10: IntegerLiteral= Extent=[5:10 - 5:11] // CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:1 - 3:16] // CHECK: preamble.c:3:15: ParmDecl=:3:15 (Definition) Extent=[3:12 - 3:16] // CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: warning: incompatible pointer types assigning to 'int *' from 'float *' diff --git a/test/Index/preamble_macro_template.cpp b/test/Index/preamble_macro_template.cpp new file mode 100644 index 000000000000..ee1b41376bb8 --- /dev/null +++ b/test/Index/preamble_macro_template.cpp @@ -0,0 +1,15 @@ +template void foo(int *); + +int main() { } + +// RUN: c-index-test -write-pch %t.pch -fno-delayed-template-parsing -x c++-header %S/Inputs/preamble_macro_template.h +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -fno-delayed-template-parsing -I %S/Inputs -include %t %s | FileCheck %s +// CHECK: preamble_macro_template.h:4:6: FunctionDecl=foo:4:6 (Definition) [Specialization of foo:4:6] Extent=[4:1 - 6:2] +// CHECK: preamble_macro_template.h:4:13: ParmDecl=p:4:13 (Definition) Extent=[4:10 - 4:14] +// CHECK: preamble_macro_template.h:4:16: CompoundStmt= Extent=[4:16 - 6:2] +// CHECK: preamble_macro_template.h:5:3: CStyleCastExpr= Extent=[5:3 - 5:27] +// CHECK: preamble_macro_template.h:1:21: CXXStaticCastExpr= Extent=[1:21 - 5:27] +// CHECK: preamble_macro_template.h:5:25: UnexposedExpr= Extent=[5:25 - 5:26] +// CHECK: preamble_macro_template.h:5:25: IntegerLiteral= Extent=[5:25 - 5:26] +// CHECK: preamble_macro_template.cpp:3:5: FunctionDecl=main:3:5 (Definition) Extent=[3:1 - 3:15] +// CHECK: preamble_macro_template.cpp:3:12: CompoundStmt= Extent=[3:12 - 3:15] diff --git a/test/Index/print-typekind.c b/test/Index/print-typekind.c index 30bd409b090f..c6583dbff38b 100644 --- a/test/Index/print-typekind.c +++ b/test/Index/print-typekind.c @@ -5,6 +5,7 @@ int *f(int *p, char *x, FooType z) { return p + z; } typedef double OtherType; +typedef int ArrayType[5]; // RUN: c-index-test -test-print-typekind %s | FileCheck %s // CHECK: TypedefDecl=FooType:1:13 (Definition) typekind=Typedef [canonical=Int] [isPOD=1] @@ -14,14 +15,14 @@ typedef double OtherType; // CHECK: ParmDecl=x:3:22 (Definition) typekind=Pointer [isPOD=1] // CHECK: ParmDecl=z:3:33 (Definition) typekind=Typedef [canonical=Int] [isPOD=1] // CHECK: TypeRef=FooType:1:13 typekind=Typedef [canonical=Int] [isPOD=1] -// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0] -// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0] +// CHECK: CompoundStmt= typekind=Invalid [isPOD=0] +// CHECK: DeclStmt= typekind=Invalid [isPOD=0] // CHECK: VarDecl=w:4:17 (Definition) typekind=Typedef const [canonical=Int] [isPOD=1] // CHECK: TypeRef=FooType:1:13 typekind=Typedef [canonical=Int] [isPOD=1] // CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int] [isPOD=1] -// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0] -// CHECK: UnexposedExpr= typekind=Pointer [isPOD=1] +// CHECK: ReturnStmt= typekind=Invalid [isPOD=0] +// CHECK: BinaryOperator= typekind=Pointer [isPOD=1] // CHECK: DeclRefExpr=p:3:13 typekind=Pointer [isPOD=1] // CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int] [isPOD=1] // CHECK: TypedefDecl=OtherType:7:16 (Definition) typekind=Typedef [canonical=Double] [isPOD=1] - +// CHECK: TypedefDecl=ArrayType:8:13 (Definition) typekind=Typedef [canonical=ConstantArray] [isPOD=1] diff --git a/test/Index/properties-class-extensions.m b/test/Index/properties-class-extensions.m index de612425c270..7b1e90fcd6fe 100644 --- a/test/Index/properties-class-extensions.m +++ b/test/Index/properties-class-extensions.m @@ -72,12 +72,12 @@ // CHECK: properties-class-extensions.m:19:26: ParmDecl=bar:19:26 (Definition) Extent=[19:26 - 19:29] // CHECK: properties-class-extensions.m:24:1: UnexposedDecl=[24:8] Extent=[24:1 - 24:23] // CHECK: properties-class-extensions.m:24:8: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[24:8 - 24:23] -// CHECK: properties-class-extensions.m:25:1: ObjCProtocolDecl=Rdar8467189_FooProtocol:25:1 (Definition) Extent=[25:1 - 27:5] +// CHECK: properties-class-extensions.m:25:11: ObjCProtocolDecl=Rdar8467189_FooProtocol:25:11 (Definition) Extent=[25:1 - 27:5] // CHECK: properties-class-extensions.m:26:39: ObjCPropertyDecl=Rdar8467189_Bar:26:39 Extent=[26:1 - 26:54] // CHECK: properties-class-extensions.m:26:22: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[26:22 - 26:37] // CHECK: properties-class-extensions.m:26:39: ObjCInstanceMethodDecl=Rdar8467189_Bar:26:39 Extent=[26:39 - 26:54] // CHECK: properties-class-extensions.m:28:12: ObjCInterfaceDecl=Rdar8467189_Foo:28:12 Extent=[28:1 - 29:5] -// CHECK: properties-class-extensions.m:28:29: ObjCProtocolRef=Rdar8467189_FooProtocol:25:1 Extent=[28:29 - 28:52] +// CHECK: properties-class-extensions.m:28:29: ObjCProtocolRef=Rdar8467189_FooProtocol:25:11 Extent=[28:29 - 28:52] // CHECK-NOT: properties-class-extensions.m:31:40: ObjCPropertyDecl=Rdar8467189_Bar:31:40 Extent=[31:40 - 31:55] // CHECK-NOT: properties-class-extensions.m:31:23: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[31:23 - 31:38] // CHECK: properties-class-extensions.m:30:12: ObjCCategoryDecl=:30:12 Extent=[30:1 - 32:5] diff --git a/test/Index/rdar-8288645-invalid-code.mm b/test/Index/rdar-8288645-invalid-code.mm index 74e2365edcfe..ec4564130a52 100644 --- a/test/Index/rdar-8288645-invalid-code.mm +++ b/test/Index/rdar-8288645-invalid-code.mm @@ -5,4 +5,3 @@ extern "C" { @implementation Foo - (id)initWithBar:(Baz<WozBar>)pepper { // CHECK: warning: cannot find interface declaration for 'Foo' -// CHECK: error: '@end' is missing in implementation context diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp index 4c24083efd71..adaaae9cdd19 100644 --- a/test/Index/recursive-cxx-member-calls.cpp +++ b/test/Index/recursive-cxx-member-calls.cpp @@ -28,7 +28,7 @@ namespace clang { AT_unavailable, AT_unused, AT_used, AT_vecreturn, AT_vector_size, AT_visibility, AT_warn_unused_result, AT_weak, AT_weakref, AT_weak_import, AT_reqd_wg_size, AT_init_priority, - IgnoredAttribute, UnknownAttribute + AT_returns_twice, IgnoredAttribute, UnknownAttribute }; static Kind getKind(const IdentifierInfo * Name); }; @@ -157,7 +157,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { .Case("overloadable", AT_overloadable) .Case("address_space", AT_address_space) .Case("always_inline", AT_always_inline) - .Case("returns_twice", IgnoredAttribute) + .Case("returns_twice", AT_returns_twice) .Case("vec_type_hint", IgnoredAttribute) .Case("objc_exception", AT_objc_exception) .Case("ext_vector_type", AT_ext_vector_type) @@ -392,9 +392,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "," [30:38 - 30:39] EnumDecl=Kind:13:10 (Definition) // CHECK-tokens: Identifier: "AT_init_priority" [30:40 - 30:56] EnumConstantDecl=AT_init_priority:30:40 (Definition) // CHECK-tokens: Punctuation: "," [30:56 - 30:57] EnumDecl=Kind:13:10 (Definition) -// CHECK-tokens: Identifier: "IgnoredAttribute" [31:7 - 31:23] EnumConstantDecl=IgnoredAttribute:31:7 (Definition) +// CHECK-tokens: Identifier: "AT_returns_twice" [31:7 - 31:23] EnumConstantDecl=AT_returns_twice:31:7 (Definition) // CHECK-tokens: Punctuation: "," [31:23 - 31:24] EnumDecl=Kind:13:10 (Definition) -// CHECK-tokens: Identifier: "UnknownAttribute" [31:25 - 31:41] EnumConstantDecl=UnknownAttribute:31:25 (Definition) +// CHECK-tokens: Identifier: "IgnoredAttribute" [31:25 - 31:41] EnumConstantDecl=IgnoredAttribute:31:25 (Definition) // CHECK-tokens: Punctuation: "}" [32:5 - 32:6] EnumDecl=Kind:13:10 (Definition) // CHECK-tokens: Punctuation: ";" [32:6 - 32:7] ClassDecl=AttributeList:12:9 (Definition) // CHECK-tokens: Keyword: "static" [33:5 - 33:11] ClassDecl=AttributeList:12:9 (Definition) @@ -425,8 +425,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Keyword: "class" [38:1 - 38:6] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Identifier: "StringRef" [38:7 - 38:16] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Punctuation: "{" [38:17 - 38:18] ClassDecl=StringRef:38:7 (Definition) -// CHECK-tokens: Keyword: "public" [39:1 - 39:7] UnexposedDecl=:39:1 (Definition) -// CHECK-tokens: Punctuation: ":" [39:7 - 39:8] UnexposedDecl=:39:1 (Definition) +// CHECK-tokens: Keyword: "public" [39:1 - 39:7] CXXAccessSpecifier=:39:1 (Definition) +// CHECK-tokens: Punctuation: ":" [39:7 - 39:8] CXXAccessSpecifier=:39:1 (Definition) // CHECK-tokens: Keyword: "typedef" [40:3 - 40:10] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Keyword: "const" [40:11 - 40:16] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Keyword: "char" [40:17 - 40:21] TypedefDecl=iterator:40:23 (Definition) @@ -438,14 +438,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "size_t" [41:16 - 41:22] TypeRef=size_t:2:25 // CHECK-tokens: Identifier: "npos" [41:23 - 41:27] VarDecl=npos:41:23 // CHECK-tokens: Punctuation: "=" [41:28 - 41:29] VarDecl=npos:41:23 -// CHECK-tokens: Punctuation: "~" [41:30 - 41:31] UnexposedExpr= +// CHECK-tokens: Punctuation: "~" [41:30 - 41:31] UnaryOperator= // CHECK-tokens: Identifier: "size_t" [41:31 - 41:37] TypeRef=size_t:2:25 -// CHECK-tokens: Punctuation: "(" [41:37 - 41:38] UnexposedExpr= -// CHECK-tokens: Literal: "0" [41:38 - 41:39] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [41:39 - 41:40] UnexposedExpr= +// CHECK-tokens: Punctuation: "(" [41:37 - 41:38] CXXFunctionalCastExpr= +// CHECK-tokens: Literal: "0" [41:38 - 41:39] IntegerLiteral= +// CHECK-tokens: Punctuation: ")" [41:39 - 41:40] CXXFunctionalCastExpr // CHECK-tokens: Punctuation: ";" [41:40 - 41:41] ClassDecl=StringRef:38:7 (Definition) -// CHECK-tokens: Keyword: "private" [42:1 - 42:8] UnexposedDecl=:42:1 (Definition) -// CHECK-tokens: Punctuation: ":" [42:8 - 42:9] UnexposedDecl=:42:1 (Definition) +// CHECK-tokens: Keyword: "private" [42:1 - 42:8] CXXAccessSpecifier=:42:1 (Definition) +// CHECK-tokens: Punctuation: ":" [42:8 - 42:9] CXXAccessSpecifier=:42:1 (Definition) // CHECK-tokens: Keyword: "const" [43:3 - 43:8] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Keyword: "char" [43:9 - 43:13] FieldDecl=Data:43:15 (Definition) // CHECK-tokens: Punctuation: "*" [43:14 - 43:15] FieldDecl=Data:43:15 (Definition) @@ -464,34 +464,34 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "size_t" [45:31 - 45:37] TypeRef=size_t:2:25 // CHECK-tokens: Identifier: "b" [45:38 - 45:39] ParmDecl=b:45:38 (Definition) // CHECK-tokens: Punctuation: ")" [45:39 - 45:40] CXXMethod=min:45:17 (Definition) (static) -// CHECK-tokens: Punctuation: "{" [45:41 - 45:42] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [45:43 - 45:49] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [45:41 - 45:42] CompoundStmt= +// CHECK-tokens: Keyword: "return" [45:43 - 45:49] ReturnStmt= // CHECK-tokens: Identifier: "a" [45:50 - 45:51] DeclRefExpr=a:45:28 -// CHECK-tokens: Punctuation: "<" [45:52 - 45:53] UnexposedExpr= +// CHECK-tokens: Punctuation: "<" [45:52 - 45:53] BinaryOperator= // CHECK-tokens: Identifier: "b" [45:54 - 45:55] DeclRefExpr=b:45:38 -// CHECK-tokens: Punctuation: "?" [45:56 - 45:57] UnexposedExpr= +// CHECK-tokens: Punctuation: "?" [45:56 - 45:57] ConditionalOperator= // CHECK-tokens: Identifier: "a" [45:58 - 45:59] DeclRefExpr=a:45:28 -// CHECK-tokens: Punctuation: ":" [45:60 - 45:61] UnexposedExpr= +// CHECK-tokens: Punctuation: ":" [45:60 - 45:61] ConditionalOperator // CHECK-tokens: Identifier: "b" [45:62 - 45:63] DeclRefExpr=b:45:38 -// CHECK-tokens: Punctuation: ";" [45:63 - 45:64] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [45:65 - 45:66] UnexposedStmt= -// CHECK-tokens: Keyword: "public" [46:1 - 46:7] UnexposedDecl=:46:1 (Definition) -// CHECK-tokens: Punctuation: ":" [46:7 - 46:8] UnexposedDecl=:46:1 (Definition) +// CHECK-tokens: Punctuation: ";" [45:63 - 45:64] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [45:65 - 45:66] CompoundStmt= +// CHECK-tokens: Keyword: "public" [46:1 - 46:7] CXXAccessSpecifier=:46:1 (Definition) +// CHECK-tokens: Punctuation: ":" [46:7 - 46:8] CXXAccessSpecifier=:46:1 (Definition) // CHECK-tokens: Identifier: "StringRef" [47:3 - 47:12] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Punctuation: "(" [47:12 - 47:13] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Punctuation: ")" [47:13 - 47:14] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Punctuation: ":" [47:14 - 47:15] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Identifier: "Data" [47:16 - 47:20] MemberRef=Data:43:15 // CHECK-tokens: Punctuation: "(" [47:20 - 47:21] CXXConstructor=StringRef:47:3 (Definition) -// CHECK-tokens: Literal: "0" [47:21 - 47:22] UnexposedExpr= +// CHECK-tokens: Literal: "0" [47:21 - 47:22] IntegerLiteral= // CHECK-tokens: Punctuation: ")" [47:22 - 47:23] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Punctuation: "," [47:23 - 47:24] CXXConstructor=StringRef:47:3 (Definition) // CHECK-tokens: Identifier: "Length" [47:25 - 47:31] MemberRef=Length:44:10 // CHECK-tokens: Punctuation: "(" [47:31 - 47:32] CXXConstructor=StringRef:47:3 (Definition) -// CHECK-tokens: Literal: "0" [47:32 - 47:33] UnexposedExpr= +// CHECK-tokens: Literal: "0" [47:32 - 47:33] IntegerLiteral= // CHECK-tokens: Punctuation: ")" [47:33 - 47:34] CXXConstructor=StringRef:47:3 (Definition) -// CHECK-tokens: Punctuation: "{" [47:35 - 47:36] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [47:36 - 47:37] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [47:35 - 47:36] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [47:36 - 47:37] CompoundStmt= // CHECK-tokens: Identifier: "StringRef" [48:3 - 48:12] CXXConstructor=StringRef:48:3 (Definition) // CHECK-tokens: Punctuation: "(" [48:12 - 48:13] CXXConstructor=StringRef:48:3 (Definition) // CHECK-tokens: Keyword: "const" [48:13 - 48:18] CXXConstructor=StringRef:48:3 (Definition) @@ -512,8 +512,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "Str" [48:63 - 48:66] DeclRefExpr=Str:48:25 // CHECK-tokens: Punctuation: ")" [48:66 - 48:67] CallExpr=magic_length:36:8 // CHECK-tokens: Punctuation: ")" [48:67 - 48:68] CXXConstructor=StringRef:48:3 (Definition) -// CHECK-tokens: Punctuation: "{" [48:69 - 48:70] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [48:70 - 48:71] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [48:69 - 48:70] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [48:70 - 48:71] CompoundStmt= // CHECK-tokens: Identifier: "StringRef" [49:3 - 49:12] CXXConstructor=StringRef:49:3 (Definition) // CHECK-tokens: Punctuation: "(" [49:12 - 49:13] CXXConstructor=StringRef:49:3 (Definition) // CHECK-tokens: Keyword: "const" [49:13 - 49:18] CXXConstructor=StringRef:49:3 (Definition) @@ -534,28 +534,28 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "(" [49:66 - 49:67] CXXConstructor=StringRef:49:3 (Definition) // CHECK-tokens: Identifier: "length" [49:67 - 49:73] DeclRefExpr=length:49:38 // CHECK-tokens: Punctuation: ")" [49:73 - 49:74] CXXConstructor=StringRef:49:3 (Definition) -// CHECK-tokens: Punctuation: "{" [49:75 - 49:76] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [49:76 - 49:77] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [49:75 - 49:76] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [49:76 - 49:77] CompoundStmt= // CHECK-tokens: Identifier: "iterator" [50:3 - 50:11] TypeRef=iterator:40:23 // CHECK-tokens: Identifier: "end" [50:12 - 50:15] CXXMethod=end:50:12 (Definition) // CHECK-tokens: Punctuation: "(" [50:15 - 50:16] CXXMethod=end:50:12 (Definition) // CHECK-tokens: Punctuation: ")" [50:16 - 50:17] CXXMethod=end:50:12 (Definition) // CHECK-tokens: Keyword: "const" [50:18 - 50:23] CXXMethod=end:50:12 (Definition) -// CHECK-tokens: Punctuation: "{" [50:24 - 50:25] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [50:26 - 50:32] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [50:24 - 50:25] CompoundStmt= +// CHECK-tokens: Keyword: "return" [50:26 - 50:32] ReturnStmt= // CHECK-tokens: Identifier: "Data" [50:33 - 50:37] MemberRefExpr=Data:43:15 -// CHECK-tokens: Punctuation: ";" [50:37 - 50:38] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [50:39 - 50:40] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [50:37 - 50:38] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [50:39 - 50:40] CompoundStmt= // CHECK-tokens: Identifier: "size_t" [51:3 - 51:9] TypeRef=size_t:2:25 // CHECK-tokens: Identifier: "size" [51:10 - 51:14] CXXMethod=size:51:10 (Definition) // CHECK-tokens: Punctuation: "(" [51:14 - 51:15] CXXMethod=size:51:10 (Definition) // CHECK-tokens: Punctuation: ")" [51:15 - 51:16] CXXMethod=size:51:10 (Definition) // CHECK-tokens: Keyword: "const" [51:17 - 51:22] CXXMethod=size:51:10 (Definition) -// CHECK-tokens: Punctuation: "{" [51:23 - 51:24] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [51:25 - 51:31] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [51:23 - 51:24] CompoundStmt= +// CHECK-tokens: Keyword: "return" [51:25 - 51:31] ReturnStmt= // CHECK-tokens: Identifier: "Length" [51:32 - 51:38] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: ";" [51:38 - 51:39] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [51:40 - 51:41] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [51:38 - 51:39] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [51:40 - 51:41] CompoundStmt= // CHECK-tokens: Keyword: "bool" [52:3 - 52:7] CXXMethod=startswith:52:8 (Definition) // CHECK-tokens: Identifier: "startswith" [52:8 - 52:18] CXXMethod=startswith:52:8 (Definition) // CHECK-tokens: Punctuation: "(" [52:18 - 52:19] CXXMethod=startswith:52:8 (Definition) @@ -563,14 +563,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "Prefix" [52:29 - 52:35] ParmDecl=Prefix:52:29 (Definition) // CHECK-tokens: Punctuation: ")" [52:35 - 52:36] CXXMethod=startswith:52:8 (Definition) // CHECK-tokens: Keyword: "const" [52:37 - 52:42] CXXMethod=startswith:52:8 (Definition) -// CHECK-tokens: Punctuation: "{" [52:43 - 52:44] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [53:5 - 53:11] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [52:43 - 52:44] CompoundStmt= +// CHECK-tokens: Keyword: "return" [53:5 - 53:11] ReturnStmt= // CHECK-tokens: Identifier: "Length" [53:12 - 53:18] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: ">=" [53:19 - 53:21] UnexposedExpr= +// CHECK-tokens: Punctuation: ">=" [53:19 - 53:21] BinaryOperator= // CHECK-tokens: Identifier: "Prefix" [53:22 - 53:28] DeclRefExpr=Prefix:52:29 // CHECK-tokens: Punctuation: "." [53:28 - 53:29] MemberRefExpr=Length:44:10 // CHECK-tokens: Identifier: "Length" [53:29 - 53:35] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: "&&" [53:36 - 53:38] UnexposedExpr= +// CHECK-tokens: Punctuation: "&&" [53:36 - 53:38] BinaryOperator= // CHECK-tokens: Identifier: "memcmp" [54:11 - 54:17] DeclRefExpr=memcmp:7:7 // CHECK-tokens: Punctuation: "(" [54:17 - 54:18] CallExpr=memcmp:7:7 // CHECK-tokens: Identifier: "Data" [54:18 - 54:22] MemberRefExpr=Data:43:15 @@ -583,10 +583,10 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "." [54:43 - 54:44] MemberRefExpr=Length:44:10 // CHECK-tokens: Identifier: "Length" [54:44 - 54:50] MemberRefExpr=Length:44:10 // CHECK-tokens: Punctuation: ")" [54:50 - 54:51] CallExpr=memcmp:7:7 -// CHECK-tokens: Punctuation: "==" [54:52 - 54:54] UnexposedExpr= -// CHECK-tokens: Literal: "0" [54:55 - 54:56] UnexposedExpr= -// CHECK-tokens: Punctuation: ";" [54:56 - 54:57] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [55:3 - 55:4] UnexposedStmt= +// CHECK-tokens: Punctuation: "==" [54:52 - 54:54] BinaryOperator= +// CHECK-tokens: Literal: "0" [54:55 - 54:56] IntegerLiteral= +// CHECK-tokens: Punctuation: ";" [54:56 - 54:57] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [55:3 - 55:4] CompoundStmt= // CHECK-tokens: Keyword: "bool" [56:3 - 56:7] CXXMethod=endswith:56:8 (Definition) // CHECK-tokens: Identifier: "endswith" [56:8 - 56:16] CXXMethod=endswith:56:8 (Definition) // CHECK-tokens: Punctuation: "(" [56:16 - 56:17] CXXMethod=endswith:56:8 (Definition) @@ -594,20 +594,20 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "Suffix" [56:27 - 56:33] ParmDecl=Suffix:56:27 (Definition) // CHECK-tokens: Punctuation: ")" [56:33 - 56:34] CXXMethod=endswith:56:8 (Definition) // CHECK-tokens: Keyword: "const" [56:35 - 56:40] CXXMethod=endswith:56:8 (Definition) -// CHECK-tokens: Punctuation: "{" [56:41 - 56:42] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [57:5 - 57:11] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [56:41 - 56:42] CompoundStmt= +// CHECK-tokens: Keyword: "return" [57:5 - 57:11] ReturnStmt= // CHECK-tokens: Identifier: "Length" [57:12 - 57:18] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: ">=" [57:19 - 57:21] UnexposedExpr= +// CHECK-tokens: Punctuation: ">=" [57:19 - 57:21] BinaryOperator= // CHECK-tokens: Identifier: "Suffix" [57:22 - 57:28] DeclRefExpr=Suffix:56:27 // CHECK-tokens: Punctuation: "." [57:28 - 57:29] MemberRefExpr=Length:44:10 // CHECK-tokens: Identifier: "Length" [57:29 - 57:35] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: "&&" [57:36 - 57:38] UnexposedExpr= +// CHECK-tokens: Punctuation: "&&" [57:36 - 57:38] BinaryOperator= // CHECK-tokens: Identifier: "memcmp" [58:7 - 58:13] DeclRefExpr=memcmp:7:7 // CHECK-tokens: Punctuation: "(" [58:13 - 58:14] CallExpr=memcmp:7:7 // CHECK-tokens: Identifier: "end" [58:14 - 58:17] MemberRefExpr=end:50:12 // CHECK-tokens: Punctuation: "(" [58:17 - 58:18] CallExpr=end:50:12 // CHECK-tokens: Punctuation: ")" [58:18 - 58:19] CallExpr=end:50:12 -// CHECK-tokens: Punctuation: "-" [58:20 - 58:21] UnexposedExpr= +// CHECK-tokens: Punctuation: "-" [58:20 - 58:21] BinaryOperator= // CHECK-tokens: Identifier: "Suffix" [58:22 - 58:28] DeclRefExpr=Suffix:56:27 // CHECK-tokens: Punctuation: "." [58:28 - 58:29] MemberRefExpr=Length:44:10 // CHECK-tokens: Identifier: "Length" [58:29 - 58:35] MemberRefExpr=Length:44:10 @@ -620,10 +620,10 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "." [58:56 - 58:57] MemberRefExpr=Length:44:10 // CHECK-tokens: Identifier: "Length" [58:57 - 58:63] MemberRefExpr=Length:44:10 // CHECK-tokens: Punctuation: ")" [58:63 - 58:64] CallExpr=memcmp:7:7 -// CHECK-tokens: Punctuation: "==" [58:65 - 58:67] UnexposedExpr= -// CHECK-tokens: Literal: "0" [58:68 - 58:69] UnexposedExpr= -// CHECK-tokens: Punctuation: ";" [58:69 - 58:70] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [59:3 - 59:4] UnexposedStmt= +// CHECK-tokens: Punctuation: "==" [58:65 - 58:67] BinaryOperator= +// CHECK-tokens: Literal: "0" [58:68 - 58:69] IntegerLiteral= +// CHECK-tokens: Punctuation: ";" [58:69 - 58:70] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [59:3 - 59:4] CompoundStmt= // CHECK-tokens: Identifier: "StringRef" [60:3 - 60:12] TypeRef=class llvm::StringRef:38:7 // CHECK-tokens: Identifier: "substr" [60:13 - 60:19] CXXMethod=substr:60:13 (Definition) // CHECK-tokens: Punctuation: "(" [60:19 - 60:20] CXXMethod=substr:60:13 (Definition) @@ -636,12 +636,12 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "npos" [60:45 - 60:49] DeclRefExpr=npos:41:23 // CHECK-tokens: Punctuation: ")" [60:49 - 60:50] CXXMethod=substr:60:13 (Definition) // CHECK-tokens: Keyword: "const" [60:51 - 60:56] CXXMethod=substr:60:13 (Definition) -// CHECK-tokens: Punctuation: "{" [60:57 - 60:58] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [61:5 - 61:11] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [60:57 - 60:58] CompoundStmt= +// CHECK-tokens: Keyword: "return" [61:5 - 61:11] ReturnStmt= // CHECK-tokens: Identifier: "StringRef" [61:12 - 61:21] TypeRef=class llvm::StringRef:38:7 // CHECK-tokens: Punctuation: "(" [61:21 - 61:22] CallExpr=StringRef:49:3 // CHECK-tokens: Identifier: "Data" [61:22 - 61:26] MemberRefExpr=Data:43:15 -// CHECK-tokens: Punctuation: "+" [61:27 - 61:28] UnexposedExpr= +// CHECK-tokens: Punctuation: "+" [61:27 - 61:28] BinaryOperator= // CHECK-tokens: Identifier: "Start" [61:29 - 61:34] DeclRefExpr=Start:60:27 // CHECK-tokens: Punctuation: "," [61:34 - 61:35] CallExpr=StringRef:49:3 // CHECK-tokens: Identifier: "min" [61:36 - 61:39] DeclRefExpr=min:45:17 @@ -649,12 +649,12 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "N" [61:40 - 61:41] DeclRefExpr=N:60:41 // CHECK-tokens: Punctuation: "," [61:41 - 61:42] CallExpr=min:45:17 // CHECK-tokens: Identifier: "Length" [61:43 - 61:49] MemberRefExpr=Length:44:10 -// CHECK-tokens: Punctuation: "-" [61:50 - 61:51] UnexposedExpr= +// CHECK-tokens: Punctuation: "-" [61:50 - 61:51] BinaryOperator= // CHECK-tokens: Identifier: "Start" [61:52 - 61:57] DeclRefExpr=Start:60:27 // CHECK-tokens: Punctuation: ")" [61:57 - 61:58] CallExpr=min:45:17 // CHECK-tokens: Punctuation: ")" [61:58 - 61:59] CallExpr=StringRef:49:3 -// CHECK-tokens: Punctuation: ";" [61:59 - 61:60] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [62:3 - 62:4] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [61:59 - 61:60] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [62:3 - 62:4] CompoundStmt= // CHECK-tokens: Punctuation: "}" [63:1 - 63:2] ClassDecl=StringRef:38:7 (Definition) // CHECK-tokens: Punctuation: ";" [63:2 - 63:3] Namespace=llvm:37:11 (Definition) // CHECK-tokens: Punctuation: "}" [64:1 - 64:2] Namespace=llvm:37:11 (Definition) @@ -664,8 +664,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Keyword: "class" [66:1 - 66:6] ClassDecl=IdentifierInfo:66:7 (Definition) // CHECK-tokens: Identifier: "IdentifierInfo" [66:7 - 66:21] ClassDecl=IdentifierInfo:66:7 (Definition) // CHECK-tokens: Punctuation: "{" [66:22 - 66:23] ClassDecl=IdentifierInfo:66:7 (Definition) -// CHECK-tokens: Keyword: "public" [67:1 - 67:7] UnexposedDecl=:67:1 (Definition) -// CHECK-tokens: Punctuation: ":" [67:7 - 67:8] UnexposedDecl=:67:1 (Definition) +// CHECK-tokens: Keyword: "public" [67:1 - 67:7] CXXAccessSpecifier=:67:1 (Definition) +// CHECK-tokens: Punctuation: ":" [67:7 - 67:8] CXXAccessSpecifier=:67:1 (Definition) // CHECK-tokens: Identifier: "IdentifierInfo" [67:8 - 67:22] CXXConstructor=IdentifierInfo:67:8 // CHECK-tokens: Punctuation: "(" [67:22 - 67:23] CXXConstructor=IdentifierInfo:67:8 // CHECK-tokens: Punctuation: ")" [67:23 - 67:24] CXXConstructor=IdentifierInfo:67:8 @@ -677,8 +677,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "(" [68:27 - 68:28] CXXMethod=getNameStart:68:15 (Definition) // CHECK-tokens: Punctuation: ")" [68:28 - 68:29] CXXMethod=getNameStart:68:15 (Definition) // CHECK-tokens: Keyword: "const" [68:30 - 68:35] CXXMethod=getNameStart:68:15 (Definition) -// CHECK-tokens: Punctuation: "{" [68:36 - 68:37] UnexposedStmt= -// CHECK-tokens: Keyword: "typedef" [69:5 - 69:12] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [68:36 - 68:37] CompoundStmt= +// CHECK-tokens: Keyword: "typedef" [69:5 - 69:12] DeclStmt= // CHECK-tokens: Identifier: "std" [69:13 - 69:16] NamespaceRef=std:3:11 // CHECK-tokens: Punctuation: "::" [69:16 - 69:18] TypedefDecl=actualtype:69:54 (Definition) // CHECK-tokens: Identifier: "pair" [69:18 - 69:22] TemplateRef=pair:4:44 @@ -690,27 +690,27 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "*" [69:52 - 69:53] TypedefDecl=actualtype:69:54 (Definition) // CHECK-tokens: Punctuation: ">" [69:53 - 69:54] TypedefDecl=actualtype:69:54 (Definition) // CHECK-tokens: Identifier: "actualtype" [69:54 - 69:64] TypedefDecl=actualtype:69:54 (Definition) -// CHECK-tokens: Punctuation: ";" [69:64 - 69:65] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [70:5 - 70:11] UnexposedStmt= -// CHECK-tokens: Punctuation: "(" [70:12 - 70:13] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [70:13 - 70:14] UnexposedExpr= -// CHECK-tokens: Keyword: "const" [70:14 - 70:19] UnexposedExpr= +// CHECK-tokens: Punctuation: ";" [69:64 - 69:65] DeclStmt= +// CHECK-tokens: Keyword: "return" [70:5 - 70:11] ReturnStmt= +// CHECK-tokens: Punctuation: "(" [70:12 - 70:13] ParenExpr= +// CHECK-tokens: Punctuation: "(" [70:13 - 70:14] CStyleCastExpr= +// CHECK-tokens: Keyword: "const" [70:14 - 70:19] CStyleCastExpr= // CHECK-tokens: Identifier: "actualtype" [70:20 - 70:30] TypeRef=actualtype:69:54 -// CHECK-tokens: Punctuation: "*" [70:31 - 70:32] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [70:32 - 70:33] UnexposedExpr= -// CHECK-tokens: Keyword: "this" [70:34 - 70:38] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [70:38 - 70:39] UnexposedExpr= +// CHECK-tokens: Punctuation: "*" [70:31 - 70:32] CStyleCastExpr= +// CHECK-tokens: Punctuation: ")" [70:32 - 70:33] CStyleCastExpr= +// CHECK-tokens: Keyword: "this" [70:34 - 70:38] CXXThisExpr= +// CHECK-tokens: Punctuation: ")" [70:38 - 70:39] ParenExpr= // CHECK-tokens: Punctuation: "->" [70:39 - 70:41] MemberRefExpr=second:4:55 // CHECK-tokens: Identifier: "second" [70:41 - 70:47] MemberRefExpr=second:4:55 -// CHECK-tokens: Punctuation: ";" [70:47 - 70:48] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [71:3 - 71:4] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [70:47 - 70:48] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [71:3 - 71:4] CompoundStmt= // CHECK-tokens: Keyword: "unsigned" [72:3 - 72:11] CXXMethod=getLength:72:12 (Definition) // CHECK-tokens: Identifier: "getLength" [72:12 - 72:21] CXXMethod=getLength:72:12 (Definition) // CHECK-tokens: Punctuation: "(" [72:21 - 72:22] CXXMethod=getLength:72:12 (Definition) // CHECK-tokens: Punctuation: ")" [72:22 - 72:23] CXXMethod=getLength:72:12 (Definition) // CHECK-tokens: Keyword: "const" [72:24 - 72:29] CXXMethod=getLength:72:12 (Definition) -// CHECK-tokens: Punctuation: "{" [72:30 - 72:31] UnexposedStmt= -// CHECK-tokens: Keyword: "typedef" [73:5 - 73:12] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [72:30 - 72:31] CompoundStmt= +// CHECK-tokens: Keyword: "typedef" [73:5 - 73:12] DeclStmt= // CHECK-tokens: Identifier: "std" [73:13 - 73:16] NamespaceRef=std:3:11 // CHECK-tokens: Punctuation: "::" [73:16 - 73:18] TypedefDecl=actualtype:73:54 (Definition) // CHECK-tokens: Identifier: "pair" [73:18 - 73:22] TemplateRef=pair:4:44 @@ -722,55 +722,55 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "*" [73:52 - 73:53] TypedefDecl=actualtype:73:54 (Definition) // CHECK-tokens: Punctuation: ">" [73:53 - 73:54] TypedefDecl=actualtype:73:54 (Definition) // CHECK-tokens: Identifier: "actualtype" [73:54 - 73:64] TypedefDecl=actualtype:73:54 (Definition) -// CHECK-tokens: Punctuation: ";" [73:64 - 73:65] UnexposedStmt= -// CHECK-tokens: Keyword: "const" [74:5 - 74:10] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [73:64 - 73:65] DeclStmt= +// CHECK-tokens: Keyword: "const" [74:5 - 74:10] DeclStmt= // CHECK-tokens: Keyword: "char" [74:11 - 74:15] VarDecl=p:74:17 (Definition) // CHECK-tokens: Punctuation: "*" [74:16 - 74:17] VarDecl=p:74:17 (Definition) // CHECK-tokens: Identifier: "p" [74:17 - 74:18] VarDecl=p:74:17 (Definition) // CHECK-tokens: Punctuation: "=" [74:19 - 74:20] VarDecl=p:74:17 (Definition) -// CHECK-tokens: Punctuation: "(" [74:21 - 74:22] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [74:22 - 74:23] UnexposedExpr= -// CHECK-tokens: Keyword: "const" [74:23 - 74:28] UnexposedExpr= +// CHECK-tokens: Punctuation: "(" [74:21 - 74:22] ParenExpr= +// CHECK-tokens: Punctuation: "(" [74:22 - 74:23] CStyleCastExpr= +// CHECK-tokens: Keyword: "const" [74:23 - 74:28] CStyleCastExpr= // CHECK-tokens: Identifier: "actualtype" [74:29 - 74:39] TypeRef=actualtype:73:54 -// CHECK-tokens: Punctuation: "*" [74:40 - 74:41] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [74:41 - 74:42] UnexposedExpr= -// CHECK-tokens: Keyword: "this" [74:43 - 74:47] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [74:47 - 74:48] UnexposedExpr= +// CHECK-tokens: Punctuation: "*" [74:40 - 74:41] CStyleCastExpr= +// CHECK-tokens: Punctuation: ")" [74:41 - 74:42] CStyleCastExpr= +// CHECK-tokens: Keyword: "this" [74:43 - 74:47] CXXThisExpr= +// CHECK-tokens: Punctuation: ")" [74:47 - 74:48] ParenExpr= // CHECK-tokens: Punctuation: "->" [74:48 - 74:50] MemberRefExpr=second:4:55 // CHECK-tokens: Identifier: "second" [74:50 - 74:56] MemberRefExpr=second:4:55 -// CHECK-tokens: Punctuation: "-" [74:57 - 74:58] UnexposedExpr= -// CHECK-tokens: Literal: "2" [74:59 - 74:60] UnexposedExpr= -// CHECK-tokens: Punctuation: ";" [74:60 - 74:61] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [75:5 - 75:11] UnexposedStmt= -// CHECK-tokens: Punctuation: "(" [75:12 - 75:13] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [75:13 - 75:14] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [75:14 - 75:15] UnexposedExpr= -// CHECK-tokens: Keyword: "unsigned" [75:15 - 75:23] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:23 - 75:24] UnexposedExpr= +// CHECK-tokens: Punctuation: "-" [74:57 - 74:58] BinaryOperator= +// CHECK-tokens: Literal: "2" [74:59 - 74:60] IntegerLiteral= +// CHECK-tokens: Punctuation: ";" [74:60 - 74:61] DeclStmt= +// CHECK-tokens: Keyword: "return" [75:5 - 75:11] ReturnStmt= +// CHECK-tokens: Punctuation: "(" [75:12 - 75:13] ParenExpr= +// CHECK-tokens: Punctuation: "(" [75:13 - 75:14] ParenExpr= +// CHECK-tokens: Punctuation: "(" [75:14 - 75:15] CStyleCastExpr= +// CHECK-tokens: Keyword: "unsigned" [75:15 - 75:23] CStyleCastExpr= +// CHECK-tokens: Punctuation: ")" [75:23 - 75:24] CStyleCastExpr= // CHECK-tokens: Identifier: "p" [75:25 - 75:26] DeclRefExpr=p:74:17 -// CHECK-tokens: Punctuation: "[" [75:26 - 75:27] UnexposedExpr= -// CHECK-tokens: Literal: "0" [75:27 - 75:28] UnexposedExpr= -// CHECK-tokens: Punctuation: "]" [75:28 - 75:29] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:29 - 75:30] UnexposedExpr= -// CHECK-tokens: Punctuation: "|" [75:31 - 75:32] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [75:33 - 75:34] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [75:34 - 75:35] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [75:35 - 75:36] UnexposedExpr= -// CHECK-tokens: Keyword: "unsigned" [75:36 - 75:44] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:44 - 75:45] UnexposedExpr= +// CHECK-tokens: Punctuation: "[" [75:26 - 75:27] ArraySubscriptExpr= +// CHECK-tokens: Literal: "0" [75:27 - 75:28] IntegerLiteral= +// CHECK-tokens: Punctuation: "]" [75:28 - 75:29] ArraySubscriptExpr= +// CHECK-tokens: Punctuation: ")" [75:29 - 75:30] ParenExpr= +// CHECK-tokens: Punctuation: "|" [75:31 - 75:32] BinaryOperator= +// CHECK-tokens: Punctuation: "(" [75:33 - 75:34] ParenExpr= +// CHECK-tokens: Punctuation: "(" [75:34 - 75:35] ParenExpr= +// CHECK-tokens: Punctuation: "(" [75:35 - 75:36] CStyleCastExpr= +// CHECK-tokens: Keyword: "unsigned" [75:36 - 75:44] CStyleCastExpr= +// CHECK-tokens: Punctuation: ")" [75:44 - 75:45] CStyleCastExpr= // CHECK-tokens: Identifier: "p" [75:46 - 75:47] DeclRefExpr=p:74:17 -// CHECK-tokens: Punctuation: "[" [75:47 - 75:48] UnexposedExpr= -// CHECK-tokens: Literal: "1" [75:48 - 75:49] UnexposedExpr= -// CHECK-tokens: Punctuation: "]" [75:49 - 75:50] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:50 - 75:51] UnexposedExpr= -// CHECK-tokens: Punctuation: "<<" [75:52 - 75:54] UnexposedExpr= -// CHECK-tokens: Literal: "8" [75:55 - 75:56] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:56 - 75:57] UnexposedExpr= -// CHECK-tokens: Punctuation: ")" [75:57 - 75:58] UnexposedExpr= -// CHECK-tokens: Punctuation: "-" [75:59 - 75:60] UnexposedExpr= -// CHECK-tokens: Literal: "1" [75:61 - 75:62] UnexposedExpr= -// CHECK-tokens: Punctuation: ";" [75:62 - 75:63] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [76:3 - 76:4] UnexposedStmt= +// CHECK-tokens: Punctuation: "[" [75:47 - 75:48] ArraySubscriptExpr= +// CHECK-tokens: Literal: "1" [75:48 - 75:49] IntegerLiteral= +// CHECK-tokens: Punctuation: "]" [75:49 - 75:50] ArraySubscriptExpr= +// CHECK-tokens: Punctuation: ")" [75:50 - 75:51] ParenExpr= +// CHECK-tokens: Punctuation: "<<" [75:52 - 75:54] BinaryOperator= +// CHECK-tokens: Literal: "8" [75:55 - 75:56] IntegerLiteral= +// CHECK-tokens: Punctuation: ")" [75:56 - 75:57] ParenExpr= +// CHECK-tokens: Punctuation: ")" [75:57 - 75:58] ParenExpr= +// CHECK-tokens: Punctuation: "-" [75:59 - 75:60] BinaryOperator= +// CHECK-tokens: Literal: "1" [75:61 - 75:62] IntegerLiteral= +// CHECK-tokens: Punctuation: ";" [75:62 - 75:63] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [76:3 - 76:4] CompoundStmt= // CHECK-tokens: Identifier: "llvm" [77:3 - 77:7] NamespaceRef=llvm:37:11 // CHECK-tokens: Punctuation: "::" [77:7 - 77:9] CXXMethod=getName:77:19 (Definition) // CHECK-tokens: Identifier: "StringRef" [77:9 - 77:18] TypeRef=class llvm::StringRef:38:7 @@ -778,8 +778,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "(" [77:26 - 77:27] CXXMethod=getName:77:19 (Definition) // CHECK-tokens: Punctuation: ")" [77:27 - 77:28] CXXMethod=getName:77:19 (Definition) // CHECK-tokens: Keyword: "const" [77:29 - 77:34] CXXMethod=getName:77:19 (Definition) -// CHECK-tokens: Punctuation: "{" [77:35 - 77:36] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [78:5 - 78:11] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [77:35 - 77:36] CompoundStmt= +// CHECK-tokens: Keyword: "return" [78:5 - 78:11] ReturnStmt= // CHECK-tokens: Identifier: "llvm" [78:12 - 78:16] NamespaceRef=llvm:37:11 // CHECK-tokens: Punctuation: "::" [78:16 - 78:18] CallExpr=StringRef:49:3 // CHECK-tokens: Identifier: "StringRef" [78:18 - 78:27] TypeRef=class llvm::StringRef:38:7 @@ -792,8 +792,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "(" [78:53 - 78:54] CallExpr=getLength:72:12 // CHECK-tokens: Punctuation: ")" [78:54 - 78:55] CallExpr=getLength:72:12 // CHECK-tokens: Punctuation: ")" [78:55 - 78:56] CallExpr=StringRef:49:3 -// CHECK-tokens: Punctuation: ";" [78:56 - 78:57] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [79:3 - 79:4] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [78:56 - 78:57] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [79:3 - 79:4] CompoundStmt= // CHECK-tokens: Punctuation: "}" [80:1 - 80:2] ClassDecl=IdentifierInfo:66:7 (Definition) // CHECK-tokens: Punctuation: ";" [80:2 - 80:3] Namespace=clang:65:11 (Definition) // CHECK-tokens: Punctuation: "}" [81:1 - 81:2] Namespace=clang:65:11 (Definition) @@ -821,8 +821,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "*" [85:11 - 85:12] FieldDecl=Result:85:12 (Definition) // CHECK-tokens: Identifier: "Result" [85:12 - 85:18] FieldDecl=Result:85:12 (Definition) // CHECK-tokens: Punctuation: ";" [85:18 - 85:19] ClassTemplate=StringSwitch:83:47 (Definition) -// CHECK-tokens: Keyword: "public" [86:1 - 86:7] UnexposedDecl=:86:1 (Definition) -// CHECK-tokens: Punctuation: ":" [86:7 - 86:8] UnexposedDecl=:86:1 (Definition) +// CHECK-tokens: Keyword: "public" [86:1 - 86:7] CXXAccessSpecifier=:86:1 (Definition) +// CHECK-tokens: Punctuation: ":" [86:7 - 86:8] CXXAccessSpecifier=:86:1 (Definition) // CHECK-tokens: Keyword: "explicit" [87:3 - 87:11] CXXConstructor=StringSwitch<T, R>:87:12 (Definition) // CHECK-tokens: Identifier: "StringSwitch" [87:12 - 87:24] CXXConstructor=StringSwitch<T, R>:87:12 (Definition) // CHECK-tokens: Punctuation: "(" [87:24 - 87:25] CXXConstructor=StringSwitch<T, R>:87:12 (Definition) @@ -837,16 +837,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "," [87:50 - 87:51] CXXConstructor=StringSwitch<T, R>:87:12 (Definition) // CHECK-tokens: Identifier: "Result" [87:52 - 87:58] MemberRef=Result:85:12 // CHECK-tokens: Punctuation: "(" [87:58 - 87:59] UnexposedExpr= -// CHECK-tokens: Literal: "0" [87:59 - 87:60] UnexposedExpr= +// CHECK-tokens: Literal: "0" [87:59 - 87:60] IntegerLiteral= // CHECK-tokens: Punctuation: ")" [87:60 - 87:61] UnexposedExpr= -// CHECK-tokens: Punctuation: "{" [87:62 - 87:63] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [87:63 - 87:64] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [87:62 - 87:63] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [87:63 - 87:64] CompoundStmt= // CHECK-tokens: Keyword: "template" [88:3 - 88:11] FunctionTemplate=Case:88:42 (Definition) // CHECK-tokens: Punctuation: "<" [88:12 - 88:13] FunctionTemplate=Case:88:42 (Definition) // CHECK-tokens: Keyword: "unsigned" [88:14 - 88:22] NonTypeTemplateParameter=N:88:23 (Definition) // CHECK-tokens: Identifier: "N" [88:23 - 88:24] NonTypeTemplateParameter=N:88:23 (Definition) // CHECK-tokens: Punctuation: ">" [88:25 - 88:26] FunctionTemplate=Case:88:42 (Definition) -// CHECK-tokens: Identifier: "StringSwitch" [88:27 - 88:39] FunctionTemplate=Case:88:42 (Definition) +// CHECK-tokens: Identifier: "StringSwitch" [88:27 - 88:39] TypeRef=StringSwitch<T, R>:83:47 // CHECK-tokens: Punctuation: "&" [88:40 - 88:41] FunctionTemplate=Case:88:42 (Definition) // CHECK-tokens: Identifier: "Case" [88:42 - 88:46] FunctionTemplate=Case:88:42 (Definition) // CHECK-tokens: Punctuation: "(" [88:46 - 88:47] FunctionTemplate=Case:88:42 (Definition) @@ -865,12 +865,12 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "&" [89:55 - 89:56] ParmDecl=Value:89:57 (Definition) // CHECK-tokens: Identifier: "Value" [89:57 - 89:62] ParmDecl=Value:89:57 (Definition) // CHECK-tokens: Punctuation: ")" [89:62 - 89:63] FunctionTemplate=Case:88:42 (Definition) -// CHECK-tokens: Punctuation: "{" [89:64 - 89:65] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [90:5 - 90:11] UnexposedStmt= -// CHECK-tokens: Punctuation: "*" [90:12 - 90:13] UnexposedExpr= -// CHECK-tokens: Keyword: "this" [90:13 - 90:17] UnexposedExpr= -// CHECK-tokens: Punctuation: ";" [90:17 - 90:18] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [91:3 - 91:4] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [89:64 - 89:65] CompoundStmt= +// CHECK-tokens: Keyword: "return" [90:5 - 90:11] ReturnStmt= +// CHECK-tokens: Punctuation: "*" [90:12 - 90:13] UnaryOperator= +// CHECK-tokens: Keyword: "this" [90:13 - 90:17] CXXThisExpr= +// CHECK-tokens: Punctuation: ";" [90:17 - 90:18] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [91:3 - 91:4] CompoundStmt= // CHECK-tokens: Identifier: "R" [92:3 - 92:4] TypeRef=R:83:33 // CHECK-tokens: Identifier: "Default" [92:5 - 92:12] CXXMethod=Default:92:5 (Definition) // CHECK-tokens: Punctuation: "(" [92:12 - 92:13] CXXMethod=Default:92:5 (Definition) @@ -880,11 +880,11 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "Value" [92:23 - 92:28] ParmDecl=Value:92:23 (Definition) // CHECK-tokens: Punctuation: ")" [92:28 - 92:29] CXXMethod=Default:92:5 (Definition) // CHECK-tokens: Keyword: "const" [92:30 - 92:35] CXXMethod=Default:92:5 (Definition) -// CHECK-tokens: Punctuation: "{" [92:36 - 92:37] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [93:5 - 93:11] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [92:36 - 92:37] CompoundStmt= +// CHECK-tokens: Keyword: "return" [93:5 - 93:11] ReturnStmt= // CHECK-tokens: Identifier: "Value" [93:12 - 93:17] DeclRefExpr=Value:92:23 -// CHECK-tokens: Punctuation: ";" [93:17 - 93:18] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [94:3 - 94:4] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [93:17 - 93:18] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [94:3 - 94:4] CompoundStmt= // CHECK-tokens: Punctuation: "}" [95:1 - 95:2] ClassTemplate=StringSwitch:83:47 (Definition) // CHECK-tokens: Punctuation: ";" [95:2 - 95:3] Namespace=llvm:82:11 (Definition) // CHECK-tokens: Punctuation: "}" [96:1 - 96:2] Namespace=llvm:82:11 (Definition) @@ -904,7 +904,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: "*" [100:65 - 100:66] ParmDecl=Name:100:67 (Definition) // CHECK-tokens: Identifier: "Name" [100:67 - 100:71] ParmDecl=Name:100:67 (Definition) // CHECK-tokens: Punctuation: ")" [100:71 - 100:72] CXXMethod=getKind:100:36 (Definition) (static) -// CHECK-tokens: Punctuation: "{" [100:73 - 100:74] UnexposedStmt= +// CHECK-tokens: Punctuation: "{" [100:73 - 100:74] CompoundStmt= // CHECK-tokens: Identifier: "llvm" [101:3 - 101:7] NamespaceRef=llvm:82:11 // CHECK-tokens: Punctuation: "::" [101:7 - 101:9] VarDecl=AttrName:101:19 (Definition) // CHECK-tokens: Identifier: "StringRef" [101:9 - 101:18] TypeRef=class llvm::StringRef:38:7 @@ -915,613 +915,613 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Identifier: "getName" [101:36 - 101:43] MemberRefExpr=getName:77:19 // CHECK-tokens: Punctuation: "(" [101:43 - 101:44] CallExpr=getName:77:19 // CHECK-tokens: Punctuation: ")" [101:44 - 101:45] CallExpr=getName:77:19 -// CHECK-tokens: Punctuation: ";" [101:45 - 101:46] UnexposedStmt= -// CHECK-tokens: Keyword: "if" [102:3 - 102:5] UnexposedStmt= -// CHECK-tokens: Punctuation: "(" [102:6 - 102:7] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [101:45 - 101:46] DeclStmt= +// CHECK-tokens: Keyword: "if" [102:3 - 102:5] IfStmt= +// CHECK-tokens: Punctuation: "(" [102:6 - 102:7] IfStmt= // CHECK-tokens: Identifier: "AttrName" [102:7 - 102:15] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "." [102:15 - 102:16] MemberRefExpr=startswith:52:8 // CHECK-tokens: Identifier: "startswith" [102:16 - 102:26] MemberRefExpr=startswith:52:8 // CHECK-tokens: Punctuation: "(" [102:26 - 102:27] CallExpr=startswith:52:8 -// CHECK-tokens: Literal: ""__"" [102:27 - 102:31] UnexposedExpr= +// CHECK-tokens: Literal: ""__"" [102:27 - 102:31] StringLiteral= // CHECK-tokens: Punctuation: ")" [102:31 - 102:32] CallExpr=startswith:52:8 -// CHECK-tokens: Punctuation: "&&" [102:33 - 102:35] UnexposedExpr= +// CHECK-tokens: Punctuation: "&&" [102:33 - 102:35] BinaryOperator= // CHECK-tokens: Identifier: "AttrName" [102:36 - 102:44] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "." [102:44 - 102:45] MemberRefExpr=endswith:56:8 // CHECK-tokens: Identifier: "endswith" [102:45 - 102:53] MemberRefExpr=endswith:56:8 // CHECK-tokens: Punctuation: "(" [102:53 - 102:54] CallExpr=endswith:56:8 -// CHECK-tokens: Literal: ""__"" [102:54 - 102:58] UnexposedExpr= +// CHECK-tokens: Literal: ""__"" [102:54 - 102:58] StringLiteral= // CHECK-tokens: Punctuation: ")" [102:58 - 102:59] CallExpr=endswith:56:8 -// CHECK-tokens: Punctuation: ")" [102:59 - 102:60] UnexposedStmt= +// CHECK-tokens: Punctuation: ")" [102:59 - 102:60] IfStmt= // CHECK-tokens: Identifier: "AttrName" [103:5 - 103:13] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "=" [103:14 - 103:15] CallExpr=operator=:38:7 // CHECK-tokens: Identifier: "AttrName" [103:16 - 103:24] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "." [103:24 - 103:25] MemberRefExpr=substr:60:13 // CHECK-tokens: Identifier: "substr" [103:25 - 103:31] MemberRefExpr=substr:60:13 // CHECK-tokens: Punctuation: "(" [103:31 - 103:32] CallExpr=substr:60:13 -// CHECK-tokens: Literal: "2" [103:32 - 103:33] UnexposedExpr= +// CHECK-tokens: Literal: "2" [103:32 - 103:33] IntegerLiteral= // CHECK-tokens: Punctuation: "," [103:33 - 103:34] CallExpr=substr:60:13 // CHECK-tokens: Identifier: "AttrName" [103:35 - 103:43] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "." [103:43 - 103:44] MemberRefExpr=size:51:10 // CHECK-tokens: Identifier: "size" [103:44 - 103:48] MemberRefExpr=size:51:10 // CHECK-tokens: Punctuation: "(" [103:48 - 103:49] CallExpr=size:51:10 // CHECK-tokens: Punctuation: ")" [103:49 - 103:50] CallExpr=size:51:10 -// CHECK-tokens: Punctuation: "-" [103:51 - 103:52] UnexposedExpr= -// CHECK-tokens: Literal: "4" [103:53 - 103:54] UnexposedExpr= +// CHECK-tokens: Punctuation: "-" [103:51 - 103:52] BinaryOperator= +// CHECK-tokens: Literal: "4" [103:53 - 103:54] IntegerLiteral= // CHECK-tokens: Punctuation: ")" [103:54 - 103:55] CallExpr=substr:60:13 -// CHECK-tokens: Punctuation: ";" [103:55 - 103:56] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [105:3 - 105:9] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [103:55 - 103:56] CompoundStmt= +// CHECK-tokens: Keyword: "return" [105:3 - 105:9] ReturnStmt= // FIXME: Missing "llvm" namespace reference below // CHECK-tokens: Identifier: "llvm" [105:10 - 105:14] NamespaceRef=llvm:82:11 -// CHECK-tokens: Punctuation: "::" [105:14 - 105:16] UnexposedExpr=StringSwitch:87:12 +// CHECK-tokens: Punctuation: "::" [105:14 - 105:16] CXXFunctionalCastExpr= // CHECK-tokens: Identifier: "StringSwitch" [105:16 - 105:28] TemplateRef=StringSwitch:83:47 -// CHECK-tokens: Punctuation: "<" [105:29 - 105:30] UnexposedExpr=StringSwitch:87:12 +// CHECK-tokens: Punctuation: "<" [105:29 - 105:30] CXXFunctionalCastExpr= // CHECK-tokens: Identifier: "AttributeList" [105:31 - 105:44] TypeRef=class clang::AttributeList:12:9 -// CHECK-tokens: Punctuation: "::" [105:44 - 105:46] UnexposedExpr=StringSwitch:87:12 +// CHECK-tokens: Punctuation: "::" [105:44 - 105:46] CXXFunctionalCastExpr= // CHECK-tokens: Identifier: "Kind" [105:46 - 105:50] TypeRef=enum clang::AttributeList::Kind:13:10 // CHECK-tokens: Punctuation: ">" [105:51 - 105:52] CallExpr=StringSwitch:87:12 // CHECK-tokens: Punctuation: "(" [105:53 - 105:54] CallExpr=StringSwitch:87:12 // CHECK-tokens: Identifier: "AttrName" [105:54 - 105:62] DeclRefExpr=AttrName:101:19 -// CHECK-tokens: Punctuation: ")" [105:62 - 105:63] UnexposedExpr=StringSwitch:87:12 +// CHECK-tokens: Punctuation: ")" [105:62 - 105:63] CXXFunctionalCastExpr= // CHECK-tokens: Punctuation: "." [106:5 - 106:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [106:6 - 106:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [106:10 - 106:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""weak"" [106:11 - 106:17] UnexposedExpr= +// CHECK-tokens: Literal: ""weak"" [106:11 - 106:17] StringLiteral= // CHECK-tokens: Punctuation: "," [106:17 - 106:18] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_weak" [106:19 - 106:26] DeclRefExpr=AT_weak:29:45 // CHECK-tokens: Punctuation: ")" [106:26 - 106:27] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [107:5 - 107:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [107:6 - 107:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [107:10 - 107:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""weakref"" [107:11 - 107:20] UnexposedExpr= +// CHECK-tokens: Literal: ""weakref"" [107:11 - 107:20] StringLiteral= // CHECK-tokens: Punctuation: "," [107:20 - 107:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_weakref" [107:22 - 107:32] DeclRefExpr=AT_weakref:29:54 // CHECK-tokens: Punctuation: ")" [107:32 - 107:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [108:5 - 108:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [108:6 - 108:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [108:10 - 108:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""pure"" [108:11 - 108:17] UnexposedExpr= +// CHECK-tokens: Literal: ""pure"" [108:11 - 108:17] StringLiteral= // CHECK-tokens: Punctuation: "," [108:17 - 108:18] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_pure" [108:19 - 108:26] DeclRefExpr=AT_pure:26:49 // CHECK-tokens: Punctuation: ")" [108:26 - 108:27] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [109:5 - 109:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [109:6 - 109:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [109:10 - 109:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""mode"" [109:11 - 109:17] UnexposedExpr= +// CHECK-tokens: Literal: ""mode"" [109:11 - 109:17] StringLiteral= // CHECK-tokens: Punctuation: "," [109:17 - 109:18] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_mode" [109:19 - 109:26] DeclRefExpr=AT_mode:20:44 // CHECK-tokens: Punctuation: ")" [109:26 - 109:27] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [110:5 - 110:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [110:6 - 110:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [110:10 - 110:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""used"" [110:11 - 110:17] UnexposedExpr= +// CHECK-tokens: Literal: ""used"" [110:11 - 110:17] StringLiteral= // CHECK-tokens: Punctuation: "," [110:17 - 110:18] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_used" [110:19 - 110:26] DeclRefExpr=AT_used:28:34 // CHECK-tokens: Punctuation: ")" [110:26 - 110:27] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [111:5 - 111:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [111:6 - 111:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [111:10 - 111:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""alias"" [111:11 - 111:18] UnexposedExpr= +// CHECK-tokens: Literal: ""alias"" [111:11 - 111:18] StringLiteral= // CHECK-tokens: Punctuation: "," [111:18 - 111:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_alias" [111:20 - 111:28] DeclRefExpr=AT_alias:15:25 // CHECK-tokens: Punctuation: ")" [111:28 - 111:29] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [112:5 - 112:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [112:6 - 112:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [112:10 - 112:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""align"" [112:11 - 112:18] UnexposedExpr= +// CHECK-tokens: Literal: ""align"" [112:11 - 112:18] StringLiteral= // CHECK-tokens: Punctuation: "," [112:18 - 112:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_aligned" [112:20 - 112:30] DeclRefExpr=AT_aligned:15:35 // CHECK-tokens: Punctuation: ")" [112:30 - 112:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [113:5 - 113:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [113:6 - 113:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [113:10 - 113:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""final"" [113:11 - 113:18] UnexposedExpr= +// CHECK-tokens: Literal: ""final"" [113:11 - 113:18] StringLiteral= // CHECK-tokens: Punctuation: "," [113:18 - 113:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_final" [113:20 - 113:28] DeclRefExpr=AT_final:19:40 // CHECK-tokens: Punctuation: ")" [113:28 - 113:29] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [114:5 - 114:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [114:6 - 114:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [114:10 - 114:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""cdecl"" [114:11 - 114:18] UnexposedExpr= +// CHECK-tokens: Literal: ""cdecl"" [114:11 - 114:18] StringLiteral= // CHECK-tokens: Punctuation: "," [114:18 - 114:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_cdecl" [114:20 - 114:28] DeclRefExpr=AT_cdecl:17:30 // CHECK-tokens: Punctuation: ")" [114:28 - 114:29] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [115:5 - 115:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [115:6 - 115:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [115:10 - 115:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""const"" [115:11 - 115:18] UnexposedExpr= +// CHECK-tokens: Literal: ""const"" [115:11 - 115:18] StringLiteral= // CHECK-tokens: Punctuation: "," [115:18 - 115:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_const" [115:20 - 115:28] DeclRefExpr=AT_const:17:52 // CHECK-tokens: Punctuation: ")" [115:28 - 115:29] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [116:5 - 116:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [116:6 - 116:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [116:10 - 116:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__const"" [116:11 - 116:20] UnexposedExpr= +// CHECK-tokens: Literal: ""__const"" [116:11 - 116:20] StringLiteral= // CHECK-tokens: Punctuation: "," [116:20 - 116:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_const" [116:22 - 116:30] DeclRefExpr=AT_const:17:52 // CHECK-tokens: Punctuation: ")" [116:30 - 116:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [117:5 - 117:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [117:6 - 117:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [117:10 - 117:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""blocks"" [117:11 - 117:19] UnexposedExpr= +// CHECK-tokens: Literal: ""blocks"" [117:11 - 117:19] StringLiteral= // CHECK-tokens: Punctuation: "," [117:19 - 117:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_blocks" [117:21 - 117:30] DeclRefExpr=AT_blocks:16:57 // CHECK-tokens: Punctuation: ")" [117:30 - 117:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [118:5 - 118:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [118:6 - 118:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [118:10 - 118:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""format"" [118:11 - 118:19] UnexposedExpr= +// CHECK-tokens: Literal: ""format"" [118:11 - 118:19] StringLiteral= // CHECK-tokens: Punctuation: "," [118:19 - 118:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_format" [118:21 - 118:30] DeclRefExpr=AT_format:19:50 // CHECK-tokens: Punctuation: ")" [118:30 - 118:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [119:5 - 119:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [119:6 - 119:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [119:10 - 119:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""hiding"" [119:11 - 119:19] UnexposedExpr= +// CHECK-tokens: Literal: ""hiding"" [119:11 - 119:19] StringLiteral= // CHECK-tokens: Punctuation: "," [119:19 - 119:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_hiding" [119:21 - 119:30] DeclRefExpr=AT_hiding:20:22 // CHECK-tokens: Punctuation: ")" [119:30 - 119:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [120:5 - 120:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [120:6 - 120:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [120:10 - 120:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""malloc"" [120:11 - 120:19] UnexposedExpr= +// CHECK-tokens: Literal: ""malloc"" [120:11 - 120:19] StringLiteral= // CHECK-tokens: Punctuation: "," [120:19 - 120:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_malloc" [120:21 - 120:30] DeclRefExpr=AT_malloc:20:33 // CHECK-tokens: Punctuation: ")" [120:30 - 120:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [121:5 - 121:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [121:6 - 121:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [121:10 - 121:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""packed"" [121:11 - 121:19] UnexposedExpr= +// CHECK-tokens: Literal: ""packed"" [121:11 - 121:19] StringLiteral= // CHECK-tokens: Punctuation: "," [121:19 - 121:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_packed" [121:21 - 121:30] DeclRefExpr=AT_packed:26:27 // CHECK-tokens: Punctuation: ")" [121:30 - 121:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [122:5 - 122:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [122:6 - 122:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [122:10 - 122:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""unused"" [122:11 - 122:19] UnexposedExpr= +// CHECK-tokens: Literal: ""unused"" [122:11 - 122:19] StringLiteral= // CHECK-tokens: Punctuation: "," [122:19 - 122:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_unused" [122:21 - 122:30] DeclRefExpr=AT_unused:28:23 // CHECK-tokens: Punctuation: ")" [122:30 - 122:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [123:5 - 123:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [123:6 - 123:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [123:10 - 123:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""aligned"" [123:11 - 123:20] UnexposedExpr= +// CHECK-tokens: Literal: ""aligned"" [123:11 - 123:20] StringLiteral= // CHECK-tokens: Punctuation: "," [123:20 - 123:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_aligned" [123:22 - 123:32] DeclRefExpr=AT_aligned:15:35 // CHECK-tokens: Punctuation: ")" [123:32 - 123:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [124:5 - 124:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [124:6 - 124:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [124:10 - 124:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""cleanup"" [124:11 - 124:20] UnexposedExpr= +// CHECK-tokens: Literal: ""cleanup"" [124:11 - 124:20] StringLiteral= // CHECK-tokens: Punctuation: "," [124:20 - 124:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_cleanup" [124:22 - 124:32] DeclRefExpr=AT_cleanup:17:40 // CHECK-tokens: Punctuation: ")" [124:32 - 124:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [125:5 - 125:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [125:6 - 125:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [125:10 - 125:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""naked"" [125:11 - 125:18] UnexposedExpr= +// CHECK-tokens: Literal: ""naked"" [125:11 - 125:18] StringLiteral= // CHECK-tokens: Punctuation: "," [125:18 - 125:19] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_naked" [125:20 - 125:28] DeclRefExpr=AT_naked:20:53 // CHECK-tokens: Punctuation: ")" [125:28 - 125:29] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [126:5 - 126:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [126:6 - 126:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [126:10 - 126:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""nodebug"" [126:11 - 126:20] UnexposedExpr= +// CHECK-tokens: Literal: ""nodebug"" [126:11 - 126:20] StringLiteral= // CHECK-tokens: Punctuation: "," [126:20 - 126:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_nodebug" [126:22 - 126:32] DeclRefExpr=AT_nodebug:20:63 // CHECK-tokens: Punctuation: ")" [126:32 - 126:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [127:5 - 127:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [127:6 - 127:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [127:10 - 127:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""nonnull"" [127:11 - 127:20] UnexposedExpr= +// CHECK-tokens: Literal: ""nonnull"" [127:11 - 127:20] StringLiteral= // CHECK-tokens: Punctuation: "," [127:20 - 127:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_nonnull" [127:22 - 127:32] DeclRefExpr=AT_nonnull:21:47 // CHECK-tokens: Punctuation: ")" [127:32 - 127:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [128:5 - 128:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [128:6 - 128:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [128:10 - 128:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""nothrow"" [128:11 - 128:20] UnexposedExpr= +// CHECK-tokens: Literal: ""nothrow"" [128:11 - 128:20] StringLiteral= // CHECK-tokens: Punctuation: "," [128:20 - 128:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_nothrow" [128:22 - 128:32] DeclRefExpr=AT_nothrow:22:7 // CHECK-tokens: Punctuation: ")" [128:32 - 128:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [129:5 - 129:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [129:6 - 129:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [129:10 - 129:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""objc_gc"" [129:11 - 129:20] UnexposedExpr= +// CHECK-tokens: Literal: ""objc_gc"" [129:11 - 129:20] StringLiteral= // CHECK-tokens: Punctuation: "," [129:20 - 129:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_objc_gc" [129:22 - 129:32] DeclRefExpr=AT_objc_gc:24:59 // CHECK-tokens: Punctuation: ")" [129:32 - 129:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [130:5 - 130:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [130:6 - 130:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [130:10 - 130:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""regparm"" [130:11 - 130:20] UnexposedExpr= +// CHECK-tokens: Literal: ""regparm"" [130:11 - 130:20] StringLiteral= // CHECK-tokens: Punctuation: "," [130:20 - 130:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_regparm" [130:22 - 130:32] DeclRefExpr=AT_regparm:26:58 // CHECK-tokens: Punctuation: ")" [130:32 - 130:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [131:5 - 131:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [131:6 - 131:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [131:10 - 131:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""section"" [131:11 - 131:20] UnexposedExpr= +// CHECK-tokens: Literal: ""section"" [131:11 - 131:20] StringLiteral= // CHECK-tokens: Punctuation: "," [131:20 - 131:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_section" [131:22 - 131:32] DeclRefExpr=AT_section:27:7 // CHECK-tokens: Punctuation: ")" [131:32 - 131:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [132:5 - 132:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [132:6 - 132:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [132:10 - 132:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""stdcall"" [132:11 - 132:20] UnexposedExpr= +// CHECK-tokens: Literal: ""stdcall"" [132:11 - 132:20] StringLiteral= // CHECK-tokens: Punctuation: "," [132:20 - 132:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_stdcall" [132:22 - 132:32] DeclRefExpr=AT_stdcall:27:32 // CHECK-tokens: Punctuation: ")" [132:32 - 132:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [133:5 - 133:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [133:6 - 133:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [133:10 - 133:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""annotate"" [133:11 - 133:21] UnexposedExpr= +// CHECK-tokens: Literal: ""annotate"" [133:11 - 133:21] StringLiteral= // CHECK-tokens: Punctuation: "," [133:21 - 133:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_annotate" [133:23 - 133:34] DeclRefExpr=AT_annotate:16:29 // CHECK-tokens: Punctuation: ")" [133:34 - 133:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [134:5 - 134:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [134:6 - 134:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [134:10 - 134:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""fastcall"" [134:11 - 134:21] UnexposedExpr= +// CHECK-tokens: Literal: ""fastcall"" [134:11 - 134:21] StringLiteral= // CHECK-tokens: Punctuation: "," [134:21 - 134:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_fastcall" [134:23 - 134:34] DeclRefExpr=AT_fastcall:19:27 // CHECK-tokens: Punctuation: ")" [134:34 - 134:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [135:5 - 135:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [135:6 - 135:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [135:10 - 135:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ibaction"" [135:11 - 135:21] UnexposedExpr= +// CHECK-tokens: Literal: ""ibaction"" [135:11 - 135:21] StringLiteral= // CHECK-tokens: Punctuation: "," [135:21 - 135:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_IBAction" [135:23 - 135:34] DeclRefExpr=AT_IBAction:14:7 // CHECK-tokens: Punctuation: ")" [135:34 - 135:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [136:5 - 136:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [136:6 - 136:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [136:10 - 136:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""iboutlet"" [136:11 - 136:21] UnexposedExpr= +// CHECK-tokens: Literal: ""iboutlet"" [136:11 - 136:21] StringLiteral= // CHECK-tokens: Punctuation: "," [136:21 - 136:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_IBOutlet" [136:23 - 136:34] DeclRefExpr=AT_IBOutlet:14:20 // CHECK-tokens: Punctuation: ")" [136:34 - 136:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [137:5 - 137:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [137:6 - 137:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [137:10 - 137:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""iboutletcollection"" [137:11 - 137:31] UnexposedExpr= +// CHECK-tokens: Literal: ""iboutletcollection"" [137:11 - 137:31] StringLiteral= // CHECK-tokens: Punctuation: "," [137:31 - 137:32] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_IBOutletCollection" [137:33 - 137:54] DeclRefExpr=AT_IBOutletCollection:14:33 // CHECK-tokens: Punctuation: ")" [137:54 - 137:55] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [138:5 - 138:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [138:6 - 138:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [138:10 - 138:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""noreturn"" [138:11 - 138:21] UnexposedExpr= +// CHECK-tokens: Literal: ""noreturn"" [138:11 - 138:21] StringLiteral= // CHECK-tokens: Punctuation: "," [138:21 - 138:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_noreturn" [138:23 - 138:34] DeclRefExpr=AT_noreturn:21:59 // CHECK-tokens: Punctuation: ")" [138:34 - 138:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [139:5 - 139:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [139:6 - 139:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [139:10 - 139:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""noinline"" [139:11 - 139:21] UnexposedExpr= +// CHECK-tokens: Literal: ""noinline"" [139:11 - 139:21] StringLiteral= // CHECK-tokens: Punctuation: "," [139:21 - 139:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_noinline" [139:23 - 139:34] DeclRefExpr=AT_noinline:21:7 // CHECK-tokens: Punctuation: ")" [139:34 - 139:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [140:5 - 140:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [140:6 - 140:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [140:10 - 140:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""override"" [140:11 - 140:21] UnexposedExpr= +// CHECK-tokens: Literal: ""override"" [140:11 - 140:21] StringLiteral= // CHECK-tokens: Punctuation: "," [140:21 - 140:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_override" [140:23 - 140:34] DeclRefExpr=AT_override:22:51 // CHECK-tokens: Punctuation: ")" [140:34 - 140:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [141:5 - 141:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [141:6 - 141:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [141:10 - 141:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""sentinel"" [141:11 - 141:21] UnexposedExpr= +// CHECK-tokens: Literal: ""sentinel"" [141:11 - 141:21] StringLiteral= // CHECK-tokens: Punctuation: "," [141:21 - 141:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_sentinel" [141:23 - 141:34] DeclRefExpr=AT_sentinel:27:19 // CHECK-tokens: Punctuation: ")" [141:34 - 141:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [142:5 - 142:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [142:6 - 142:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [142:10 - 142:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""NSObject"" [142:11 - 142:21] UnexposedExpr= +// CHECK-tokens: Literal: ""NSObject"" [142:11 - 142:21] StringLiteral= // CHECK-tokens: Punctuation: "," [142:21 - 142:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_nsobject" [142:23 - 142:34] DeclRefExpr=AT_nsobject:22:19 // CHECK-tokens: Punctuation: ")" [142:34 - 142:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [143:5 - 143:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [143:6 - 143:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [143:10 - 143:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""dllimport"" [143:11 - 143:22] UnexposedExpr= +// CHECK-tokens: Literal: ""dllimport"" [143:11 - 143:22] StringLiteral= // CHECK-tokens: Punctuation: "," [143:22 - 143:23] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_dllimport" [143:24 - 143:36] DeclRefExpr=AT_dllimport:18:51 // CHECK-tokens: Punctuation: ")" [143:36 - 143:37] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [144:5 - 144:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [144:6 - 144:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [144:10 - 144:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""dllexport"" [144:11 - 144:22] UnexposedExpr= +// CHECK-tokens: Literal: ""dllexport"" [144:11 - 144:22] StringLiteral= // CHECK-tokens: Punctuation: "," [144:22 - 144:23] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_dllexport" [144:24 - 144:36] DeclRefExpr=AT_dllexport:18:37 // CHECK-tokens: Punctuation: ")" [144:36 - 144:37] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [145:5 - 145:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [145:6 - 145:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [145:10 - 145:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""may_alias"" [145:11 - 145:22] UnexposedExpr= +// CHECK-tokens: Literal: ""may_alias"" [145:11 - 145:22] StringLiteral= // CHECK-tokens: Punctuation: "," [145:22 - 145:23] CallExpr=Case:88:42 -// CHECK-tokens: Identifier: "IgnoredAttribute" [145:24 - 145:40] DeclRefExpr=IgnoredAttribute:31:7 +// CHECK-tokens: Identifier: "IgnoredAttribute" [145:24 - 145:40] DeclRefExpr=IgnoredAttribute:31:25 // CHECK-tokens: Punctuation: ")" [145:40 - 145:41] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [146:5 - 146:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [146:6 - 146:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [146:10 - 146:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""base_check"" [146:11 - 146:23] UnexposedExpr= +// CHECK-tokens: Literal: ""base_check"" [146:11 - 146:23] StringLiteral= // CHECK-tokens: Punctuation: "," [146:23 - 146:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_base_check" [146:25 - 146:38] DeclRefExpr=AT_base_check:16:42 // CHECK-tokens: Punctuation: ")" [146:38 - 146:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [147:5 - 147:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [147:6 - 147:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [147:10 - 147:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""deprecated"" [147:11 - 147:23] UnexposedExpr= +// CHECK-tokens: Literal: ""deprecated"" [147:11 - 147:23] StringLiteral= // CHECK-tokens: Punctuation: "," [147:23 - 147:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_deprecated" [147:25 - 147:38] DeclRefExpr=AT_deprecated:18:7 // CHECK-tokens: Punctuation: ")" [147:38 - 147:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [148:5 - 148:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [148:6 - 148:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [148:10 - 148:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""visibility"" [148:11 - 148:23] UnexposedExpr= +// CHECK-tokens: Literal: ""visibility"" [148:11 - 148:23] StringLiteral= // CHECK-tokens: Punctuation: "," [148:23 - 148:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_visibility" [148:25 - 148:38] DeclRefExpr=AT_visibility:29:7 // CHECK-tokens: Punctuation: ")" [148:38 - 148:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [149:5 - 149:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [149:6 - 149:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [149:10 - 149:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""destructor"" [149:11 - 149:23] UnexposedExpr= +// CHECK-tokens: Literal: ""destructor"" [149:11 - 149:23] StringLiteral= // CHECK-tokens: Punctuation: "," [149:23 - 149:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_destructor" [149:25 - 149:38] DeclRefExpr=AT_destructor:18:22 // CHECK-tokens: Punctuation: ")" [149:38 - 149:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [150:5 - 150:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [150:6 - 150:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [150:10 - 150:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""format_arg"" [150:11 - 150:23] UnexposedExpr= +// CHECK-tokens: Literal: ""format_arg"" [150:11 - 150:23] StringLiteral= // CHECK-tokens: Punctuation: "," [150:23 - 150:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_format_arg" [150:25 - 150:38] DeclRefExpr=AT_format_arg:19:61 // CHECK-tokens: Punctuation: ")" [150:38 - 150:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [151:5 - 151:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [151:6 - 151:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [151:10 - 151:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""gnu_inline"" [151:11 - 151:23] UnexposedExpr= +// CHECK-tokens: Literal: ""gnu_inline"" [151:11 - 151:23] StringLiteral= // CHECK-tokens: Punctuation: "," [151:23 - 151:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_gnu_inline" [151:25 - 151:38] DeclRefExpr=AT_gnu_inline:20:7 // CHECK-tokens: Punctuation: ")" [151:38 - 151:39] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [152:5 - 152:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [152:6 - 152:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [152:10 - 152:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""weak_import"" [152:11 - 152:24] UnexposedExpr= +// CHECK-tokens: Literal: ""weak_import"" [152:11 - 152:24] StringLiteral= // CHECK-tokens: Punctuation: "," [152:24 - 152:25] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_weak_import" [152:26 - 152:40] DeclRefExpr=AT_weak_import:30:7 // CHECK-tokens: Punctuation: ")" [152:40 - 152:41] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [153:5 - 153:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [153:6 - 153:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [153:10 - 153:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""vecreturn"" [153:11 - 153:22] UnexposedExpr= +// CHECK-tokens: Literal: ""vecreturn"" [153:11 - 153:22] StringLiteral= // CHECK-tokens: Punctuation: "," [153:22 - 153:23] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_vecreturn" [153:24 - 153:36] DeclRefExpr=AT_vecreturn:28:43 // CHECK-tokens: Punctuation: ")" [153:36 - 153:37] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [154:5 - 154:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [154:6 - 154:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [154:10 - 154:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""vector_size"" [154:11 - 154:24] UnexposedExpr= +// CHECK-tokens: Literal: ""vector_size"" [154:11 - 154:24] StringLiteral= // CHECK-tokens: Punctuation: "," [154:24 - 154:25] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_vector_size" [154:26 - 154:40] DeclRefExpr=AT_vector_size:28:57 // CHECK-tokens: Punctuation: ")" [154:40 - 154:41] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [155:5 - 155:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [155:6 - 155:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [155:10 - 155:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""constructor"" [155:11 - 155:24] UnexposedExpr= +// CHECK-tokens: Literal: ""constructor"" [155:11 - 155:24] StringLiteral= // CHECK-tokens: Punctuation: "," [155:24 - 155:25] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_constructor" [155:26 - 155:40] DeclRefExpr=AT_constructor:17:62 // CHECK-tokens: Punctuation: ")" [155:40 - 155:41] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [156:5 - 156:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [156:6 - 156:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [156:10 - 156:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""unavailable"" [156:11 - 156:24] UnexposedExpr= +// CHECK-tokens: Literal: ""unavailable"" [156:11 - 156:24] StringLiteral= // CHECK-tokens: Punctuation: "," [156:24 - 156:25] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_unavailable" [156:26 - 156:40] DeclRefExpr=AT_unavailable:28:7 // CHECK-tokens: Punctuation: ")" [156:40 - 156:41] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [157:5 - 157:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [157:6 - 157:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [157:10 - 157:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""overloadable"" [157:11 - 157:25] UnexposedExpr= +// CHECK-tokens: Literal: ""overloadable"" [157:11 - 157:25] StringLiteral= // CHECK-tokens: Punctuation: "," [157:25 - 157:26] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_overloadable" [157:27 - 157:42] DeclRefExpr=AT_overloadable:25:7 // CHECK-tokens: Punctuation: ")" [157:42 - 157:43] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [158:5 - 158:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [158:6 - 158:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [158:10 - 158:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""address_space"" [158:11 - 158:26] UnexposedExpr= +// CHECK-tokens: Literal: ""address_space"" [158:11 - 158:26] StringLiteral= // CHECK-tokens: Punctuation: "," [158:26 - 158:27] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_address_space" [158:28 - 158:44] DeclRefExpr=AT_address_space:15:7 // CHECK-tokens: Punctuation: ")" [158:44 - 158:45] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [159:5 - 159:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [159:6 - 159:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [159:10 - 159:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""always_inline"" [159:11 - 159:26] UnexposedExpr= +// CHECK-tokens: Literal: ""always_inline"" [159:11 - 159:26] StringLiteral= // CHECK-tokens: Punctuation: "," [159:26 - 159:27] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_always_inline" [159:28 - 159:44] DeclRefExpr=AT_always_inline:15:47 // CHECK-tokens: Punctuation: ")" [159:44 - 159:45] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [160:5 - 160:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [160:6 - 160:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [160:10 - 160:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""returns_twice"" [160:11 - 160:26] UnexposedExpr= +// CHECK-tokens: Literal: ""returns_twice"" [160:11 - 160:26] StringLiteral= // CHECK-tokens: Punctuation: "," [160:26 - 160:27] CallExpr=Case:88:42 -// CHECK-tokens: Identifier: "IgnoredAttribute" [160:28 - 160:44] DeclRefExpr=IgnoredAttribute:31:7 +// CHECK-tokens: Identifier: "AT_returns_twice" [160:28 - 160:44] DeclRefExpr=AT_returns_twice:31:7 // CHECK-tokens: Punctuation: ")" [160:44 - 160:45] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [161:5 - 161:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [161:6 - 161:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [161:10 - 161:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""vec_type_hint"" [161:11 - 161:26] UnexposedExpr= +// CHECK-tokens: Literal: ""vec_type_hint"" [161:11 - 161:26] StringLiteral= // CHECK-tokens: Punctuation: "," [161:26 - 161:27] CallExpr=Case:88:42 -// CHECK-tokens: Identifier: "IgnoredAttribute" [161:28 - 161:44] DeclRefExpr=IgnoredAttribute:31:7 +// CHECK-tokens: Identifier: "IgnoredAttribute" [161:28 - 161:44] DeclRefExpr=IgnoredAttribute:31:25 // CHECK-tokens: Punctuation: ")" [161:44 - 161:45] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [162:5 - 162:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [162:6 - 162:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [162:10 - 162:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""objc_exception"" [162:11 - 162:27] UnexposedExpr= +// CHECK-tokens: Literal: ""objc_exception"" [162:11 - 162:27] StringLiteral= // CHECK-tokens: Punctuation: "," [162:27 - 162:28] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_objc_exception" [162:29 - 162:46] DeclRefExpr=AT_objc_exception:22:32 // CHECK-tokens: Punctuation: ")" [162:46 - 162:47] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [163:5 - 163:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [163:6 - 163:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [163:10 - 163:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ext_vector_type"" [163:11 - 163:28] UnexposedExpr= +// CHECK-tokens: Literal: ""ext_vector_type"" [163:11 - 163:28] StringLiteral= // CHECK-tokens: Punctuation: "," [163:28 - 163:29] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ext_vector_type" [163:30 - 163:48] DeclRefExpr=AT_ext_vector_type:19:7 // CHECK-tokens: Punctuation: ")" [163:48 - 163:49] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [164:5 - 164:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [164:6 - 164:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [164:10 - 164:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""transparent_union"" [164:11 - 164:30] UnexposedExpr= +// CHECK-tokens: Literal: ""transparent_union"" [164:11 - 164:30] StringLiteral= // CHECK-tokens: Punctuation: "," [164:30 - 164:31] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_transparent_union" [164:32 - 164:52] DeclRefExpr=AT_transparent_union:27:57 // CHECK-tokens: Punctuation: ")" [164:52 - 164:53] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [165:5 - 165:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [165:6 - 165:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [165:10 - 165:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""analyzer_noreturn"" [165:11 - 165:30] UnexposedExpr= +// CHECK-tokens: Literal: ""analyzer_noreturn"" [165:11 - 165:30] StringLiteral= // CHECK-tokens: Punctuation: "," [165:30 - 165:31] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_analyzer_noreturn" [165:32 - 165:52] DeclRefExpr=AT_analyzer_noreturn:16:7 // CHECK-tokens: Punctuation: ")" [165:52 - 165:53] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [166:5 - 166:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [166:6 - 166:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [166:10 - 166:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""warn_unused_result"" [166:11 - 166:31] UnexposedExpr= +// CHECK-tokens: Literal: ""warn_unused_result"" [166:11 - 166:31] StringLiteral= // CHECK-tokens: Punctuation: "," [166:31 - 166:32] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_warn_unused_result" [166:33 - 166:54] DeclRefExpr=AT_warn_unused_result:29:22 // CHECK-tokens: Punctuation: ")" [166:54 - 166:55] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [167:5 - 167:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [167:6 - 167:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [167:10 - 167:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""carries_dependency"" [167:11 - 167:31] UnexposedExpr= +// CHECK-tokens: Literal: ""carries_dependency"" [167:11 - 167:31] StringLiteral= // CHECK-tokens: Punctuation: "," [167:31 - 167:32] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_carries_dependency" [167:33 - 167:54] DeclRefExpr=AT_carries_dependency:17:7 // CHECK-tokens: Punctuation: ")" [167:54 - 167:55] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [168:5 - 168:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [168:6 - 168:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [168:10 - 168:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ns_returns_not_retained"" [168:11 - 168:36] UnexposedExpr= +// CHECK-tokens: Literal: ""ns_returns_not_retained"" [168:11 - 168:36] StringLiteral= // CHECK-tokens: Punctuation: "," [168:36 - 168:37] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ns_returns_not_retained" [168:38 - 168:64] DeclRefExpr=AT_ns_returns_not_retained:24:7 // CHECK-tokens: Punctuation: ")" [168:64 - 168:65] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [169:5 - 169:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [169:6 - 169:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [169:10 - 169:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ns_returns_retained"" [169:11 - 169:32] UnexposedExpr= +// CHECK-tokens: Literal: ""ns_returns_retained"" [169:11 - 169:32] StringLiteral= // CHECK-tokens: Punctuation: "," [169:32 - 169:33] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ns_returns_retained" [169:34 - 169:56] DeclRefExpr=AT_ns_returns_retained:24:35 // CHECK-tokens: Punctuation: ")" [169:56 - 169:57] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [170:5 - 170:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [170:6 - 170:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [170:10 - 170:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""cf_returns_not_retained"" [170:11 - 170:36] UnexposedExpr= +// CHECK-tokens: Literal: ""cf_returns_not_retained"" [170:11 - 170:36] StringLiteral= // CHECK-tokens: Punctuation: "," [170:36 - 170:37] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_cf_returns_not_retained" [170:38 - 170:64] DeclRefExpr=AT_cf_returns_not_retained:23:7 // CHECK-tokens: Punctuation: ")" [170:64 - 170:65] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [171:5 - 171:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [171:6 - 171:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [171:10 - 171:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""cf_returns_retained"" [171:11 - 171:32] UnexposedExpr= +// CHECK-tokens: Literal: ""cf_returns_retained"" [171:11 - 171:32] StringLiteral= // CHECK-tokens: Punctuation: "," [171:32 - 171:33] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_cf_returns_retained" [171:34 - 171:56] DeclRefExpr=AT_cf_returns_retained:23:35 // CHECK-tokens: Punctuation: ")" [171:56 - 171:57] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [172:5 - 172:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [172:6 - 172:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [172:10 - 172:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ownership_returns"" [172:11 - 172:30] UnexposedExpr= +// CHECK-tokens: Literal: ""ownership_returns"" [172:11 - 172:30] StringLiteral= // CHECK-tokens: Punctuation: "," [172:30 - 172:31] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ownership_returns" [172:32 - 172:52] DeclRefExpr=AT_ownership_returns:25:44 // CHECK-tokens: Punctuation: ")" [172:52 - 172:53] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [173:5 - 173:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [173:6 - 173:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [173:10 - 173:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ownership_holds"" [173:11 - 173:28] UnexposedExpr= +// CHECK-tokens: Literal: ""ownership_holds"" [173:11 - 173:28] StringLiteral= // CHECK-tokens: Punctuation: "," [173:28 - 173:29] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ownership_holds" [173:30 - 173:48] DeclRefExpr=AT_ownership_holds:25:24 // CHECK-tokens: Punctuation: ")" [173:48 - 173:49] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [174:5 - 174:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [174:6 - 174:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [174:10 - 174:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""ownership_takes"" [174:11 - 174:28] UnexposedExpr= +// CHECK-tokens: Literal: ""ownership_takes"" [174:11 - 174:28] StringLiteral= // CHECK-tokens: Punctuation: "," [174:28 - 174:29] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_ownership_takes" [174:30 - 174:48] DeclRefExpr=AT_ownership_takes:26:7 // CHECK-tokens: Punctuation: ")" [174:48 - 174:49] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [175:5 - 175:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [175:6 - 175:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [175:10 - 175:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""reqd_work_group_size"" [175:11 - 175:33] UnexposedExpr= +// CHECK-tokens: Literal: ""reqd_work_group_size"" [175:11 - 175:33] StringLiteral= // CHECK-tokens: Punctuation: "," [175:33 - 175:34] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_reqd_wg_size" [175:35 - 175:50] DeclRefExpr=AT_reqd_wg_size:30:23 // CHECK-tokens: Punctuation: ")" [175:50 - 175:51] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [176:5 - 176:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [176:6 - 176:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [176:10 - 176:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""init_priority"" [176:11 - 176:26] UnexposedExpr= +// CHECK-tokens: Literal: ""init_priority"" [176:11 - 176:26] StringLiteral= // CHECK-tokens: Punctuation: "," [176:26 - 176:27] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_init_priority" [176:28 - 176:44] DeclRefExpr=AT_init_priority:30:40 // CHECK-tokens: Punctuation: ")" [176:44 - 176:45] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [177:5 - 177:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [177:6 - 177:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [177:10 - 177:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""no_instrument_function"" [177:11 - 177:35] UnexposedExpr= +// CHECK-tokens: Literal: ""no_instrument_function"" [177:11 - 177:35] StringLiteral= // CHECK-tokens: Punctuation: "," [177:35 - 177:36] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_no_instrument_function" [177:37 - 177:62] DeclRefExpr=AT_no_instrument_function:21:20 // CHECK-tokens: Punctuation: ")" [177:62 - 177:63] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [178:5 - 178:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [178:6 - 178:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [178:10 - 178:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""thiscall"" [178:11 - 178:21] UnexposedExpr= +// CHECK-tokens: Literal: ""thiscall"" [178:11 - 178:21] StringLiteral= // CHECK-tokens: Punctuation: "," [178:21 - 178:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_thiscall" [178:23 - 178:34] DeclRefExpr=AT_thiscall:27:44 // CHECK-tokens: Punctuation: ")" [178:34 - 178:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [179:5 - 179:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [179:6 - 179:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [179:10 - 179:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""pascal"" [179:11 - 179:19] UnexposedExpr= +// CHECK-tokens: Literal: ""pascal"" [179:11 - 179:19] StringLiteral= // CHECK-tokens: Punctuation: "," [179:19 - 179:20] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_pascal" [179:21 - 179:30] DeclRefExpr=AT_pascal:26:38 // CHECK-tokens: Punctuation: ")" [179:30 - 179:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [180:5 - 180:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [180:6 - 180:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [180:10 - 180:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__cdecl"" [180:11 - 180:20] UnexposedExpr= +// CHECK-tokens: Literal: ""__cdecl"" [180:11 - 180:20] StringLiteral= // CHECK-tokens: Punctuation: "," [180:20 - 180:21] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_cdecl" [180:22 - 180:30] DeclRefExpr=AT_cdecl:17:30 // CHECK-tokens: Punctuation: ")" [180:30 - 180:31] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [181:5 - 181:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [181:6 - 181:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [181:10 - 181:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__stdcall"" [181:11 - 181:22] UnexposedExpr= +// CHECK-tokens: Literal: ""__stdcall"" [181:11 - 181:22] StringLiteral= // CHECK-tokens: Punctuation: "," [181:22 - 181:23] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_stdcall" [181:24 - 181:34] DeclRefExpr=AT_stdcall:27:32 // CHECK-tokens: Punctuation: ")" [181:34 - 181:35] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [182:5 - 182:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [182:6 - 182:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [182:10 - 182:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__fastcall"" [182:11 - 182:23] UnexposedExpr= +// CHECK-tokens: Literal: ""__fastcall"" [182:11 - 182:23] StringLiteral= // CHECK-tokens: Punctuation: "," [182:23 - 182:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_fastcall" [182:25 - 182:36] DeclRefExpr=AT_fastcall:19:27 // CHECK-tokens: Punctuation: ")" [182:36 - 182:37] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [183:5 - 183:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [183:6 - 183:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [183:10 - 183:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__thiscall"" [183:11 - 183:23] UnexposedExpr= +// CHECK-tokens: Literal: ""__thiscall"" [183:11 - 183:23] StringLiteral= // CHECK-tokens: Punctuation: "," [183:23 - 183:24] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_thiscall" [183:25 - 183:36] DeclRefExpr=AT_thiscall:27:44 // CHECK-tokens: Punctuation: ")" [183:36 - 183:37] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [184:5 - 184:6] MemberRefExpr=Case:88:42 // CHECK-tokens: Identifier: "Case" [184:6 - 184:10] MemberRefExpr=Case:88:42 // CHECK-tokens: Punctuation: "(" [184:10 - 184:11] CallExpr=Case:88:42 -// CHECK-tokens: Literal: ""__pascal"" [184:11 - 184:21] UnexposedExpr= +// CHECK-tokens: Literal: ""__pascal"" [184:11 - 184:21] StringLiteral= // CHECK-tokens: Punctuation: "," [184:21 - 184:22] CallExpr=Case:88:42 // CHECK-tokens: Identifier: "AT_pascal" [184:23 - 184:32] DeclRefExpr=AT_pascal:26:38 // CHECK-tokens: Punctuation: ")" [184:32 - 184:33] CallExpr=Case:88:42 // CHECK-tokens: Punctuation: "." [185:5 - 185:6] MemberRefExpr=Default:92:5 // CHECK-tokens: Identifier: "Default" [185:6 - 185:13] MemberRefExpr=Default:92:5 // CHECK-tokens: Punctuation: "(" [185:13 - 185:14] CallExpr=Default:92:5 -// CHECK-tokens: Identifier: "UnknownAttribute" [185:14 - 185:30] DeclRefExpr=UnknownAttribute:31:25 +// CHECK-tokens: Identifier: "UnknownAttribute" [185:14 - 185:30] DeclRefExpr=UnknownAttribute:31:43 // CHECK-tokens: Punctuation: ")" [185:30 - 185:31] CallExpr=Default:92:5 -// CHECK-tokens: Punctuation: ";" [185:31 - 185:32] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [186:1 - 186:2] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [185:31 - 185:32] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [186:1 - 186:2] CompoundStmt= // RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s // CHECK: 1:27: TypedefDecl=__darwin_size_t:1:27 (Definition) Extent=[1:1 - 1:42] @@ -1614,8 +1614,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 30:7: EnumConstantDecl=AT_weak_import:30:7 (Definition) Extent=[30:7 - 30:21] // CHECK: 30:23: EnumConstantDecl=AT_reqd_wg_size:30:23 (Definition) Extent=[30:23 - 30:38] // CHECK: 30:40: EnumConstantDecl=AT_init_priority:30:40 (Definition) Extent=[30:40 - 30:56] -// CHECK: 31:7: EnumConstantDecl=IgnoredAttribute:31:7 (Definition) Extent=[31:7 - 31:23] -// CHECK: 31:25: EnumConstantDecl=UnknownAttribute:31:25 (Definition) Extent=[31:25 - 31:41] +// CHECK: 31:7: EnumConstantDecl=AT_returns_twice:31:7 (Definition) Extent=[31:7 - 31:23] +// CHECK: 31:25: EnumConstantDecl=IgnoredAttribute:31:25 (Definition) Extent=[31:25 - 31:41] // CHECK: 33:17: CXXMethod=getKind:33:17 (static) Extent=[33:5 - 33:53] // CHECK: 33:12: TypeRef=enum clang::AttributeList::Kind:13:10 Extent=[33:12 - 33:16] // CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:25 - 33:52] @@ -1625,16 +1625,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:21 - 36:34] // CHECK: 37:11: Namespace=llvm:37:11 (Definition) Extent=[37:1 - 64:2] // CHECK: 38:7: ClassDecl=StringRef:38:7 (Definition) Extent=[38:1 - 63:2] -// CHECK: 39:1: UnexposedDecl=:39:1 (Definition) Extent=[39:1 - 39:8] +// CHECK: 39:1: CXXAccessSpecifier=:39:1 (Definition) Extent=[39:1 - 39:8] // CHECK: 40:23: TypedefDecl=iterator:40:23 (Definition) Extent=[40:3 - 40:31] // CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:3 - 41:40] // CHECK: 41:16: TypeRef=size_t:2:25 Extent=[41:16 - 41:22] -// CHECK: 41:30: UnexposedExpr= Extent=[41:30 - 41:40] -// CHECK: 41:31: UnexposedExpr= Extent=[41:31 - 41:40] +// CHECK: 41:30: UnaryOperator= Extent=[41:30 - 41:40] +// CHECK: 41:31: CXXFunctionalCastExpr= Extent=[41:31 - 41:40] // CHECK: 41:31: TypeRef=size_t:2:25 Extent=[41:31 - 41:37] // CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39] -// CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39] -// CHECK: 42:1: UnexposedDecl=:42:1 (Definition) Extent=[42:1 - 42:9] +// CHECK: 41:38: IntegerLiteral= Extent=[41:38 - 41:39] +// CHECK: 42:1: CXXAccessSpecifier=:42:1 (Definition) Extent=[42:1 - 42:9] // CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:3 - 43:19] // CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:3 - 44:16] // CHECK: 44:3: TypeRef=size_t:2:25 Extent=[44:3 - 44:9] @@ -1644,23 +1644,23 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 45:21: TypeRef=size_t:2:25 Extent=[45:21 - 45:27] // CHECK: 45:38: ParmDecl=b:45:38 (Definition) Extent=[45:31 - 45:39] // CHECK: 45:31: TypeRef=size_t:2:25 Extent=[45:31 - 45:37] -// CHECK: 45:41: UnexposedStmt= Extent=[45:41 - 45:66] -// CHECK: 45:43: UnexposedStmt= Extent=[45:43 - 45:63] -// CHECK: 45:50: UnexposedExpr= Extent=[45:50 - 45:63] -// CHECK: 45:50: UnexposedExpr= Extent=[45:50 - 45:55] +// CHECK: 45:41: CompoundStmt= Extent=[45:41 - 45:66] +// CHECK: 45:43: ReturnStmt= Extent=[45:43 - 45:63] +// CHECK: 45:50: ConditionalOperator= Extent=[45:50 - 45:63] +// CHECK: 45:50: BinaryOperator= Extent=[45:50 - 45:55] // CHECK: 45:50: DeclRefExpr=a:45:28 Extent=[45:50 - 45:51] // CHECK: 45:54: DeclRefExpr=b:45:38 Extent=[45:54 - 45:55] // CHECK: 45:58: DeclRefExpr=a:45:28 Extent=[45:58 - 45:59] // CHECK: 45:62: DeclRefExpr=b:45:38 Extent=[45:62 - 45:63] -// CHECK: 46:1: UnexposedDecl=:46:1 (Definition) Extent=[46:1 - 46:8] +// CHECK: 46:1: CXXAccessSpecifier=:46:1 (Definition) Extent=[46:1 - 46:8] // CHECK: 47:3: CXXConstructor=StringRef:47:3 (Definition) Extent=[47:3 - 47:37] // CHECK: 47:16: MemberRef=Data:43:15 Extent=[47:16 - 47:20] // CHECK: 47:21: UnexposedExpr= Extent=[47:21 - 47:22] -// CHECK: 47:21: UnexposedExpr= Extent=[47:21 - 47:22] +// CHECK: 47:21: IntegerLiteral= Extent=[47:21 - 47:22] // CHECK: 47:25: MemberRef=Length:44:10 Extent=[47:25 - 47:31] // CHECK: 47:32: UnexposedExpr= Extent=[47:32 - 47:33] -// CHECK: 47:32: UnexposedExpr= Extent=[47:32 - 47:33] -// CHECK: 47:35: UnexposedStmt= Extent=[47:35 - 47:37] +// CHECK: 47:32: IntegerLiteral= Extent=[47:32 - 47:33] +// CHECK: 47:35: CompoundStmt= Extent=[47:35 - 47:37] // CHECK: 48:3: CXXConstructor=StringRef:48:3 (Definition) Extent=[48:3 - 48:71] // CHECK: 48:25: ParmDecl=Str:48:25 (Definition) Extent=[48:13 - 48:28] // CHECK: 48:32: MemberRef=Data:43:15 Extent=[48:32 - 48:36] @@ -1670,7 +1670,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 48:50: UnexposedExpr=magic_length:36:8 Extent=[48:50 - 48:62] // CHECK: 48:50: DeclRefExpr=magic_length:36:8 Extent=[48:50 - 48:62] // CHECK: 48:63: DeclRefExpr=Str:48:25 Extent=[48:63 - 48:66] -// CHECK: 48:69: UnexposedStmt= Extent=[48:69 - 48:71] +// CHECK: 48:69: CompoundStmt= Extent=[48:69 - 48:71] // CHECK: 49:3: CXXConstructor=StringRef:49:3 (Definition) Extent=[49:3 - 49:77] // CHECK: 49:25: ParmDecl=data:49:25 (Definition) Extent=[49:13 - 49:29] // CHECK: 49:38: ParmDecl=length:49:38 (Definition) Extent=[49:31 - 49:44] @@ -1679,67 +1679,67 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 49:53: DeclRefExpr=data:49:25 Extent=[49:53 - 49:57] // CHECK: 49:60: MemberRef=Length:44:10 Extent=[49:60 - 49:66] // CHECK: 49:67: DeclRefExpr=length:49:38 Extent=[49:67 - 49:73] -// CHECK: 49:75: UnexposedStmt= Extent=[49:75 - 49:77] +// CHECK: 49:75: CompoundStmt= Extent=[49:75 - 49:77] // CHECK: 50:12: CXXMethod=end:50:12 (Definition) Extent=[50:3 - 50:40] // CHECK: 50:3: TypeRef=iterator:40:23 Extent=[50:3 - 50:11] -// CHECK: 50:24: UnexposedStmt= Extent=[50:24 - 50:40] -// CHECK: 50:26: UnexposedStmt= Extent=[50:26 - 50:37] +// CHECK: 50:24: CompoundStmt= Extent=[50:24 - 50:40] +// CHECK: 50:26: ReturnStmt= Extent=[50:26 - 50:37] // CHECK: 50:33: MemberRefExpr=Data:43:15 Extent=[50:33 - 50:37] // CHECK: 51:10: CXXMethod=size:51:10 (Definition) Extent=[51:3 - 51:41] // CHECK: 51:3: TypeRef=size_t:2:25 Extent=[51:3 - 51:9] -// CHECK: 51:23: UnexposedStmt= Extent=[51:23 - 51:41] -// CHECK: 51:25: UnexposedStmt= Extent=[51:25 - 51:38] +// CHECK: 51:23: CompoundStmt= Extent=[51:23 - 51:41] +// CHECK: 51:25: ReturnStmt= Extent=[51:25 - 51:38] // CHECK: 51:32: MemberRefExpr=Length:44:10 Extent=[51:32 - 51:38] // CHECK: 52:8: CXXMethod=startswith:52:8 (Definition) Extent=[52:3 - 55:4] // CHECK: 52:29: ParmDecl=Prefix:52:29 (Definition) Extent=[52:19 - 52:35] // CHECK: 52:19: TypeRef=class llvm::StringRef:38:7 Extent=[52:19 - 52:28] -// CHECK: 52:43: UnexposedStmt= Extent=[52:43 - 55:4] -// CHECK: 53:5: UnexposedStmt= Extent=[53:5 - 54:56] -// CHECK: 53:12: UnexposedExpr= Extent=[53:12 - 54:56] -// CHECK: 53:12: UnexposedExpr= Extent=[53:12 - 53:35] +// CHECK: 52:43: CompoundStmt= Extent=[52:43 - 55:4] +// CHECK: 53:5: ReturnStmt= Extent=[53:5 - 54:56] +// CHECK: 53:12: BinaryOperator= Extent=[53:12 - 54:56] +// CHECK: 53:12: BinaryOperator= Extent=[53:12 - 53:35] // CHECK: 53:12: UnexposedExpr=Length:44:10 Extent=[53:12 - 53:18] // CHECK: 53:12: MemberRefExpr=Length:44:10 Extent=[53:12 - 53:18] -// CHECK: 53:29: MemberRefExpr=Length:44:10 Extent=[53:22 - 53:35] +// CHECK: 53:29: MemberRefExpr=Length:44:10 SingleRefName=[53:29 - 53:35] RefName=[53:29 - 53:35] Extent=[53:22 - 53:35] // CHECK: 53:22: DeclRefExpr=Prefix:52:29 Extent=[53:22 - 53:28] -// CHECK: 54:11: UnexposedExpr= Extent=[54:11 - 54:56] +// CHECK: 54:11: BinaryOperator= Extent=[54:11 - 54:56] // CHECK: 54:11: CallExpr=memcmp:7:7 Extent=[54:11 - 54:51] // CHECK: 54:11: UnexposedExpr=memcmp:7:7 Extent=[54:11 - 54:17] // CHECK: 54:11: DeclRefExpr=memcmp:7:7 Extent=[54:11 - 54:17] // CHECK: 54:18: UnexposedExpr=Data:43:15 Extent=[54:18 - 54:22] // CHECK: 54:18: MemberRefExpr=Data:43:15 Extent=[54:18 - 54:22] -// CHECK: 54:24: UnexposedExpr=Data:43:15 Extent=[54:24 - 54:35] -// CHECK: 54:31: MemberRefExpr=Data:43:15 Extent=[54:24 - 54:35] +// CHECK: 54:31: UnexposedExpr=Data:43:15 Extent=[54:24 - 54:35] +// CHECK: 54:31: MemberRefExpr=Data:43:15 SingleRefName=[54:31 - 54:35] RefName=[54:31 - 54:35] Extent=[54:24 - 54:35] // CHECK: 54:24: DeclRefExpr=Prefix:52:29 Extent=[54:24 - 54:30] -// CHECK: 54:44: MemberRefExpr=Length:44:10 Extent=[54:37 - 54:50] +// CHECK: 54:44: MemberRefExpr=Length:44:10 SingleRefName=[54:44 - 54:50] RefName=[54:44 - 54:50] Extent=[54:37 - 54:50] // CHECK: 54:37: DeclRefExpr=Prefix:52:29 Extent=[54:37 - 54:43] -// CHECK: 54:55: UnexposedExpr= Extent=[54:55 - 54:56] +// CHECK: 54:55: IntegerLiteral= Extent=[54:55 - 54:56] // CHECK: 56:8: CXXMethod=endswith:56:8 (Definition) Extent=[56:3 - 59:4] // CHECK: 56:27: ParmDecl=Suffix:56:27 (Definition) Extent=[56:17 - 56:33] // CHECK: 56:17: TypeRef=class llvm::StringRef:38:7 Extent=[56:17 - 56:26] -// CHECK: 56:41: UnexposedStmt= Extent=[56:41 - 59:4] -// CHECK: 57:5: UnexposedStmt= Extent=[57:5 - 58:69] -// CHECK: 57:12: UnexposedExpr= Extent=[57:12 - 58:69] -// CHECK: 57:12: UnexposedExpr= Extent=[57:12 - 57:35] +// CHECK: 56:41: CompoundStmt= Extent=[56:41 - 59:4] +// CHECK: 57:5: ReturnStmt= Extent=[57:5 - 58:69] +// CHECK: 57:12: BinaryOperator= Extent=[57:12 - 58:69] +// CHECK: 57:12: BinaryOperator= Extent=[57:12 - 57:35] // CHECK: 57:12: UnexposedExpr=Length:44:10 Extent=[57:12 - 57:18] // CHECK: 57:12: MemberRefExpr=Length:44:10 Extent=[57:12 - 57:18] -// CHECK: 57:29: MemberRefExpr=Length:44:10 Extent=[57:22 - 57:35] +// CHECK: 57:29: MemberRefExpr=Length:44:10 SingleRefName=[57:29 - 57:35] RefName=[57:29 - 57:35] Extent=[57:22 - 57:35] // CHECK: 57:22: DeclRefExpr=Suffix:56:27 Extent=[57:22 - 57:28] -// CHECK: 58:7: UnexposedExpr= Extent=[58:7 - 58:69] +// CHECK: 58:7: BinaryOperator= Extent=[58:7 - 58:69] // CHECK: 58:7: CallExpr=memcmp:7:7 Extent=[58:7 - 58:64] // CHECK: 58:7: UnexposedExpr=memcmp:7:7 Extent=[58:7 - 58:13] // CHECK: 58:7: DeclRefExpr=memcmp:7:7 Extent=[58:7 - 58:13] // CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:35] -// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:35] +// CHECK: 58:14: BinaryOperator= Extent=[58:14 - 58:35] // CHECK: 58:14: CallExpr=end:50:12 Extent=[58:14 - 58:19] // CHECK: 58:14: MemberRefExpr=end:50:12 Extent=[58:14 - 58:17] -// CHECK: 58:29: MemberRefExpr=Length:44:10 Extent=[58:22 - 58:35] +// CHECK: 58:29: MemberRefExpr=Length:44:10 SingleRefName=[58:29 - 58:35] RefName=[58:29 - 58:35] Extent=[58:22 - 58:35] // CHECK: 58:22: DeclRefExpr=Suffix:56:27 Extent=[58:22 - 58:28] -// CHECK: 58:37: UnexposedExpr=Data:43:15 Extent=[58:37 - 58:48] -// CHECK: 58:44: MemberRefExpr=Data:43:15 Extent=[58:37 - 58:48] +// CHECK: 58:44: UnexposedExpr=Data:43:15 Extent=[58:37 - 58:48] +// CHECK: 58:44: MemberRefExpr=Data:43:15 SingleRefName=[58:44 - 58:48] RefName=[58:44 - 58:48] Extent=[58:37 - 58:48] // CHECK: 58:37: DeclRefExpr=Suffix:56:27 Extent=[58:37 - 58:43] -// CHECK: 58:57: MemberRefExpr=Length:44:10 Extent=[58:50 - 58:63] +// CHECK: 58:57: MemberRefExpr=Length:44:10 SingleRefName=[58:57 - 58:63] RefName=[58:57 - 58:63] Extent=[58:50 - 58:63] // CHECK: 58:50: DeclRefExpr=Suffix:56:27 Extent=[58:50 - 58:56] -// CHECK: 58:68: UnexposedExpr= Extent=[58:68 - 58:69] +// CHECK: 58:68: IntegerLiteral= Extent=[58:68 - 58:69] // CHECK: 60:13: CXXMethod=substr:60:13 (Definition) Extent=[60:3 - 62:4] // CHECK: 60:3: TypeRef=class llvm::StringRef:38:7 Extent=[60:3 - 60:12] // CHECK: 60:27: ParmDecl=Start:60:27 (Definition) Extent=[60:20 - 60:32] @@ -1747,13 +1747,13 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 60:41: ParmDecl=N:60:41 (Definition) Extent=[60:34 - 60:49] // CHECK: 60:34: TypeRef=size_t:2:25 Extent=[60:34 - 60:40] // CHECK: 60:45: DeclRefExpr=npos:41:23 Extent=[60:45 - 60:49] -// CHECK: 60:57: UnexposedStmt= Extent=[60:57 - 62:4] -// CHECK: 61:5: UnexposedStmt= Extent=[61:5 - 61:59] +// CHECK: 60:57: CompoundStmt= Extent=[60:57 - 62:4] +// CHECK: 61:5: ReturnStmt= Extent=[61:5 - 61:59] // CHECK: 61:12: CallExpr= Extent=[61:12 - 61:59] // CHECK: 61:12: UnexposedExpr=StringRef:49:3 Extent=[61:12 - 61:59] // CHECK: 61:12: CallExpr=StringRef:49:3 Extent=[61:12 - 61:59] // CHECK: 61:12: TypeRef=class llvm::StringRef:38:7 Extent=[61:12 - 61:21] -// CHECK: 61:22: UnexposedExpr= Extent=[61:22 - 61:34] +// CHECK: 61:22: BinaryOperator= Extent=[61:22 - 61:34] // CHECK: 61:22: UnexposedExpr=Data:43:15 Extent=[61:22 - 61:26] // CHECK: 61:22: MemberRefExpr=Data:43:15 Extent=[61:22 - 61:26] // CHECK: 61:29: DeclRefExpr=Start:60:27 Extent=[61:29 - 61:34] @@ -1761,68 +1761,68 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 61:36: UnexposedExpr=min:45:17 Extent=[61:36 - 61:39] // CHECK: 61:36: DeclRefExpr=min:45:17 Extent=[61:36 - 61:39] // CHECK: 61:40: DeclRefExpr=N:60:41 Extent=[61:40 - 61:41] -// CHECK: 61:43: UnexposedExpr= Extent=[61:43 - 61:57] +// CHECK: 61:43: BinaryOperator= Extent=[61:43 - 61:57] // CHECK: 61:43: UnexposedExpr=Length:44:10 Extent=[61:43 - 61:49] // CHECK: 61:43: MemberRefExpr=Length:44:10 Extent=[61:43 - 61:49] // CHECK: 61:52: DeclRefExpr=Start:60:27 Extent=[61:52 - 61:57] // CHECK: 65:11: Namespace=clang:65:11 (Definition) Extent=[65:1 - 81:2] // CHECK: 66:7: ClassDecl=IdentifierInfo:66:7 (Definition) Extent=[66:1 - 80:2] -// CHECK: 67:1: UnexposedDecl=:67:1 (Definition) Extent=[67:1 - 67:8] +// CHECK: 67:1: CXXAccessSpecifier=:67:1 (Definition) Extent=[67:1 - 67:8] // CHECK: 67:8: CXXConstructor=IdentifierInfo:67:8 Extent=[67:8 - 67:24] // CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) Extent=[68:3 - 71:4] -// CHECK: 68:36: UnexposedStmt= Extent=[68:36 - 71:4] -// CHECK: 69:5: UnexposedStmt= Extent=[69:5 - 69:65] +// CHECK: 68:36: CompoundStmt= Extent=[68:36 - 71:4] +// CHECK: 69:5: DeclStmt= Extent=[69:5 - 69:65] // CHECK: 69:54: TypedefDecl=actualtype:69:54 (Definition) Extent=[69:5 - 69:64] // CHECK: 69:18: TemplateRef=pair:4:44 Extent=[69:18 - 69:22] // CHECK: 69:25: TypeRef=class clang::IdentifierInfo:66:7 Extent=[69:25 - 69:39] -// CHECK: 70:5: UnexposedStmt= Extent=[70:5 - 70:47] -// CHECK: 70:41: MemberRefExpr=second:4:55 Extent=[70:12 - 70:47] -// CHECK: 70:12: UnexposedExpr= Extent=[70:12 - 70:39] -// CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:38] +// CHECK: 70:5: ReturnStmt= Extent=[70:5 - 70:47] +// CHECK: 70:41: MemberRefExpr=second:4:55 SingleRefName=[70:41 - 70:47] RefName=[70:41 - 70:47] Extent=[70:12 - 70:47] +// CHECK: 70:12: ParenExpr= Extent=[70:12 - 70:39] +// CHECK: 70:13: CStyleCastExpr= Extent=[70:13 - 70:38] // CHECK: 70:20: TypeRef=actualtype:69:54 Extent=[70:20 - 70:30] -// CHECK: 70:34: UnexposedExpr= Extent=[70:34 - 70:38] +// CHECK: 70:34: CXXThisExpr= Extent=[70:34 - 70:38] // CHECK: 72:12: CXXMethod=getLength:72:12 (Definition) Extent=[72:3 - 76:4] -// CHECK: 72:30: UnexposedStmt= Extent=[72:30 - 76:4] -// CHECK: 73:5: UnexposedStmt= Extent=[73:5 - 73:65] +// CHECK: 72:30: CompoundStmt= Extent=[72:30 - 76:4] +// CHECK: 73:5: DeclStmt= Extent=[73:5 - 73:65] // CHECK: 73:54: TypedefDecl=actualtype:73:54 (Definition) Extent=[73:5 - 73:64] // CHECK: 73:18: TemplateRef=pair:4:44 Extent=[73:18 - 73:22] // CHECK: 73:25: TypeRef=class clang::IdentifierInfo:66:7 Extent=[73:25 - 73:39] -// CHECK: 74:5: UnexposedStmt= Extent=[74:5 - 74:61] +// CHECK: 74:5: DeclStmt= Extent=[74:5 - 74:61] // CHECK: 74:17: VarDecl=p:74:17 (Definition) Extent=[74:5 - 74:60] -// CHECK: 74:21: UnexposedExpr= Extent=[74:21 - 74:60] -// CHECK: 74:21: UnexposedExpr=second:4:55 Extent=[74:21 - 74:56] -// CHECK: 74:50: MemberRefExpr=second:4:55 Extent=[74:21 - 74:56] -// CHECK: 74:21: UnexposedExpr= Extent=[74:21 - 74:48] -// CHECK: 74:22: UnexposedExpr= Extent=[74:22 - 74:47] +// CHECK: 74:21: BinaryOperator= Extent=[74:21 - 74:60] +// CHECK: 74:50: UnexposedExpr=second:4:55 Extent=[74:21 - 74:56] +// CHECK: 74:50: MemberRefExpr=second:4:55 SingleRefName=[74:50 - 74:56] RefName=[74:50 - 74:56] Extent=[74:21 - 74:56] +// CHECK: 74:21: ParenExpr= Extent=[74:21 - 74:48] +// CHECK: 74:22: CStyleCastExpr= Extent=[74:22 - 74:47] // CHECK: 74:29: TypeRef=actualtype:73:54 Extent=[74:29 - 74:39] -// CHECK: 74:43: UnexposedExpr= Extent=[74:43 - 74:47] -// CHECK: 74:59: UnexposedExpr= Extent=[74:59 - 74:60] -// CHECK: 75:5: UnexposedStmt= Extent=[75:5 - 75:62] -// CHECK: 75:12: UnexposedExpr= Extent=[75:12 - 75:62] -// CHECK: 75:12: UnexposedExpr= Extent=[75:12 - 75:58] -// CHECK: 75:13: UnexposedExpr= Extent=[75:13 - 75:57] -// CHECK: 75:13: UnexposedExpr= Extent=[75:13 - 75:30] -// CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:29] -// CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29] +// CHECK: 74:43: CXXThisExpr= Extent=[74:43 - 74:47] +// CHECK: 74:59: IntegerLiteral= Extent=[74:59 - 74:60] +// CHECK: 75:5: ReturnStmt= Extent=[75:5 - 75:62] +// CHECK: 75:12: BinaryOperator= Extent=[75:12 - 75:62] +// CHECK: 75:12: ParenExpr= Extent=[75:12 - 75:58] +// CHECK: 75:13: BinaryOperator= Extent=[75:13 - 75:57] +// CHECK: 75:13: ParenExpr= Extent=[75:13 - 75:30] +// CHECK: 75:14: CStyleCastExpr= Extent=[75:14 - 75:29] // CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29] // CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29] +// CHECK: 75:25: ArraySubscriptExpr= Extent=[75:25 - 75:29] // CHECK: 75:25: DeclRefExpr=p:74:17 Extent=[75:25 - 75:26] -// CHECK: 75:27: UnexposedExpr= Extent=[75:27 - 75:28] -// CHECK: 75:33: UnexposedExpr= Extent=[75:33 - 75:57] -// CHECK: 75:34: UnexposedExpr= Extent=[75:34 - 75:56] -// CHECK: 75:34: UnexposedExpr= Extent=[75:34 - 75:51] -// CHECK: 75:35: UnexposedExpr= Extent=[75:35 - 75:50] -// CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50] +// CHECK: 75:27: IntegerLiteral= Extent=[75:27 - 75:28] +// CHECK: 75:33: ParenExpr= Extent=[75:33 - 75:57] +// CHECK: 75:34: BinaryOperator= Extent=[75:34 - 75:56] +// CHECK: 75:34: ParenExpr= Extent=[75:34 - 75:51] +// CHECK: 75:35: CStyleCastExpr= Extent=[75:35 - 75:50] // CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50] // CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50] +// CHECK: 75:46: ArraySubscriptExpr= Extent=[75:46 - 75:50] // CHECK: 75:46: DeclRefExpr=p:74:17 Extent=[75:46 - 75:47] -// CHECK: 75:48: UnexposedExpr= Extent=[75:48 - 75:49] -// CHECK: 75:55: UnexposedExpr= Extent=[75:55 - 75:56] -// CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62] +// CHECK: 75:48: IntegerLiteral= Extent=[75:48 - 75:49] +// CHECK: 75:55: IntegerLiteral= Extent=[75:55 - 75:56] // CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62] +// CHECK: 75:61: IntegerLiteral= Extent=[75:61 - 75:62] // CHECK: 77:19: CXXMethod=getName:77:19 (Definition) Extent=[77:3 - 79:4] -// CHECK: 77:35: UnexposedStmt= Extent=[77:35 - 79:4] -// CHECK: 78:5: UnexposedStmt= Extent=[78:5 - 78:56] +// CHECK: 77:35: CompoundStmt= Extent=[77:35 - 79:4] +// CHECK: 78:5: ReturnStmt= Extent=[78:5 - 78:56] // CHECK: 78:12: CallExpr= Extent=[78:12 - 78:56] // CHECK: 78:12: UnexposedExpr=StringRef:49:3 Extent=[78:12 - 78:56] // CHECK: 78:12: CallExpr=StringRef:49:3 Extent=[78:12 - 78:56] @@ -1838,7 +1838,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 84:13: FieldDecl=Str:84:13 (Definition) Extent=[84:3 - 84:16] // CHECK: 84:3: TypeRef=class llvm::StringRef:38:7 Extent=[84:3 - 84:12] // CHECK: 85:12: FieldDecl=Result:85:12 (Definition) Extent=[85:3 - 85:18] -// CHECK: 86:1: UnexposedDecl=:86:1 (Definition) Extent=[86:1 - 86:8] +// CHECK: 86:1: CXXAccessSpecifier=:86:1 (Definition) Extent=[86:1 - 86:8] // CHECK: 87:12: CXXConstructor=StringSwitch<T, R>:87:12 (Definition) Extent=[87:3 - 87:64] // CHECK: 87:35: ParmDecl=Str:87:35 (Definition) Extent=[87:25 - 87:38] // CHECK: 87:25: TypeRef=class llvm::StringRef:38:7 Extent=[87:25 - 87:34] @@ -1847,21 +1847,21 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 87:46: DeclRefExpr=Str:87:35 Extent=[87:46 - 87:49] // CHECK: 87:52: MemberRef=Result:85:12 Extent=[87:52 - 87:58] // CHECK: 87:58: UnexposedExpr= Extent=[87:58 - 87:61] -// CHECK: 87:59: UnexposedExpr= Extent=[87:59 - 87:60] -// CHECK: 87:62: UnexposedStmt= Extent=[87:62 - 87:64] +// CHECK: 87:59: IntegerLiteral= Extent=[87:59 - 87:60] +// CHECK: 87:62: CompoundStmt= Extent=[87:62 - 87:64] // CHECK: 88:42: FunctionTemplate=Case:88:42 (Definition) Extent=[88:3 - 91:4] // CHECK: 88:23: NonTypeTemplateParameter=N:88:23 (Definition) Extent=[88:14 - 88:24] // CHECK: 88:60: ParmDecl=S:88:60 (Definition) Extent=[88:47 - 88:65] // CHECK: 88:63: DeclRefExpr=N:88:23 Extent=[88:63 - 88:64] // CHECK: 89:57: ParmDecl=Value:89:57 (Definition) Extent=[89:47 - 89:62] -// CHECK: 89:64: UnexposedStmt= Extent=[89:64 - 91:4] -// CHECK: 90:5: UnexposedStmt= Extent=[90:5 - 90:17] -// CHECK: 90:12: UnexposedExpr= Extent=[90:12 - 90:17] -// CHECK: 90:13: UnexposedExpr= Extent=[90:13 - 90:17] +// CHECK: 89:64: CompoundStmt= Extent=[89:64 - 91:4] +// CHECK: 90:5: ReturnStmt= Extent=[90:5 - 90:17] +// CHECK: 90:12: UnaryOperator= Extent=[90:12 - 90:17] +// CHECK: 90:13: CXXThisExpr= Extent=[90:13 - 90:17] // CHECK: 92:5: CXXMethod=Default:92:5 (Definition) Extent=[92:3 - 94:4] // CHECK: 92:23: ParmDecl=Value:92:23 (Definition) Extent=[92:13 - 92:28] -// CHECK: 92:36: UnexposedStmt= Extent=[92:36 - 94:4] -// CHECK: 93:5: UnexposedStmt= Extent=[93:5 - 93:17] +// CHECK: 92:36: CompoundStmt= Extent=[92:36 - 94:4] +// CHECK: 93:5: ReturnStmt= Extent=[93:5 - 93:17] // CHECK: 93:12: DeclRefExpr=Value:92:23 Extent=[93:12 - 93:17] // CHECK: 98:17: UsingDirective=:98:17 Extent=[98:1 - 98:22] // CHECK: 98:17: NamespaceRef=clang:10:17 Extent=[98:17 - 98:22] @@ -1869,18 +1869,18 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 100:21: TypeRef=class clang::AttributeList:12:9 Extent=[100:21 - 100:34] // CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:44 - 100:71] // CHECK: 100:50: TypeRef=class clang::IdentifierInfo:66:7 Extent=[100:50 - 100:64] -// CHECK: 100:73: UnexposedStmt= Extent=[100:73 - 186:2] -// CHECK: 101:3: UnexposedStmt= Extent=[101:3 - 101:46] +// CHECK: 100:73: CompoundStmt= Extent=[100:73 - 186:2] +// CHECK: 101:3: DeclStmt= Extent=[101:3 - 101:46] // CHECK: 101:19: VarDecl=AttrName:101:19 (Definition) Extent=[101:3 - 101:45] // CHECK: 101:30: CallExpr= Extent=[101:30 - 101:45] // CHECK: 101:30: UnexposedExpr=getName:77:19 Extent=[101:30 - 101:45] // CHECK: 101:30: CallExpr=getName:77:19 Extent=[101:30 - 101:45] -// CHECK: 101:36: MemberRefExpr=getName:77:19 Extent=[101:30 - 101:43] +// CHECK: 101:36: MemberRefExpr=getName:77:19 SingleRefName=[101:36 - 101:43] RefName=[101:36 - 101:43] Extent=[101:30 - 101:43] // CHECK: 101:30: DeclRefExpr=Name:100:67 Extent=[101:30 - 101:34] -// CHECK: 102:3: UnexposedStmt= Extent=[102:3 - 103:55] -// CHECK: 102:7: UnexposedExpr= Extent=[102:7 - 102:59] +// CHECK: 102:3: IfStmt= Extent=[102:3 - 103:55] +// CHECK: 102:7: BinaryOperator= Extent=[102:7 - 102:59] // CHECK: 102:7: CallExpr=startswith:52:8 Extent=[102:7 - 102:32] -// CHECK: 102:16: MemberRefExpr=startswith:52:8 Extent=[102:7 - 102:26] +// CHECK: 102:16: MemberRefExpr=startswith:52:8 SingleRefName=[102:16 - 102:26] RefName=[102:16 - 102:26] Extent=[102:7 - 102:26] // CHECK: 102:7: UnexposedExpr=AttrName:101:19 Extent=[102:7 - 102:15] // CHECK: 102:7: DeclRefExpr=AttrName:101:19 Extent=[102:7 - 102:15] // CHECK: 102:27: CallExpr= Extent=[102:27 - 102:31] @@ -1888,9 +1888,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 102:27: UnexposedExpr=StringRef:48:3 Extent=[102:27 - 102:31] // CHECK: 102:27: CallExpr=StringRef:48:3 Extent=[102:27 - 102:31] // CHECK: 102:27: UnexposedExpr= Extent=[102:27 - 102:31] -// CHECK: 102:27: UnexposedExpr= Extent=[102:27 - 102:31] +// CHECK: 102:27: StringLiteral= Extent=[102:27 - 102:31] // CHECK: 102:36: CallExpr=endswith:56:8 Extent=[102:36 - 102:59] -// CHECK: 102:45: MemberRefExpr=endswith:56:8 Extent=[102:36 - 102:53] +// CHECK: 102:45: MemberRefExpr=endswith:56:8 SingleRefName=[102:45 - 102:53] RefName=[102:45 - 102:53] Extent=[102:36 - 102:53] // CHECK: 102:36: UnexposedExpr=AttrName:101:19 Extent=[102:36 - 102:44] // CHECK: 102:36: DeclRefExpr=AttrName:101:19 Extent=[102:36 - 102:44] // CHECK: 102:54: CallExpr= Extent=[102:54 - 102:58] @@ -1898,350 +1898,346 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 102:54: UnexposedExpr=StringRef:48:3 Extent=[102:54 - 102:58] // CHECK: 102:54: CallExpr=StringRef:48:3 Extent=[102:54 - 102:58] // CHECK: 102:54: UnexposedExpr= Extent=[102:54 - 102:58] -// CHECK: 102:54: UnexposedExpr= Extent=[102:54 - 102:58] +// CHECK: 102:54: StringLiteral= Extent=[102:54 - 102:58] // CHECK: 103:5: CallExpr=operator=:38:7 Extent=[103:5 - 103:55] // CHECK: 103:5: DeclRefExpr=AttrName:101:19 Extent=[103:5 - 103:13] // CHECK: 103:14: UnexposedExpr=operator=:38:7 // CHECK: 103:14: DeclRefExpr=operator=:38:7 // CHECK: 103:16: UnexposedExpr=substr:60:13 Extent=[103:16 - 103:55] // CHECK: 103:16: CallExpr=substr:60:13 Extent=[103:16 - 103:55] -// CHECK: 103:25: MemberRefExpr=substr:60:13 Extent=[103:16 - 103:31] +// CHECK: 103:25: MemberRefExpr=substr:60:13 SingleRefName=[103:25 - 103:31] RefName=[103:25 - 103:31] Extent=[103:16 - 103:31] // CHECK: 103:16: UnexposedExpr=AttrName:101:19 Extent=[103:16 - 103:24] // CHECK: 103:16: DeclRefExpr=AttrName:101:19 Extent=[103:16 - 103:24] // CHECK: 103:32: UnexposedExpr= Extent=[103:32 - 103:33] -// CHECK: 103:32: UnexposedExpr= Extent=[103:32 - 103:33] -// CHECK: 103:35: UnexposedExpr= Extent=[103:35 - 103:54] +// CHECK: 103:32: IntegerLiteral= Extent=[103:32 - 103:33] +// CHECK: 103:35: BinaryOperator= Extent=[103:35 - 103:54] // CHECK: 103:35: CallExpr=size:51:10 Extent=[103:35 - 103:50] -// CHECK: 103:44: MemberRefExpr=size:51:10 Extent=[103:35 - 103:48] +// CHECK: 103:44: MemberRefExpr=size:51:10 SingleRefName=[103:44 - 103:48] RefName=[103:44 - 103:48] Extent=[103:35 - 103:48] // CHECK: 103:35: UnexposedExpr=AttrName:101:19 Extent=[103:35 - 103:43] // CHECK: 103:35: DeclRefExpr=AttrName:101:19 Extent=[103:35 - 103:43] // CHECK: 103:53: UnexposedExpr= Extent=[103:53 - 103:54] -// CHECK: 103:53: UnexposedExpr= Extent=[103:53 - 103:54] -// CHECK: 105:3: UnexposedStmt= Extent=[105:3 - 185:31] +// CHECK: 103:53: IntegerLiteral= Extent=[103:53 - 103:54] +// CHECK: 105:3: ReturnStmt= Extent=[105:3 - 185:31] // CHECK: 105:10: CallExpr=Default:92:5 Extent=[105:10 - 185:31] -// CHECK: 185:6: MemberRefExpr=Default:92:5 Extent=[105:10 - 185:13] +// CHECK: 185:6: MemberRefExpr=Default:92:5 SingleRefName=[185:6 - 185:13] RefName=[185:6 - 185:13] Extent=[105:10 - 185:13] // CHECK: 105:10: UnexposedExpr=Case:88:42 Extent=[105:10 - 184:33] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 184:33] -// CHECK: 184:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 184:10] +// CHECK: 184:6: MemberRefExpr=Case:88:42 SingleRefName=[184:6 - 184:10] RefName=[184:6 - 184:10] Extent=[105:10 - 184:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 183:37] -// CHECK: 183:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 183:10] +// CHECK: 183:6: MemberRefExpr=Case:88:42 SingleRefName=[183:6 - 183:10] RefName=[183:6 - 183:10] Extent=[105:10 - 183:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 182:37] -// CHECK: 182:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 182:10] +// CHECK: 182:6: MemberRefExpr=Case:88:42 SingleRefName=[182:6 - 182:10] RefName=[182:6 - 182:10] Extent=[105:10 - 182:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 181:35] -// CHECK: 181:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 181:10] +// CHECK: 181:6: MemberRefExpr=Case:88:42 SingleRefName=[181:6 - 181:10] RefName=[181:6 - 181:10] Extent=[105:10 - 181:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 180:31] -// CHECK: 180:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 180:10] +// CHECK: 180:6: MemberRefExpr=Case:88:42 SingleRefName=[180:6 - 180:10] RefName=[180:6 - 180:10] Extent=[105:10 - 180:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 179:31] -// CHECK: 179:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 179:10] +// CHECK: 179:6: MemberRefExpr=Case:88:42 SingleRefName=[179:6 - 179:10] RefName=[179:6 - 179:10] Extent=[105:10 - 179:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 178:35] -// CHECK: 178:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 178:10] +// CHECK: 178:6: MemberRefExpr=Case:88:42 SingleRefName=[178:6 - 178:10] RefName=[178:6 - 178:10] Extent=[105:10 - 178:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 177:63] -// CHECK: 177:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 177:10] +// CHECK: 177:6: MemberRefExpr=Case:88:42 SingleRefName=[177:6 - 177:10] RefName=[177:6 - 177:10] Extent=[105:10 - 177:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 176:45] -// CHECK: 176:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 176:10] +// CHECK: 176:6: MemberRefExpr=Case:88:42 SingleRefName=[176:6 - 176:10] RefName=[176:6 - 176:10] Extent=[105:10 - 176:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 175:51] -// CHECK: 175:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 175:10] +// CHECK: 175:6: MemberRefExpr=Case:88:42 SingleRefName=[175:6 - 175:10] RefName=[175:6 - 175:10] Extent=[105:10 - 175:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 174:49] -// CHECK: 174:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 174:10] +// CHECK: 174:6: MemberRefExpr=Case:88:42 SingleRefName=[174:6 - 174:10] RefName=[174:6 - 174:10] Extent=[105:10 - 174:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 173:49] -// CHECK: 173:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 173:10] +// CHECK: 173:6: MemberRefExpr=Case:88:42 SingleRefName=[173:6 - 173:10] RefName=[173:6 - 173:10] Extent=[105:10 - 173:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 172:53] -// CHECK: 172:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 172:10] +// CHECK: 172:6: MemberRefExpr=Case:88:42 SingleRefName=[172:6 - 172:10] RefName=[172:6 - 172:10] Extent=[105:10 - 172:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 171:57] -// CHECK: 171:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 171:10] +// CHECK: 171:6: MemberRefExpr=Case:88:42 SingleRefName=[171:6 - 171:10] RefName=[171:6 - 171:10] Extent=[105:10 - 171:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 170:65] -// CHECK: 170:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 170:10] +// CHECK: 170:6: MemberRefExpr=Case:88:42 SingleRefName=[170:6 - 170:10] RefName=[170:6 - 170:10] Extent=[105:10 - 170:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 169:57] -// CHECK: 169:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 169:10] +// CHECK: 169:6: MemberRefExpr=Case:88:42 SingleRefName=[169:6 - 169:10] RefName=[169:6 - 169:10] Extent=[105:10 - 169:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 168:65] -// CHECK: 168:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 168:10] +// CHECK: 168:6: MemberRefExpr=Case:88:42 SingleRefName=[168:6 - 168:10] RefName=[168:6 - 168:10] Extent=[105:10 - 168:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 167:55] -// CHECK: 167:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 167:10] +// CHECK: 167:6: MemberRefExpr=Case:88:42 SingleRefName=[167:6 - 167:10] RefName=[167:6 - 167:10] Extent=[105:10 - 167:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 166:55] -// CHECK: 166:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 166:10] +// CHECK: 166:6: MemberRefExpr=Case:88:42 SingleRefName=[166:6 - 166:10] RefName=[166:6 - 166:10] Extent=[105:10 - 166:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 165:53] -// CHECK: 165:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 165:10] +// CHECK: 165:6: MemberRefExpr=Case:88:42 SingleRefName=[165:6 - 165:10] RefName=[165:6 - 165:10] Extent=[105:10 - 165:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 164:53] -// CHECK: 164:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 164:10] +// CHECK: 164:6: MemberRefExpr=Case:88:42 SingleRefName=[164:6 - 164:10] RefName=[164:6 - 164:10] Extent=[105:10 - 164:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 163:49] -// CHECK: 163:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 163:10] +// CHECK: 163:6: MemberRefExpr=Case:88:42 SingleRefName=[163:6 - 163:10] RefName=[163:6 - 163:10] Extent=[105:10 - 163:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 162:47] -// CHECK: 162:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 162:10] +// CHECK: 162:6: MemberRefExpr=Case:88:42 SingleRefName=[162:6 - 162:10] RefName=[162:6 - 162:10] Extent=[105:10 - 162:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 161:45] -// CHECK: 161:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 161:10] +// CHECK: 161:6: MemberRefExpr=Case:88:42 SingleRefName=[161:6 - 161:10] RefName=[161:6 - 161:10] Extent=[105:10 - 161:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 160:45] -// CHECK: 160:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 160:10] +// CHECK: 160:6: MemberRefExpr=Case:88:42 SingleRefName=[160:6 - 160:10] RefName=[160:6 - 160:10] Extent=[105:10 - 160:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 159:45] -// CHECK: 159:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 159:10] +// CHECK: 159:6: MemberRefExpr=Case:88:42 SingleRefName=[159:6 - 159:10] RefName=[159:6 - 159:10] Extent=[105:10 - 159:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 158:45] -// CHECK: 158:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 158:10] +// CHECK: 158:6: MemberRefExpr=Case:88:42 SingleRefName=[158:6 - 158:10] RefName=[158:6 - 158:10] Extent=[105:10 - 158:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 157:43] -// CHECK: 157:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 157:10] +// CHECK: 157:6: MemberRefExpr=Case:88:42 SingleRefName=[157:6 - 157:10] RefName=[157:6 - 157:10] Extent=[105:10 - 157:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 156:41] -// CHECK: 156:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 156:10] +// CHECK: 156:6: MemberRefExpr=Case:88:42 SingleRefName=[156:6 - 156:10] RefName=[156:6 - 156:10] Extent=[105:10 - 156:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 155:41] -// CHECK: 155:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 155:10] +// CHECK: 155:6: MemberRefExpr=Case:88:42 SingleRefName=[155:6 - 155:10] RefName=[155:6 - 155:10] Extent=[105:10 - 155:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 154:41] -// CHECK: 154:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 154:10] +// CHECK: 154:6: MemberRefExpr=Case:88:42 SingleRefName=[154:6 - 154:10] RefName=[154:6 - 154:10] Extent=[105:10 - 154:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 153:37] -// CHECK: 153:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 153:10] +// CHECK: 153:6: MemberRefExpr=Case:88:42 SingleRefName=[153:6 - 153:10] RefName=[153:6 - 153:10] Extent=[105:10 - 153:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 152:41] -// CHECK: 152:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 152:10] +// CHECK: 152:6: MemberRefExpr=Case:88:42 SingleRefName=[152:6 - 152:10] RefName=[152:6 - 152:10] Extent=[105:10 - 152:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 151:39] -// CHECK: 151:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 151:10] +// CHECK: 151:6: MemberRefExpr=Case:88:42 SingleRefName=[151:6 - 151:10] RefName=[151:6 - 151:10] Extent=[105:10 - 151:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 150:39] -// CHECK: 150:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 150:10] +// CHECK: 150:6: MemberRefExpr=Case:88:42 SingleRefName=[150:6 - 150:10] RefName=[150:6 - 150:10] Extent=[105:10 - 150:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 149:39] -// CHECK: 149:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 149:10] +// CHECK: 149:6: MemberRefExpr=Case:88:42 SingleRefName=[149:6 - 149:10] RefName=[149:6 - 149:10] Extent=[105:10 - 149:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 148:39] -// CHECK: 148:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 148:10] +// CHECK: 148:6: MemberRefExpr=Case:88:42 SingleRefName=[148:6 - 148:10] RefName=[148:6 - 148:10] Extent=[105:10 - 148:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 147:39] -// CHECK: 147:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 147:10] +// CHECK: 147:6: MemberRefExpr=Case:88:42 SingleRefName=[147:6 - 147:10] RefName=[147:6 - 147:10] Extent=[105:10 - 147:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 146:39] -// CHECK: 146:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 146:10] +// CHECK: 146:6: MemberRefExpr=Case:88:42 SingleRefName=[146:6 - 146:10] RefName=[146:6 - 146:10] Extent=[105:10 - 146:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 145:41] -// CHECK: 145:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 145:10] +// CHECK: 145:6: MemberRefExpr=Case:88:42 SingleRefName=[145:6 - 145:10] RefName=[145:6 - 145:10] Extent=[105:10 - 145:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 144:37] -// CHECK: 144:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 144:10] +// CHECK: 144:6: MemberRefExpr=Case:88:42 SingleRefName=[144:6 - 144:10] RefName=[144:6 - 144:10] Extent=[105:10 - 144:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 143:37] -// CHECK: 143:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 143:10] +// CHECK: 143:6: MemberRefExpr=Case:88:42 SingleRefName=[143:6 - 143:10] RefName=[143:6 - 143:10] Extent=[105:10 - 143:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 142:35] -// CHECK: 142:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 142:10] +// CHECK: 142:6: MemberRefExpr=Case:88:42 SingleRefName=[142:6 - 142:10] RefName=[142:6 - 142:10] Extent=[105:10 - 142:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 141:35] -// CHECK: 141:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 141:10] +// CHECK: 141:6: MemberRefExpr=Case:88:42 SingleRefName=[141:6 - 141:10] RefName=[141:6 - 141:10] Extent=[105:10 - 141:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 140:35] -// CHECK: 140:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 140:10] +// CHECK: 140:6: MemberRefExpr=Case:88:42 SingleRefName=[140:6 - 140:10] RefName=[140:6 - 140:10] Extent=[105:10 - 140:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 139:35] -// CHECK: 139:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 139:10] +// CHECK: 139:6: MemberRefExpr=Case:88:42 SingleRefName=[139:6 - 139:10] RefName=[139:6 - 139:10] Extent=[105:10 - 139:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 138:35] -// CHECK: 138:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 138:10] +// CHECK: 138:6: MemberRefExpr=Case:88:42 SingleRefName=[138:6 - 138:10] RefName=[138:6 - 138:10] Extent=[105:10 - 138:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 137:55] -// CHECK: 137:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 137:10] +// CHECK: 137:6: MemberRefExpr=Case:88:42 SingleRefName=[137:6 - 137:10] RefName=[137:6 - 137:10] Extent=[105:10 - 137:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 136:35] -// CHECK: 136:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 136:10] +// CHECK: 136:6: MemberRefExpr=Case:88:42 SingleRefName=[136:6 - 136:10] RefName=[136:6 - 136:10] Extent=[105:10 - 136:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 135:35] -// CHECK: 135:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 135:10] +// CHECK: 135:6: MemberRefExpr=Case:88:42 SingleRefName=[135:6 - 135:10] RefName=[135:6 - 135:10] Extent=[105:10 - 135:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 134:35] -// CHECK: 134:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 134:10] +// CHECK: 134:6: MemberRefExpr=Case:88:42 SingleRefName=[134:6 - 134:10] RefName=[134:6 - 134:10] Extent=[105:10 - 134:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 133:35] -// CHECK: 133:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 133:10] +// CHECK: 133:6: MemberRefExpr=Case:88:42 SingleRefName=[133:6 - 133:10] RefName=[133:6 - 133:10] Extent=[105:10 - 133:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 132:33] -// CHECK: 132:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 132:10] +// CHECK: 132:6: MemberRefExpr=Case:88:42 SingleRefName=[132:6 - 132:10] RefName=[132:6 - 132:10] Extent=[105:10 - 132:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 131:33] -// CHECK: 131:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 131:10] +// CHECK: 131:6: MemberRefExpr=Case:88:42 SingleRefName=[131:6 - 131:10] RefName=[131:6 - 131:10] Extent=[105:10 - 131:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 130:33] -// CHECK: 130:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 130:10] +// CHECK: 130:6: MemberRefExpr=Case:88:42 SingleRefName=[130:6 - 130:10] RefName=[130:6 - 130:10] Extent=[105:10 - 130:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 129:33] -// CHECK: 129:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 129:10] +// CHECK: 129:6: MemberRefExpr=Case:88:42 SingleRefName=[129:6 - 129:10] RefName=[129:6 - 129:10] Extent=[105:10 - 129:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 128:33] -// CHECK: 128:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 128:10] +// CHECK: 128:6: MemberRefExpr=Case:88:42 SingleRefName=[128:6 - 128:10] RefName=[128:6 - 128:10] Extent=[105:10 - 128:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 127:33] -// CHECK: 127:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 127:10] +// CHECK: 127:6: MemberRefExpr=Case:88:42 SingleRefName=[127:6 - 127:10] RefName=[127:6 - 127:10] Extent=[105:10 - 127:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 126:33] -// CHECK: 126:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 126:10] +// CHECK: 126:6: MemberRefExpr=Case:88:42 SingleRefName=[126:6 - 126:10] RefName=[126:6 - 126:10] Extent=[105:10 - 126:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 125:29] -// CHECK: 125:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 125:10] +// CHECK: 125:6: MemberRefExpr=Case:88:42 SingleRefName=[125:6 - 125:10] RefName=[125:6 - 125:10] Extent=[105:10 - 125:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 124:33] -// CHECK: 124:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 124:10] +// CHECK: 124:6: MemberRefExpr=Case:88:42 SingleRefName=[124:6 - 124:10] RefName=[124:6 - 124:10] Extent=[105:10 - 124:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 123:33] -// CHECK: 123:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 123:10] +// CHECK: 123:6: MemberRefExpr=Case:88:42 SingleRefName=[123:6 - 123:10] RefName=[123:6 - 123:10] Extent=[105:10 - 123:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 122:31] -// CHECK: 122:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 122:10] +// CHECK: 122:6: MemberRefExpr=Case:88:42 SingleRefName=[122:6 - 122:10] RefName=[122:6 - 122:10] Extent=[105:10 - 122:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 121:31] -// CHECK: 121:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 121:10] +// CHECK: 121:6: MemberRefExpr=Case:88:42 SingleRefName=[121:6 - 121:10] RefName=[121:6 - 121:10] Extent=[105:10 - 121:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 120:31] -// CHECK: 120:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 120:10] +// CHECK: 120:6: MemberRefExpr=Case:88:42 SingleRefName=[120:6 - 120:10] RefName=[120:6 - 120:10] Extent=[105:10 - 120:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 119:31] -// CHECK: 119:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 119:10] +// CHECK: 119:6: MemberRefExpr=Case:88:42 SingleRefName=[119:6 - 119:10] RefName=[119:6 - 119:10] Extent=[105:10 - 119:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 118:31] -// CHECK: 118:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 118:10] +// CHECK: 118:6: MemberRefExpr=Case:88:42 SingleRefName=[118:6 - 118:10] RefName=[118:6 - 118:10] Extent=[105:10 - 118:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 117:31] -// CHECK: 117:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 117:10] +// CHECK: 117:6: MemberRefExpr=Case:88:42 SingleRefName=[117:6 - 117:10] RefName=[117:6 - 117:10] Extent=[105:10 - 117:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 116:31] -// CHECK: 116:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 116:10] +// CHECK: 116:6: MemberRefExpr=Case:88:42 SingleRefName=[116:6 - 116:10] RefName=[116:6 - 116:10] Extent=[105:10 - 116:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 115:29] -// CHECK: 115:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 115:10] +// CHECK: 115:6: MemberRefExpr=Case:88:42 SingleRefName=[115:6 - 115:10] RefName=[115:6 - 115:10] Extent=[105:10 - 115:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 114:29] -// CHECK: 114:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 114:10] +// CHECK: 114:6: MemberRefExpr=Case:88:42 SingleRefName=[114:6 - 114:10] RefName=[114:6 - 114:10] Extent=[105:10 - 114:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 113:29] -// CHECK: 113:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 113:10] +// CHECK: 113:6: MemberRefExpr=Case:88:42 SingleRefName=[113:6 - 113:10] RefName=[113:6 - 113:10] Extent=[105:10 - 113:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 112:31] -// CHECK: 112:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 112:10] +// CHECK: 112:6: MemberRefExpr=Case:88:42 SingleRefName=[112:6 - 112:10] RefName=[112:6 - 112:10] Extent=[105:10 - 112:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 111:29] -// CHECK: 111:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 111:10] +// CHECK: 111:6: MemberRefExpr=Case:88:42 SingleRefName=[111:6 - 111:10] RefName=[111:6 - 111:10] Extent=[105:10 - 111:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 110:27] -// CHECK: 110:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 110:10] +// CHECK: 110:6: MemberRefExpr=Case:88:42 SingleRefName=[110:6 - 110:10] RefName=[110:6 - 110:10] Extent=[105:10 - 110:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 109:27] -// CHECK: 109:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 109:10] +// CHECK: 109:6: MemberRefExpr=Case:88:42 SingleRefName=[109:6 - 109:10] RefName=[109:6 - 109:10] Extent=[105:10 - 109:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 108:27] -// CHECK: 108:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 108:10] +// CHECK: 108:6: MemberRefExpr=Case:88:42 SingleRefName=[108:6 - 108:10] RefName=[108:6 - 108:10] Extent=[105:10 - 108:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 107:33] -// CHECK: 107:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 107:10] +// CHECK: 107:6: MemberRefExpr=Case:88:42 SingleRefName=[107:6 - 107:10] RefName=[107:6 - 107:10] Extent=[105:10 - 107:10] // CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 106:27] -// CHECK: 106:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 106:10] -// CHECK: 105:10: UnexposedExpr=StringSwitch:87:12 Extent=[105:10 - 105:63] +// CHECK: 106:6: MemberRefExpr=Case:88:42 SingleRefName=[106:6 - 106:10] RefName=[106:6 - 106:10] Extent=[105:10 - 106:10] +// CHECK: 105:10: CXXFunctionalCastExpr= Extent=[105:10 - 105:63] // CHECK: 105:16: TemplateRef=StringSwitch:83:47 Extent=[105:16 - 105:28] // CHECK: 105:10: CallExpr=StringSwitch:87:12 Extent=[105:10 - 105:62] // CHECK: 105:54: CallExpr=StringRef:38:7 Extent=[105:54 - 105:62] // CHECK: 105:54: UnexposedExpr=AttrName:101:19 Extent=[105:54 - 105:62] // CHECK: 105:54: DeclRefExpr=AttrName:101:19 Extent=[105:54 - 105:62] -// CHECK: 106:11: UnexposedExpr= Extent=[106:11 - 106:17] +// CHECK: 106:11: StringLiteral= Extent=[106:11 - 106:17] // CHECK: 106:19: DeclRefExpr=AT_weak:29:45 Extent=[106:19 - 106:26] -// CHECK: 107:11: UnexposedExpr= Extent=[107:11 - 107:20] +// CHECK: 107:11: StringLiteral= Extent=[107:11 - 107:20] // CHECK: 107:22: DeclRefExpr=AT_weakref:29:54 Extent=[107:22 - 107:32] -// CHECK: 108:11: UnexposedExpr= Extent=[108:11 - 108:17] +// CHECK: 108:11: StringLiteral= Extent=[108:11 - 108:17] // CHECK: 108:19: DeclRefExpr=AT_pure:26:49 Extent=[108:19 - 108:26] -// CHECK: 109:11: UnexposedExpr= Extent=[109:11 - 109:17] +// CHECK: 109:11: StringLiteral= Extent=[109:11 - 109:17] // CHECK: 109:19: DeclRefExpr=AT_mode:20:44 Extent=[109:19 - 109:26] -// CHECK: 110:11: UnexposedExpr= Extent=[110:11 - 110:17] +// CHECK: 110:11: StringLiteral= Extent=[110:11 - 110:17] // CHECK: 110:19: DeclRefExpr=AT_used:28:34 Extent=[110:19 - 110:26] -// CHECK: 111:11: UnexposedExpr= Extent=[111:11 - 111:18] +// CHECK: 111:11: StringLiteral= Extent=[111:11 - 111:18] // CHECK: 111:20: DeclRefExpr=AT_alias:15:25 Extent=[111:20 - 111:28] -// CHECK: 112:11: UnexposedExpr= Extent=[112:11 - 112:18] +// CHECK: 112:11: StringLiteral= Extent=[112:11 - 112:18] // CHECK: 112:20: DeclRefExpr=AT_aligned:15:35 Extent=[112:20 - 112:30] -// CHECK: 113:11: UnexposedExpr= Extent=[113:11 - 113:18] +// CHECK: 113:11: StringLiteral= Extent=[113:11 - 113:18] // CHECK: 113:20: DeclRefExpr=AT_final:19:40 Extent=[113:20 - 113:28] -// CHECK: 114:11: UnexposedExpr= Extent=[114:11 - 114:18] +// CHECK: 114:11: StringLiteral= Extent=[114:11 - 114:18] // CHECK: 114:20: DeclRefExpr=AT_cdecl:17:30 Extent=[114:20 - 114:28] -// CHECK: 115:11: UnexposedExpr= Extent=[115:11 - 115:18] +// CHECK: 115:11: StringLiteral= Extent=[115:11 - 115:18] // CHECK: 115:20: DeclRefExpr=AT_const:17:52 Extent=[115:20 - 115:28] -// CHECK: 116:11: UnexposedExpr= Extent=[116:11 - 116:20] +// CHECK: 116:11: StringLiteral= Extent=[116:11 - 116:20] // CHECK: 116:22: DeclRefExpr=AT_const:17:52 Extent=[116:22 - 116:30] -// CHECK: 117:11: UnexposedExpr= Extent=[117:11 - 117:19] +// CHECK: 117:11: StringLiteral= Extent=[117:11 - 117:19] // CHECK: 117:21: DeclRefExpr=AT_blocks:16:57 Extent=[117:21 - 117:30] -// CHECK: 118:11: UnexposedExpr= Extent=[118:11 - 118:19] +// CHECK: 118:11: StringLiteral= Extent=[118:11 - 118:19] // CHECK: 118:21: DeclRefExpr=AT_format:19:50 Extent=[118:21 - 118:30] -// CHECK: 119:11: UnexposedExpr= Extent=[119:11 - 119:19] +// CHECK: 119:11: StringLiteral= Extent=[119:11 - 119:19] // CHECK: 119:21: DeclRefExpr=AT_hiding:20:22 Extent=[119:21 - 119:30] -// CHECK: 120:11: UnexposedExpr= Extent=[120:11 - 120:19] +// CHECK: 120:11: StringLiteral= Extent=[120:11 - 120:19] // CHECK: 120:21: DeclRefExpr=AT_malloc:20:33 Extent=[120:21 - 120:30] -// CHECK: 121:11: UnexposedExpr= Extent=[121:11 - 121:19] +// CHECK: 121:11: StringLiteral= Extent=[121:11 - 121:19] // CHECK: 121:21: DeclRefExpr=AT_packed:26:27 Extent=[121:21 - 121:30] -// CHECK: 122:11: UnexposedExpr= Extent=[122:11 - 122:19] +// CHECK: 122:11: StringLiteral= Extent=[122:11 - 122:19] // CHECK: 122:21: DeclRefExpr=AT_unused:28:23 Extent=[122:21 - 122:30] -// CHECK: 123:11: UnexposedExpr= Extent=[123:11 - 123:20] +// CHECK: 123:11: StringLiteral= Extent=[123:11 - 123:20] // CHECK: 123:22: DeclRefExpr=AT_aligned:15:35 Extent=[123:22 - 123:32] -// CHECK: 124:11: UnexposedExpr= Extent=[124:11 - 124:20] +// CHECK: 124:11: StringLiteral= Extent=[124:11 - 124:20] // CHECK: 124:22: DeclRefExpr=AT_cleanup:17:40 Extent=[124:22 - 124:32] -// CHECK: 125:11: UnexposedExpr= Extent=[125:11 - 125:18] +// CHECK: 125:11: StringLiteral= Extent=[125:11 - 125:18] // CHECK: 125:20: DeclRefExpr=AT_naked:20:53 Extent=[125:20 - 125:28] -// CHECK: 126:11: UnexposedExpr= Extent=[126:11 - 126:20] +// CHECK: 126:11: StringLiteral= Extent=[126:11 - 126:20] // CHECK: 126:22: DeclRefExpr=AT_nodebug:20:63 Extent=[126:22 - 126:32] -// CHECK: 127:11: UnexposedExpr= Extent=[127:11 - 127:20] +// CHECK: 127:11: StringLiteral= Extent=[127:11 - 127:20] // CHECK: 127:22: DeclRefExpr=AT_nonnull:21:47 Extent=[127:22 - 127:32] -// CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:20] +// CHECK: 128:11: StringLiteral= Extent=[128:11 - 128:20] // CHECK: 128:22: DeclRefExpr=AT_nothrow:22:7 Extent=[128:22 - 128:32] -// CHECK: 129:11: UnexposedExpr= Extent=[129:11 - 129:20] +// CHECK: 129:11: StringLiteral= Extent=[129:11 - 129:20] // CHECK: 129:22: DeclRefExpr=AT_objc_gc:24:59 Extent=[129:22 - 129:32] -// CHECK: 130:11: UnexposedExpr= Extent=[130:11 - 130:20] +// CHECK: 130:11: StringLiteral= Extent=[130:11 - 130:20] // CHECK: 130:22: DeclRefExpr=AT_regparm:26:58 Extent=[130:22 - 130:32] -// CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:20] +// CHECK: 131:11: StringLiteral= Extent=[131:11 - 131:20] // CHECK: 131:22: DeclRefExpr=AT_section:27:7 Extent=[131:22 - 131:32] -// CHECK: 132:11: UnexposedExpr= Extent=[132:11 - 132:20] +// CHECK: 132:11: StringLiteral= Extent=[132:11 - 132:20] // CHECK: 132:22: DeclRefExpr=AT_stdcall:27:32 Extent=[132:22 - 132:32] -// CHECK: 133:11: UnexposedExpr= Extent=[133:11 - 133:21] +// CHECK: 133:11: StringLiteral= Extent=[133:11 - 133:21] // CHECK: 133:23: DeclRefExpr=AT_annotate:16:29 Extent=[133:23 - 133:34] -// CHECK: 134:11: UnexposedExpr= Extent=[134:11 - 134:21] +// CHECK: 134:11: StringLiteral= Extent=[134:11 - 134:21] // CHECK: 134:23: DeclRefExpr=AT_fastcall:19:27 Extent=[134:23 - 134:34] -// CHECK: 135:11: UnexposedExpr= Extent=[135:11 - 135:21] +// CHECK: 135:11: StringLiteral= Extent=[135:11 - 135:21] // CHECK: 135:23: DeclRefExpr=AT_IBAction:14:7 Extent=[135:23 - 135:34] -// CHECK: 136:11: UnexposedExpr= Extent=[136:11 - 136:21] +// CHECK: 136:11: StringLiteral= Extent=[136:11 - 136:21] // CHECK: 136:23: DeclRefExpr=AT_IBOutlet:14:20 Extent=[136:23 - 136:34] -// CHECK: 137:11: UnexposedExpr= Extent=[137:11 - 137:31] +// CHECK: 137:11: StringLiteral= Extent=[137:11 - 137:31] // CHECK: 137:33: DeclRefExpr=AT_IBOutletCollection:14:33 Extent=[137:33 - 137:54] -// CHECK: 138:11: UnexposedExpr= Extent=[138:11 - 138:21] +// CHECK: 138:11: StringLiteral= Extent=[138:11 - 138:21] // CHECK: 138:23: DeclRefExpr=AT_noreturn:21:59 Extent=[138:23 - 138:34] -// CHECK: 139:11: UnexposedExpr= Extent=[139:11 - 139:21] +// CHECK: 139:11: StringLiteral= Extent=[139:11 - 139:21] // CHECK: 139:23: DeclRefExpr=AT_noinline:21:7 Extent=[139:23 - 139:34] -// CHECK: 140:11: UnexposedExpr= Extent=[140:11 - 140:21] +// CHECK: 140:11: StringLiteral= Extent=[140:11 - 140:21] // CHECK: 140:23: DeclRefExpr=AT_override:22:51 Extent=[140:23 - 140:34] -// CHECK: 141:11: UnexposedExpr= Extent=[141:11 - 141:21] +// CHECK: 141:11: StringLiteral= Extent=[141:11 - 141:21] // CHECK: 141:23: DeclRefExpr=AT_sentinel:27:19 Extent=[141:23 - 141:34] -// CHECK: 142:11: UnexposedExpr= Extent=[142:11 - 142:21] +// CHECK: 142:11: StringLiteral= Extent=[142:11 - 142:21] // CHECK: 142:23: DeclRefExpr=AT_nsobject:22:19 Extent=[142:23 - 142:34] -// CHECK: 143:11: UnexposedExpr= Extent=[143:11 - 143:22] +// CHECK: 143:11: StringLiteral= Extent=[143:11 - 143:22] // CHECK: 143:24: DeclRefExpr=AT_dllimport:18:51 Extent=[143:24 - 143:36] -// CHECK: 144:11: UnexposedExpr= Extent=[144:11 - 144:22] +// CHECK: 144:11: StringLiteral= Extent=[144:11 - 144:22] // CHECK: 144:24: DeclRefExpr=AT_dllexport:18:37 Extent=[144:24 - 144:36] -// CHECK: 145:11: UnexposedExpr= Extent=[145:11 - 145:22] -// CHECK: 145:24: DeclRefExpr=IgnoredAttribute:31:7 Extent=[145:24 - 145:40] -// CHECK: 146:11: UnexposedExpr= Extent=[146:11 - 146:23] +// CHECK: 145:11: StringLiteral= Extent=[145:11 - 145:22] +// CHECK: 146:11: StringLiteral= Extent=[146:11 - 146:23] // CHECK: 146:25: DeclRefExpr=AT_base_check:16:42 Extent=[146:25 - 146:38] -// CHECK: 147:11: UnexposedExpr= Extent=[147:11 - 147:23] +// CHECK: 147:11: StringLiteral= Extent=[147:11 - 147:23] // CHECK: 147:25: DeclRefExpr=AT_deprecated:18:7 Extent=[147:25 - 147:38] -// CHECK: 148:11: UnexposedExpr= Extent=[148:11 - 148:23] +// CHECK: 148:11: StringLiteral= Extent=[148:11 - 148:23] // CHECK: 148:25: DeclRefExpr=AT_visibility:29:7 Extent=[148:25 - 148:38] -// CHECK: 149:11: UnexposedExpr= Extent=[149:11 - 149:23] +// CHECK: 149:11: StringLiteral= Extent=[149:11 - 149:23] // CHECK: 149:25: DeclRefExpr=AT_destructor:18:22 Extent=[149:25 - 149:38] -// CHECK: 150:11: UnexposedExpr= Extent=[150:11 - 150:23] +// CHECK: 150:11: StringLiteral= Extent=[150:11 - 150:23] // CHECK: 150:25: DeclRefExpr=AT_format_arg:19:61 Extent=[150:25 - 150:38] -// CHECK: 151:11: UnexposedExpr= Extent=[151:11 - 151:23] +// CHECK: 151:11: StringLiteral= Extent=[151:11 - 151:23] // CHECK: 151:25: DeclRefExpr=AT_gnu_inline:20:7 Extent=[151:25 - 151:38] -// CHECK: 152:11: UnexposedExpr= Extent=[152:11 - 152:24] +// CHECK: 152:11: StringLiteral= Extent=[152:11 - 152:24] // CHECK: 152:26: DeclRefExpr=AT_weak_import:30:7 Extent=[152:26 - 152:40] -// CHECK: 153:11: UnexposedExpr= Extent=[153:11 - 153:22] +// CHECK: 153:11: StringLiteral= Extent=[153:11 - 153:22] // CHECK: 153:24: DeclRefExpr=AT_vecreturn:28:43 Extent=[153:24 - 153:36] -// CHECK: 154:11: UnexposedExpr= Extent=[154:11 - 154:24] +// CHECK: 154:11: StringLiteral= Extent=[154:11 - 154:24] // CHECK: 154:26: DeclRefExpr=AT_vector_size:28:57 Extent=[154:26 - 154:40] -// CHECK: 155:11: UnexposedExpr= Extent=[155:11 - 155:24] +// CHECK: 155:11: StringLiteral= Extent=[155:11 - 155:24] // CHECK: 155:26: DeclRefExpr=AT_constructor:17:62 Extent=[155:26 - 155:40] -// CHECK: 156:11: UnexposedExpr= Extent=[156:11 - 156:24] +// CHECK: 156:11: StringLiteral= Extent=[156:11 - 156:24] // CHECK: 156:26: DeclRefExpr=AT_unavailable:28:7 Extent=[156:26 - 156:40] -// CHECK: 157:11: UnexposedExpr= Extent=[157:11 - 157:25] +// CHECK: 157:11: StringLiteral= Extent=[157:11 - 157:25] // CHECK: 157:27: DeclRefExpr=AT_overloadable:25:7 Extent=[157:27 - 157:42] -// CHECK: 158:11: UnexposedExpr= Extent=[158:11 - 158:26] +// CHECK: 158:11: StringLiteral= Extent=[158:11 - 158:26] // CHECK: 158:28: DeclRefExpr=AT_address_space:15:7 Extent=[158:28 - 158:44] -// CHECK: 159:11: UnexposedExpr= Extent=[159:11 - 159:26] +// CHECK: 159:11: StringLiteral= Extent=[159:11 - 159:26] // CHECK: 159:28: DeclRefExpr=AT_always_inline:15:47 Extent=[159:28 - 159:44] -// CHECK: 160:11: UnexposedExpr= Extent=[160:11 - 160:26] -// CHECK: 160:28: DeclRefExpr=IgnoredAttribute:31:7 Extent=[160:28 - 160:44] -// CHECK: 161:11: UnexposedExpr= Extent=[161:11 - 161:26] -// CHECK: 161:28: DeclRefExpr=IgnoredAttribute:31:7 Extent=[161:28 - 161:44] -// CHECK: 162:11: UnexposedExpr= Extent=[162:11 - 162:27] +// CHECK: 160:11: StringLiteral= Extent=[160:11 - 160:26] +// CHECK: 161:11: StringLiteral= Extent=[161:11 - 161:26] +// CHECK: 162:11: StringLiteral= Extent=[162:11 - 162:27] // CHECK: 162:29: DeclRefExpr=AT_objc_exception:22:32 Extent=[162:29 - 162:46] -// CHECK: 163:11: UnexposedExpr= Extent=[163:11 - 163:28] +// CHECK: 163:11: StringLiteral= Extent=[163:11 - 163:28] // CHECK: 163:30: DeclRefExpr=AT_ext_vector_type:19:7 Extent=[163:30 - 163:48] -// CHECK: 164:11: UnexposedExpr= Extent=[164:11 - 164:30] +// CHECK: 164:11: StringLiteral= Extent=[164:11 - 164:30] // CHECK: 164:32: DeclRefExpr=AT_transparent_union:27:57 Extent=[164:32 - 164:52] -// CHECK: 165:11: UnexposedExpr= Extent=[165:11 - 165:30] +// CHECK: 165:11: StringLiteral= Extent=[165:11 - 165:30] // CHECK: 165:32: DeclRefExpr=AT_analyzer_noreturn:16:7 Extent=[165:32 - 165:52] -// CHECK: 166:11: UnexposedExpr= Extent=[166:11 - 166:31] +// CHECK: 166:11: StringLiteral= Extent=[166:11 - 166:31] // CHECK: 166:33: DeclRefExpr=AT_warn_unused_result:29:22 Extent=[166:33 - 166:54] -// CHECK: 167:11: UnexposedExpr= Extent=[167:11 - 167:31] +// CHECK: 167:11: StringLiteral= Extent=[167:11 - 167:31] // CHECK: 167:33: DeclRefExpr=AT_carries_dependency:17:7 Extent=[167:33 - 167:54] -// CHECK: 168:11: UnexposedExpr= Extent=[168:11 - 168:36] +// CHECK: 168:11: StringLiteral= Extent=[168:11 - 168:36] // CHECK: 168:38: DeclRefExpr=AT_ns_returns_not_retained:24:7 Extent=[168:38 - 168:64] -// CHECK: 169:11: UnexposedExpr= Extent=[169:11 - 169:32] +// CHECK: 169:11: StringLiteral= Extent=[169:11 - 169:32] // CHECK: 169:34: DeclRefExpr=AT_ns_returns_retained:24:35 Extent=[169:34 - 169:56] -// CHECK: 170:11: UnexposedExpr= Extent=[170:11 - 170:36] +// CHECK: 170:11: StringLiteral= Extent=[170:11 - 170:36] // CHECK: 170:38: DeclRefExpr=AT_cf_returns_not_retained:23:7 Extent=[170:38 - 170:64] -// CHECK: 171:11: UnexposedExpr= Extent=[171:11 - 171:32] +// CHECK: 171:11: StringLiteral= Extent=[171:11 - 171:32] // CHECK: 171:34: DeclRefExpr=AT_cf_returns_retained:23:35 Extent=[171:34 - 171:56] -// CHECK: 172:11: UnexposedExpr= Extent=[172:11 - 172:30] +// CHECK: 172:11: StringLiteral= Extent=[172:11 - 172:30] // CHECK: 172:32: DeclRefExpr=AT_ownership_returns:25:44 Extent=[172:32 - 172:52] -// CHECK: 173:11: UnexposedExpr= Extent=[173:11 - 173:28] +// CHECK: 173:11: StringLiteral= Extent=[173:11 - 173:28] // CHECK: 173:30: DeclRefExpr=AT_ownership_holds:25:24 Extent=[173:30 - 173:48] -// CHECK: 174:11: UnexposedExpr= Extent=[174:11 - 174:28] +// CHECK: 174:11: StringLiteral= Extent=[174:11 - 174:28] // CHECK: 174:30: DeclRefExpr=AT_ownership_takes:26:7 Extent=[174:30 - 174:48] -// CHECK: 175:11: UnexposedExpr= Extent=[175:11 - 175:33] +// CHECK: 175:11: StringLiteral= Extent=[175:11 - 175:33] // CHECK: 175:35: DeclRefExpr=AT_reqd_wg_size:30:23 Extent=[175:35 - 175:50] -// CHECK: 176:11: UnexposedExpr= Extent=[176:11 - 176:26] +// CHECK: 176:11: StringLiteral= Extent=[176:11 - 176:26] // CHECK: 176:28: DeclRefExpr=AT_init_priority:30:40 Extent=[176:28 - 176:44] -// CHECK: 177:11: UnexposedExpr= Extent=[177:11 - 177:35] +// CHECK: 177:11: StringLiteral= Extent=[177:11 - 177:35] // CHECK: 177:37: DeclRefExpr=AT_no_instrument_function:21:20 Extent=[177:37 - 177:62] -// CHECK: 178:11: UnexposedExpr= Extent=[178:11 - 178:21] +// CHECK: 178:11: StringLiteral= Extent=[178:11 - 178:21] // CHECK: 178:23: DeclRefExpr=AT_thiscall:27:44 Extent=[178:23 - 178:34] -// CHECK: 179:11: UnexposedExpr= Extent=[179:11 - 179:19] +// CHECK: 179:11: StringLiteral= Extent=[179:11 - 179:19] // CHECK: 179:21: DeclRefExpr=AT_pascal:26:38 Extent=[179:21 - 179:30] -// CHECK: 180:11: UnexposedExpr= Extent=[180:11 - 180:20] +// CHECK: 180:11: StringLiteral= Extent=[180:11 - 180:20] // CHECK: 180:22: DeclRefExpr=AT_cdecl:17:30 Extent=[180:22 - 180:30] -// CHECK: 181:11: UnexposedExpr= Extent=[181:11 - 181:22] +// CHECK: 181:11: StringLiteral= Extent=[181:11 - 181:22] // CHECK: 181:24: DeclRefExpr=AT_stdcall:27:32 Extent=[181:24 - 181:34] -// CHECK: 182:11: UnexposedExpr= Extent=[182:11 - 182:23] +// CHECK: 182:11: StringLiteral= Extent=[182:11 - 182:23] // CHECK: 182:25: DeclRefExpr=AT_fastcall:19:27 Extent=[182:25 - 182:36] -// CHECK: 183:11: UnexposedExpr= Extent=[183:11 - 183:23] +// CHECK: 183:11: StringLiteral= Extent=[183:11 - 183:23] // CHECK: 183:25: DeclRefExpr=AT_thiscall:27:44 Extent=[183:25 - 183:36] -// CHECK: 184:11: UnexposedExpr= Extent=[184:11 - 184:21] +// CHECK: 184:11: StringLiteral= Extent=[184:11 - 184:21] // CHECK: 184:23: DeclRefExpr=AT_pascal:26:38 Extent=[184:23 - 184:32] -// CHECK: 185:14: DeclRefExpr=UnknownAttribute:31:25 Extent=[185:14 - 185:30] diff --git a/test/Index/recursive-member-access.c b/test/Index/recursive-member-access.c index 87855ca36159..6a19f578d707 100644 --- a/test/Index/recursive-member-access.c +++ b/test/Index/recursive-member-access.c @@ -131,126 +131,126 @@ int test_rdar8650865(struct rdar8650865 *s) { // CHECK: 6:5: FunctionDecl=test_rdar8650865:6:5 (Definition) Extent=[6:1 - 124:2] // CHECK: 6:42: ParmDecl=s:6:42 (Definition) Extent=[6:22 - 6:43] // CHECK: 6:29: TypeRef=struct rdar8650865:1:8 Extent=[6:29 - 6:40] -// CHECK: 6:45: UnexposedStmt= Extent=[6:45 - 124:2] -// CHECK: 7:3: UnexposedStmt= Extent=[7:3 - 123:8] -// CHECK: 123:7: MemberRefExpr=x:3:7 Extent=[7:10 - 123:8] -// CHECK: 122:7: MemberRefExpr=first:2:23 Extent=[7:10 - 122:12] -// CHECK: 121:7: MemberRefExpr=first:2:23 Extent=[7:10 - 121:12] -// CHECK: 120:7: MemberRefExpr=first:2:23 Extent=[7:10 - 120:12] -// CHECK: 119:7: MemberRefExpr=first:2:23 Extent=[7:10 - 119:12] -// CHECK: 118:7: MemberRefExpr=first:2:23 Extent=[7:10 - 118:12] -// CHECK: 117:7: MemberRefExpr=first:2:23 Extent=[7:10 - 117:12] -// CHECK: 116:7: MemberRefExpr=first:2:23 Extent=[7:10 - 116:12] -// CHECK: 115:7: MemberRefExpr=first:2:23 Extent=[7:10 - 115:12] -// CHECK: 114:7: MemberRefExpr=first:2:23 Extent=[7:10 - 114:12] -// CHECK: 113:7: MemberRefExpr=first:2:23 Extent=[7:10 - 113:12] -// CHECK: 112:7: MemberRefExpr=first:2:23 Extent=[7:10 - 112:12] -// CHECK: 111:7: MemberRefExpr=first:2:23 Extent=[7:10 - 111:12] -// CHECK: 110:7: MemberRefExpr=first:2:23 Extent=[7:10 - 110:12] -// CHECK: 109:7: MemberRefExpr=first:2:23 Extent=[7:10 - 109:12] -// CHECK: 108:7: MemberRefExpr=first:2:23 Extent=[7:10 - 108:12] -// CHECK: 107:7: MemberRefExpr=first:2:23 Extent=[7:10 - 107:12] -// CHECK: 106:7: MemberRefExpr=first:2:23 Extent=[7:10 - 106:12] -// CHECK: 105:7: MemberRefExpr=first:2:23 Extent=[7:10 - 105:12] -// CHECK: 104:7: MemberRefExpr=first:2:23 Extent=[7:10 - 104:12] -// CHECK: 103:7: MemberRefExpr=first:2:23 Extent=[7:10 - 103:12] -// CHECK: 102:7: MemberRefExpr=first:2:23 Extent=[7:10 - 102:12] -// CHECK: 101:7: MemberRefExpr=first:2:23 Extent=[7:10 - 101:12] -// CHECK: 100:7: MemberRefExpr=first:2:23 Extent=[7:10 - 100:12] -// CHECK: 99:7: MemberRefExpr=first:2:23 Extent=[7:10 - 99:12] -// CHECK: 98:7: MemberRefExpr=first:2:23 Extent=[7:10 - 98:12] -// CHECK: 97:7: MemberRefExpr=first:2:23 Extent=[7:10 - 97:12] -// CHECK: 96:7: MemberRefExpr=first:2:23 Extent=[7:10 - 96:12] -// CHECK: 95:7: MemberRefExpr=first:2:23 Extent=[7:10 - 95:12] -// CHECK: 94:7: MemberRefExpr=first:2:23 Extent=[7:10 - 94:12] -// CHECK: 93:7: MemberRefExpr=first:2:23 Extent=[7:10 - 93:12] -// CHECK: 92:7: MemberRefExpr=first:2:23 Extent=[7:10 - 92:12] -// CHECK: 91:7: MemberRefExpr=first:2:23 Extent=[7:10 - 91:12] -// CHECK: 90:7: MemberRefExpr=first:2:23 Extent=[7:10 - 90:12] -// CHECK: 89:7: MemberRefExpr=first:2:23 Extent=[7:10 - 89:12] -// CHECK: 88:7: MemberRefExpr=first:2:23 Extent=[7:10 - 88:12] -// CHECK: 87:7: MemberRefExpr=first:2:23 Extent=[7:10 - 87:12] -// CHECK: 86:7: MemberRefExpr=first:2:23 Extent=[7:10 - 86:12] -// CHECK: 85:7: MemberRefExpr=first:2:23 Extent=[7:10 - 85:12] -// CHECK: 84:7: MemberRefExpr=first:2:23 Extent=[7:10 - 84:12] -// CHECK: 83:7: MemberRefExpr=first:2:23 Extent=[7:10 - 83:12] -// CHECK: 82:7: MemberRefExpr=first:2:23 Extent=[7:10 - 82:12] -// CHECK: 81:7: MemberRefExpr=first:2:23 Extent=[7:10 - 81:12] -// CHECK: 80:7: MemberRefExpr=first:2:23 Extent=[7:10 - 80:12] -// CHECK: 79:7: MemberRefExpr=first:2:23 Extent=[7:10 - 79:12] -// CHECK: 78:7: MemberRefExpr=first:2:23 Extent=[7:10 - 78:12] -// CHECK: 77:7: MemberRefExpr=first:2:23 Extent=[7:10 - 77:12] -// CHECK: 76:7: MemberRefExpr=first:2:23 Extent=[7:10 - 76:12] -// CHECK: 75:7: MemberRefExpr=first:2:23 Extent=[7:10 - 75:12] -// CHECK: 74:7: MemberRefExpr=first:2:23 Extent=[7:10 - 74:12] -// CHECK: 73:7: MemberRefExpr=first:2:23 Extent=[7:10 - 73:12] -// CHECK: 72:7: MemberRefExpr=first:2:23 Extent=[7:10 - 72:12] -// CHECK: 71:7: MemberRefExpr=first:2:23 Extent=[7:10 - 71:12] -// CHECK: 70:7: MemberRefExpr=first:2:23 Extent=[7:10 - 70:12] -// CHECK: 69:7: MemberRefExpr=first:2:23 Extent=[7:10 - 69:12] -// CHECK: 68:7: MemberRefExpr=first:2:23 Extent=[7:10 - 68:12] -// CHECK: 67:7: MemberRefExpr=first:2:23 Extent=[7:10 - 67:12] -// CHECK: 66:7: MemberRefExpr=first:2:23 Extent=[7:10 - 66:12] -// CHECK: 65:7: MemberRefExpr=first:2:23 Extent=[7:10 - 65:12] -// CHECK: 64:7: MemberRefExpr=first:2:23 Extent=[7:10 - 64:12] -// CHECK: 63:7: MemberRefExpr=first:2:23 Extent=[7:10 - 63:12] -// CHECK: 62:7: MemberRefExpr=first:2:23 Extent=[7:10 - 62:12] -// CHECK: 61:7: MemberRefExpr=first:2:23 Extent=[7:10 - 61:12] -// CHECK: 60:7: MemberRefExpr=first:2:23 Extent=[7:10 - 60:12] -// CHECK: 59:7: MemberRefExpr=first:2:23 Extent=[7:10 - 59:12] -// CHECK: 58:7: MemberRefExpr=first:2:23 Extent=[7:10 - 58:12] -// CHECK: 57:7: MemberRefExpr=first:2:23 Extent=[7:10 - 57:12] -// CHECK: 56:7: MemberRefExpr=first:2:23 Extent=[7:10 - 56:12] -// CHECK: 55:7: MemberRefExpr=first:2:23 Extent=[7:10 - 55:12] -// CHECK: 54:7: MemberRefExpr=first:2:23 Extent=[7:10 - 54:12] -// CHECK: 53:7: MemberRefExpr=first:2:23 Extent=[7:10 - 53:12] -// CHECK: 52:7: MemberRefExpr=first:2:23 Extent=[7:10 - 52:12] -// CHECK: 51:7: MemberRefExpr=first:2:23 Extent=[7:10 - 51:12] -// CHECK: 50:7: MemberRefExpr=first:2:23 Extent=[7:10 - 50:12] -// CHECK: 49:7: MemberRefExpr=first:2:23 Extent=[7:10 - 49:12] -// CHECK: 48:7: MemberRefExpr=first:2:23 Extent=[7:10 - 48:12] -// CHECK: 47:7: MemberRefExpr=first:2:23 Extent=[7:10 - 47:12] -// CHECK: 46:7: MemberRefExpr=first:2:23 Extent=[7:10 - 46:12] -// CHECK: 45:7: MemberRefExpr=first:2:23 Extent=[7:10 - 45:12] -// CHECK: 44:7: MemberRefExpr=first:2:23 Extent=[7:10 - 44:12] -// CHECK: 43:7: MemberRefExpr=first:2:23 Extent=[7:10 - 43:12] -// CHECK: 42:7: MemberRefExpr=first:2:23 Extent=[7:10 - 42:12] -// CHECK: 41:7: MemberRefExpr=first:2:23 Extent=[7:10 - 41:12] -// CHECK: 40:7: MemberRefExpr=first:2:23 Extent=[7:10 - 40:12] -// CHECK: 39:7: MemberRefExpr=first:2:23 Extent=[7:10 - 39:12] -// CHECK: 38:7: MemberRefExpr=first:2:23 Extent=[7:10 - 38:12] -// CHECK: 37:7: MemberRefExpr=first:2:23 Extent=[7:10 - 37:12] -// CHECK: 36:7: MemberRefExpr=first:2:23 Extent=[7:10 - 36:12] -// CHECK: 35:7: MemberRefExpr=first:2:23 Extent=[7:10 - 35:12] -// CHECK: 34:7: MemberRefExpr=first:2:23 Extent=[7:10 - 34:12] -// CHECK: 33:7: MemberRefExpr=first:2:23 Extent=[7:10 - 33:12] -// CHECK: 32:7: MemberRefExpr=first:2:23 Extent=[7:10 - 32:12] -// CHECK: 31:7: MemberRefExpr=first:2:23 Extent=[7:10 - 31:12] -// CHECK: 30:7: MemberRefExpr=first:2:23 Extent=[7:10 - 30:12] -// CHECK: 29:7: MemberRefExpr=first:2:23 Extent=[7:10 - 29:12] -// CHECK: 28:7: MemberRefExpr=first:2:23 Extent=[7:10 - 28:12] -// CHECK: 27:7: MemberRefExpr=first:2:23 Extent=[7:10 - 27:12] -// CHECK: 26:7: MemberRefExpr=first:2:23 Extent=[7:10 - 26:12] -// CHECK: 25:7: MemberRefExpr=first:2:23 Extent=[7:10 - 25:12] -// CHECK: 24:7: MemberRefExpr=first:2:23 Extent=[7:10 - 24:12] -// CHECK: 23:7: MemberRefExpr=first:2:23 Extent=[7:10 - 23:12] -// CHECK: 22:7: MemberRefExpr=first:2:23 Extent=[7:10 - 22:12] -// CHECK: 21:7: MemberRefExpr=first:2:23 Extent=[7:10 - 21:12] -// CHECK: 20:7: MemberRefExpr=first:2:23 Extent=[7:10 - 20:12] -// CHECK: 19:7: MemberRefExpr=first:2:23 Extent=[7:10 - 19:12] -// CHECK: 18:7: MemberRefExpr=first:2:23 Extent=[7:10 - 18:12] -// CHECK: 17:7: MemberRefExpr=first:2:23 Extent=[7:10 - 17:12] -// CHECK: 16:7: MemberRefExpr=first:2:23 Extent=[7:10 - 16:12] -// CHECK: 15:7: MemberRefExpr=first:2:23 Extent=[7:10 - 15:12] -// CHECK: 14:7: MemberRefExpr=first:2:23 Extent=[7:10 - 14:12] -// CHECK: 13:7: MemberRefExpr=first:2:23 Extent=[7:10 - 13:12] -// CHECK: 12:7: MemberRefExpr=first:2:23 Extent=[7:10 - 12:12] -// CHECK: 11:7: MemberRefExpr=first:2:23 Extent=[7:11 - 11:12] -// CHECK: 10:7: MemberRefExpr=first:2:23 Extent=[7:12 - 10:12] -// CHECK: 9:7: MemberRefExpr=first:2:23 Extent=[7:13 - 9:12] -// CHECK: 8:7: MemberRefExpr=first:2:23 Extent=[7:14 - 8:12] -// CHECK: 7:27: MemberRefExpr=first:2:23 Extent=[7:15 - 7:32] -// CHECK: 7:19: MemberRefExpr=first:2:23 Extent=[7:16 - 7:24] +// CHECK: 6:45: CompoundStmt= Extent=[6:45 - 124:2] +// CHECK: 7:3: ReturnStmt= Extent=[7:3 - 123:8] +// CHECK: 123:7: MemberRefExpr=x:3:7 SingleRefName=[123:7 - 123:8] RefName=[123:7 - 123:8] Extent=[7:10 - 123:8] +// CHECK: 122:7: MemberRefExpr=first:2:23 SingleRefName=[122:7 - 122:12] RefName=[122:7 - 122:12] Extent=[7:10 - 122:12] +// CHECK: 121:7: MemberRefExpr=first:2:23 SingleRefName=[121:7 - 121:12] RefName=[121:7 - 121:12] Extent=[7:10 - 121:12] +// CHECK: 120:7: MemberRefExpr=first:2:23 SingleRefName=[120:7 - 120:12] RefName=[120:7 - 120:12] Extent=[7:10 - 120:12] +// CHECK: 119:7: MemberRefExpr=first:2:23 SingleRefName=[119:7 - 119:12] RefName=[119:7 - 119:12] Extent=[7:10 - 119:12] +// CHECK: 118:7: MemberRefExpr=first:2:23 SingleRefName=[118:7 - 118:12] RefName=[118:7 - 118:12] Extent=[7:10 - 118:12] +// CHECK: 117:7: MemberRefExpr=first:2:23 SingleRefName=[117:7 - 117:12] RefName=[117:7 - 117:12] Extent=[7:10 - 117:12] +// CHECK: 116:7: MemberRefExpr=first:2:23 SingleRefName=[116:7 - 116:12] RefName=[116:7 - 116:12] Extent=[7:10 - 116:12] +// CHECK: 115:7: MemberRefExpr=first:2:23 SingleRefName=[115:7 - 115:12] RefName=[115:7 - 115:12] Extent=[7:10 - 115:12] +// CHECK: 114:7: MemberRefExpr=first:2:23 SingleRefName=[114:7 - 114:12] RefName=[114:7 - 114:12] Extent=[7:10 - 114:12] +// CHECK: 113:7: MemberRefExpr=first:2:23 SingleRefName=[113:7 - 113:12] RefName=[113:7 - 113:12] Extent=[7:10 - 113:12] +// CHECK: 112:7: MemberRefExpr=first:2:23 SingleRefName=[112:7 - 112:12] RefName=[112:7 - 112:12] Extent=[7:10 - 112:12] +// CHECK: 111:7: MemberRefExpr=first:2:23 SingleRefName=[111:7 - 111:12] RefName=[111:7 - 111:12] Extent=[7:10 - 111:12] +// CHECK: 110:7: MemberRefExpr=first:2:23 SingleRefName=[110:7 - 110:12] RefName=[110:7 - 110:12] Extent=[7:10 - 110:12] +// CHECK: 109:7: MemberRefExpr=first:2:23 SingleRefName=[109:7 - 109:12] RefName=[109:7 - 109:12] Extent=[7:10 - 109:12] +// CHECK: 108:7: MemberRefExpr=first:2:23 SingleRefName=[108:7 - 108:12] RefName=[108:7 - 108:12] Extent=[7:10 - 108:12] +// CHECK: 107:7: MemberRefExpr=first:2:23 SingleRefName=[107:7 - 107:12] RefName=[107:7 - 107:12] Extent=[7:10 - 107:12] +// CHECK: 106:7: MemberRefExpr=first:2:23 SingleRefName=[106:7 - 106:12] RefName=[106:7 - 106:12] Extent=[7:10 - 106:12] +// CHECK: 105:7: MemberRefExpr=first:2:23 SingleRefName=[105:7 - 105:12] RefName=[105:7 - 105:12] Extent=[7:10 - 105:12] +// CHECK: 104:7: MemberRefExpr=first:2:23 SingleRefName=[104:7 - 104:12] RefName=[104:7 - 104:12] Extent=[7:10 - 104:12] +// CHECK: 103:7: MemberRefExpr=first:2:23 SingleRefName=[103:7 - 103:12] RefName=[103:7 - 103:12] Extent=[7:10 - 103:12] +// CHECK: 102:7: MemberRefExpr=first:2:23 SingleRefName=[102:7 - 102:12] RefName=[102:7 - 102:12] Extent=[7:10 - 102:12] +// CHECK: 101:7: MemberRefExpr=first:2:23 SingleRefName=[101:7 - 101:12] RefName=[101:7 - 101:12] Extent=[7:10 - 101:12] +// CHECK: 100:7: MemberRefExpr=first:2:23 SingleRefName=[100:7 - 100:12] RefName=[100:7 - 100:12] Extent=[7:10 - 100:12] +// CHECK: 99:7: MemberRefExpr=first:2:23 SingleRefName=[99:7 - 99:12] RefName=[99:7 - 99:12] Extent=[7:10 - 99:12] +// CHECK: 98:7: MemberRefExpr=first:2:23 SingleRefName=[98:7 - 98:12] RefName=[98:7 - 98:12] Extent=[7:10 - 98:12] +// CHECK: 97:7: MemberRefExpr=first:2:23 SingleRefName=[97:7 - 97:12] RefName=[97:7 - 97:12] Extent=[7:10 - 97:12] +// CHECK: 96:7: MemberRefExpr=first:2:23 SingleRefName=[96:7 - 96:12] RefName=[96:7 - 96:12] Extent=[7:10 - 96:12] +// CHECK: 95:7: MemberRefExpr=first:2:23 SingleRefName=[95:7 - 95:12] RefName=[95:7 - 95:12] Extent=[7:10 - 95:12] +// CHECK: 94:7: MemberRefExpr=first:2:23 SingleRefName=[94:7 - 94:12] RefName=[94:7 - 94:12] Extent=[7:10 - 94:12] +// CHECK: 93:7: MemberRefExpr=first:2:23 SingleRefName=[93:7 - 93:12] RefName=[93:7 - 93:12] Extent=[7:10 - 93:12] +// CHECK: 92:7: MemberRefExpr=first:2:23 SingleRefName=[92:7 - 92:12] RefName=[92:7 - 92:12] Extent=[7:10 - 92:12] +// CHECK: 91:7: MemberRefExpr=first:2:23 SingleRefName=[91:7 - 91:12] RefName=[91:7 - 91:12] Extent=[7:10 - 91:12] +// CHECK: 90:7: MemberRefExpr=first:2:23 SingleRefName=[90:7 - 90:12] RefName=[90:7 - 90:12] Extent=[7:10 - 90:12] +// CHECK: 89:7: MemberRefExpr=first:2:23 SingleRefName=[89:7 - 89:12] RefName=[89:7 - 89:12] Extent=[7:10 - 89:12] +// CHECK: 88:7: MemberRefExpr=first:2:23 SingleRefName=[88:7 - 88:12] RefName=[88:7 - 88:12] Extent=[7:10 - 88:12] +// CHECK: 87:7: MemberRefExpr=first:2:23 SingleRefName=[87:7 - 87:12] RefName=[87:7 - 87:12] Extent=[7:10 - 87:12] +// CHECK: 86:7: MemberRefExpr=first:2:23 SingleRefName=[86:7 - 86:12] RefName=[86:7 - 86:12] Extent=[7:10 - 86:12] +// CHECK: 85:7: MemberRefExpr=first:2:23 SingleRefName=[85:7 - 85:12] RefName=[85:7 - 85:12] Extent=[7:10 - 85:12] +// CHECK: 84:7: MemberRefExpr=first:2:23 SingleRefName=[84:7 - 84:12] RefName=[84:7 - 84:12] Extent=[7:10 - 84:12] +// CHECK: 83:7: MemberRefExpr=first:2:23 SingleRefName=[83:7 - 83:12] RefName=[83:7 - 83:12] Extent=[7:10 - 83:12] +// CHECK: 82:7: MemberRefExpr=first:2:23 SingleRefName=[82:7 - 82:12] RefName=[82:7 - 82:12] Extent=[7:10 - 82:12] +// CHECK: 81:7: MemberRefExpr=first:2:23 SingleRefName=[81:7 - 81:12] RefName=[81:7 - 81:12] Extent=[7:10 - 81:12] +// CHECK: 80:7: MemberRefExpr=first:2:23 SingleRefName=[80:7 - 80:12] RefName=[80:7 - 80:12] Extent=[7:10 - 80:12] +// CHECK: 79:7: MemberRefExpr=first:2:23 SingleRefName=[79:7 - 79:12] RefName=[79:7 - 79:12] Extent=[7:10 - 79:12] +// CHECK: 78:7: MemberRefExpr=first:2:23 SingleRefName=[78:7 - 78:12] RefName=[78:7 - 78:12] Extent=[7:10 - 78:12] +// CHECK: 77:7: MemberRefExpr=first:2:23 SingleRefName=[77:7 - 77:12] RefName=[77:7 - 77:12] Extent=[7:10 - 77:12] +// CHECK: 76:7: MemberRefExpr=first:2:23 SingleRefName=[76:7 - 76:12] RefName=[76:7 - 76:12] Extent=[7:10 - 76:12] +// CHECK: 75:7: MemberRefExpr=first:2:23 SingleRefName=[75:7 - 75:12] RefName=[75:7 - 75:12] Extent=[7:10 - 75:12] +// CHECK: 74:7: MemberRefExpr=first:2:23 SingleRefName=[74:7 - 74:12] RefName=[74:7 - 74:12] Extent=[7:10 - 74:12] +// CHECK: 73:7: MemberRefExpr=first:2:23 SingleRefName=[73:7 - 73:12] RefName=[73:7 - 73:12] Extent=[7:10 - 73:12] +// CHECK: 72:7: MemberRefExpr=first:2:23 SingleRefName=[72:7 - 72:12] RefName=[72:7 - 72:12] Extent=[7:10 - 72:12] +// CHECK: 71:7: MemberRefExpr=first:2:23 SingleRefName=[71:7 - 71:12] RefName=[71:7 - 71:12] Extent=[7:10 - 71:12] +// CHECK: 70:7: MemberRefExpr=first:2:23 SingleRefName=[70:7 - 70:12] RefName=[70:7 - 70:12] Extent=[7:10 - 70:12] +// CHECK: 69:7: MemberRefExpr=first:2:23 SingleRefName=[69:7 - 69:12] RefName=[69:7 - 69:12] Extent=[7:10 - 69:12] +// CHECK: 68:7: MemberRefExpr=first:2:23 SingleRefName=[68:7 - 68:12] RefName=[68:7 - 68:12] Extent=[7:10 - 68:12] +// CHECK: 67:7: MemberRefExpr=first:2:23 SingleRefName=[67:7 - 67:12] RefName=[67:7 - 67:12] Extent=[7:10 - 67:12] +// CHECK: 66:7: MemberRefExpr=first:2:23 SingleRefName=[66:7 - 66:12] RefName=[66:7 - 66:12] Extent=[7:10 - 66:12] +// CHECK: 65:7: MemberRefExpr=first:2:23 SingleRefName=[65:7 - 65:12] RefName=[65:7 - 65:12] Extent=[7:10 - 65:12] +// CHECK: 64:7: MemberRefExpr=first:2:23 SingleRefName=[64:7 - 64:12] RefName=[64:7 - 64:12] Extent=[7:10 - 64:12] +// CHECK: 63:7: MemberRefExpr=first:2:23 SingleRefName=[63:7 - 63:12] RefName=[63:7 - 63:12] Extent=[7:10 - 63:12] +// CHECK: 62:7: MemberRefExpr=first:2:23 SingleRefName=[62:7 - 62:12] RefName=[62:7 - 62:12] Extent=[7:10 - 62:12] +// CHECK: 61:7: MemberRefExpr=first:2:23 SingleRefName=[61:7 - 61:12] RefName=[61:7 - 61:12] Extent=[7:10 - 61:12] +// CHECK: 60:7: MemberRefExpr=first:2:23 SingleRefName=[60:7 - 60:12] RefName=[60:7 - 60:12] Extent=[7:10 - 60:12] +// CHECK: 59:7: MemberRefExpr=first:2:23 SingleRefName=[59:7 - 59:12] RefName=[59:7 - 59:12] Extent=[7:10 - 59:12] +// CHECK: 58:7: MemberRefExpr=first:2:23 SingleRefName=[58:7 - 58:12] RefName=[58:7 - 58:12] Extent=[7:10 - 58:12] +// CHECK: 57:7: MemberRefExpr=first:2:23 SingleRefName=[57:7 - 57:12] RefName=[57:7 - 57:12] Extent=[7:10 - 57:12] +// CHECK: 56:7: MemberRefExpr=first:2:23 SingleRefName=[56:7 - 56:12] RefName=[56:7 - 56:12] Extent=[7:10 - 56:12] +// CHECK: 55:7: MemberRefExpr=first:2:23 SingleRefName=[55:7 - 55:12] RefName=[55:7 - 55:12] Extent=[7:10 - 55:12] +// CHECK: 54:7: MemberRefExpr=first:2:23 SingleRefName=[54:7 - 54:12] RefName=[54:7 - 54:12] Extent=[7:10 - 54:12] +// CHECK: 53:7: MemberRefExpr=first:2:23 SingleRefName=[53:7 - 53:12] RefName=[53:7 - 53:12] Extent=[7:10 - 53:12] +// CHECK: 52:7: MemberRefExpr=first:2:23 SingleRefName=[52:7 - 52:12] RefName=[52:7 - 52:12] Extent=[7:10 - 52:12] +// CHECK: 51:7: MemberRefExpr=first:2:23 SingleRefName=[51:7 - 51:12] RefName=[51:7 - 51:12] Extent=[7:10 - 51:12] +// CHECK: 50:7: MemberRefExpr=first:2:23 SingleRefName=[50:7 - 50:12] RefName=[50:7 - 50:12] Extent=[7:10 - 50:12] +// CHECK: 49:7: MemberRefExpr=first:2:23 SingleRefName=[49:7 - 49:12] RefName=[49:7 - 49:12] Extent=[7:10 - 49:12] +// CHECK: 48:7: MemberRefExpr=first:2:23 SingleRefName=[48:7 - 48:12] RefName=[48:7 - 48:12] Extent=[7:10 - 48:12] +// CHECK: 47:7: MemberRefExpr=first:2:23 SingleRefName=[47:7 - 47:12] RefName=[47:7 - 47:12] Extent=[7:10 - 47:12] +// CHECK: 46:7: MemberRefExpr=first:2:23 SingleRefName=[46:7 - 46:12] RefName=[46:7 - 46:12] Extent=[7:10 - 46:12] +// CHECK: 45:7: MemberRefExpr=first:2:23 SingleRefName=[45:7 - 45:12] RefName=[45:7 - 45:12] Extent=[7:10 - 45:12] +// CHECK: 44:7: MemberRefExpr=first:2:23 SingleRefName=[44:7 - 44:12] RefName=[44:7 - 44:12] Extent=[7:10 - 44:12] +// CHECK: 43:7: MemberRefExpr=first:2:23 SingleRefName=[43:7 - 43:12] RefName=[43:7 - 43:12] Extent=[7:10 - 43:12] +// CHECK: 42:7: MemberRefExpr=first:2:23 SingleRefName=[42:7 - 42:12] RefName=[42:7 - 42:12] Extent=[7:10 - 42:12] +// CHECK: 41:7: MemberRefExpr=first:2:23 SingleRefName=[41:7 - 41:12] RefName=[41:7 - 41:12] Extent=[7:10 - 41:12] +// CHECK: 40:7: MemberRefExpr=first:2:23 SingleRefName=[40:7 - 40:12] RefName=[40:7 - 40:12] Extent=[7:10 - 40:12] +// CHECK: 39:7: MemberRefExpr=first:2:23 SingleRefName=[39:7 - 39:12] RefName=[39:7 - 39:12] Extent=[7:10 - 39:12] +// CHECK: 38:7: MemberRefExpr=first:2:23 SingleRefName=[38:7 - 38:12] RefName=[38:7 - 38:12] Extent=[7:10 - 38:12] +// CHECK: 37:7: MemberRefExpr=first:2:23 SingleRefName=[37:7 - 37:12] RefName=[37:7 - 37:12] Extent=[7:10 - 37:12] +// CHECK: 36:7: MemberRefExpr=first:2:23 SingleRefName=[36:7 - 36:12] RefName=[36:7 - 36:12] Extent=[7:10 - 36:12] +// CHECK: 35:7: MemberRefExpr=first:2:23 SingleRefName=[35:7 - 35:12] RefName=[35:7 - 35:12] Extent=[7:10 - 35:12] +// CHECK: 34:7: MemberRefExpr=first:2:23 SingleRefName=[34:7 - 34:12] RefName=[34:7 - 34:12] Extent=[7:10 - 34:12] +// CHECK: 33:7: MemberRefExpr=first:2:23 SingleRefName=[33:7 - 33:12] RefName=[33:7 - 33:12] Extent=[7:10 - 33:12] +// CHECK: 32:7: MemberRefExpr=first:2:23 SingleRefName=[32:7 - 32:12] RefName=[32:7 - 32:12] Extent=[7:10 - 32:12] +// CHECK: 31:7: MemberRefExpr=first:2:23 SingleRefName=[31:7 - 31:12] RefName=[31:7 - 31:12] Extent=[7:10 - 31:12] +// CHECK: 30:7: MemberRefExpr=first:2:23 SingleRefName=[30:7 - 30:12] RefName=[30:7 - 30:12] Extent=[7:10 - 30:12] +// CHECK: 29:7: MemberRefExpr=first:2:23 SingleRefName=[29:7 - 29:12] RefName=[29:7 - 29:12] Extent=[7:10 - 29:12] +// CHECK: 28:7: MemberRefExpr=first:2:23 SingleRefName=[28:7 - 28:12] RefName=[28:7 - 28:12] Extent=[7:10 - 28:12] +// CHECK: 27:7: MemberRefExpr=first:2:23 SingleRefName=[27:7 - 27:12] RefName=[27:7 - 27:12] Extent=[7:10 - 27:12] +// CHECK: 26:7: MemberRefExpr=first:2:23 SingleRefName=[26:7 - 26:12] RefName=[26:7 - 26:12] Extent=[7:10 - 26:12] +// CHECK: 25:7: MemberRefExpr=first:2:23 SingleRefName=[25:7 - 25:12] RefName=[25:7 - 25:12] Extent=[7:10 - 25:12] +// CHECK: 24:7: MemberRefExpr=first:2:23 SingleRefName=[24:7 - 24:12] RefName=[24:7 - 24:12] Extent=[7:10 - 24:12] +// CHECK: 23:7: MemberRefExpr=first:2:23 SingleRefName=[23:7 - 23:12] RefName=[23:7 - 23:12] Extent=[7:10 - 23:12] +// CHECK: 22:7: MemberRefExpr=first:2:23 SingleRefName=[22:7 - 22:12] RefName=[22:7 - 22:12] Extent=[7:10 - 22:12] +// CHECK: 21:7: MemberRefExpr=first:2:23 SingleRefName=[21:7 - 21:12] RefName=[21:7 - 21:12] Extent=[7:10 - 21:12] +// CHECK: 20:7: MemberRefExpr=first:2:23 SingleRefName=[20:7 - 20:12] RefName=[20:7 - 20:12] Extent=[7:10 - 20:12] +// CHECK: 19:7: MemberRefExpr=first:2:23 SingleRefName=[19:7 - 19:12] RefName=[19:7 - 19:12] Extent=[7:10 - 19:12] +// CHECK: 18:7: MemberRefExpr=first:2:23 SingleRefName=[18:7 - 18:12] RefName=[18:7 - 18:12] Extent=[7:10 - 18:12] +// CHECK: 17:7: MemberRefExpr=first:2:23 SingleRefName=[17:7 - 17:12] RefName=[17:7 - 17:12] Extent=[7:10 - 17:12] +// CHECK: 16:7: MemberRefExpr=first:2:23 SingleRefName=[16:7 - 16:12] RefName=[16:7 - 16:12] Extent=[7:10 - 16:12] +// CHECK: 15:7: MemberRefExpr=first:2:23 SingleRefName=[15:7 - 15:12] RefName=[15:7 - 15:12] Extent=[7:10 - 15:12] +// CHECK: 14:7: MemberRefExpr=first:2:23 SingleRefName=[14:7 - 14:12] RefName=[14:7 - 14:12] Extent=[7:10 - 14:12] +// CHECK: 13:7: MemberRefExpr=first:2:23 SingleRefName=[13:7 - 13:12] RefName=[13:7 - 13:12] Extent=[7:10 - 13:12] +// CHECK: 12:7: MemberRefExpr=first:2:23 SingleRefName=[12:7 - 12:12] RefName=[12:7 - 12:12] Extent=[7:10 - 12:12] +// CHECK: 11:7: MemberRefExpr=first:2:23 SingleRefName=[11:7 - 11:12] RefName=[11:7 - 11:12] Extent=[7:11 - 11:12] +// CHECK: 10:7: MemberRefExpr=first:2:23 SingleRefName=[10:7 - 10:12] RefName=[10:7 - 10:12] Extent=[7:12 - 10:12] +// CHECK: 9:7: MemberRefExpr=first:2:23 SingleRefName=[9:7 - 9:12] RefName=[9:7 - 9:12] Extent=[7:13 - 9:12] +// CHECK: 8:7: MemberRefExpr=first:2:23 SingleRefName=[8:7 - 8:12] RefName=[8:7 - 8:12] Extent=[7:14 - 8:12] +// CHECK: 7:27: MemberRefExpr=first:2:23 SingleRefName=[7:27 - 7:32] RefName=[7:27 - 7:32] Extent=[7:15 - 7:32] +// CHECK: 7:19: MemberRefExpr=first:2:23 SingleRefName=[7:19 - 7:24] RefName=[7:19 - 7:24] Extent=[7:16 - 7:24] // CHECK: 7:16: DeclRefExpr=s:6:42 Extent=[7:16 - 7:17] // RUN: c-index-test -test-annotate-tokens=%s:1:1:124:1 %s | FileCheck -check-prefix=CHECK-tokens %s @@ -275,33 +275,33 @@ int test_rdar8650865(struct rdar8650865 *s) { // CHECK-tokens: Punctuation: "*" [6:41 - 6:42] ParmDecl=s:6:42 (Definition) // CHECK-tokens: Identifier: "s" [6:42 - 6:43] ParmDecl=s:6:42 (Definition) // CHECK-tokens: Punctuation: ")" [6:43 - 6:44] FunctionDecl=test_rdar8650865:6:5 (Definition) -// CHECK-tokens: Punctuation: "{" [6:45 - 6:46] UnexposedStmt= -// CHECK-tokens: Keyword: "return" [7:3 - 7:9] UnexposedStmt= -// CHECK-tokens: Punctuation: "(" [7:10 - 7:11] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [7:11 - 7:12] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [7:12 - 7:13] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [7:14 - 7:15] UnexposedExpr= -// CHECK-tokens: Punctuation: "(" [7:15 - 7:16] UnexposedExpr= +// CHECK-tokens: Punctuation: "{" [6:45 - 6:46] CompoundStmt= +// CHECK-tokens: Keyword: "return" [7:3 - 7:9] ReturnStmt= +// CHECK-tokens: Punctuation: "(" [7:10 - 7:11] ParenExpr= +// CHECK-tokens: Punctuation: "(" [7:11 - 7:12] ParenExpr= +// CHECK-tokens: Punctuation: "(" [7:12 - 7:13] ParenExpr= +// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] ParenExpr= +// CHECK-tokens: Punctuation: "(" [7:14 - 7:15] ParenExpr= +// CHECK-tokens: Punctuation: "(" [7:15 - 7:16] ParenExpr= // CHECK-tokens: Identifier: "s" [7:16 - 7:17] DeclRefExpr=s:6:42 // CHECK-tokens: Punctuation: "->" [7:17 - 7:19] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [7:19 - 7:24] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [7:24 - 7:25] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [7:24 - 7:25] ParenExpr= // CHECK-tokens: Punctuation: "->" [7:25 - 7:27] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [7:27 - 7:32] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [7:32 - 7:33] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [7:32 - 7:33] ParenExpr= // CHECK-tokens: Punctuation: "->" [8:5 - 8:7] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [8:7 - 8:12] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [8:12 - 8:13] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [8:12 - 8:13] ParenExpr= // CHECK-tokens: Punctuation: "->" [9:5 - 9:7] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [9:7 - 9:12] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [9:12 - 9:13] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [9:12 - 9:13] ParenExpr= // CHECK-tokens: Punctuation: "->" [10:5 - 10:7] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [10:7 - 10:12] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [10:12 - 10:13] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [10:12 - 10:13] ParenExpr= // CHECK-tokens: Punctuation: "->" [11:5 - 11:7] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [11:7 - 11:12] MemberRefExpr=first:2:23 -// CHECK-tokens: Punctuation: ")" [11:12 - 11:13] UnexposedExpr= +// CHECK-tokens: Punctuation: ")" [11:12 - 11:13] ParenExpr= // CHECK-tokens: Punctuation: "->" [12:5 - 12:7] MemberRefExpr=first:2:23 // CHECK-tokens: Identifier: "first" [12:7 - 12:12] MemberRefExpr=first:2:23 // CHECK-tokens: Punctuation: "->" [13:5 - 13:7] MemberRefExpr=first:2:23 @@ -526,7 +526,7 @@ int test_rdar8650865(struct rdar8650865 *s) { // CHECK-tokens: Identifier: "first" [122:7 - 122:12] MemberRefExpr=first:2:23 // CHECK-tokens: Punctuation: "->" [123:5 - 123:7] MemberRefExpr=x:3:7 // CHECK-tokens: Identifier: "x" [123:7 - 123:8] MemberRefExpr=x:3:7 -// CHECK-tokens: Punctuation: ";" [123:8 - 123:9] UnexposedStmt= -// CHECK-tokens: Punctuation: "}" [124:1 - 124:2] UnexposedStmt= +// CHECK-tokens: Punctuation: ";" [123:8 - 123:9] CompoundStmt= +// CHECK-tokens: Punctuation: "}" [124:1 - 124:2] CompoundStmt= diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c index 5a8f46b7f3d8..260887469f6c 100644 --- a/test/Index/remap-load.c +++ b/test/Index/remap-load.c @@ -4,7 +4,7 @@ // CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:18] // CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:31] // CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23] -// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23] +// CHECK: remap-load.c:2:10: BinaryOperator= Extent=[2:10 - 2:23] // CHECK: remap-load.c:2:10: UnexposedExpr=parm1:1:13 Extent=[2:10 - 2:15] // CHECK: remap-load.c:2:10: DeclRefExpr=parm1:1:13 Extent=[2:10 - 2:15] // CHECK: remap-load.c:2:18: DeclRefExpr=parm2:1:26 Extent=[2:18 - 2:23] diff --git a/test/Index/usrs-cxx0x.cpp b/test/Index/usrs-cxx0x.cpp index 50aee0968867..a48b4467b731 100644 --- a/test/Index/usrs-cxx0x.cpp +++ b/test/Index/usrs-cxx0x.cpp @@ -3,6 +3,6 @@ struct tuple { }; void f(tuple<int, float, double>); -// RUN: c-index-test -test-load-source-usrs all -std=c++0x %s | FileCheck %s +// RUN: c-index-test -test-load-source-usrs all -std=c++11 %s | FileCheck %s // CHECK: usrs-cxx0x.cpp c:@ST>1#pT@tuple Extent=[1:1 - 2:17] // CHECK: usrs-cxx0x.cpp c:@F@f#$@S@tuple>#p3Ifd# Extent=[4:1 - 4:34] diff --git a/test/Index/usrs.m b/test/Index/usrs.m index 283064701918..826abb53f37c 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -142,9 +142,9 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:1 - 3:60] // CHECK-source: usrs.m:3:33: ParmDecl=x:3:33 (Definition) Extent=[3:29 - 3:34] // CHECK-source: usrs.m:3:40: ParmDecl=y:3:40 (Definition) Extent=[3:36 - 3:41] -// CHECK-source: usrs.m:3:43: UnexposedStmt= Extent=[3:43 - 3:60] -// CHECK-source: usrs.m:3:45: UnexposedStmt= Extent=[3:45 - 3:57] -// CHECK-source: usrs.m:3:52: UnexposedExpr= Extent=[3:52 - 3:57] +// CHECK-source: usrs.m:3:43: CompoundStmt= Extent=[3:43 - 3:60] +// CHECK-source: usrs.m:3:45: ReturnStmt= Extent=[3:45 - 3:57] +// CHECK-source: usrs.m:3:52: BinaryOperator= Extent=[3:52 - 3:57] // CHECK-source: usrs.m:3:52: DeclRefExpr=x:3:33 Extent=[3:52 - 3:53] // CHECK-source: usrs.m:3:56: DeclRefExpr=y:3:40 Extent=[3:56 - 3:57] // CHECK-source: usrs.m:5:1: EnumDecl=:5:1 (Definition) Extent=[5:1 - 8:2] @@ -153,11 +153,10 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:10:1: EnumDecl=:10:1 (Definition) Extent=[10:1 - 13:2] // CHECK-source: usrs.m:11:3: EnumConstantDecl=FOO:11:3 (Definition) Extent=[11:3 - 11:6] // CHECK-source: usrs.m:12:3: EnumConstantDecl=BAR:12:3 (Definition) Extent=[12:3 - 12:6] +// CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[15:1 - 18:11] // CHECK-source: usrs.m:15:9: StructDecl=:15:9 (Definition) Extent=[15:9 - 18:2] // CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:3 - 16:9] // CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:3 - 17:10] -// CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[15:1 - 18:11] -// CHECK-source: usrs.m:15:9: TypeRef=MyStruct:15:9 Extent=[15:9 - 15:15] // CHECK-source: usrs.m:20:6: EnumDecl=Pizza:20:6 (Definition) Extent=[20:1 - 23:2] // CHECK-source: usrs.m:21:3: EnumConstantDecl=CHEESE:21:3 (Definition) Extent=[21:3 - 21:9] // CHECK-source: usrs.m:22:3: EnumConstantDecl=MUSHROOMS:22:3 (Definition) Extent=[22:3 - 22:12] @@ -174,33 +173,33 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=d1:31:15 Extent=[31:15 - 31:17] // CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=setD1::31:15 Extent=[31:15 - 31:17] // CHECK-source: usrs.m:31:15: ParmDecl=d1:31:15 (Definition) Extent=[31:15 - 31:17] -// CHECK-source: usrs.m:34:1: ObjCImplementationDecl=Foo:34:1 (Definition) Extent=[34:1 - 45:2] +// CHECK-source: usrs.m:34:17: ObjCImplementationDecl=Foo:34:17 (Definition) Extent=[34:1 - 45:2] // CHECK-source: usrs.m:35:1: ObjCInstanceMethodDecl=godzilla:35:1 (Definition) [Overrides @29:1] Extent=[35:1 - 39:2] // CHECK-source: usrs.m:35:4: TypeRef=id:0:0 Extent=[35:4 - 35:6] -// CHECK-source: usrs.m:35:17: UnexposedStmt= Extent=[35:17 - 39:2] -// CHECK-source: usrs.m:36:3: UnexposedStmt= Extent=[36:3 - 36:20] +// CHECK-source: usrs.m:35:17: CompoundStmt= Extent=[35:17 - 39:2] +// CHECK-source: usrs.m:36:3: DeclStmt= Extent=[36:3 - 36:20] // CHECK-source: usrs.m:36:14: VarDecl=a:36:14 (Definition) Extent=[36:3 - 36:19] -// CHECK-source: usrs.m:36:18: UnexposedExpr= Extent=[36:18 - 36:19] -// CHECK-source: usrs.m:37:3: UnexposedStmt= Extent=[37:3 - 37:16] +// CHECK-source: usrs.m:36:18: IntegerLiteral= Extent=[36:18 - 36:19] +// CHECK-source: usrs.m:37:3: DeclStmt= Extent=[37:3 - 37:16] // CHECK-source: usrs.m:37:14: VarDecl=z:37:14 Extent=[37:3 - 37:15] -// CHECK-source: usrs.m:38:3: UnexposedStmt= Extent=[38:3 - 38:11] -// CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11] +// CHECK-source: usrs.m:38:3: ReturnStmt= Extent=[38:3 - 38:11] // CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11] +// CHECK-source: usrs.m:38:10: IntegerLiteral= Extent=[38:10 - 38:11] // CHECK-source: usrs.m:40:1: ObjCClassMethodDecl=kingkong:40:1 (Definition) [Overrides @30:1] Extent=[40:1 - 43:2] // CHECK-source: usrs.m:40:4: TypeRef=id:0:0 Extent=[40:4 - 40:6] -// CHECK-source: usrs.m:40:17: UnexposedStmt= Extent=[40:17 - 43:2] -// CHECK-source: usrs.m:41:3: UnexposedStmt= Extent=[41:3 - 41:17] +// CHECK-source: usrs.m:40:17: CompoundStmt= Extent=[40:17 - 43:2] +// CHECK-source: usrs.m:41:3: DeclStmt= Extent=[41:3 - 41:17] // CHECK-source: usrs.m:41:7: VarDecl=local_var:41:7 (Definition) Extent=[41:3 - 41:16] -// CHECK-source: usrs.m:42:3: UnexposedStmt= Extent=[42:3 - 42:11] -// CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11] +// CHECK-source: usrs.m:42:3: ReturnStmt= Extent=[42:3 - 42:11] // CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11] +// CHECK-source: usrs.m:42:10: IntegerLiteral= Extent=[42:10 - 42:11] // CHECK-source: usrs.m:44:13: ObjCIvarDecl=d1:44:13 (Definition) Extent=[44:13 - 44:15] // CHECK-source: usrs.m:44:13: ObjCSynthesizeDecl=d1:31:15 (Definition) Extent=[44:1 - 44:15] // CHECK-source: usrs.m:47:5: VarDecl=z:47:5 Extent=[47:1 - 47:6] // CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:1 - 49:43] // CHECK-source: usrs.m:49:27: ParmDecl=x:49:27 (Definition) Extent=[49:23 - 49:28] -// CHECK-source: usrs.m:49:30: UnexposedStmt= Extent=[49:30 - 49:43] -// CHECK-source: usrs.m:49:32: UnexposedStmt= Extent=[49:32 - 49:40] +// CHECK-source: usrs.m:49:30: CompoundStmt= Extent=[49:30 - 49:43] +// CHECK-source: usrs.m:49:32: ReturnStmt= Extent=[49:32 - 49:40] // CHECK-source: usrs.m:49:39: DeclRefExpr=x:49:27 Extent=[49:39 - 49:40] // CHECK-source: usrs.m:51:12: ObjCInterfaceDecl=CWithExt:51:12 Extent=[51:1 - 53:5] // CHECK-source: usrs.m:52:1: ObjCInstanceMethodDecl=meth1:52:1 Extent=[52:1 - 52:14] @@ -217,54 +216,54 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:60:12: ObjCClassRef=CWithExt:51:12 Extent=[60:12 - 60:20] // CHECK-source: usrs.m:61:1: ObjCInstanceMethodDecl=meth4:61:1 Extent=[61:1 - 61:14] // CHECK-source: usrs.m:61:4: TypeRef=id:0:0 Extent=[61:4 - 61:6] -// CHECK-source: usrs.m:63:1: ObjCImplementationDecl=CWithExt:63:1 (Definition) Extent=[63:1 - 67:2] +// CHECK-source: usrs.m:63:17: ObjCImplementationDecl=CWithExt:63:17 (Definition) Extent=[63:1 - 67:2] // CHECK-source: usrs.m:64:1: ObjCInstanceMethodDecl=meth1:64:1 (Definition) [Overrides @52:1] Extent=[64:1 - 64:27] // CHECK-source: usrs.m:64:4: TypeRef=id:0:0 Extent=[64:4 - 64:6] -// CHECK-source: usrs.m:64:14: UnexposedStmt= Extent=[64:14 - 64:27] -// CHECK-source: usrs.m:64:16: UnexposedStmt= Extent=[64:16 - 64:24] -// CHECK-source: usrs.m:64:23: UnexposedExpr= Extent=[64:23 - 64:24] +// CHECK-source: usrs.m:64:14: CompoundStmt= Extent=[64:14 - 64:27] +// CHECK-source: usrs.m:64:16: ReturnStmt= Extent=[64:16 - 64:24] // CHECK-source: usrs.m:64:23: UnexposedExpr= Extent=[64:23 - 64:24] +// CHECK-source: usrs.m:64:23: IntegerLiteral= Extent=[64:23 - 64:24] // CHECK-source: usrs.m:65:1: ObjCInstanceMethodDecl=meth2:65:1 (Definition) [Overrides @55:1] Extent=[65:1 - 65:27] // CHECK-source: usrs.m:65:4: TypeRef=id:0:0 Extent=[65:4 - 65:6] -// CHECK-source: usrs.m:65:14: UnexposedStmt= Extent=[65:14 - 65:27] -// CHECK-source: usrs.m:65:16: UnexposedStmt= Extent=[65:16 - 65:24] -// CHECK-source: usrs.m:65:23: UnexposedExpr= Extent=[65:23 - 65:24] +// CHECK-source: usrs.m:65:14: CompoundStmt= Extent=[65:14 - 65:27] +// CHECK-source: usrs.m:65:16: ReturnStmt= Extent=[65:16 - 65:24] // CHECK-source: usrs.m:65:23: UnexposedExpr= Extent=[65:23 - 65:24] +// CHECK-source: usrs.m:65:23: IntegerLiteral= Extent=[65:23 - 65:24] // CHECK-source: usrs.m:66:1: ObjCInstanceMethodDecl=meth3:66:1 (Definition) [Overrides @58:1] Extent=[66:1 - 66:27] // CHECK-source: usrs.m:66:4: TypeRef=id:0:0 Extent=[66:4 - 66:6] -// CHECK-source: usrs.m:66:14: UnexposedStmt= Extent=[66:14 - 66:27] -// CHECK-source: usrs.m:66:16: UnexposedStmt= Extent=[66:16 - 66:24] +// CHECK-source: usrs.m:66:14: CompoundStmt= Extent=[66:14 - 66:27] +// CHECK-source: usrs.m:66:16: ReturnStmt= Extent=[66:16 - 66:24] // CHECK-source: usrs.m:66:23: UnexposedExpr= Extent=[66:23 - 66:24] -// CHECK-source: usrs.m:66:23: UnexposedExpr= Extent=[66:23 - 66:24] -// CHECK-source: usrs.m:68:1: ObjCCategoryImplDecl=Bar:68:1 (Definition) Extent=[68:1 - 70:2] -// CHECK-source: usrs.m:68:1: ObjCClassRef=CWithExt:51:12 Extent=[68:1 - 68:2] +// CHECK-source: usrs.m:66:23: IntegerLiteral= Extent=[66:23 - 66:24] +// CHECK-source: usrs.m:68:17: ObjCCategoryImplDecl=Bar:68:17 (Definition) Extent=[68:1 - 70:2] +// CHECK-source: usrs.m:68:17: ObjCClassRef=CWithExt:51:12 Extent=[68:17 - 68:25] // CHECK-source: usrs.m:69:1: ObjCInstanceMethodDecl=meth4:69:1 (Definition) [Overrides @61:1] Extent=[69:1 - 69:27] // CHECK-source: usrs.m:69:4: TypeRef=id:0:0 Extent=[69:4 - 69:6] -// CHECK-source: usrs.m:69:14: UnexposedStmt= Extent=[69:14 - 69:27] -// CHECK-source: usrs.m:69:16: UnexposedStmt= Extent=[69:16 - 69:24] -// CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24] +// CHECK-source: usrs.m:69:14: CompoundStmt= Extent=[69:14 - 69:27] +// CHECK-source: usrs.m:69:16: ReturnStmt= Extent=[69:16 - 69:24] // CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24] +// CHECK-source: usrs.m:69:23: IntegerLiteral= Extent=[69:23 - 69:24] // CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:1 - 72:26] // CHECK-source: usrs.m:72:15: ParmDecl=:72:15 (Definition) Extent=[72:12 - 72:16] // CHECK-source: usrs.m:72:20: ParmDecl=:72:20 (Definition) Extent=[72:17 - 72:21] // CHECK-source: usrs.m:72:25: ParmDecl=:72:25 (Definition) Extent=[72:22 - 72:26] // CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:1 - 77:2] -// CHECK-source: usrs.m:73:34: UnexposedStmt= Extent=[73:34 - 77:2] -// CHECK-source: usrs.m:74:3: UnexposedStmt= Extent=[74:3 - 74:33] +// CHECK-source: usrs.m:73:34: CompoundStmt= Extent=[73:34 - 77:2] +// CHECK-source: usrs.m:74:3: DeclStmt= Extent=[74:3 - 74:33] // CHECK-source: usrs.m:74:7: VarDecl=foo:74:7 (Definition) Extent=[74:3 - 74:14] -// CHECK-source: usrs.m:74:13: UnexposedExpr= Extent=[74:13 - 74:14] +// CHECK-source: usrs.m:74:13: IntegerLiteral= Extent=[74:13 - 74:14] // CHECK-source: usrs.m:74:16: VarDecl=bar:74:16 Extent=[74:16 - 74:23] -// CHECK-source: usrs.m:74:22: UnexposedExpr= Extent=[74:22 - 74:23] +// CHECK-source: usrs.m:74:22: IntegerLiteral= Extent=[74:22 - 74:23] // CHECK-source: usrs.m:74:25: VarDecl=baz:74:25 Extent=[74:25 - 74:32] -// CHECK-source: usrs.m:74:31: UnexposedExpr= Extent=[74:31 - 74:32] +// CHECK-source: usrs.m:74:31: IntegerLiteral= Extent=[74:31 - 74:32] // CHECK-source: usrs.m:75:3: CallExpr=aux_1:72:6 Extent=[75:3 - 75:23] // CHECK-source: usrs.m:75:3: UnexposedExpr=aux_1:72:6 Extent=[75:3 - 75:8] // CHECK-source: usrs.m:75:3: DeclRefExpr=aux_1:72:6 Extent=[75:3 - 75:8] // CHECK-source: usrs.m:75:9: DeclRefExpr=foo:74:7 Extent=[75:9 - 75:12] // CHECK-source: usrs.m:75:14: DeclRefExpr=bar:74:16 Extent=[75:14 - 75:17] // CHECK-source: usrs.m:75:19: DeclRefExpr=baz:74:25 Extent=[75:19 - 75:22] -// CHECK-source: usrs.m:76:3: UnexposedStmt= Extent=[76:3 - 76:11] -// CHECK-source: usrs.m:76:10: UnexposedExpr= Extent=[76:10 - 76:11] -// CHECK-source: usrs.m:79:1: ObjCProtocolDecl=P1:79:1 (Definition) Extent=[79:1 - 81:5] +// CHECK-source: usrs.m:76:3: ReturnStmt= Extent=[76:3 - 76:11] +// CHECK-source: usrs.m:76:10: IntegerLiteral= Extent=[76:10 - 76:11] +// CHECK-source: usrs.m:79:11: ObjCProtocolDecl=P1:79:11 (Definition) Extent=[79:1 - 81:5] // CHECK-source: usrs.m:80:1: ObjCInstanceMethodDecl=method:80:1 Extent=[80:1 - 80:16] diff --git a/test/Lexer/bcpl-escaped-newline.c b/test/Lexer/bcpl-escaped-newline.c new file mode 100644 index 000000000000..4d4a7b5e89eb --- /dev/null +++ b/test/Lexer/bcpl-escaped-newline.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -Eonly -trigraphs %s +// RUN: %clang_cc1 -Eonly -verify %s + +//\ +#error bar + +//??/ +#error qux // expected-error {{qux}} + +// Trailing whitespace! +//\ +#error quux diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c index 3d2da2c764e6..013103b1f5dd 100644 --- a/test/Lexer/constants.c +++ b/test/Lexer/constants.c @@ -65,3 +65,5 @@ double t1[] = { // PR7888 double g = 1e100000000; // expected-warning {{too large}} + +char h = '\u1234'; // expected-warning {{character unicode escape sequence too long for its type}} diff --git a/test/Lexer/cxx0x_keyword.cpp b/test/Lexer/cxx0x_keyword.cpp index c27925bcfee4..e6841ef7665d 100644 --- a/test/Lexer/cxx0x_keyword.cpp +++ b/test/Lexer/cxx0x_keyword.cpp @@ -1,2 +1,2 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s 2>&1 +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2>&1 int static_assert; /* expected-error {{expected unqualified-id}} */ diff --git a/test/Lexer/cxx0x_keyword_as_cxx98.cpp b/test/Lexer/cxx0x_keyword_as_cxx98.cpp index 0223b039be92..d87d3dc7faff 100644 --- a/test/Lexer/cxx0x_keyword_as_cxx98.cpp +++ b/test/Lexer/cxx0x_keyword_as_cxx98.cpp @@ -1,3 +1,36 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -int static_assert; -int char16_t; + +#define constexpr const +constexpr int x = 0; +#undef constexpr + +namespace lib { + struct nullptr_t; + typedef nullptr_t nullptr; // expected-warning {{'nullptr' is a keyword in C++11}} +} + +#define CONCAT(X,Y) CONCAT2(X,Y) +#define CONCAT2(X,Y) X ## Y +int CONCAT(constexpr,ession); + +#define ID(X) X +extern int ID(decltype); // expected-warning {{'decltype' is a keyword in C++11}} + +extern int CONCAT(align,of); // expected-warning {{'alignof' is a keyword in C++11}} + +#define static_assert(b, s) int CONCAT(check, __LINE__)[(b) ? 1 : 0]; +static_assert(1 > 0, "hello"); // ok + +#define IF_CXX11(CXX11, CXX03) CXX03 +typedef IF_CXX11(char16_t, wchar_t) my_wide_char_t; // ok + +int alignas; // expected-warning {{'alignas' is a keyword in C++11}} +int alignof; // already diagnosed in this TU +int char16_t; // expected-warning {{'char16_t' is a keyword in C++11}} +int char32_t; // expected-warning {{'char32_t' is a keyword in C++11}} +int constexpr; // expected-warning {{'constexpr' is a keyword in C++11}} +int decltype; // already diagnosed in this TU +int noexcept; // expected-warning {{'noexcept' is a keyword in C++11}} +int nullptr; // already diagnosed in this TU +int static_assert; // expected-warning {{'static_assert' is a keyword in C++11}} +int thread_local; // expected-warning {{'thread_local' is a keyword in C++11}} diff --git a/test/Lexer/cxx0x_raw_string_delim_length.cpp b/test/Lexer/cxx0x_raw_string_delim_length.cpp new file mode 100644 index 000000000000..e7d5c6f8cd27 --- /dev/null +++ b/test/Lexer/cxx0x_raw_string_delim_length.cpp @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string delimiter longer than 16 characters' + +const char *str = R"abcdefghijkmnopqrstuvwxyz(abcdef)abcdefghijkmnopqrstuvwxyz"; diff --git a/test/Lexer/cxx0x_raw_string_unterminated.cpp b/test/Lexer/cxx0x_raw_string_unterminated.cpp new file mode 100644 index 000000000000..dfbaaeee1e72 --- /dev/null +++ b/test/Lexer/cxx0x_raw_string_unterminated.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string missing terminating delimiter )foo"' + +const char *str = R"foo(abc +def)bar"; diff --git a/test/Lexer/has_extension.c b/test/Lexer/has_extension.c index bc75a4a1c546..4c322c7ce7a3 100644 --- a/test/Lexer/has_extension.c +++ b/test/Lexer/has_extension.c @@ -28,3 +28,11 @@ int has_c_generic_selections(); int no_c_generic_selections(); #endif +// CHECK-PED-NONE: has_c_alignas +// CHECK-PED-ERR: no_c_alignas +#if __has_extension(c_alignas) +int has_c_alignas(); +#else +int no_c_alignas(); +#endif + diff --git a/test/Lexer/has_extension_cxx.cpp b/test/Lexer/has_extension_cxx.cpp index 77efa357938c..5481b596cc4a 100644 --- a/test/Lexer/has_extension_cxx.cpp +++ b/test/Lexer/has_extension_cxx.cpp @@ -25,6 +25,11 @@ int has_inline_namespaces(); int has_override_control(); #endif +// CHECK: has_range_for +#if __has_extension(cxx_range_for) +int has_range_for(); +#endif + // CHECK: has_reference_qualified_functions #if __has_extension(cxx_reference_qualified_functions) int has_reference_qualified_functions(); diff --git a/test/Lexer/has_feature_c1x.c b/test/Lexer/has_feature_c1x.c index 6c0fb212cce3..ca4e9b95ad04 100644 --- a/test/Lexer/has_feature_c1x.c +++ b/test/Lexer/has_feature_c1x.c @@ -18,3 +18,12 @@ int no_generic_selections(); // CHECK-1X: has_generic_selections // CHECK-NO-1X: no_generic_selections + +#if __has_feature(c_alignas) +int has_alignas(); +#else +int no_alignas(); +#endif + +// CHECK-1X: has_alignas +// CHECK-NO-1X: no_alignas diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index ca5f868d9b05..f2b4576b57e9 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -E -std=c++0x %s -o - | FileCheck --check-prefix=CHECK-0X %s +// RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s // RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s #if __has_feature(cxx_lambdas) @@ -164,3 +164,21 @@ int no_alias_templates(); // CHECK-0X: has_alias_templates // CHECK-NO-0X: no_alias_templates + +#if __has_feature(cxx_implicit_moves) +int has_implicit_moves(); +#else +int no_implicit_moves(); +#endif + +// CHECK-0X: has_implicit_moves +// CHECK-NO-0X: no_implicit_moves + +#if __has_feature(cxx_alignas) +int has_alignas(); +#else +int no_alignas(); +#endif + +// CHECK-0X: has_alignas +// CHECK-NO-0X: no_alignas diff --git a/test/Lexer/has_feature_objc_arc.m b/test/Lexer/has_feature_objc_arc.m index cd41900c60b7..279b91af39cd 100644 --- a/test/Lexer/has_feature_objc_arc.m +++ b/test/Lexer/has_feature_objc_arc.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -E %s -fobjc-nonfragile-abi -fobjc-arc "-triple" "x86_64-apple-macosx10.7.0" -fobjc-runtime-has-weak | FileCheck --check-prefix=CHECK-ARC %s -// RUN: %clang_cc1 -E %s -fobjc-nonfragile-abi -fobjc-arc "-triple" "x86_64-apple-macosx10.6.0" | FileCheck --check-prefix=CHECK-ARCLITE %s +// RUN: %clang_cc1 -E %s -fobjc-arc "-triple" "x86_64-apple-macosx10.7.0" -fobjc-runtime-has-weak | FileCheck --check-prefix=CHECK-ARC %s +// RUN: %clang_cc1 -E %s -fobjc-arc "-triple" "x86_64-apple-macosx10.6.0" | FileCheck --check-prefix=CHECK-ARCLITE %s #if __has_feature(objc_arc) void has_objc_arc_feature(); diff --git a/test/Lexer/has_feature_type_traits.cpp b/test/Lexer/has_feature_type_traits.cpp index 5da845f06512..53056a02b72a 100644 --- a/test/Lexer/has_feature_type_traits.cpp +++ b/test/Lexer/has_feature_type_traits.cpp @@ -99,3 +99,8 @@ int is_standard_layout(); int is_trivially_copyable(); #endif // CHECK: int is_trivially_copyable(); + +#if __has_feature(underlying_type) +int underlying_type(); +#endif +// CHECK: int underlying_type(); diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp index 493b64e62740..23daa49ad210 100644 --- a/test/Lexer/hexfloat.cpp +++ b/test/Lexer/hexfloat.cpp @@ -1,9 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s -// XFAIL: * +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s +float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}} -#ifndef __GXX_EXPERIMENTAL_CXX0X__ -float f = 0x1p+1; // expected-warning {{incompatible with C++0x}} -#else -float f = 0x1p+1; // expected-warning {{invalid suffix}} -#endif diff --git a/test/Lexer/newline-eof.c b/test/Lexer/newline-eof.c new file mode 100644 index 000000000000..2f95dc7593c7 --- /dev/null +++ b/test/Lexer/newline-eof.c @@ -0,0 +1,5 @@ +// RUN: %clang -fsyntax-only -Wnewline-eof -verify %s +// rdar://9133072 + +// The following line isn't terminated, don't fix it. +void foo() {} // expected-warning{{No newline at end of file}}
\ No newline at end of file diff --git a/test/Lexer/preamble.c b/test/Lexer/preamble.c index 7735b475e1ae..5b2739abefcc 100644 --- a/test/Lexer/preamble.c +++ b/test/Lexer/preamble.c @@ -1,5 +1,5 @@ // Preamble detection test: see below for comments and test commands. -// +//* A BCPL comment that includes '/*' #include <blah> #ifndef FOO #else @@ -24,7 +24,7 @@ int foo(); // RUN: FileCheck < %t %s // CHECK: // Preamble detection test: see below for comments and test commands. -// CHECK-NEXT: // +// CHECK-NEXT: //* A BCPL comment that includes '/*' // CHECK-NEXT: #include <blah> // CHECK-NEXT: #ifndef FOO // CHECK-NEXT: #else diff --git a/test/Lexer/string_concat.cpp b/test/Lexer/string_concat.cpp new file mode 100644 index 000000000000..43782bce8c50 --- /dev/null +++ b/test/Lexer/string_concat.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +void f() { + + const char* a = u8"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* b = u8"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* c = u8"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* d = u8"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* e = u8"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char* f = u8"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + + const char16_t* g = u"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* h = u"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* i = u"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* j = u"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* k = u"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char16_t* l = u"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + + const char32_t* m = U"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* n = U"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* o = U"abc" L"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* p = U"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* q = U"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const char32_t* r = U"abc" LR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + + const wchar_t* s = L"abc" u8"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* t = L"abc" u"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* u = L"abc" U"abc"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* v = L"abc" u8R"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* w = L"abc" uR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} + const wchar_t* x = L"abc" UR"(abc)"; // expected-error {{ unsupported non-standard concatenation of string literals }} +} + diff --git a/test/Lexer/utf8-char-literal.cpp b/test/Lexer/utf8-char-literal.cpp new file mode 100644 index 000000000000..c4ea5fc3c3e9 --- /dev/null +++ b/test/Lexer/utf8-char-literal.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -fsyntax-only -verify %s + +int array0[u'ñ' == u'\xf1'? 1 : -1]; +int array1['ñ' != u'\xf1'? 1 : -1]; diff --git a/test/Lexer/wchar.c b/test/Lexer/wchar.c index ac82c1f73b4d..648a38ef3f9a 100644 --- a/test/Lexer/wchar.c +++ b/test/Lexer/wchar.c @@ -5,8 +5,8 @@ void f() { (void)L'\U00010000'; // expected-warning {{character unicode escape sequence too long for its type}} - (void)L'ab'; // expected-warning {{extraneous characters in wide character constant ignored}} + (void)L'ab'; // expected-warning {{extraneous characters in character constant ignored}} - (void)L'a\u1000'; // expected-warning {{extraneous characters in wide character constant ignored}} + (void)L'a\u1000'; // expected-warning {{extraneous characters in character constant ignored}} } diff --git a/test/Misc/ast-dump-templates.cpp b/test/Misc/ast-dump-templates.cpp new file mode 100644 index 000000000000..7d56e7b04eb2 --- /dev/null +++ b/test/Misc/ast-dump-templates.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -ast-dump %s > %t +// RUN: FileCheck < %t %s -check-prefix=CHECK1 +// RUN: FileCheck < %t %s -check-prefix=CHECK2 + +template <int X, typename Y, int Z = 5> +struct foo { + int constant; + foo() {} + Y getSum() { return Y(X + Z); } +}; + +template <int A, typename B> +B bar() { + return B(A); +} + +void baz() { + int x = bar<5, int>(); + int y = foo<5, int>().getSum(); + double z = foo<2, double, 3>().getSum(); +} + +// Template instantiation - foo +// Since the order of instantiation may vary during runs, run FileCheck twice +// to make sure each instantiation is in the correct spot. +// CHECK1: template <int X = 5, typename Y = int, int Z = 5> struct foo { +// CHECK2: template <int X = 2, typename Y = double, int Z = 3> struct foo { + +// Template definition - foo +// CHECK1: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5) +// CHECK2: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5) + +// Template instantiation - bar +// CHECK1: template <int A = 5, typename B = int> int bar() +// CHECK2: template <int A = 5, typename B = int> int bar() + +// Template definition - bar +// CHECK1: template <int A, typename B> B bar() +// CHECK2: template <int A, typename B> B bar() diff --git a/test/Misc/caret-diags-macros.c b/test/Misc/caret-diags-macros.c index ac83ecc69525..3d2e576d6414 100644 --- a/test/Misc/caret-diags-macros.c +++ b/test/Misc/caret-diags-macros.c @@ -113,11 +113,8 @@ void test3() { // CHECK: {{.*}}:102:41: note: expanded from: variadic_pasting_args3a(1, 2, 3, 4); - // FIXME: It'd be really nice to retain the start location of the first token - // involved in the token paste instead of falling back on the full macro - // location in the first two locations here. - // CHECK: {{.*}}:115:3: warning: expression result unused - // CHECK: {{.*}}:106:44: note: expanded from: - // CHECK: {{.*}}:104:72: note: expanded from: + // CHECK: {{.*}}:115:30: warning: expression result unused + // CHECK: {{.*}}:106:71: note: expanded from: + // CHECK: {{.*}}:104:70: note: expanded from: // CHECK: {{.*}}:102:41: note: expanded from: } diff --git a/test/Misc/diag-aka-types.cpp b/test/Misc/diag-aka-types.cpp index 042c70b18a75..0339b7b63e82 100644 --- a/test/Misc/diag-aka-types.cpp +++ b/test/Misc/diag-aka-types.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++0x +// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11 struct X {}; typedef X foo_t; diff --git a/test/Misc/diag-line-wrapping.cpp b/test/Misc/diag-line-wrapping.cpp new file mode 100644 index 000000000000..830aa1340831 --- /dev/null +++ b/test/Misc/diag-line-wrapping.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -fmessage-length 60 %s 2>&1 | FileCheck %s + +struct B { void f(); }; +struct D1 : B {}; +struct D2 : B {}; +struct DD : D1, D2 { + void g() { f(); } + // Ensure that after line-wrapping takes place, we preserve artificial + // newlines introduced to manually format a section of the diagnostic text. + // CHECK: {{.*}}: error: + // CHECK: struct DD -> struct D1 -> struct B + // CHECK: struct DD -> struct D2 -> struct B +} diff --git a/test/Misc/error-limit-multiple-notes.cpp b/test/Misc/error-limit-multiple-notes.cpp new file mode 100644 index 000000000000..019b4dde2633 --- /dev/null +++ b/test/Misc/error-limit-multiple-notes.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -ferror-limit 1 -fsyntax-only %s 2>&1 | FileCheck %s + +// error and three notes emitted +void foo(int); +void foo(double); +void foo(int, int); + +int main() +{ + foo(); +} + +// error and note suppressed by error-limit +struct s1{}; +struct s1{}; + +// CHECK: 10:5: error: no matching function for call to 'foo' +// CHECK: 6:6: note: candidate function not viable: requires 2 arguments, but 0 were provided +// CHECK: 5:6: note: candidate function not viable: requires 1 argument, but 0 were provided +// CHECK: 4:6: note: candidate function not viable: requires 1 argument, but 0 were provided +// CHECK: fatal error: too many errors emitted, stopping now +// CHECK-NOT: 15:8: error: redefinition of 's1' +// CHECK-NOT: 14:8: note: previous definition is here diff --git a/test/Misc/error-limit.c b/test/Misc/error-limit.c new file mode 100644 index 000000000000..26f4ac1d8a5e --- /dev/null +++ b/test/Misc/error-limit.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -ferror-limit 1 -fsyntax-only %s 2>&1 | FileCheck %s + +// error and note emitted +struct s1{}; +struct s1{}; + +// error and note suppressed by error-limit +struct s2{}; +struct s2{}; + +// CHECK: 5:8: error: redefinition of 's1' +// CHECK: 4:8: note: previous definition is here +// CHECK: fatal error: too many errors emitted, stopping now +// CHECK-NOT: 9:8: error: redefinition of 's2' +// CHECK-NOT: 8:8: note: previous definition is here diff --git a/test/Misc/show-diag-options.c b/test/Misc/show-diag-options.c new file mode 100644 index 000000000000..f0404a8555de --- /dev/null +++ b/test/Misc/show-diag-options.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=BASE +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=OPTION +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -Werror %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=OPTION_ERROR +// RUN: %clang_cc1 -fsyntax-only -std=c89 -pedantic -fdiagnostics-show-option %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=OPTION_PEDANTIC +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category id %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CATEGORY_ID +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category name %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CATEGORY_NAME +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -fdiagnostics-show-category name -Werror %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=OPTION_ERROR_CATEGORY + +void test(int x, int y) { + if (x = y) ++x; + // BASE: {{.*}}: warning: {{[a-z ]+$}} + // OPTION: {{.*}}: warning: {{[a-z ]+}} [-Wparentheses] + // OPTION_ERROR: {{.*}}: error: {{[a-z ]+}} [-Werror,-Wparentheses] + // CATEGORY_ID: {{.*}}: warning: {{[a-z ]+}} [2] + // CATEGORY_NAME: {{.*}}: warning: {{[a-z ]+}} [Semantic Issue] + // OPTION_ERROR_CATEGORY: {{.*}}: error: {{[a-z ]+}} [-Werror,-Wparentheses,Semantic Issue] + + // Leverage the fact that all these '//'s get warned about in C89 pedantic. + // OPTION_PEDANTIC: {{.*}}: warning: {{[/a-z ]+}} [-pedantic,-Wcomment] +} diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c new file mode 100644 index 000000000000..2f7103ab1cd2 --- /dev/null +++ b/test/Misc/warning-flags.c @@ -0,0 +1,317 @@ +RUN: diagtool list-warnings 2>&1 | FileCheck %s + +This test serves two purposes: + +(1) It documents all existing warnings that currently have no associated -W flag, + and ensures that the list never grows. + + If take an existing warning and add a flag, this test will fail. To + fix this test, simply remove that warning from the list below. + +(2) It prevents us adding new warnings to Clang that have no -W flag. All + new warnings should have -W flags. + + If you add a new warning without a flag, this test will fail. To fix + this test, simply add a warning group to that warning. + + +The list of warnings below should NEVER grow. It should gradually shrink to 0. + +CHECK: Warnings without flags (297): +CHECK-NEXT: backslash_newline_space +CHECK-NEXT: charize_microsoft_ext +CHECK-NEXT: ext_anon_param_requires_type_specifier +CHECK-NEXT: ext_anonymous_struct_union_qualified +CHECK-NEXT: ext_array_init_copy +CHECK-NEXT: ext_auto_storage_class +CHECK-NEXT: ext_binary_literal +CHECK-NEXT: ext_c99_array_usage +CHECK-NEXT: ext_c99_compound_literal +CHECK-NEXT: ext_c99_variable_decl_in_for_loop +CHECK-NEXT: ext_c99_whitespace_required_after_macro_name +CHECK-NEXT: ext_cast_fn_obj +CHECK-NEXT: ext_catch_incomplete_ptr +CHECK-NEXT: ext_catch_incomplete_ref +CHECK-NEXT: ext_delete_void_ptr_operand +CHECK-NEXT: ext_designated_init +CHECK-NEXT: ext_designated_init_cxx +CHECK-NEXT: ext_dollar_in_identifier +CHECK-NEXT: ext_duplicate_declspec +CHECK-NEXT: ext_ellipsis_exception_spec +CHECK-NEXT: ext_embedded_directive +CHECK-NEXT: ext_empty_fnmacro_arg +CHECK-NEXT: ext_empty_source_file +CHECK-NEXT: ext_enum_friend +CHECK-NEXT: ext_enum_value_not_int +CHECK-NEXT: ext_enumerator_list_comma +CHECK-NEXT: ext_expected_semi_decl_list +CHECK-NEXT: ext_explicit_instantiation_without_qualified_id +CHECK-NEXT: ext_explicit_specialization_storage_class +CHECK-NEXT: ext_expr_not_ice +CHECK-NEXT: ext_extra_ivar_semi +CHECK-NEXT: ext_extra_struct_semi +CHECK-NEXT: ext_flexible_array_in_array +CHECK-NEXT: ext_flexible_array_in_struct +CHECK-NEXT: ext_forward_ref_enum +CHECK-NEXT: ext_freestanding_complex +CHECK-NEXT: ext_hexconstant_invalid +CHECK-NEXT: ext_ident_list_in_param +CHECK-NEXT: ext_imaginary_constant +CHECK-NEXT: ext_implicit_lib_function_decl +CHECK-NEXT: ext_in_class_initializer_non_constant +CHECK-NEXT: ext_integer_complement_complex +CHECK-NEXT: ext_integer_complex +CHECK-NEXT: ext_integer_increment_complex +CHECK-NEXT: ext_invalid_sign_spec +CHECK-NEXT: ext_missing_declspec +CHECK-NEXT: ext_missing_varargs_arg +CHECK-NEXT: ext_missing_whitespace_after_macro_name +CHECK-NEXT: ext_new_paren_array_nonconst +CHECK-NEXT: ext_nonstandard_escape +CHECK-NEXT: ext_offsetof_extended_field_designator +CHECK-NEXT: ext_param_not_declared +CHECK-NEXT: ext_param_promoted_not_compatible_with_prototype +CHECK-NEXT: ext_paste_comma +CHECK-NEXT: ext_plain_complex +CHECK-NEXT: ext_pp_bad_vaargs_use +CHECK-NEXT: ext_pp_comma_expr +CHECK-NEXT: ext_pp_ident_directive +CHECK-NEXT: ext_pp_import_directive +CHECK-NEXT: ext_pp_include_next_directive +CHECK-NEXT: ext_pp_line_too_big +CHECK-NEXT: ext_pp_macro_redef +CHECK-NEXT: ext_pp_warning_directive +CHECK-NEXT: ext_return_has_void_expr +CHECK-NEXT: ext_subscript_non_lvalue +CHECK-NEXT: ext_template_arg_extra_parens +CHECK-NEXT: ext_thread_before +CHECK-NEXT: ext_top_level_semi +CHECK-NEXT: ext_typecheck_addrof_void +CHECK-NEXT: ext_typecheck_cast_nonscalar +CHECK-NEXT: ext_typecheck_cast_to_union +CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers +CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers_nonstandard +CHECK-NEXT: ext_typecheck_comparison_of_fptr_to_void +CHECK-NEXT: ext_typecheck_comparison_of_pointer_integer +CHECK-NEXT: ext_typecheck_cond_incompatible_operands +CHECK-NEXT: ext_typecheck_cond_incompatible_operands_nonstandard +CHECK-NEXT: ext_typecheck_cond_one_void +CHECK-NEXT: ext_typecheck_convert_int_pointer +CHECK-NEXT: ext_typecheck_convert_pointer_int +CHECK-NEXT: ext_typecheck_convert_pointer_void_func +CHECK-NEXT: ext_typecheck_ordered_comparison_of_function_pointers +CHECK-NEXT: ext_typecheck_ordered_comparison_of_pointer_and_zero +CHECK-NEXT: ext_typecheck_ordered_comparison_of_pointer_integer +CHECK-NEXT: ext_typecheck_zero_array_size +CHECK-NEXT: ext_unknown_escape +CHECK-NEXT: ext_using_undefined_std +CHECK-NEXT: ext_vla_folded_to_constant +CHECK-NEXT: null_in_char +CHECK-NEXT: null_in_file +CHECK-NEXT: null_in_string +CHECK-NEXT: pp_include_next_absolute_path +CHECK-NEXT: pp_include_next_in_primary +CHECK-NEXT: pp_invalid_string_literal +CHECK-NEXT: pp_out_of_date_dependency +CHECK-NEXT: pp_poisoning_existing_macro +CHECK-NEXT: pp_pragma_once_in_main_file +CHECK-NEXT: pp_pragma_sysheader_in_main_file +CHECK-NEXT: pp_undef_builtin_macro +CHECK-NEXT: w_asm_qualifier_ignored +CHECK-NEXT: warn_accessor_property_type_mismatch +CHECK-NEXT: warn_anon_bitfield_width_exceeds_type_size +CHECK-NEXT: warn_asm_label_on_auto_decl +CHECK-NEXT: warn_attribute_ibaction +CHECK-NEXT: warn_attribute_iboutlet +CHECK-NEXT: warn_attribute_ignored +CHECK-NEXT: warn_attribute_ignored_for_field_of_type +CHECK-NEXT: warn_attribute_malloc_pointer_only +CHECK-NEXT: warn_attribute_method_def +CHECK-NEXT: warn_attribute_nonnull_no_pointers +CHECK-NEXT: warn_attribute_precede_definition +CHECK-NEXT: warn_attribute_sentinel_named_arguments +CHECK-NEXT: warn_attribute_sentinel_not_variadic +CHECK-NEXT: warn_attribute_type_not_supported +CHECK-NEXT: warn_attribute_unknown_visibility +CHECK-NEXT: warn_attribute_void_function_method +CHECK-NEXT: warn_attribute_weak_import_invalid_on_definition +CHECK-NEXT: warn_attribute_weak_on_field +CHECK-NEXT: warn_attribute_weak_on_local +CHECK-NEXT: warn_attribute_wrong_decl_type +CHECK-NEXT: warn_availability_and_unavailable +CHECK-NEXT: warn_availability_unknown_platform +CHECK-NEXT: warn_availability_version_ordering +CHECK-NEXT: warn_bad_receiver_type +CHECK-NEXT: warn_bitfield_width_exceeds_type_size +CHECK-NEXT: warn_bool_switch_condition +CHECK-NEXT: warn_braces_around_scalar_init +CHECK-NEXT: warn_builtin_unknown +CHECK-NEXT: warn_c_kext +CHECK-NEXT: warn_call_to_pure_virtual_member_function_from_ctor_dtor +CHECK-NEXT: warn_call_wrong_number_of_arguments +CHECK-NEXT: warn_case_empty_range +CHECK-NEXT: warn_char_constant_too_large +CHECK-NEXT: warn_class_method_not_found +CHECK-NEXT: warn_cmdline_missing_macro_defs +CHECK-NEXT: warn_collection_expr_type +CHECK-NEXT: warn_conflicting_param_types +CHECK-NEXT: warn_conflicting_ret_types +CHECK-NEXT: warn_conflicting_variadic +CHECK-NEXT: warn_conv_to_base_not_used +CHECK-NEXT: warn_conv_to_self_not_used +CHECK-NEXT: warn_conv_to_void_not_used +CHECK-NEXT: warn_cxx0x_right_shift_in_template_arg +CHECK-NEXT: warn_decl_in_param_list +CHECK-NEXT: warn_delete_array_type +CHECK-NEXT: warn_delete_incomplete +CHECK-NEXT: warn_division_by_zero +CHECK-NEXT: warn_double_const_requires_fp64 +CHECK-NEXT: warn_drv_assuming_mfloat_abi_is +CHECK-NEXT: warn_drv_clang_unsupported +CHECK-NEXT: warn_drv_conflicting_deployment_targets +CHECK-NEXT: warn_drv_input_file_unused +CHECK-NEXT: warn_drv_not_using_clang_arch +CHECK-NEXT: warn_drv_not_using_clang_cpp +CHECK-NEXT: warn_drv_not_using_clang_cxx +CHECK-NEXT: warn_drv_objc_gc_unsupported +CHECK-NEXT: warn_drv_pch_not_first_include +CHECK-NEXT: warn_drv_pipe_ignored_with_save_temps +CHECK-NEXT: warn_drv_preprocessed_input_file_unused +CHECK-NEXT: warn_drv_unsupported_option_argument +CHECK-NEXT: warn_drv_unused_argument +CHECK-NEXT: warn_dup_category_def +CHECK-NEXT: warn_duplicate_protocol_def +CHECK-NEXT: warn_enum_too_large +CHECK-NEXT: warn_enum_value_overflow +CHECK-NEXT: warn_enumerator_too_large +CHECK-NEXT: warn_exception_caught_by_earlier_handler +CHECK-NEXT: warn_excess_initializers +CHECK-NEXT: warn_excess_initializers_in_char_array_initializer +CHECK-NEXT: warn_expected_qualified_after_typename +CHECK-NEXT: warn_extern_init +CHECK-NEXT: warn_extraneous_char_constant +CHECK-NEXT: warn_fe_cc_log_diagnostics_failure +CHECK-NEXT: warn_fe_cc_print_header_failure +CHECK-NEXT: warn_fe_macro_contains_embedded_newline +CHECK-NEXT: warn_file_asm_volatile +CHECK-NEXT: warn_function_attribute_wrong_type +CHECK-NEXT: warn_gc_attribute_weak_on_local +CHECK-NEXT: warn_gnu_inline_attribute_requires_inline +CHECK-NEXT: warn_hex_escape_too_large +CHECK-NEXT: warn_ignoring_ftabstop_value +CHECK-NEXT: warn_illegal_constant_array_size +CHECK-NEXT: warn_implements_nscopying +CHECK-NEXT: warn_implicit_decl_requires_setjmp +CHECK-NEXT: warn_implicit_decl_requires_stdio +CHECK-NEXT: warn_incompatible_qualified_id +CHECK-NEXT: warn_initializer_string_for_char_array_too_long +CHECK-NEXT: warn_inline_namespace_reopened_noninline +CHECK-NEXT: warn_inst_method_not_found +CHECK-NEXT: warn_instance_method_on_class_found +CHECK-NEXT: warn_integer_too_large +CHECK-NEXT: warn_integer_too_large_for_signed +CHECK-NEXT: warn_invalid_asm_cast_lvalue +CHECK-NEXT: warn_label_attribute_not_unused +CHECK-NEXT: warn_many_braces_around_scalar_init +CHECK-NEXT: warn_maynot_respond +CHECK-NEXT: warn_member_extra_qualification +CHECK-NEXT: warn_method_param_redefinition +CHECK-NEXT: warn_mismatched_exception_spec +CHECK-NEXT: warn_missing_case_for_condition +CHECK-NEXT: warn_missing_dependent_template_keyword +CHECK-NEXT: warn_missing_exception_specification +CHECK-NEXT: warn_missing_whitespace_after_macro_name +CHECK-NEXT: warn_multiple_method_decl +CHECK-NEXT: warn_no_constructor_for_refconst +CHECK-NEXT: warn_nonnull_pointers_only +CHECK-NEXT: warn_not_compound_assign +CHECK-NEXT: warn_ns_attribute_wrong_parameter_type +CHECK-NEXT: warn_ns_attribute_wrong_return_type +CHECK-NEXT: warn_objc_object_attribute_wrong_type +CHECK-NEXT: warn_objc_property_copy_missing_on_block +CHECK-NEXT: warn_objc_property_default_assign_on_object +CHECK-NEXT: warn_objc_property_no_assignment_attribute +CHECK-NEXT: warn_objc_protocol_qualifier_missing_id +CHECK-NEXT: warn_octal_escape_too_large +CHECK-NEXT: warn_odr_tag_type_inconsistent +CHECK-NEXT: warn_on_superclass_use +CHECK-NEXT: warn_param_default_argument_redefinition +CHECK-NEXT: warn_parens_disambiguated_as_function_decl +CHECK-NEXT: warn_partial_specs_not_deducible +CHECK-NEXT: warn_pointer_attribute_wrong_type +CHECK-NEXT: warn_pp_convert_lhs_to_positive +CHECK-NEXT: warn_pp_convert_rhs_to_positive +CHECK-NEXT: warn_pp_expr_overflow +CHECK-NEXT: warn_pp_line_decimal +CHECK-NEXT: warn_pragma_align_expected_equal +CHECK-NEXT: warn_pragma_align_invalid_option +CHECK-NEXT: warn_pragma_debug_unexpected_command +CHECK-NEXT: warn_pragma_expected_colon +CHECK-NEXT: warn_pragma_expected_enable_disable +CHECK-NEXT: warn_pragma_expected_identifier +CHECK-NEXT: warn_pragma_expected_lparen +CHECK-NEXT: warn_pragma_expected_rparen +CHECK-NEXT: warn_pragma_extra_tokens_at_eol +CHECK-NEXT: warn_pragma_ms_struct +CHECK-NEXT: warn_pragma_options_align_reset_failed +CHECK-NEXT: warn_pragma_options_align_unsupported_option +CHECK-NEXT: warn_pragma_options_expected_align +CHECK-NEXT: warn_pragma_pack_invalid_action +CHECK-NEXT: warn_pragma_pack_invalid_alignment +CHECK-NEXT: warn_pragma_pack_invalid_constant +CHECK-NEXT: warn_pragma_pack_malformed +CHECK-NEXT: warn_pragma_pack_pop_failed +CHECK-NEXT: warn_pragma_pack_pop_identifer_and_alignment +CHECK-NEXT: warn_pragma_pack_show +CHECK-NEXT: warn_pragma_pop_macro_no_push +CHECK-NEXT: warn_pragma_unknown_extension +CHECK-NEXT: warn_pragma_unused_expected_punc +CHECK-NEXT: warn_pragma_unused_expected_var +CHECK-NEXT: warn_pragma_unused_expected_var_arg +CHECK-NEXT: warn_pragma_unused_undeclared_var +CHECK-NEXT: warn_previous_alias_decl +CHECK-NEXT: warn_printf_asterisk_missing_arg +CHECK-NEXT: warn_property_attr_mismatch +CHECK-NEXT: warn_property_attribute +CHECK-NEXT: warn_property_getter_owning_mismatch +CHECK-NEXT: warn_property_types_are_incompatible +CHECK-NEXT: warn_readonly_property +CHECK-NEXT: warn_receiver_forward_class +CHECK-NEXT: warn_redecl_library_builtin +CHECK-NEXT: warn_redeclaration_without_attribute_prev_attribute_ignored +CHECK-NEXT: warn_register_objc_catch_parm +CHECK-NEXT: warn_related_result_type_compatibility_class +CHECK-NEXT: warn_related_result_type_compatibility_protocol +CHECK-NEXT: warn_remainder_by_zero +CHECK-NEXT: warn_root_inst_method_not_found +CHECK-NEXT: warn_second_parameter_of_va_start_not_last_named_argument +CHECK-NEXT: warn_second_parameter_to_va_arg_never_compatible +CHECK-NEXT: warn_setter_getter_impl_required +CHECK-NEXT: warn_setter_getter_impl_required_in_category +CHECK-NEXT: warn_standalone_specifier +CHECK-NEXT: warn_static_inline_explicit_inst_ignored +CHECK-NEXT: warn_static_non_static +CHECK-NEXT: warn_template_export_unsupported +CHECK-NEXT: warn_template_spec_extra_headers +CHECK-NEXT: warn_tentative_incomplete_array +CHECK-NEXT: warn_transparent_union_attribute_field_size_align +CHECK-NEXT: warn_transparent_union_attribute_floating +CHECK-NEXT: warn_transparent_union_attribute_not_definition +CHECK-NEXT: warn_transparent_union_attribute_zero_fields +CHECK-NEXT: warn_transparent_union_nonpointer +CHECK-NEXT: warn_typecheck_function_qualifiers +CHECK-NEXT: warn_ucn_escape_too_large +CHECK-NEXT: warn_ucn_not_valid_in_c89 +CHECK-NEXT: warn_unavailable_fwdclass_message +CHECK-NEXT: warn_undef_interface +CHECK-NEXT: warn_undef_interface_suggest +CHECK-NEXT: warn_undef_protocolref +CHECK-NEXT: warn_undefined_internal +CHECK-NEXT: warn_uninit_val +CHECK-NEXT: warn_unknown_analyzer_checker +CHECK-NEXT: warn_unknown_method_family +CHECK-NEXT: warn_unterminated_char +CHECK-NEXT: warn_unterminated_string +CHECK-NEXT: warn_use_out_of_scope_declaration +CHECK-NEXT: warn_weak_identifier_undeclared +CHECK-NEXT: warn_weak_import diff --git a/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h b/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h new file mode 100644 index 000000000000..46b8fc0425a6 --- /dev/null +++ b/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h @@ -0,0 +1,6 @@ +#ifdef FOO_RETURNS_INT_PTR +int *foo(void); +#else +float *foo(void); +#endif + diff --git a/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h b/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h new file mode 100644 index 000000000000..fa4069774561 --- /dev/null +++ b/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h @@ -0,0 +1,3 @@ +#include <Module/Module.h> + +#define DEPENDS_ON_MODULE 1 diff --git a/test/Modules/Inputs/Module.framework/Headers/Module.h b/test/Modules/Inputs/Module.framework/Headers/Module.h new file mode 100644 index 000000000000..7c7ef6ea10e9 --- /dev/null +++ b/test/Modules/Inputs/Module.framework/Headers/Module.h @@ -0,0 +1,12 @@ +const char *getModuleVersion(void); + +#ifdef FOO +# error Module should have been built without -DFOO +#endif + +@interface Module ++(const char *)version; // retrieve module version ++alloc; +@end + +#define MODULE_H_MACRO 1 diff --git a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h new file mode 100644 index 000000000000..2a8282cc0119 --- /dev/null +++ b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h @@ -0,0 +1,3 @@ + +__import_module__ MutuallyRecursive2; + diff --git a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h new file mode 100644 index 000000000000..98008533f307 --- /dev/null +++ b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h @@ -0,0 +1,6 @@ + + +__import_module__ MutuallyRecursive1; + + + diff --git a/test/Modules/Inputs/diamond_bottom.h b/test/Modules/Inputs/diamond_bottom.h new file mode 100644 index 000000000000..e0b06d6cd972 --- /dev/null +++ b/test/Modules/Inputs/diamond_bottom.h @@ -0,0 +1,4 @@ +__import_module__ diamond_left; +__import_module__ diamond_right; + +char bottom(char *x); diff --git a/test/Modules/Inputs/diamond_left.h b/test/Modules/Inputs/diamond_left.h new file mode 100644 index 000000000000..88cbf60977b3 --- /dev/null +++ b/test/Modules/Inputs/diamond_left.h @@ -0,0 +1,9 @@ +__import_module__ diamond_top; + +float left(float *); + +int top_left(char *c); + +int left_and_right(int*); + + diff --git a/test/Modules/Inputs/diamond_right.h b/test/Modules/Inputs/diamond_right.h new file mode 100644 index 000000000000..6f8bb82f8d24 --- /dev/null +++ b/test/Modules/Inputs/diamond_right.h @@ -0,0 +1,7 @@ +__import_module__ diamond_top; + +double right(double *); + +struct left_and_right { + int left, right; +}; diff --git a/test/Modules/Inputs/diamond_top.h b/test/Modules/Inputs/diamond_top.h new file mode 100644 index 000000000000..34998cd4324b --- /dev/null +++ b/test/Modules/Inputs/diamond_top.h @@ -0,0 +1,4 @@ +int top(int *); + +int top_left(char *c); + diff --git a/test/Modules/Inputs/load_failure.h b/test/Modules/Inputs/load_failure.h new file mode 100644 index 000000000000..5bcb44dcb3dc --- /dev/null +++ b/test/Modules/Inputs/load_failure.h @@ -0,0 +1 @@ +int fail(int); diff --git a/test/Modules/Inputs/lookup_left.h b/test/Modules/Inputs/lookup_left.h new file mode 100644 index 000000000000..01723d40aa7a --- /dev/null +++ b/test/Modules/Inputs/lookup_left.h @@ -0,0 +1,3 @@ +@interface A +- (int)method; +@end diff --git a/test/Modules/Inputs/lookup_left.hpp b/test/Modules/Inputs/lookup_left.hpp new file mode 100644 index 000000000000..66d6206137b8 --- /dev/null +++ b/test/Modules/Inputs/lookup_left.hpp @@ -0,0 +1,5 @@ +int *f0(int*); + +#pragma weak weak_identifier // expected-warning{{weak identifier 'weak_identifier' never declared}} + + diff --git a/test/Modules/Inputs/lookup_right.h b/test/Modules/Inputs/lookup_right.h new file mode 100644 index 000000000000..f8f0c97d6818 --- /dev/null +++ b/test/Modules/Inputs/lookup_right.h @@ -0,0 +1,5 @@ + +@interface B +- (double)method; +@end + diff --git a/test/Modules/Inputs/lookup_right.hpp b/test/Modules/Inputs/lookup_right.hpp new file mode 100644 index 000000000000..884534747f69 --- /dev/null +++ b/test/Modules/Inputs/lookup_right.hpp @@ -0,0 +1 @@ +float *f0(float*); diff --git a/test/Modules/Inputs/point.h b/test/Modules/Inputs/point.h new file mode 100644 index 000000000000..eab23d5867a8 --- /dev/null +++ b/test/Modules/Inputs/point.h @@ -0,0 +1,2 @@ +struct Point { int x, y; }; + diff --git a/test/Modules/auto-module-import.c b/test/Modules/auto-module-import.c new file mode 100644 index 000000000000..018717423876 --- /dev/null +++ b/test/Modules/auto-module-import.c @@ -0,0 +1,13 @@ + +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c -fmodule-cache-path %t -fauto-module-import -F %S/Inputs -verify %s + +#include <DependsOnModule/DependsOnModule.h> + +#ifdef MODULE_H_MACRO +# error MODULE_H_MACRO should have been hidden +#endif + +#ifdef DEPENDS_ON_MODULE +# error DEPENDS_ON_MODULE should have been hidden +#endif diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c new file mode 100644 index 000000000000..8e3e9c631617 --- /dev/null +++ b/test/Modules/cycles.c @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s + +__import_module__ MutuallyRecursive1; + +// FIXME: Lots of redundant diagnostics here, because the preprocessor +// can't currently tell the parser not to try to load the module again. + +// CHECK: MutuallyRecursive2.h:3:19: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1 +// CHECK: MutuallyRecursive1.h:2:19: fatal error: could not build module 'MutuallyRecursive2' +// CHECK: cycles.c:4:19: fatal error: could not build module 'MutuallyRecursive1' + diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c new file mode 100644 index 000000000000..482836c44978 --- /dev/null +++ b/test/Modules/diamond.c @@ -0,0 +1,27 @@ + + + +// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}} + +__import_module__ diamond_bottom; + +void test_diamond(int i, float f, double d, char c) { + top(&i); + left(&f); + right(&d); + bottom(&c); + bottom(&d); // expected-warning{{incompatible pointer types passing 'double *' to parameter of type 'char *'}} + + // Names in multiple places in the diamond. + top_left(&c); + + left_and_right(&i); + struct left_and_right lr; + lr.left = 17; +} + +// RUN: %clang_cc1 -emit-module -o %T/diamond_top.pcm %S/Inputs/diamond_top.h +// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash -emit-module -o %T/diamond_left.pcm %S/Inputs/diamond_left.h +// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash -emit-module -o %T/diamond_right.pcm %S/Inputs/diamond_right.h +// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash -emit-module -o %T/diamond_bottom.pcm %S/Inputs/diamond_bottom.h +// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash %s -verify diff --git a/test/Modules/driver.c b/test/Modules/driver.c new file mode 100644 index 000000000000..de10cd0cecca --- /dev/null +++ b/test/Modules/driver.c @@ -0,0 +1,6 @@ +// RUN: %clang %s -### 2>&1 | FileCheck -check-prefix NO_MODULE_CACHE %s +// RUN: %clang -fmodule-cache-path blarg %s -### 2>&1 | FileCheck -check-prefix WITH_MODULE_CACHE %s + +// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodule-cache-path"}} + +// CHECK-WITH_MODULE_CACHE: {{clang.*"-fmodule-cache-path" "blarg"}} diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m new file mode 100644 index 000000000000..9996dc75c8b7 --- /dev/null +++ b/test/Modules/header-import.m @@ -0,0 +1,7 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s + +#import "point.h" +__import_module__ Module; +#import "point.h" + diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c new file mode 100644 index 000000000000..0debf05f5934 --- /dev/null +++ b/test/Modules/irgen.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -emit-module -triple x86_64-apple-darwin10 -o %t/module.pcm -DBUILD_MODULE %s +// RUN: %clang_cc1 -fmodule-cache-path %t -triple x86_64-apple-darwin10 -fdisable-module-hash -emit-llvm -o - %s | FileCheck %s + +#ifdef BUILD_MODULE +static inline int triple(int x) { return x * 3; } +#else +__import_module__ module; + +// CHECK: define void @triple_value +void triple_value(int *px) { + *px = triple(*px); +} + +// CHECK: define internal i32 @triple(i32 +#endif diff --git a/test/Modules/load_failure.c b/test/Modules/load_failure.c new file mode 100644 index 000000000000..d16bba7628b1 --- /dev/null +++ b/test/Modules/load_failure.c @@ -0,0 +1,19 @@ +#ifdef NONEXISTENT +__import_module__ load_nonexistent; +#endif + +#ifdef FAILURE +__import_module__ load_failure; +#endif + +// RUN: %clang_cc1 -x c++ -emit-module -o %T/load_failure.pcm %S/Inputs/load_failure.h +// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s +// CHECK-NONEXISTENT: load_failure.c:2:19: fatal error: module 'load_nonexistent' not found + +// RUN: not %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash %s -DFAILURE 2> %t +// RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t + +// FIXME: Clean up diagnostic text below and give it a location +// CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled + + diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp new file mode 100644 index 000000000000..d3245f2935f9 --- /dev/null +++ b/test/Modules/lookup.cpp @@ -0,0 +1,25 @@ + +#define import __import_module__ +import lookup_left_cxx; +#define IMPORT(X) __import_module__ X +IMPORT(lookup_right_cxx); + +void test(int i, float f) { + // unqualified lookup + f0(&i); + f0(&f); + + // qualified lookup into the translation unit + ::f0(&i); + ::f0(&f); +} + +// RUN: %clang_cc1 -emit-module -x c++ -verify -o %T/lookup_left_cxx.pcm %S/Inputs/lookup_left.hpp +// RUN: %clang_cc1 -emit-module -x c++ -o %T/lookup_right_cxx.pcm %S/Inputs/lookup_right.hpp +// RUN: %clang_cc1 -x c++ -fmodule-cache-path %T -fdisable-module-hash %s -verify +// RUN: %clang_cc1 -ast-print -x c++ -fmodule-cache-path %T -fdisable-module-hash %s | FileCheck -check-prefix=CHECK-PRINT %s + +// CHECK-PRINT: int *f0(int *); +// CHECK-PRINT: float *f0(float *); +// CHECK-PRINT: void test(int i, float f) + diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m new file mode 100644 index 000000000000..d45f93661b9a --- /dev/null +++ b/test/Modules/lookup.m @@ -0,0 +1,19 @@ + +// lookup_left.h: expected-note{{using}} +// lookup_right.h: expected-note{{also found}} +__import_module__ lookup_left_objc; +__import_module__ lookup_right_objc; + +void test(id x) { + [x method]; // expected-warning{{multiple methods named 'method' found}} +} + +// RUN: %clang_cc1 -emit-module -x objective-c -o %T/lookup_left_objc.pcm %S/Inputs/lookup_left.h +// RUN: %clang_cc1 -emit-module -x objective-c -o %T/lookup_right_objc.pcm %S/Inputs/lookup_right.h +// RUN: %clang_cc1 -x objective-c -fmodule-cache-path %T -fdisable-module-hash -verify %s +// RUN: %clang_cc1 -ast-print -x objective-c -fmodule-cache-path %T -fdisable-module-hash %s | FileCheck -check-prefix=CHECK-PRINT %s + +// CHECK-PRINT: - (int) method; +// CHECK-PRINT: - (double) method +// CHECK-PRINT: void test(id x) + diff --git a/test/Modules/macros.c b/test/Modules/macros.c new file mode 100644 index 000000000000..899c19bb29c9 --- /dev/null +++ b/test/Modules/macros.c @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s +// RUN: %clang_cc1 -verify -fmodule-cache-path %t -fdisable-module-hash %s +// RUN: %clang_cc1 -E -fmodule-cache-path %t -fdisable-module-hash %s | FileCheck -check-prefix CHECK-PREPROCESSED %s + +#if defined(MODULE) +#define INTEGER(X) int +#define FLOAT float +#define DOUBLE double + +#__export_macro__ INTEGER +#__export_macro__ DOUBLE + +int (INTEGER); + +#else + +__import_module__ macros; + +#ifndef INTEGER +# error INTEGER macro should be visible +#endif + +#ifdef FLOAT +# error FLOAT macro should not be visible +#endif + +#ifdef MODULE +# error MODULE macro should not be visible +#endif + +// CHECK-PREPROCESSED: double d +double d; +DOUBLE *dp = &d; + +#__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}} + +void f() { + // CHECK-PREPROCESSED: int i = INTEGER; + int i = INTEGER; // the value was exported, the macro was not. +} +#endif diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp new file mode 100644 index 000000000000..7bd2a205c055 --- /dev/null +++ b/test/Modules/module-private.cpp @@ -0,0 +1,140 @@ +// RUN: mkdir -p %t +// RUN: %clang_cc1 -x c++ -emit-module -o %t/left.pcm %s -D MODULE_LEFT +// RUN: %clang_cc1 -x c++ -emit-module -o %t/right.pcm %s -D MODULE_RIGHT +// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify + +#if defined(MODULE_LEFT) + +__module_private__ struct HiddenStruct; + +struct HiddenStruct { +}; + + +int &f0(int); + +template<typename T> +__module_private__ void f1(T*); + +template<typename T> +void f1(T*); + +template<typename T> +__module_private__ class vector; + +template<typename T> +class vector { +}; + +vector<float> vec_float; + +typedef __module_private__ int Integer; +typedef int Integer; + +#elif defined(MODULE_RIGHT) +__module_private__ double &f0(double); +double &f0(double); + +__module_private__ int hidden_var; + +inline void test_f0_in_right() { + double &dr = f0(hidden_var); +} + +struct VisibleStruct { + __module_private__ int field; + __module_private__ virtual void setField(int f); +}; + +#else +__import_module__ left; +__import_module__ right; + +void test() { + int &ir = f0(1.0); // okay: f0() from 'right' is not visible +} + +int test_broken() { + HiddenStruct hidden; // expected-error{{use of undeclared identifier 'HiddenStruct'}} + + Integer i; // expected-error{{use of undeclared identifier 'Integer'}} + + int *ip = 0; + f1(ip); // expected-error{{use of undeclared identifier 'f1'}} + + vector<int> vec; // expected-error{{use of undeclared identifier 'vector'}} \ + // expected-error{{expected '(' for function-style cast or type construction}} \ + // expected-error{{use of undeclared identifier 'vec'}} + + VisibleStruct vs; + vs.field = 0; // expected-error{{no member named 'field' in 'VisibleStruct'}} + vs.setField(1); // expected-error{{no member named 'setField' in 'VisibleStruct'}} + + return hidden_var; // expected-error{{use of undeclared identifier 'hidden_var'}} +} + +// Check for private redeclarations of public entities. +template<typename T> +class public_class_template; // expected-note{{previous declaration is here}} + +template<typename T> +__module_private__ class public_class_template; // expected-error{{__module_private__ declaration of 'public_class_template' follows public declaration}} + + +typedef int public_typedef; // expected-note{{previous declaration is here}} +typedef __module_private__ int public_typedef; // expected-error{{__module_private__ declaration of 'public_typedef' follows public declaration}} + +extern int public_var; // expected-note{{previous declaration is here}} +extern __module_private__ int public_var; // expected-error{{__module_private__ declaration of 'public_var' follows public declaration}} + +void public_func(); // expected-note{{previous declaration is here}} +__module_private__ void public_func(); // expected-error{{__module_private__ declaration of 'public_func' follows public declaration}} + +template<typename T> +void public_func_template(); // expected-note{{previous declaration is here}} +template<typename T> +__module_private__ void public_func_template(); // expected-error{{__module_private__ declaration of 'public_func_template' follows public declaration}} + +struct public_struct; // expected-note{{previous declaration is here}} +__module_private__ struct public_struct; // expected-error{{__module_private__ declaration of 'public_struct' follows public declaration}} + +// Check for attempts to make specializations private +template<> __module_private__ void public_func_template<int>(); // expected-error{{template specialization cannot be declared __module_private__}} + +template<typename T> +struct public_class { + struct inner_struct; + static int static_var; + + friend __module_private__ void public_func_friend(); + friend __module_private__ struct public_struct_friend; +}; + +template<> __module_private__ struct public_class<int>::inner_struct { }; // expected-error{{member specialization cannot be declared __module_private__}} +template<> __module_private__ int public_class<int>::static_var = 17; // expected-error{{member specialization cannot be declared __module_private__}} + +template<> +__module_private__ struct public_class<float> { }; // expected-error{{template specialization cannot be declared __module_private__}} + +template<typename T> +__module_private__ struct public_class<T *> { }; // expected-error{{partial specialization cannot be declared __module_private__}} + +// Check for attempts to make parameters and variables with automatic +// storage module-private. + +void local_var_private(__module_private__ int param) { // expected-error{{parameter 'param' cannot be declared __module_private__}} + __module_private__ struct Local { int x, y; } local; //expected-error{{local variable 'local' cannot be declared __module_private__}} + + __module_private__ struct OtherLocal { int x; }; // expected-error{{local struct cannot be declared __module_private__}} + + typedef __module_private__ int local_typedef; // expected-error{{typedef 'local_typedef' cannot be declared __module_private__}} +} + +// Check struct size +struct LikeVisibleStruct { + int field; + virtual void setField(int f); +}; + +int check_struct_size[sizeof(VisibleStruct) == sizeof(LikeVisibleStruct)? 1 : -1]; +#endif diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m new file mode 100644 index 000000000000..87aaa5c12cae --- /dev/null +++ b/test/Modules/objc-categories.m @@ -0,0 +1,89 @@ +// RUN: mkdir -p %t +// RUN: %clang_cc1 -emit-module -o %t/diamond_top.pcm %s -D MODULE_TOP +// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_left.pcm %s -D MODULE_LEFT +// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_right.pcm %s -D MODULE_RIGHT +// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_bottom.pcm %s -D MODULE_BOTTOM +// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify + +/*============================================================================*/ +#ifdef MODULE_TOP + +@interface Foo +@end + +@interface Foo(Top) +-(void)top; +@end + +/*============================================================================*/ +#elif defined(MODULE_LEFT) + +__import_module__ diamond_top; + +@interface Foo(Left) +-(void)left; +@end + +@interface LeftFoo +-(void)left; +@end + +@interface Foo(Duplicate) // expected-note {{previous definition}} +@end + +@interface Foo(Duplicate) +@end + +/*============================================================================*/ +#elif defined(MODULE_RIGHT) + +__import_module__ diamond_top; + +@interface Foo(Right1) +-(void)right1; +@end + +@interface Foo(Right2) +-(void)right2; +@end + +@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}} +@end + +/*============================================================================*/ +#elif defined(MODULE_BOTTOM) + +__import_module__ diamond_left; + +@interface Foo(Bottom) +-(void)bottom; +@end + +__import_module__ diamond_right; + +@interface LeftFoo(Bottom) +-(void)bottom; +@end + +/*============================================================================*/ +#else + +__import_module__ diamond_bottom; + +@interface Foo(Source) +-(void)source; +@end + +void test(Foo *foo, LeftFoo *leftFoo) { + [foo source]; + [foo bottom]; + [foo left]; + [foo right1]; + [foo right2]; + [foo top]; + + [leftFoo left]; + [leftFoo bottom]; +} + +#endif diff --git a/test/Modules/on-demand-build-warnings.m b/test/Modules/on-demand-build-warnings.m new file mode 100644 index 000000000000..aa122dbd8559 --- /dev/null +++ b/test/Modules/on-demand-build-warnings.m @@ -0,0 +1,5 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s + +__import_module__ Module; // expected-warning{{building module 'Module' from source}} + diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m new file mode 100644 index 000000000000..649caa8a7d80 --- /dev/null +++ b/test/Modules/on-demand-build.m @@ -0,0 +1,17 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s +// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -verify %s +// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s +#define FOO +__import_module__ Module; +@interface OtherClass +@end +// in module: expected-note{{class method 'alloc' is assumed to return an instance of its receiver type ('Module *')}} +void test_getModuleVersion() { + const char *version = getModuleVersion(); + const char *version2 = [Module version]; + + OtherClass *other = [Module alloc]; // expected-error{{init}} +} + + diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m new file mode 100644 index 000000000000..96abb2331f10 --- /dev/null +++ b/test/Modules/on-demand-macros.m @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s +// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -verify %s + +__import_module__ CmdLine; + +void test() { +#ifdef FOO_RETURNS_INT_PTR + int *ip = foo(); +#else + float *fp = foo(); +#endif +} diff --git a/test/PCH/Inputs/cxx-method.h b/test/PCH/Inputs/cxx-method.h new file mode 100644 index 000000000000..6adb8591707d --- /dev/null +++ b/test/PCH/Inputs/cxx-method.h @@ -0,0 +1,6 @@ +struct S { + void m(int x); + + operator const char*(); + operator char*(); +}; diff --git a/test/PCH/arc.m b/test/PCH/arc.m index 6f7b8704d9ea..64b390c30715 100644 --- a/test/PCH/arc.m +++ b/test/PCH/arc.m @@ -1,9 +1,17 @@ // Test this without pch. -// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-arc -include %S/Inputs/arc.h -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include %S/Inputs/arc.h -fsyntax-only -emit-llvm-only %s // Test with pch. -// RUN: %clang_cc1 -emit-pch -fblocks -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-arc -x objective-c-header -o %t %S/Inputs/arc.h -// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-arc -include-pch %t -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -emit-pch -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -x objective-c-header -o %t %S/Inputs/arc.h +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include-pch %t -fsyntax-only -emit-llvm-only %s + +// Test error when pch's -fobjc-arc state is different. +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -include-pch %t -fsyntax-only -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=ERR1 %s +// RUN: %clang_cc1 -emit-pch -fblocks -triple x86_64-apple-darwin11 -x objective-c-header -o %t %S/Inputs/arc.h +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include-pch %t -fsyntax-only -emit-llvm-only %s 2>&1 | FileCheck -check-prefix=ERR2 %s array0 a0; array1 a1; + +// CHECK-ERR1: Objective-C automated reference counting was enabled in PCH file but is currently disabled +// CHECK-ERR2: Objective-C automated reference counting was disabled in PCH file but is currently enabled diff --git a/test/PCH/chain-categories.m b/test/PCH/chain-categories.m new file mode 100644 index 000000000000..1b91c732b4d0 --- /dev/null +++ b/test/PCH/chain-categories.m @@ -0,0 +1,51 @@ +// Without PCH +// RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s + +// With PCH +// RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s + +#ifndef HEADER1 +#define HEADER1 +//===----------------------------------------------------------------------===// +// Primary header + +@interface NSObject +- (id)init; +- (void)finalize; +@end + +//===----------------------------------------------------------------------===// +#elif !defined(HEADER2) +#define HEADER2 +#if !defined(HEADER1) +#error Header inclusion order messed up +#endif + +//===----------------------------------------------------------------------===// +// Dependent header + +@interface MyClass : NSObject ++(void)meth; +@end + +@interface NSObject(ObjExt) +-(void)extMeth; +@end + +//===----------------------------------------------------------------------===// +#else +//===----------------------------------------------------------------------===// + +@implementation MyClass ++(void)meth {} +-(void)finalize { + [super finalize]; +} +@end + +void test(NSObject *o) { + [o extMeth]; +} + +//===----------------------------------------------------------------------===// +#endif diff --git a/test/PCH/chain-conversion-lookup.cpp b/test/PCH/chain-conversion-lookup.cpp new file mode 100644 index 000000000000..db9d8fc33eaf --- /dev/null +++ b/test/PCH/chain-conversion-lookup.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -chain-include %s -chain-include %s + +#if !defined(PASS1) +#define PASS1 +struct X { + operator int*(); +}; + +struct Z { + operator int*(); +}; +#elif !defined(PASS2) +#define PASS2 +struct Y { + operator int *(); +}; +#else +int main() { + X x; + int *ip = x.operator int*(); + Y y; + int *ip2 = y.operator int*(); + Z z; + int *ip3 = z.operator int*(); +} +#endif diff --git a/test/PCH/chain-decls.c b/test/PCH/chain-decls.c index b3daa4a7b7cd..f5724c4c1343 100644 --- a/test/PCH/chain-decls.c +++ b/test/PCH/chain-decls.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-decls1.h -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s diff --git a/test/PCH/chain-ext_vector.c b/test/PCH/chain-ext_vector.c index 263507003d18..d99a732f2ffa 100644 --- a/test/PCH/chain-ext_vector.c +++ b/test/PCH/chain-ext_vector.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-ext_vector1.h -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s int test(float4 f4) { diff --git a/test/PCH/chain-external-defs.c b/test/PCH/chain-external-defs.c index dd92d8e63ac6..742229442865 100644 --- a/test/PCH/chain-external-defs.c +++ b/test/PCH/chain-external-defs.c @@ -1,6 +1,6 @@ // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t1.pch %S/Inputs/chain-external-defs1.h -// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch -chained-pch +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t2.pch -emit-llvm -o %t %s // RUN: echo FINI >> %t // RUN: FileCheck -input-file=%t -check-prefix=Z %s diff --git a/test/PCH/chain-friend-instantiation.cpp b/test/PCH/chain-friend-instantiation.cpp new file mode 100644 index 000000000000..294d97911236 --- /dev/null +++ b/test/PCH/chain-friend-instantiation.cpp @@ -0,0 +1,61 @@ +// RUN: %clang_cc1 %s -ast-print -o - -chain-include %s -chain-include %s + +#if !defined(PASS1) +#define PASS1 + +template <class T> class TClass; + +namespace NS { + template <class X, class Y> TClass<X> problematic(X * ptr, const TClass<Y> &src); + + template <class T> + class TBaseClass + { + protected: + template <class X, class Y> friend TClass<X> problematic(X * ptr, const TClass<Y> &src); + }; +} + +template <class T> +class TClass: public NS::TBaseClass<T> +{ +public: + inline TClass() { } +}; + + +namespace NS { + template <class X, class T> + TClass<X> problematic(X *ptr, const TClass<T> &src); +} + +template <class X, class T> +TClass<X> unconst(const TClass<T> &src); + +#elif !defined(PASS2) +#define PASS2 + +namespace std { +class s {}; +} + + +typedef TClass<std::s> TStr; + +struct crash { + TStr str; + + crash(const TClass<std::s> p) + { + unconst<TStr>(p); + } +}; + +#else + +void f() { + const TStr p; + crash c(p); +} + +#endif diff --git a/test/PCH/chain-macro-override.c b/test/PCH/chain-macro-override.c index 8e208815fb26..2713e7084a9d 100644 --- a/test/PCH/chain-macro-override.c +++ b/test/PCH/chain-macro-override.c @@ -3,7 +3,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -chained-pch -detailed-preprocessing-record +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -detailed-preprocessing-record // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s int foo() { diff --git a/test/PCH/chain-macro.c b/test/PCH/chain-macro.c index 68b18deb0811..18356f75a0e2 100644 --- a/test/PCH/chain-macro.c +++ b/test/PCH/chain-macro.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-pch -o %t1 -detailed-preprocessing-record %S/Inputs/chain-macro1.h -// RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 // RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s diff --git a/test/PCH/chain-predecl.m b/test/PCH/chain-predecl.m index 2b0444e15a2c..6723b6f6f253 100644 --- a/test/PCH/chain-predecl.m +++ b/test/PCH/chain-predecl.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-pch -o %t1 %S/chain-predecl.h -x objective-c -// RUN: %clang_cc1 -emit-pch -o %t2 %s -x objective-c -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -o %t2 %s -x objective-c -include-pch %t1 // Test predeclarations across chained PCH. @interface Foo diff --git a/test/PCH/chain-remap-types.m b/test/PCH/chain-remap-types.m index a45a79d75c7f..585da4486502 100644 --- a/test/PCH/chain-remap-types.m +++ b/test/PCH/chain-remap-types.m @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t1 %S/Inputs/chain-remap-types1.h -// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t2 %S/Inputs/chain-remap-types2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t2 %S/Inputs/chain-remap-types2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s // CHECK: @class X; // CHECK: struct Y -// CHECK: @property ( assign,readwrite ) X * prop +// CHECK: @property ( assign,readwrite,atomic ) X * prop // CHECK: void h(X *); // CHECK: @interface X(Blah) // CHECK: void g(X *); diff --git a/test/PCH/chain-selectors.m b/test/PCH/chain-selectors.m index 3b19172799c5..c543b7106d5a 100644 --- a/test/PCH/chain-selectors.m +++ b/test/PCH/chain-selectors.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include %S/Inputs/chain-selectors1.h -include %S/Inputs/chain-selectors2.h // RUN: %clang_cc1 -x objective-c -emit-pch -o %t1 %S/Inputs/chain-selectors1.h -// RUN: %clang_cc1 -x objective-c -emit-pch -o %t2 %S/Inputs/chain-selectors2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -x objective-c -emit-pch -o %t2 %S/Inputs/chain-selectors2.h -include-pch %t1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wselector -include-pch %t2 @implementation X diff --git a/test/PCH/chain-trivial.c b/test/PCH/chain-trivial.c index c78b0e44ef30..85b1eabd86f8 100644 --- a/test/PCH/chain-trivial.c +++ b/test/PCH/chain-trivial.c @@ -1,4 +1,4 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t1 %S/Inputs/chain-trivial1.h -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 -chained-pch %S/Inputs/chain-trivial2.h +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 %S/Inputs/chain-trivial2.h // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-print -include-pch %t2 %s | FileCheck %s // CHECK: struct __va_list_tag { diff --git a/test/PCH/cxx-alias-decl.cpp b/test/PCH/cxx-alias-decl.cpp index e30311c58b7b..872658f7edfa 100644 --- a/test/PCH/cxx-alias-decl.cpp +++ b/test/PCH/cxx-alias-decl.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -include %S/cxx-alias-decl.h -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -include %S/cxx-alias-decl.h -fsyntax-only -emit-llvm -o - %s // Test with pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -emit-pch -o %t %S/cxx-alias-decl.h -// RUN: %clang_cc1 -x c++ -std=c++0x -include-pch %t -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t %S/cxx-alias-decl.h +// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s template struct T<S>; C<A>::A<char> a; diff --git a/test/PCH/cxx-for-range.cpp b/test/PCH/cxx-for-range.cpp index 46e217c574cb..48310dbc55ce 100644 --- a/test/PCH/cxx-for-range.cpp +++ b/test/PCH/cxx-for-range.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -include %S/cxx-for-range.h -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -include %S/cxx-for-range.h -fsyntax-only -emit-llvm -o - %s // Test with pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -emit-pch -o %t %S/cxx-for-range.h -// RUN: %clang_cc1 -x c++ -std=c++0x -include-pch %t -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t %S/cxx-for-range.h +// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s void h() { f(); diff --git a/test/PCH/cxx-implicit-moves.cpp b/test/PCH/cxx-implicit-moves.cpp new file mode 100644 index 000000000000..ccdc874cb1fa --- /dev/null +++ b/test/PCH/cxx-implicit-moves.cpp @@ -0,0 +1,23 @@ +// Test with PCH +// RUN: %clang_cc1 -std=c++11 -x c++-header -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s + +// PR10847 +#ifndef HEADER +#define HEADER +struct NSSize { + double width; + double height; +}; +typedef struct NSSize NSSize; + +static inline NSSize NSMakeSize(double w, double h) { + NSSize s = { w, h }; + return s; +} +#else +float test(float v1, float v2) { + NSSize s = NSMakeSize(v1, v2); + return s.width; +} +#endif diff --git a/test/PCH/cxx-member-init.cpp b/test/PCH/cxx-member-init.cpp index 70392a283261..28206652b8ff 100644 --- a/test/PCH/cxx-member-init.cpp +++ b/test/PCH/cxx-member-init.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -DHEADER -DSOURCE -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -fsyntax-only -emit-llvm -o - %s // Test with pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -DHEADER -emit-pch -o %t %s -// RUN: %clang_cc1 -x c++ -std=c++0x -DHEADER -include-pch %t -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s +// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -fsyntax-only -emit-llvm -o - %s #ifdef HEADER int n; diff --git a/test/PCH/cxx-method.cpp b/test/PCH/cxx-method.cpp index 37dabcc466a8..6ec65b248618 100644 --- a/test/PCH/cxx-method.cpp +++ b/test/PCH/cxx-method.cpp @@ -1,7 +1,8 @@ -// RUN: %clang_cc1 -emit-pch %s -o %t - -struct S { - void m(int x); -}; +// RUN: %clang_cc1 -x c++ -emit-pch %S/Inputs/cxx-method.h -o %t +// RUN: %clang_cc1 -include-pch %t -verify %s void S::m(int x) { } + +S::operator char *() { return 0; } + +S::operator const char *() { return 0; } diff --git a/test/PCH/cxx-ms-function-specialization-class-scope.cpp b/test/PCH/cxx-ms-function-specialization-class-scope.cpp new file mode 100644 index 000000000000..1803a11b96b8 --- /dev/null +++ b/test/PCH/cxx-ms-function-specialization-class-scope.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -x c++-header -emit-pch -o %t %S/cxx-ms-function-specialization-class-scope.h +// RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s + + +void test2() +{ + B<char> b(3); + char* ptr; + b.f(ptr); + b.f<int>(99); + b.f(100); +} + diff --git a/test/PCH/cxx-ms-function-specialization-class-scope.h b/test/PCH/cxx-ms-function-specialization-class-scope.h new file mode 100644 index 000000000000..7668e7338423 --- /dev/null +++ b/test/PCH/cxx-ms-function-specialization-class-scope.h @@ -0,0 +1,29 @@ + + + +template <class T> +class B { +public: + template <class U> + B(U p) { + } + template <> + B(int p) { // expected-warning{{explicit specialization of 'B<T>' within class scope is a Microsoft extension}} + } + + template <class U> + void f(U p) { + T y = 9; + } + + + template <> + void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} + T a = 3; + } + + void f(int p) { + T a = 3; + } +}; + diff --git a/test/PCH/cxx-reference.cpp b/test/PCH/cxx-reference.cpp index 2dfbcdc1382b..a1a44e6893df 100644 --- a/test/PCH/cxx-reference.cpp +++ b/test/PCH/cxx-reference.cpp @@ -1,6 +1,6 @@ // Test this without pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -include %S/cxx-reference.h -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -include %S/cxx-reference.h -fsyntax-only -emit-llvm -o - %s // Test with pch. -// RUN: %clang_cc1 -x c++ -std=c++0x -emit-pch -o %t %S/cxx-reference.h -// RUN: %clang_cc1 -x c++ -std=c++0x -include-pch %t -fsyntax-only -emit-llvm -o - %s +// RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t %S/cxx-reference.h +// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s diff --git a/test/PCH/cxx-static_assert.cpp b/test/PCH/cxx-static_assert.cpp index 464da405c3e2..ace12e0922d4 100644 --- a/test/PCH/cxx-static_assert.cpp +++ b/test/PCH/cxx-static_assert.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -include %s -verify -std=c++0x %s +// RUN: %clang_cc1 -include %s -verify -std=c++11 %s // Test with pch. -// RUN: %clang_cc1 -std=c++0x -emit-pch -o %t %s -// RUN: %clang_cc1 -include-pch %t -verify -std=c++0x %s +// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s #ifndef HEADER #define HEADER diff --git a/test/PCH/cxx-variadic-templates.cpp b/test/PCH/cxx-variadic-templates.cpp index 9b1df9a737f9..5b586931d541 100644 --- a/test/PCH/cxx-variadic-templates.cpp +++ b/test/PCH/cxx-variadic-templates.cpp @@ -1,11 +1,11 @@ // Test this without pch. -// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h -verify %s -ast-dump -o - -// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -include %S/cxx-variadic-templates.h -verify %s -ast-dump -o - +// RUN: %clang_cc1 -std=c++11 -include %S/cxx-variadic-templates.h %s -emit-llvm -o - | FileCheck %s // Test with pch. -// RUN: %clang_cc1 -std=c++0x -x c++-header -emit-pch -o %t %S/cxx-variadic-templates.h -// RUN: %clang_cc1 -std=c++0x -include-pch %t -verify %s -ast-dump -o - -// RUN: %clang_cc1 -std=c++0x -include-pch %t %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -x c++-header -emit-pch -o %t %S/cxx-variadic-templates.h +// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s -ast-dump -o - +// RUN: %clang_cc1 -std=c++11 -include-pch %t %s -emit-llvm -o - | FileCheck %s // CHECK: allocate_shared shared_ptr<int> spi = shared_ptr<int>::allocate_shared(1, 2); diff --git a/test/PCH/cxx0x-default-delete.cpp b/test/PCH/cxx0x-default-delete.cpp index 753ac4736c70..3ecb19c29572 100644 --- a/test/PCH/cxx0x-default-delete.cpp +++ b/test/PCH/cxx0x-default-delete.cpp @@ -1,8 +1,8 @@ // Without PCH -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify -include %s %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include %s %s // With PCH -// RUN: %clang_cc1 -x c++-header -std=c++0x -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify -include-pch %t %s +// RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include-pch %t %s #ifndef PASS1 #define PASS1 diff --git a/test/PCH/cxx0x-delegating-ctors.cpp b/test/PCH/cxx0x-delegating-ctors.cpp index 15311f852944..f2b7e9036252 100644 --- a/test/PCH/cxx0x-delegating-ctors.cpp +++ b/test/PCH/cxx0x-delegating-ctors.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -include %s -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -include %s -std=c++11 -fsyntax-only -verify %s // Test with pch. -// RUN: %clang_cc1 -x c++-header -std=c++0x -emit-pch -o %t %s -// RUN: %clang_cc1 -std=c++0x -include-pch %t -fsyntax-only -verify %s +// RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++11 -include-pch %t -fsyntax-only -verify %s #ifndef PASS1 #define PASS1 diff --git a/test/PCH/cxx_exprs.cpp b/test/PCH/cxx_exprs.cpp index 49df80db4fed..4cd9bae1fa4c 100644 --- a/test/PCH/cxx_exprs.cpp +++ b/test/PCH/cxx_exprs.cpp @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++0x -fsyntax-only -verify %s -ast-dump +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump // Test with pch. Use '-ast-dump' to force deserialization of function bodies. -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++0x -emit-pch -o %t %S/cxx_exprs.h -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -include-pch %t -fsyntax-only -verify %s -ast-dump +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx_exprs.h +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-dump int integer; double floating; diff --git a/test/PCH/functions.c b/test/PCH/functions.c index 23becb60e8ed..35e39210585b 100644 --- a/test/PCH/functions.c +++ b/test/PCH/functions.c @@ -4,7 +4,7 @@ // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/functions.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s - +// expected-note{{'f1' declared here}} int f0(int x0, int y0, ...) { return x0 + y0; } // expected-note{{passing argument to parameter here}} float *test_f1(int val, double x, double y) { diff --git a/test/PCH/method-redecls.m b/test/PCH/method-redecls.m new file mode 100644 index 000000000000..a11bf5aff7dc --- /dev/null +++ b/test/PCH/method-redecls.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -x objective-c -emit-pch -o %t +// RUN: %clang_cc1 -x objective-c -emit-pch -o %t -D IMPL + +// Avoid infinite loop because of method redeclarations. + +@interface Foo +-(void)meth; +-(void)meth; +-(void)meth; +@end + +#ifdef IMPL + +@implementation Foo +-(void)meth { } +@end + +#endif diff --git a/test/PCH/modified-header-error.c b/test/PCH/modified-header-error.c index 6335fb1b4539..34f04bfb8bf9 100644 --- a/test/PCH/modified-header-error.c +++ b/test/PCH/modified-header-error.c @@ -9,3 +9,5 @@ #include "header2.h" // CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built +// DISABLE: win32 + diff --git a/test/PCH/objc_methods.h b/test/PCH/objc_methods.h index bd775354349f..c9b1ad4342c6 100644 --- a/test/PCH/objc_methods.h +++ b/test/PCH/objc_methods.h @@ -2,7 +2,7 @@ @interface TestPCH + alloc; -- (id)init; +- (instancetype)instMethod; @end @class TestForwardClassDecl; diff --git a/test/PCH/objc_methods.m b/test/PCH/objc_methods.m index 3311813c98df..e90a463dce6b 100644 --- a/test/PCH/objc_methods.m +++ b/test/PCH/objc_methods.m @@ -12,5 +12,5 @@ void func() { // AliasForTestPCH *zz; xx = [TestPCH alloc]; - [xx init]; + [xx instMethod]; } diff --git a/test/PCH/preamble.c b/test/PCH/preamble.c index bdc0aea65639..6a61fa10ffa1 100644 --- a/test/PCH/preamble.c +++ b/test/PCH/preamble.c @@ -1,7 +1,7 @@ // Check that using the preamble option actually skips the preamble. -// RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/preamble.h -// RUN: %clang_cc1 -include-pch %t -preamble-bytes=278,1 -DFOO=f -verify %s +// RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/preamble.h -DFOO=f +// RUN: %clang_cc1 -include-pch %t -preamble-bytes=317,1 -DFOO=f -verify %s -emit-llvm -o - | FileCheck %s float f(int); // Not an error, because we skip this via the preamble! @@ -19,3 +19,5 @@ float f(int); // Not an error, because we skip this via the preamble! int g(int x) { return FOO(x); } + +// CHECK: call {{.*}} @f( diff --git a/test/PCH/reinclude.cpp b/test/PCH/reinclude.cpp index 71f90282ba57..97e22cf9d6f1 100644 --- a/test/PCH/reinclude.cpp +++ b/test/PCH/reinclude.cpp @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -x c++-header %S/reinclude1.h -emit-pch -o %t1 // RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 // RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify -// RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 -chained-pch +// RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 // RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify int q2 = A::y; diff --git a/test/PCH/types.c b/test/PCH/types.c index ba00dc6824e1..fc37a9c33d05 100644 --- a/test/PCH/types.c +++ b/test/PCH/types.c @@ -14,12 +14,14 @@ __attribute__((address_space(1))) int int_as_one; ASInt *as_int_ptr1 = &int_value; // expected-error{{changes address space of pointer}} ASInt *as_int_ptr2 = &int_as_one; -// FIXME: TYPE_FIXED_WIDTH_INT - // TYPE_COMPLEX _Complex float Cfloat_val; Cfloat *Cfloat_ptr = &Cfloat_val; +// TYPE_ATOMIC +_Atomic(int) AtomicInt_val; +AtomicInt *AtomicInt_ptr = &AtomicInt_val; + // TYPE_POINTER int_ptr int_value_ptr = &int_value; diff --git a/test/PCH/types.h b/test/PCH/types.h index ab42331fe413..7df3f99700f6 100644 --- a/test/PCH/types.h +++ b/test/PCH/types.h @@ -3,11 +3,12 @@ // TYPE_EXT_QUAL typedef __attribute__((address_space(1))) int ASInt; -// FIXME: TYPE_FIXED_WIDTH_INT - // TYPE_COMPLEX typedef _Complex float Cfloat; +// TYPE_ATOMIC +typedef _Atomic(int) AtomicInt; + // TYPE_POINTER typedef int * int_ptr; diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp index b447fff2f1c0..b02c4026c048 100644 --- a/test/Parser/DelayedTemplateParsing.cpp +++ b/test/Parser/DelayedTemplateParsing.cpp @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s +// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s template <class T> class A { void foo() { undeclared(); } - void foo2(); + void foo2(); }; template <class T> @@ -40,3 +40,22 @@ void undeclared() template <class T> void foo5() {} //expected-note {{previous definition is here}} template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}} + + + +namespace Inner_Outer_same_template_param_name { + +template <class T> +class Outmost { +public: + template <class T> + class Inner { + public: + void f() { + T* var; + } + }; +}; + +} + diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 2b8451b26dda..a0f15e9d8634 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -8,10 +8,16 @@ extern __declspec(dllimport) void __stdcall VarR4FromDec(); __declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix); __declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; + void * __ptr64 PtrToPtr64(const void *p) { - return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); + return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}} +} +void * __ptr32 PtrToPtr32(const void *p) +{ + return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}} } + void __forceinline InterlockedBitTestAndSet (long *Base, long Bit) { __asm { diff --git a/test/Parser/PR11000.cpp b/test/Parser/PR11000.cpp new file mode 100644 index 000000000000..7dae99621bbb --- /dev/null +++ b/test/Parser/PR11000.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -std=c++11 %s 2>&1 | FileCheck %s + +// PR11000: Don't crash. +class tuple<> +{ + template <class _Alloc> + tuple(allocator_arg_t, const _Alloc&) {} + +// CHECK: 6 errors generated. diff --git a/test/Parser/access-spec-attrs.cpp b/test/Parser/access-spec-attrs.cpp new file mode 100644 index 000000000000..4fa597581165 --- /dev/null +++ b/test/Parser/access-spec-attrs.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +struct X { +public __attribute__((unavailable)): // expected-error {{access specifier can only have annotation attributes}} + void foo(); +private __attribute__((annotate("foobar"))): + void bar(); +}; + +void f(X x) { + x.foo(); +} diff --git a/test/Parser/c1x-alignas.c b/test/Parser/c1x-alignas.c new file mode 100644 index 000000000000..5dccc99035ad --- /dev/null +++ b/test/Parser/c1x-alignas.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s + +_Alignas(4) char c1; +unsigned _Alignas(long) char c2; +char _Alignas(16) c3; + +char c4 _Alignas(32); // expected-error {{expected ';' after top level declarator}} diff --git a/test/Parser/char-literal-printing.c b/test/Parser/char-literal-printing.c index 5843e5f40157..27dd63a4fc49 100644 --- a/test/Parser/char-literal-printing.c +++ b/test/Parser/char-literal-printing.c @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -ast-print %s +// RUN: %clang_cc1 -x c++ -ast-print %s +// RUN: %clang_cc1 -x c++ -std=c++11 -ast-print %s #include <stddef.h> @@ -29,3 +31,37 @@ char test23(void) { return '\x3'; } wchar_t test24(void) { return L'\x3'; } wchar_t test25(void) { return L'\x333'; } + +#if __cplusplus >= 201103L +char16_t test26(void) { return u'\\'; } +char16_t test27(void) { return u'\''; } +char16_t test28(void) { return u'\a'; } +char16_t test29(void) { return u'\b'; } +char16_t test30(void) { return u'\e'; } +char16_t test31(void) { return u'\f'; } +char16_t test32(void) { return u'\n'; } +char16_t test33(void) { return u'\r'; } +char16_t test34(void) { return u'\t'; } +char16_t test35(void) { return u'\v'; } + +char16_t test36(void) { return u'c'; } +char16_t test37(void) { return u'\x3'; } + +char16_t test38(void) { return u'\x333'; } + +char32_t test39(void) { return U'\\'; } +char32_t test40(void) { return U'\''; } +char32_t test41(void) { return U'\a'; } +char32_t test42(void) { return U'\b'; } +char32_t test43(void) { return U'\e'; } +char32_t test44(void) { return U'\f'; } +char32_t test45(void) { return U'\n'; } +char32_t test46(void) { return U'\r'; } +char32_t test47(void) { return U'\t'; } +char32_t test48(void) { return U'\v'; } + +char32_t test49(void) { return U'c'; } +char32_t test50(void) { return U'\x3'; } + +char32_t test51(void) { return U'\x333'; } +#endif diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp index 4a0bb4d1e4e5..42ad12ee94f3 100644 --- a/test/Parser/cxx-casting.cpp +++ b/test/Parser/cxx-casting.cpp @@ -67,3 +67,26 @@ void test2(char x, struct B * b) { test1::A LCC B> e; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} (void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} } + + // This note comes from "::D[:F> A5;" +template <class T> class D {}; // expected-note{{template is declared here}} +template <class T> void E() {}; +class F {}; + +void test3() { + ::D<::F> A1; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + D<::F> A2; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + ::E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + + ::D< ::F> A3; + D< ::F> A4; + ::E< ::F>(); + E< ::F>(); + + // Make sure that parser doesn't expand '[:' to '< ::' + ::D[:F> A5; // expected-error {{cannot refer to class template 'D' without a template argument list}} \ + // expected-error {{expected expression}} \ + // expected-error {{expected ']'}} \ + // expected-note {{to match this '['}} +} diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index f863bd198e50..1c0d862b3096 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -40,3 +40,20 @@ typedef union { } y; } bug3177; +// check that we don't consume the token after the access specifier +// when it's not a colon +class D { +public // expected-error{{expected ':'}} + int i; +}; + +// consume the token after the access specifier if it's a semicolon +// that was meant to be a colon +class E { +public; // expected-error{{expected ':'}} + int i; +}; + +// PR11109 must appear at the end of the source file +class pr11109r3 { // expected-note{{to match this '{'}} + public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}} diff --git a/test/Parser/cxx-default-delete.cpp b/test/Parser/cxx-default-delete.cpp index a3d5b2c1d9b2..f34f6fb014f2 100644 --- a/test/Parser/cxx-default-delete.cpp +++ b/test/Parser/cxx-default-delete.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s int i = delete; // expected-error{{only functions}} int j = default; // expected-error{{special member functions}} diff --git a/test/Parser/cxx-ext-delete-default.cpp b/test/Parser/cxx-ext-delete-default.cpp index 062723851496..be6efee24163 100644 --- a/test/Parser/cxx-ext-delete-default.cpp +++ b/test/Parser/cxx-ext-delete-default.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s struct A { - A(const A&) = delete; // expected-warning {{accepted as a C++0x extension}} - A& operator=(const A&) = delete; // expected-warning {{accepted as a C++0x extension}} - A() = default; // expected-warning {{accepted as a C++0x extension}} + A(const A&) = delete; // expected-warning {{accepted as a C++11 extension}} + A& operator=(const A&) = delete; // expected-warning {{accepted as a C++11 extension}} + A() = default; // expected-warning {{accepted as a C++11 extension}} ~A(); }; -void f() = delete; // expected-warning {{accepted as a C++0x extension}} -A::~A() = default; //expected-warning {{accepted as a C++0x extension}} +void f() = delete; // expected-warning {{accepted as a C++11 extension}} +A::~A() = default; //expected-warning {{accepted as a C++11 extension}} diff --git a/test/Parser/cxx-member-init-missing-paren-crash.cpp b/test/Parser/cxx-member-init-missing-paren-crash.cpp new file mode 100644 index 000000000000..5485e7d2d5c3 --- /dev/null +++ b/test/Parser/cxx-member-init-missing-paren-crash.cpp @@ -0,0 +1,12 @@ +// RUN: not %clang_cc1 -fsyntax-only %s +// Note: The important part here is that we don't crash, not any specific errors +class Test { + public: + Test() : ab_(false {}; + + bool ab() { + return ab_; + } + private: + bool ab_; +} diff --git a/test/Parser/cxx-member-initializers.cpp b/test/Parser/cxx-member-initializers.cpp index 34a725ff43af..5c3906836c49 100644 --- a/test/Parser/cxx-member-initializers.cpp +++ b/test/Parser/cxx-member-initializers.cpp @@ -8,3 +8,8 @@ struct y { int a; y() : a(4) ; // expected-error {{expected '{'}} }; + +struct z { + int a; + z() : a {} // expected-error {{expected '('}} +}; diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp index fae938bcaab0..d21412cec0fc 100644 --- a/test/Parser/cxx-reference.cpp +++ b/test/Parser/cxx-reference.cpp @@ -18,4 +18,4 @@ int & volatile Y = val; // expected-error {{'volatile' qualifier may not be appl int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \ expected-error {{'volatile' qualifier may not be applied}} */ -typedef int && RV; // expected-warning {{rvalue references are a C++0x extension}} +typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}} diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index f65e29070957..e762b57a93d6 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -1,23 +1,26 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s // Declaration syntax checks [[]] int before_attr; +int [[]] between_attr; int after_attr [[]]; int * [[]] ptr_attr; int array_attr [1] [[]]; -[[align(8)]] int aligned_attr; +alignas(8) int aligned_attr; [[test::valid(for 42 [very] **** '+' symbols went on a trip; the end.)]] int garbage_attr; void fn_attr () [[]]; class [[]] class_attr {}; extern "C++" [[]] int extern_attr; template <typename T> [[]] void template_attr (); +[[]] [[]] int [[]] [[]] multi_attr [[]] [[]]; int comma_attr [[,]]; // expected-error {{expected identifier}} int scope_attr [[foo::]]; // expected-error {{expected identifier}} +unsigned [[]] int attr_in_decl_spec; // expected-error {{expected unqualified-id}} int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}} class foo { - void after_const_attr () const [[]]; // expected-error {{expected expression}} + void after_const_attr () const [[]]; // expected-error {{expected body of lambda expression}} expected-error {{array has incomplete element type 'void'}} }; extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} [[]] template <typename T> void before_template_attr (); // expected-error {{an attribute list cannot appear here}} @@ -29,8 +32,8 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} [[]] using namespace ns; // Argument tests -[[align]] int aligned_no_params; // expected-error {{C++0x attribute 'align' must have an argument list}} -[[align(i)]] int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}} +alignas int aligned_no_params; // expected-error {{expected '('}} +alignas(i) int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}} // Statement tests void foo () { diff --git a/test/Parser/cxx0x-in-cxx98.cpp b/test/Parser/cxx0x-in-cxx98.cpp index e0cbc23f5811..9e41a700a982 100644 --- a/test/Parser/cxx0x-in-cxx98.cpp +++ b/test/Parser/cxx0x-in-cxx98.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s -inline namespace N { // expected-warning{{inline namespaces are a C++0x feature}} +inline namespace N { // expected-warning{{inline namespaces are a C++11 feature}} struct X { - template<typename ...Args> // expected-warning{{variadic templates are a C++0x extension}} - void f(Args &&...) &; // expected-warning{{rvalue references are a C++0x extension}} \ - // expected-warning{{reference qualifiers on functions are a C++0x extension}} + template<typename ...Args> // expected-warning{{variadic templates are a C++11 extension}} + void f(Args &&...) &; // expected-warning{{rvalue references are a C++11 extension}} \ + // expected-warning{{reference qualifiers on functions are a C++11 extension}} }; } diff --git a/test/Parser/cxx0x-lambda-expressions.cpp b/test/Parser/cxx0x-lambda-expressions.cpp new file mode 100644 index 000000000000..b4fe4cca7d11 --- /dev/null +++ b/test/Parser/cxx0x-lambda-expressions.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +class C { + + int f() { + int foo, bar; + + []; // expected-error {{expected body of lambda expression}} + [+] {}; // expected-error {{expected variable name or 'this' in lambda capture list}} + [foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}} + [foo,&this] {}; // expected-error {{'this' cannot be captured by reference}} + [&this] {}; // expected-error {{'this' cannot be captured by reference}} + [&,] {}; // expected-error {{ expected variable name or 'this' in lambda capture list}} + [=,] {}; // expected-error {{ expected variable name or 'this' in lambda capture list}} + [] {}; + [=] (int i) {}; + [&] (int) mutable -> void {}; + [foo,bar] () { return 3; }; + [=,&foo] () {}; + [&,foo] () {}; + [this] () {}; + + return 1; + } + +}; + diff --git a/test/Parser/cxx0x-literal-operators.cpp b/test/Parser/cxx0x-literal-operators.cpp index 30b290382cb4..4fcbad490d38 100644 --- a/test/Parser/cxx0x-literal-operators.cpp +++ b/test/Parser/cxx0x-literal-operators.cpp @@ -1,5 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s void operator "" (const char *); // expected-error {{expected identifier}} -void operator "k" foo(const char *); // expected-error {{string literal after 'operator' must be '""'}} -void operator "" tester (const char *); +void operator "k" foo(const char *); // expected-error {{string literal after 'operator' must be '""'}} \ +// expected-warning{{user-defined literal with suffix 'foo' is preempted by C99 hexfloat extension}} +void operator "" tester (const char *); // expected-warning{{user-defined literal with suffix 'tester' is preempted by C99 hexfloat extension}} diff --git a/test/Parser/cxx0x-member-initializers.cpp b/test/Parser/cxx0x-member-initializers.cpp index 6c3492ef2133..a324f974bcaf 100644 --- a/test/Parser/cxx0x-member-initializers.cpp +++ b/test/Parser/cxx0x-member-initializers.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Make sure we don't run off the end of the stream when parsing a deferred // initializer. @@ -13,3 +13,17 @@ struct T { int b = 2; int c = b; // expected-error {{undeclared identifier}} }; + +// Test recovery for bad constructor initializers + +struct R1 { + int a; + R1() : a {} +}; // expected-error {{expected '{' or ','}} + +// Test correct parsing. + +struct V1 { + int a, b; + V1() : a(), b{} {} +}; diff --git a/test/Parser/cxx0x-override-control-keywords.cpp b/test/Parser/cxx0x-override-control-keywords.cpp index 91d5132febe8..444862a5c853 100644 --- a/test/Parser/cxx0x-override-control-keywords.cpp +++ b/test/Parser/cxx0x-override-control-keywords.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct Base { virtual void override(); diff --git a/test/Parser/cxx0x-rvalue-reference.cpp b/test/Parser/cxx0x-rvalue-reference.cpp index ae568e8859c0..e57e6013e5e7 100644 --- a/test/Parser/cxx0x-rvalue-reference.cpp +++ b/test/Parser/cxx0x-rvalue-reference.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s int && r1(int &&a); diff --git a/test/Parser/ms-inline-asm.c b/test/Parser/ms-inline-asm.c new file mode 100644 index 000000000000..b1af23e47280 --- /dev/null +++ b/test/Parser/ms-inline-asm.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 %s -verify -fms-extensions + +#define M __asm int 0x2c +#define M2 int + +void t1(void) { M } +void t2(void) { __asm int 0x2c } +void t3(void) { __asm M2 0x2c } +void* t4(void) { __asm mov eax, fs:[0x10] } +void t5() { + __asm { + int 0x2c ; } asm comments are fun! }{ + } + __asm {} +} +int t6() { + __asm int 3 ; } comments for single-line asm + __asm {} + + __asm int 4 + return 10; +} +int t7() { // expected-note {{to match this}} + __asm + __asm { // expected-error 3 {{expected}} expected-note {{to match this}} diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m index 32ba948f472d..074820526c93 100644 --- a/test/Parser/objc-init.m +++ b/test/Parser/objc-init.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify %s -pedantic +// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify -x objective-c++ %s // rdar://5707001 @interface NSNumber; diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m index 4ddadb816f0d..bb496e96914e 100644 --- a/test/Parser/objc-messaging-neg-1.m +++ b/test/Parser/objc-messaging-neg-1.m @@ -9,4 +9,5 @@ int main() { [a bla:0 6:7]; // expected-error {{expected ']'}} [A foo bar]; // expected-error {{expected ':'}} [A foo bar bar1]; // expected-error {{expected ':'}} + [] {}; // expected-error {{expected expression}} } diff --git a/test/Parser/objcxx-lambda-expressions-neg.mm b/test/Parser/objcxx-lambda-expressions-neg.mm new file mode 100644 index 000000000000..864cc6b8fbf5 --- /dev/null +++ b/test/Parser/objcxx-lambda-expressions-neg.mm @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int main() { + []{}; // expected-error {{expected expression}} +} diff --git a/test/Parser/objcxx0x-lambda-expressions.mm b/test/Parser/objcxx0x-lambda-expressions.mm new file mode 100644 index 000000000000..937464918b6a --- /dev/null +++ b/test/Parser/objcxx0x-lambda-expressions.mm @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +class C { + + void f() { + int foo, bar; + + // fail to parse as a lambda introducer, so we get objc message parsing errors instead + [foo,+] {}; // expected-error {{expected expression}} + + []; // expected-error {{expected body of lambda expression}} + [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}} + [&this] {}; // expected-error {{address expression must be an lvalue}} + [] {}; + [=] (int i) {}; + [&] (int) mutable -> void {}; + // FIXME: this error occurs because we do not yet handle lambda scopes + // properly. I did not anticipate it because I thought it was a semantic (not + // syntactic) check. + [foo,bar] () { return 3; }; // expected-error {{void function 'f' should not return a value}} + [=,&foo] () {}; + [this] () {}; + } + +}; + diff --git a/test/Parser/opencl-pragma.cl b/test/Parser/opencl-pragma.cl index 5b6c55ab0743..19460771137b 100644 --- a/test/Parser/opencl-pragma.cl +++ b/test/Parser/opencl-pragma.cl @@ -4,6 +4,9 @@ #pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */ +#pragma OPENCL EXTENSION all : disable +#pragma OPENCL EXTENSION all : enable /* expected-warning {{unknown OpenCL extension 'all' - ignoring}} */ + #pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */ #pragma OPENCL FP_CONTRACT ON diff --git a/test/Parser/opencl-storage-class.cl b/test/Parser/opencl-storage-class.cl index d479358f0024..874329b62d5a 100644 --- a/test/Parser/opencl-storage-class.cl +++ b/test/Parser/opencl-storage-class.cl @@ -6,4 +6,10 @@ void test_storage_class_specs() register int b; // expected-error {{OpenCL does not support the 'register' storage class specifier}} extern int c; // expected-error {{OpenCL does not support the 'extern' storage class specifier}} auto int d; // expected-error {{OpenCL does not support the 'auto' storage class specifier}} + +#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable + static int e; + register int f; + extern int g; + auto int h; } diff --git a/test/Parser/parser_overflow.c b/test/Parser/parser_overflow.c new file mode 100644 index 000000000000..d2006ea5575e --- /dev/null +++ b/test/Parser/parser_overflow.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s + +void foo(void) { + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +} + +// CHECK: fatal error: parser recursion limit reached, program too complex diff --git a/test/Parser/pragma-visibility2.c b/test/Parser/pragma-visibility2.c new file mode 100644 index 000000000000..bcef09ff2b99 --- /dev/null +++ b/test/Parser/pragma-visibility2.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s +// RUN: FileCheck --input-file=%t %s +// PR10392 + +#define push(foo) push(default) +#pragma GCC visibility push(hidden) + +int v1; +// CHECK: @v1 = common hidden global i32 0, align 4 + +#pragma GCC visibility pop + +int v2; +// CHECK: @v2 = common global i32 0, align 4 + +_Pragma("GCC visibility push(hidden)"); + +int v3; +// CHECK: @v3 = common hidden global i32 0, align 4 diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp index a1df4261db45..84ac0c899e55 100644 --- a/test/Parser/switch-recovery.cpp +++ b/test/Parser/switch-recovery.cpp @@ -79,7 +79,7 @@ int test7(int i) { case false ? 1 : 2: true ? 1 : 2: // expected-error {{expected 'case' keyword before expression}} case 10: - 14 ? 3 : 4; + 14 ? 3 : 4; // expected-warning {{expression result unused}} default: return 1; } diff --git a/test/Parser/top-level-semi-cxx0x.cpp b/test/Parser/top-level-semi-cxx0x.cpp index 592483c86bb6..be342a225704 100644 --- a/test/Parser/top-level-semi-cxx0x.cpp +++ b/test/Parser/top-level-semi-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify %s void foo(); diff --git a/test/Preprocessor/comment_save_if.c b/test/Preprocessor/comment_save_if.c index 2f35bcb9e8c6..4946122a3f0c 100644 --- a/test/Preprocessor/comment_save_if.c +++ b/test/Preprocessor/comment_save_if.c @@ -1,6 +1,11 @@ -// RUN: %clang_cc1 %s -E -CC -pedantic 2>&1 | grep -v '^/' | not grep warning +// RUN: %clang_cc1 %s -E -CC -pedantic -verify #if 1 /*bar */ #endif /*foo*/ +#if /*foo*/ defined /*foo*/ FOO /*foo*/ +#if /*foo*/ defined /*foo*/ ( /*foo*/ FOO /*foo*/ ) /*foo*/ +#endif +#endif + diff --git a/test/Preprocessor/expr_define_expansion.c b/test/Preprocessor/expr_define_expansion.c new file mode 100644 index 000000000000..38c0384092ae --- /dev/null +++ b/test/Preprocessor/expr_define_expansion.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -E -CC -pedantic -verify + +#define FOO && 1 +#if defined FOO FOO +#endif diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index f0920c9dedbd..11218154ea1c 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -9,7 +9,7 @@ // BLOCKS:#define __block __attribute__((__blocks__(byref))) // // -// RUN: %clang_cc1 -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s +// RUN: %clang_cc1 -x c++ -std=c++11 -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s // // CXX0X:#define __GNUG__ // CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1 @@ -76,7 +76,7 @@ // C94:#define __STDC_VERSION__ 199409L // // -// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s +// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-fragile-abi -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s // // MSEXT-NOT:#define __STDC__ // MSEXT:#define _INTEGRAL_MAX_BITS 64 @@ -94,7 +94,7 @@ // OBJCGC:#define __OBJC_GC__ 1 // // -// RUN: %clang_cc1 -x objective-c -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s +// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s // // NONFRAGILE:#define OBJC_ZEROCOST_EXCEPTIONS 1 // NONFRAGILE:#define __OBJC2__ 1 @@ -410,9 +410,6 @@ // I386:#define __WINT_WIDTH__ 32 // I386:#define __i386 1 // I386:#define __i386__ 1 -// I386:#define __nocona 1 -// I386:#define __nocona__ 1 -// I386:#define __tune_nocona__ 1 // I386:#define i386 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu < /dev/null | FileCheck -check-prefix I386-LINUX %s @@ -508,9 +505,6 @@ // I386-LINUX:#define __WINT_WIDTH__ 32 // I386-LINUX:#define __i386 1 // I386-LINUX:#define __i386__ 1 -// I386-LINUX:#define __nocona 1 -// I386-LINUX:#define __nocona__ 1 -// I386-LINUX:#define __tune_nocona__ 1 // I386-LINUX:#define i386 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s @@ -1183,9 +1177,6 @@ // X86_64:#define __WINT_WIDTH__ 32 // X86_64:#define __amd64 1 // X86_64:#define __amd64__ 1 -// X86_64:#define __nocona 1 -// X86_64:#define __nocona__ 1 -// X86_64:#define __tune_nocona__ 1 // X86_64:#define __x86_64 1 // X86_64:#define __x86_64__ 1 // @@ -1289,13 +1280,10 @@ // X86_64-LINUX:#define __WINT_WIDTH__ 32 // X86_64-LINUX:#define __amd64 1 // X86_64-LINUX:#define __amd64__ 1 -// X86_64-LINUX:#define __nocona 1 -// X86_64-LINUX:#define __nocona__ 1 -// X86_64-LINUX:#define __tune_nocona__ 1 // X86_64-LINUX:#define __x86_64 1 // X86_64-LINUX:#define __x86_64__ 1 // -// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s +// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-fragile-abi -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s // GNUSOURCE:#define _GNU_SOURCE 1 // // RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -check-prefix NORTTI %s diff --git a/test/Preprocessor/missing-system-header.c b/test/Preprocessor/missing-system-header.c new file mode 100644 index 000000000000..69cb1314eaef --- /dev/null +++ b/test/Preprocessor/missing-system-header.c @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s +#include "missing-system-header.h" diff --git a/test/Preprocessor/missing-system-header.h b/test/Preprocessor/missing-system-header.h new file mode 100644 index 000000000000..393ab2b5c979 --- /dev/null +++ b/test/Preprocessor/missing-system-header.h @@ -0,0 +1,2 @@ +#pragma clang system_header +#include "not exist" // expected-error {{file not found}} diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m index 1f67ed3f09bd..cf64df2bf880 100644 --- a/test/Preprocessor/non_fragile_feature.m +++ b/test/Preprocessor/non_fragile_feature.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 %s #ifndef __has_feature #error Should have __has_feature #endif diff --git a/test/Preprocessor/non_fragile_feature1.m b/test/Preprocessor/non_fragile_feature1.m index 89b52ed53bf5..79cc488a0b6e 100644 --- a/test/Preprocessor/non_fragile_feature1.m +++ b/test/Preprocessor/non_fragile_feature1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi %s #ifndef __has_feature #error Should have __has_feature #endif diff --git a/test/Preprocessor/pp-record.c b/test/Preprocessor/pp-record.c new file mode 100644 index 000000000000..dcb52b56b7d9 --- /dev/null +++ b/test/Preprocessor/pp-record.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -detailed-preprocessing-record %s + +// http://llvm.org/PR11120 + +#define FILE_HEADER_NAME "pp-record.h" + +#if defined(FILE_HEADER_NAME) +#include FILE_HEADER_NAME +#endif diff --git a/test/Preprocessor/pp-record.h b/test/Preprocessor/pp-record.h new file mode 100644 index 000000000000..34158bd20527 --- /dev/null +++ b/test/Preprocessor/pp-record.h @@ -0,0 +1 @@ +// Only useful for #inclusion. diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c new file mode 100644 index 000000000000..b063f7fe089a --- /dev/null +++ b/test/Preprocessor/predefined-arch-macros.c @@ -0,0 +1,866 @@ +// These tests are generated by running utils/generate_arch_predefine_tests.sh +// to observe GCC's behavior (or some other system compiler's behavior). +// +// Begin X86/GCC/Linux tests ---------------- +// +// RUN: %clang -march=i386 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I386_M32 +// CHECK_I386_M32: #define __i386 1 +// CHECK_I386_M32: #define __i386__ 1 +// CHECK_I386_M32: #define __tune_i386__ 1 +// CHECK_I386_M32: #define i386 1 +// RUN: %clang -march=i386 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I386_M64 +// CHECK_I386_M64: error: +// +// RUN: %clang -march=i486 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I486_M32 +// CHECK_I486_M32: #define __i386 1 +// CHECK_I486_M32: #define __i386__ 1 +// CHECK_I486_M32: #define __i486 1 +// CHECK_I486_M32: #define __i486__ 1 +// CHECK_I486_M32: #define __tune_i486__ 1 +// CHECK_I486_M32: #define i386 1 +// RUN: %clang -march=i486 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I486_M64 +// CHECK_I486_M64: error: +// +// RUN: %clang -march=i586 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I586_M32 +// CHECK_I586_M32: #define __i386 1 +// CHECK_I586_M32: #define __i386__ 1 +// CHECK_I586_M32: #define __i586 1 +// CHECK_I586_M32: #define __i586__ 1 +// CHECK_I586_M32: #define __pentium 1 +// CHECK_I586_M32: #define __pentium__ 1 +// CHECK_I586_M32: #define __tune_i586__ 1 +// CHECK_I586_M32: #define __tune_pentium__ 1 +// CHECK_I586_M32: #define i386 1 +// RUN: %clang -march=i586 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I586_M64 +// CHECK_I586_M64: error: +// +// RUN: %clang -march=pentium -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M32 +// CHECK_PENTIUM_M32: #define __i386 1 +// CHECK_PENTIUM_M32: #define __i386__ 1 +// CHECK_PENTIUM_M32: #define __i586 1 +// CHECK_PENTIUM_M32: #define __i586__ 1 +// CHECK_PENTIUM_M32: #define __pentium 1 +// CHECK_PENTIUM_M32: #define __pentium__ 1 +// CHECK_PENTIUM_M32: #define __tune_i586__ 1 +// CHECK_PENTIUM_M32: #define __tune_pentium__ 1 +// CHECK_PENTIUM_M32: #define i386 1 +// RUN: %clang -march=pentium -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M64 +// CHECK_PENTIUM_M64: error: +// +// RUN: %clang -march=pentium-mmx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M32 +// CHECK_PENTIUM_MMX_M32: #define __MMX__ 1 +// CHECK_PENTIUM_MMX_M32: #define __i386 1 +// CHECK_PENTIUM_MMX_M32: #define __i386__ 1 +// CHECK_PENTIUM_MMX_M32: #define __i586 1 +// CHECK_PENTIUM_MMX_M32: #define __i586__ 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium__ 1 +// CHECK_PENTIUM_MMX_M32: #define __pentium_mmx__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_i586__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_pentium__ 1 +// CHECK_PENTIUM_MMX_M32: #define __tune_pentium_mmx__ 1 +// CHECK_PENTIUM_MMX_M32: #define i386 1 +// RUN: %clang -march=pentium-mmx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M64 +// CHECK_PENTIUM_MMX_M64: error: +// +// RUN: %clang -march=winchip-c6 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M32 +// CHECK_WINCHIP_C6_M32: #define __MMX__ 1 +// CHECK_WINCHIP_C6_M32: #define __i386 1 +// CHECK_WINCHIP_C6_M32: #define __i386__ 1 +// CHECK_WINCHIP_C6_M32: #define __i486 1 +// CHECK_WINCHIP_C6_M32: #define __i486__ 1 +// CHECK_WINCHIP_C6_M32: #define __tune_i486__ 1 +// CHECK_WINCHIP_C6_M32: #define i386 1 +// RUN: %clang -march=winchip-c6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M64 +// CHECK_WINCHIP_C6_M64: error: +// +// RUN: %clang -march=winchip2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP2_M32 +// CHECK_WINCHIP2_M32: #define __3dNOW__ 1 +// CHECK_WINCHIP2_M32: #define __MMX__ 1 +// CHECK_WINCHIP2_M32: #define __i386 1 +// CHECK_WINCHIP2_M32: #define __i386__ 1 +// CHECK_WINCHIP2_M32: #define __i486 1 +// CHECK_WINCHIP2_M32: #define __i486__ 1 +// CHECK_WINCHIP2_M32: #define __tune_i486__ 1 +// CHECK_WINCHIP2_M32: #define i386 1 +// RUN: %clang -march=winchip2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP2_M64 +// CHECK_WINCHIP2_M64: error: +// +// RUN: %clang -march=c3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_M32 +// CHECK_C3_M32: #define __3dNOW__ 1 +// CHECK_C3_M32: #define __MMX__ 1 +// CHECK_C3_M32: #define __i386 1 +// CHECK_C3_M32: #define __i386__ 1 +// CHECK_C3_M32: #define __i486 1 +// CHECK_C3_M32: #define __i486__ 1 +// CHECK_C3_M32: #define __tune_i486__ 1 +// CHECK_C3_M32: #define i386 1 +// RUN: %clang -march=c3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_M64 +// CHECK_C3_M64: error: +// +// RUN: %clang -march=c3-2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_2_M32 +// CHECK_C3_2_M32: #define __MMX__ 1 +// CHECK_C3_2_M32: #define __SSE__ 1 +// CHECK_C3_2_M32: #define __i386 1 +// CHECK_C3_2_M32: #define __i386__ 1 +// CHECK_C3_2_M32: #define __i686 1 +// CHECK_C3_2_M32: #define __i686__ 1 +// CHECK_C3_2_M32: #define __pentiumpro 1 +// CHECK_C3_2_M32: #define __pentiumpro__ 1 +// CHECK_C3_2_M32: #define __tune_i686__ 1 +// CHECK_C3_2_M32: #define __tune_pentium2__ 1 +// CHECK_C3_2_M32: #define __tune_pentiumpro__ 1 +// CHECK_C3_2_M32: #define i386 1 +// RUN: %clang -march=c3-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_C3_2_M64 +// CHECK_C3_2_M64: error: +// +// RUN: %clang -march=i686 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I686_M32 +// CHECK_I686_M32: #define __i386 1 +// CHECK_I686_M32: #define __i386__ 1 +// CHECK_I686_M32: #define __i686 1 +// CHECK_I686_M32: #define __i686__ 1 +// CHECK_I686_M32: #define __pentiumpro 1 +// CHECK_I686_M32: #define __pentiumpro__ 1 +// CHECK_I686_M32: #define i386 1 +// RUN: %clang -march=i686 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_I686_M64 +// CHECK_I686_M64: error: +// +// RUN: %clang -march=pentiumpro -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M32 +// CHECK_PENTIUMPRO_M32: #define __i386 1 +// CHECK_PENTIUMPRO_M32: #define __i386__ 1 +// CHECK_PENTIUMPRO_M32: #define __i686 1 +// CHECK_PENTIUMPRO_M32: #define __i686__ 1 +// CHECK_PENTIUMPRO_M32: #define __pentiumpro 1 +// CHECK_PENTIUMPRO_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUMPRO_M32: #define __tune_i686__ 1 +// CHECK_PENTIUMPRO_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUMPRO_M32: #define i386 1 +// RUN: %clang -march=pentiumpro -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M64 +// CHECK_PENTIUMPRO_M64: error: +// +// RUN: %clang -march=pentium2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM2_M32 +// CHECK_PENTIUM2_M32: #define __MMX__ 1 +// CHECK_PENTIUM2_M32: #define __i386 1 +// CHECK_PENTIUM2_M32: #define __i386__ 1 +// CHECK_PENTIUM2_M32: #define __i686 1 +// CHECK_PENTIUM2_M32: #define __i686__ 1 +// CHECK_PENTIUM2_M32: #define __pentiumpro 1 +// CHECK_PENTIUM2_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM2_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM2_M32: #define __tune_pentium2__ 1 +// CHECK_PENTIUM2_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM2_M32: #define i386 1 +// RUN: %clang -march=pentium2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM2_M64 +// CHECK_PENTIUM2_M64: error: +// +// RUN: %clang -march=pentium3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3_M32 +// CHECK_PENTIUM3_M32: #define __MMX__ 1 +// CHECK_PENTIUM3_M32: #define __SSE__ 1 +// CHECK_PENTIUM3_M32: #define __i386 1 +// CHECK_PENTIUM3_M32: #define __i386__ 1 +// CHECK_PENTIUM3_M32: #define __i686 1 +// CHECK_PENTIUM3_M32: #define __i686__ 1 +// CHECK_PENTIUM3_M32: #define __pentiumpro 1 +// CHECK_PENTIUM3_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM3_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentium2__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentium3__ 1 +// CHECK_PENTIUM3_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM3_M32: #define i386 1 +// RUN: %clang -march=pentium3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3_M64 +// CHECK_PENTIUM3_M64: error: +// +// RUN: %clang -march=pentium3m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M32 +// CHECK_PENTIUM3M_M32: #define __MMX__ 1 +// CHECK_PENTIUM3M_M32: #define __SSE__ 1 +// CHECK_PENTIUM3M_M32: #define __i386 1 +// CHECK_PENTIUM3M_M32: #define __i386__ 1 +// CHECK_PENTIUM3M_M32: #define __i686 1 +// CHECK_PENTIUM3M_M32: #define __i686__ 1 +// CHECK_PENTIUM3M_M32: #define __pentiumpro 1 +// CHECK_PENTIUM3M_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM3M_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM3M_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM3M_M32: #define i386 1 +// RUN: %clang -march=pentium3m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M64 +// CHECK_PENTIUM3M_M64: error: +// +// RUN: %clang -march=pentium-m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M32 +// CHECK_PENTIUM_M_M32: #define __MMX__ 1 +// CHECK_PENTIUM_M_M32: #define __SSE2__ 1 +// CHECK_PENTIUM_M_M32: #define __SSE__ 1 +// CHECK_PENTIUM_M_M32: #define __i386 1 +// CHECK_PENTIUM_M_M32: #define __i386__ 1 +// CHECK_PENTIUM_M_M32: #define __i686 1 +// CHECK_PENTIUM_M_M32: #define __i686__ 1 +// CHECK_PENTIUM_M_M32: #define __pentiumpro 1 +// CHECK_PENTIUM_M_M32: #define __pentiumpro__ 1 +// CHECK_PENTIUM_M_M32: #define __tune_i686__ 1 +// CHECK_PENTIUM_M_M32: #define __tune_pentiumpro__ 1 +// CHECK_PENTIUM_M_M32: #define i386 1 +// RUN: %clang -march=pentium-m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M64 +// CHECK_PENTIUM_M_M64: error: +// +// RUN: %clang -march=pentium4 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4_M32 +// CHECK_PENTIUM4_M32: #define __MMX__ 1 +// CHECK_PENTIUM4_M32: #define __SSE2__ 1 +// CHECK_PENTIUM4_M32: #define __SSE__ 1 +// CHECK_PENTIUM4_M32: #define __i386 1 +// CHECK_PENTIUM4_M32: #define __i386__ 1 +// CHECK_PENTIUM4_M32: #define __pentium4 1 +// CHECK_PENTIUM4_M32: #define __pentium4__ 1 +// CHECK_PENTIUM4_M32: #define __tune_pentium4__ 1 +// CHECK_PENTIUM4_M32: #define i386 1 +// RUN: %clang -march=pentium4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4_M64 +// CHECK_PENTIUM4_M64: error: +// +// RUN: %clang -march=pentium4m -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M32 +// CHECK_PENTIUM4M_M32: #define __MMX__ 1 +// CHECK_PENTIUM4M_M32: #define __SSE2__ 1 +// CHECK_PENTIUM4M_M32: #define __SSE__ 1 +// CHECK_PENTIUM4M_M32: #define __i386 1 +// CHECK_PENTIUM4M_M32: #define __i386__ 1 +// CHECK_PENTIUM4M_M32: #define __pentium4 1 +// CHECK_PENTIUM4M_M32: #define __pentium4__ 1 +// CHECK_PENTIUM4M_M32: #define __tune_pentium4__ 1 +// CHECK_PENTIUM4M_M32: #define i386 1 +// RUN: %clang -march=pentium4m -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M64 +// CHECK_PENTIUM4M_M64: error: +// +// RUN: %clang -march=prescott -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PRESCOTT_M32 +// CHECK_PRESCOTT_M32: #define __MMX__ 1 +// CHECK_PRESCOTT_M32: #define __SSE2__ 1 +// CHECK_PRESCOTT_M32: #define __SSE3__ 1 +// CHECK_PRESCOTT_M32: #define __SSE__ 1 +// CHECK_PRESCOTT_M32: #define __i386 1 +// CHECK_PRESCOTT_M32: #define __i386__ 1 +// CHECK_PRESCOTT_M32: #define __nocona 1 +// CHECK_PRESCOTT_M32: #define __nocona__ 1 +// CHECK_PRESCOTT_M32: #define __tune_nocona__ 1 +// CHECK_PRESCOTT_M32: #define i386 1 +// RUN: %clang -march=prescott -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_PRESCOTT_M64 +// CHECK_PRESCOTT_M64: error: +// +// RUN: %clang -march=nocona -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_NOCONA_M32 +// CHECK_NOCONA_M32: #define __MMX__ 1 +// CHECK_NOCONA_M32: #define __SSE2__ 1 +// CHECK_NOCONA_M32: #define __SSE3__ 1 +// CHECK_NOCONA_M32: #define __SSE__ 1 +// CHECK_NOCONA_M32: #define __i386 1 +// CHECK_NOCONA_M32: #define __i386__ 1 +// CHECK_NOCONA_M32: #define __nocona 1 +// CHECK_NOCONA_M32: #define __nocona__ 1 +// CHECK_NOCONA_M32: #define __tune_nocona__ 1 +// CHECK_NOCONA_M32: #define i386 1 +// RUN: %clang -march=nocona -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_NOCONA_M64 +// CHECK_NOCONA_M64: #define __MMX__ 1 +// CHECK_NOCONA_M64: #define __SSE2_MATH__ 1 +// CHECK_NOCONA_M64: #define __SSE2__ 1 +// CHECK_NOCONA_M64: #define __SSE3__ 1 +// CHECK_NOCONA_M64: #define __SSE_MATH__ 1 +// CHECK_NOCONA_M64: #define __SSE__ 1 +// CHECK_NOCONA_M64: #define __amd64 1 +// CHECK_NOCONA_M64: #define __amd64__ 1 +// CHECK_NOCONA_M64: #define __nocona 1 +// CHECK_NOCONA_M64: #define __nocona__ 1 +// CHECK_NOCONA_M64: #define __tune_nocona__ 1 +// CHECK_NOCONA_M64: #define __x86_64 1 +// CHECK_NOCONA_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=core2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE2_M32 +// CHECK_CORE2_M32: #define __MMX__ 1 +// CHECK_CORE2_M32: #define __SSE2__ 1 +// CHECK_CORE2_M32: #define __SSE3__ 1 +// CHECK_CORE2_M32: #define __SSE__ 1 +// CHECK_CORE2_M32: #define __SSSE3__ 1 +// CHECK_CORE2_M32: #define __core2 1 +// CHECK_CORE2_M32: #define __core2__ 1 +// CHECK_CORE2_M32: #define __i386 1 +// CHECK_CORE2_M32: #define __i386__ 1 +// CHECK_CORE2_M32: #define __tune_core2__ 1 +// CHECK_CORE2_M32: #define i386 1 +// RUN: %clang -march=core2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE2_M64 +// CHECK_CORE2_M64: #define __MMX__ 1 +// CHECK_CORE2_M64: #define __SSE2_MATH__ 1 +// CHECK_CORE2_M64: #define __SSE2__ 1 +// CHECK_CORE2_M64: #define __SSE3__ 1 +// CHECK_CORE2_M64: #define __SSE_MATH__ 1 +// CHECK_CORE2_M64: #define __SSE__ 1 +// CHECK_CORE2_M64: #define __SSSE3__ 1 +// CHECK_CORE2_M64: #define __amd64 1 +// CHECK_CORE2_M64: #define __amd64__ 1 +// CHECK_CORE2_M64: #define __core2 1 +// CHECK_CORE2_M64: #define __core2__ 1 +// CHECK_CORE2_M64: #define __tune_core2__ 1 +// CHECK_CORE2_M64: #define __x86_64 1 +// CHECK_CORE2_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=corei7 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_M32 +// CHECK_COREI7_M32: #define __MMX__ 1 +// CHECK_COREI7_M32: #define __SSE2__ 1 +// CHECK_COREI7_M32: #define __SSE3__ 1 +// CHECK_COREI7_M32: #define __SSE4_1__ 1 +// CHECK_COREI7_M32: #define __SSE4_2__ 1 +// CHECK_COREI7_M32: #define __SSE__ 1 +// CHECK_COREI7_M32: #define __SSSE3__ 1 +// CHECK_COREI7_M32: #define __corei7 1 +// CHECK_COREI7_M32: #define __corei7__ 1 +// CHECK_COREI7_M32: #define __i386 1 +// CHECK_COREI7_M32: #define __i386__ 1 +// CHECK_COREI7_M32: #define __tune_corei7__ 1 +// CHECK_COREI7_M32: #define i386 1 +// RUN: %clang -march=corei7 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_M64 +// CHECK_COREI7_M64: #define __MMX__ 1 +// CHECK_COREI7_M64: #define __SSE2_MATH__ 1 +// CHECK_COREI7_M64: #define __SSE2__ 1 +// CHECK_COREI7_M64: #define __SSE3__ 1 +// CHECK_COREI7_M64: #define __SSE4_1__ 1 +// CHECK_COREI7_M64: #define __SSE4_2__ 1 +// CHECK_COREI7_M64: #define __SSE_MATH__ 1 +// CHECK_COREI7_M64: #define __SSE__ 1 +// CHECK_COREI7_M64: #define __SSSE3__ 1 +// CHECK_COREI7_M64: #define __amd64 1 +// CHECK_COREI7_M64: #define __amd64__ 1 +// CHECK_COREI7_M64: #define __corei7 1 +// CHECK_COREI7_M64: #define __corei7__ 1 +// CHECK_COREI7_M64: #define __tune_corei7__ 1 +// CHECK_COREI7_M64: #define __x86_64 1 +// CHECK_COREI7_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=corei7-avx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M32 +// CHECK_COREI7_AVX_M32: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_COREI7_AVX_M32-NOT: #define __AVX__ 1 +// CHECK_COREI7_AVX_M32: #define __MMX__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE2__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE3__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE4_1__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE4_2__ 1 +// CHECK_COREI7_AVX_M32: #define __SSE__ 1 +// CHECK_COREI7_AVX_M32: #define __SSSE3__ 1 +// CHECK_COREI7_AVX_M32: #define __corei7 1 +// CHECK_COREI7_AVX_M32: #define __corei7__ 1 +// CHECK_COREI7_AVX_M32: #define __i386 1 +// CHECK_COREI7_AVX_M32: #define __i386__ 1 +// CHECK_COREI7_AVX_M32: #define __tune_corei7__ 1 +// CHECK_COREI7_AVX_M32: #define i386 1 +// RUN: %clang -march=corei7-avx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M64 +// CHECK_COREI7_AVX_M64: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_COREI7_AVX_M64-NOT: #define __AVX__ 1 +// CHECK_COREI7_AVX_M64: #define __MMX__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE2_MATH__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE2__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE3__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE4_1__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE4_2__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE_MATH__ 1 +// CHECK_COREI7_AVX_M64: #define __SSE__ 1 +// CHECK_COREI7_AVX_M64: #define __SSSE3__ 1 +// CHECK_COREI7_AVX_M64: #define __amd64 1 +// CHECK_COREI7_AVX_M64: #define __amd64__ 1 +// CHECK_COREI7_AVX_M64: #define __corei7 1 +// CHECK_COREI7_AVX_M64: #define __corei7__ 1 +// CHECK_COREI7_AVX_M64: #define __tune_corei7__ 1 +// CHECK_COREI7_AVX_M64: #define __x86_64 1 +// CHECK_COREI7_AVX_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=core-avx-i -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M32 +// CHECK_CORE_AVX_I_M32: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_CORE_AVX_I_M32-NOT: #define __AVX__ 1 +// CHECK_CORE_AVX_I_M32: #define __MMX__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE2__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE3__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE4_1__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE4_2__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSE__ 1 +// CHECK_CORE_AVX_I_M32: #define __SSSE3__ 1 +// CHECK_CORE_AVX_I_M32: #define __corei7 1 +// CHECK_CORE_AVX_I_M32: #define __corei7__ 1 +// CHECK_CORE_AVX_I_M32: #define __i386 1 +// CHECK_CORE_AVX_I_M32: #define __i386__ 1 +// CHECK_CORE_AVX_I_M32: #define __tune_corei7__ 1 +// CHECK_CORE_AVX_I_M32: #define i386 1 +// RUN: %clang -march=core-avx-i -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M64 +// CHECK_CORE_AVX_I_M64: #define __AES__ 1 +// FIXME: AVX is not yet enabled with Clang. +// CHECK_CORE_AVX_I_M64-NOT: #define __AVX__ 1 +// CHECK_CORE_AVX_I_M64: #define __MMX__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE2_MATH__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE2__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE3__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE4_1__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE4_2__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE_MATH__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSE__ 1 +// CHECK_CORE_AVX_I_M64: #define __SSSE3__ 1 +// CHECK_CORE_AVX_I_M64: #define __amd64 1 +// CHECK_CORE_AVX_I_M64: #define __amd64__ 1 +// CHECK_CORE_AVX_I_M64: #define __corei7 1 +// CHECK_CORE_AVX_I_M64: #define __corei7__ 1 +// CHECK_CORE_AVX_I_M64: #define __tune_corei7__ 1 +// CHECK_CORE_AVX_I_M64: #define __x86_64 1 +// CHECK_CORE_AVX_I_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATOM_M32 +// CHECK_ATOM_M32: #define __MMX__ 1 +// CHECK_ATOM_M32: #define __SSE2__ 1 +// CHECK_ATOM_M32: #define __SSE3__ 1 +// CHECK_ATOM_M32: #define __SSE__ 1 +// CHECK_ATOM_M32: #define __SSSE3__ 1 +// CHECK_ATOM_M32: #define __atom 1 +// CHECK_ATOM_M32: #define __atom__ 1 +// CHECK_ATOM_M32: #define __i386 1 +// CHECK_ATOM_M32: #define __i386__ 1 +// CHECK_ATOM_M32: #define __tune_atom__ 1 +// CHECK_ATOM_M32: #define i386 1 +// RUN: %clang -march=atom -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATOM_M64 +// CHECK_ATOM_M64: #define __MMX__ 1 +// CHECK_ATOM_M64: #define __SSE2_MATH__ 1 +// CHECK_ATOM_M64: #define __SSE2__ 1 +// CHECK_ATOM_M64: #define __SSE3__ 1 +// CHECK_ATOM_M64: #define __SSE_MATH__ 1 +// CHECK_ATOM_M64: #define __SSE__ 1 +// CHECK_ATOM_M64: #define __SSSE3__ 1 +// CHECK_ATOM_M64: #define __amd64 1 +// CHECK_ATOM_M64: #define __amd64__ 1 +// CHECK_ATOM_M64: #define __atom 1 +// CHECK_ATOM_M64: #define __atom__ 1 +// CHECK_ATOM_M64: #define __tune_atom__ 1 +// CHECK_ATOM_M64: #define __x86_64 1 +// CHECK_ATOM_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M32 +// CHECK_GEODE_M32: #define __3dNOW_A__ 1 +// CHECK_GEODE_M32: #define __3dNOW__ 1 +// CHECK_GEODE_M32: #define __MMX__ 1 +// CHECK_GEODE_M32: #define __geode 1 +// CHECK_GEODE_M32: #define __geode__ 1 +// CHECK_GEODE_M32: #define __i386 1 +// CHECK_GEODE_M32: #define __i386__ 1 +// CHECK_GEODE_M32: #define __tune_geode__ 1 +// CHECK_GEODE_M32: #define i386 1 +// RUN: %clang -march=geode -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M64 +// CHECK_GEODE_M64: error: +// +// RUN: %clang -march=k6 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_M32 +// CHECK_K6_M32: #define __MMX__ 1 +// CHECK_K6_M32: #define __i386 1 +// CHECK_K6_M32: #define __i386__ 1 +// CHECK_K6_M32: #define __k6 1 +// CHECK_K6_M32: #define __k6__ 1 +// CHECK_K6_M32: #define __tune_k6__ 1 +// CHECK_K6_M32: #define i386 1 +// RUN: %clang -march=k6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_M64 +// CHECK_K6_M64: error: +// +// RUN: %clang -march=k6-2 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_2_M32 +// CHECK_K6_2_M32: #define __3dNOW__ 1 +// CHECK_K6_2_M32: #define __MMX__ 1 +// CHECK_K6_2_M32: #define __i386 1 +// CHECK_K6_2_M32: #define __i386__ 1 +// CHECK_K6_2_M32: #define __k6 1 +// CHECK_K6_2_M32: #define __k6_2__ 1 +// CHECK_K6_2_M32: #define __k6__ 1 +// CHECK_K6_2_M32: #define __tune_k6_2__ 1 +// CHECK_K6_2_M32: #define __tune_k6__ 1 +// CHECK_K6_2_M32: #define i386 1 +// RUN: %clang -march=k6-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_2_M64 +// CHECK_K6_2_M64: error: +// +// RUN: %clang -march=k6-3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_3_M32 +// CHECK_K6_3_M32: #define __3dNOW__ 1 +// CHECK_K6_3_M32: #define __MMX__ 1 +// CHECK_K6_3_M32: #define __i386 1 +// CHECK_K6_3_M32: #define __i386__ 1 +// CHECK_K6_3_M32: #define __k6 1 +// CHECK_K6_3_M32: #define __k6_3__ 1 +// CHECK_K6_3_M32: #define __k6__ 1 +// CHECK_K6_3_M32: #define __tune_k6_3__ 1 +// CHECK_K6_3_M32: #define __tune_k6__ 1 +// CHECK_K6_3_M32: #define i386 1 +// RUN: %clang -march=k6-3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K6_3_M64 +// CHECK_K6_3_M64: error: +// +// RUN: %clang -march=athlon -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_M32 +// CHECK_ATHLON_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_M32: #define __MMX__ 1 +// CHECK_ATHLON_M32: #define __athlon 1 +// CHECK_ATHLON_M32: #define __athlon__ 1 +// CHECK_ATHLON_M32: #define __i386 1 +// CHECK_ATHLON_M32: #define __i386__ 1 +// CHECK_ATHLON_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_M32: #define i386 1 +// RUN: %clang -march=athlon -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_M64 +// CHECK_ATHLON_M64: error: +// +// RUN: %clang -march=athlon-tbird -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M32 +// CHECK_ATHLON_TBIRD_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __MMX__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __athlon 1 +// CHECK_ATHLON_TBIRD_M32: #define __athlon__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __i386 1 +// CHECK_ATHLON_TBIRD_M32: #define __i386__ 1 +// CHECK_ATHLON_TBIRD_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_TBIRD_M32: #define i386 1 +// RUN: %clang -march=athlon-tbird -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M64 +// CHECK_ATHLON_TBIRD_M64: error: +// +// RUN: %clang -march=athlon-4 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_4_M32 +// CHECK_ATHLON_4_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_4_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_4_M32: #define __MMX__ 1 +// CHECK_ATHLON_4_M32: #define __SSE__ 1 +// CHECK_ATHLON_4_M32: #define __athlon 1 +// CHECK_ATHLON_4_M32: #define __athlon__ 1 +// CHECK_ATHLON_4_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_4_M32: #define __i386 1 +// CHECK_ATHLON_4_M32: #define __i386__ 1 +// CHECK_ATHLON_4_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_4_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_4_M32: #define i386 1 +// RUN: %clang -march=athlon-4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_4_M64 +// CHECK_ATHLON_4_M64: error: +// +// RUN: %clang -march=athlon-xp -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M32 +// CHECK_ATHLON_XP_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_XP_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_XP_M32: #define __MMX__ 1 +// CHECK_ATHLON_XP_M32: #define __SSE__ 1 +// CHECK_ATHLON_XP_M32: #define __athlon 1 +// CHECK_ATHLON_XP_M32: #define __athlon__ 1 +// CHECK_ATHLON_XP_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_XP_M32: #define __i386 1 +// CHECK_ATHLON_XP_M32: #define __i386__ 1 +// CHECK_ATHLON_XP_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_XP_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_XP_M32: #define i386 1 +// RUN: %clang -march=athlon-xp -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M64 +// CHECK_ATHLON_XP_M64: error: +// +// RUN: %clang -march=athlon-mp -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M32 +// CHECK_ATHLON_MP_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_MP_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_MP_M32: #define __MMX__ 1 +// CHECK_ATHLON_MP_M32: #define __SSE__ 1 +// CHECK_ATHLON_MP_M32: #define __athlon 1 +// CHECK_ATHLON_MP_M32: #define __athlon__ 1 +// CHECK_ATHLON_MP_M32: #define __athlon_sse__ 1 +// CHECK_ATHLON_MP_M32: #define __i386 1 +// CHECK_ATHLON_MP_M32: #define __i386__ 1 +// CHECK_ATHLON_MP_M32: #define __tune_athlon__ 1 +// CHECK_ATHLON_MP_M32: #define __tune_athlon_sse__ 1 +// CHECK_ATHLON_MP_M32: #define i386 1 +// RUN: %clang -march=athlon-mp -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M64 +// CHECK_ATHLON_MP_M64: error: +// +// RUN: %clang -march=x86-64 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_X86_64_M32 +// CHECK_X86_64_M32: #define __MMX__ 1 +// CHECK_X86_64_M32: #define __SSE2__ 1 +// CHECK_X86_64_M32: #define __SSE__ 1 +// CHECK_X86_64_M32: #define __i386 1 +// CHECK_X86_64_M32: #define __i386__ 1 +// CHECK_X86_64_M32: #define __k8 1 +// CHECK_X86_64_M32: #define __k8__ 1 +// CHECK_X86_64_M32: #define i386 1 +// RUN: %clang -march=x86-64 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_X86_64_M64 +// CHECK_X86_64_M64: #define __MMX__ 1 +// CHECK_X86_64_M64: #define __SSE2_MATH__ 1 +// CHECK_X86_64_M64: #define __SSE2__ 1 +// CHECK_X86_64_M64: #define __SSE_MATH__ 1 +// CHECK_X86_64_M64: #define __SSE__ 1 +// CHECK_X86_64_M64: #define __amd64 1 +// CHECK_X86_64_M64: #define __amd64__ 1 +// CHECK_X86_64_M64: #define __k8 1 +// CHECK_X86_64_M64: #define __k8__ 1 +// CHECK_X86_64_M64: #define __x86_64 1 +// CHECK_X86_64_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=k8 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_M32 +// CHECK_K8_M32: #define __3dNOW_A__ 1 +// CHECK_K8_M32: #define __3dNOW__ 1 +// CHECK_K8_M32: #define __MMX__ 1 +// CHECK_K8_M32: #define __SSE2__ 1 +// CHECK_K8_M32: #define __SSE__ 1 +// CHECK_K8_M32: #define __i386 1 +// CHECK_K8_M32: #define __i386__ 1 +// CHECK_K8_M32: #define __k8 1 +// CHECK_K8_M32: #define __k8__ 1 +// CHECK_K8_M32: #define __tune_k8__ 1 +// CHECK_K8_M32: #define i386 1 +// RUN: %clang -march=k8 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_M64 +// CHECK_K8_M64: #define __3dNOW_A__ 1 +// CHECK_K8_M64: #define __3dNOW__ 1 +// CHECK_K8_M64: #define __MMX__ 1 +// CHECK_K8_M64: #define __SSE2_MATH__ 1 +// CHECK_K8_M64: #define __SSE2__ 1 +// CHECK_K8_M64: #define __SSE_MATH__ 1 +// CHECK_K8_M64: #define __SSE__ 1 +// CHECK_K8_M64: #define __amd64 1 +// CHECK_K8_M64: #define __amd64__ 1 +// CHECK_K8_M64: #define __k8 1 +// CHECK_K8_M64: #define __k8__ 1 +// CHECK_K8_M64: #define __tune_k8__ 1 +// CHECK_K8_M64: #define __x86_64 1 +// CHECK_K8_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=k8-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_SSE3_M32 +// CHECK_K8_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_K8_SSE3_M32: #define __3dNOW__ 1 +// CHECK_K8_SSE3_M32: #define __MMX__ 1 +// CHECK_K8_SSE3_M32: #define __SSE2__ 1 +// CHECK_K8_SSE3_M32: #define __SSE3__ 1 +// CHECK_K8_SSE3_M32: #define __SSE__ 1 +// CHECK_K8_SSE3_M32: #define __i386 1 +// CHECK_K8_SSE3_M32: #define __i386__ 1 +// CHECK_K8_SSE3_M32: #define __k8 1 +// CHECK_K8_SSE3_M32: #define __k8__ 1 +// CHECK_K8_SSE3_M32: #define __tune_k8__ 1 +// CHECK_K8_SSE3_M32: #define i386 1 +// RUN: %clang -march=k8-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_K8_SSE3_M64 +// CHECK_K8_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_K8_SSE3_M64: #define __3dNOW__ 1 +// CHECK_K8_SSE3_M64: #define __MMX__ 1 +// CHECK_K8_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_K8_SSE3_M64: #define __SSE2__ 1 +// CHECK_K8_SSE3_M64: #define __SSE3__ 1 +// CHECK_K8_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_K8_SSE3_M64: #define __SSE__ 1 +// CHECK_K8_SSE3_M64: #define __amd64 1 +// CHECK_K8_SSE3_M64: #define __amd64__ 1 +// CHECK_K8_SSE3_M64: #define __k8 1 +// CHECK_K8_SSE3_M64: #define __k8__ 1 +// CHECK_K8_SSE3_M64: #define __tune_k8__ 1 +// CHECK_K8_SSE3_M64: #define __x86_64 1 +// CHECK_K8_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=opteron -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_M32 +// CHECK_OPTERON_M32: #define __3dNOW_A__ 1 +// CHECK_OPTERON_M32: #define __3dNOW__ 1 +// CHECK_OPTERON_M32: #define __MMX__ 1 +// CHECK_OPTERON_M32: #define __SSE2__ 1 +// CHECK_OPTERON_M32: #define __SSE__ 1 +// CHECK_OPTERON_M32: #define __i386 1 +// CHECK_OPTERON_M32: #define __i386__ 1 +// CHECK_OPTERON_M32: #define __k8 1 +// CHECK_OPTERON_M32: #define __k8__ 1 +// CHECK_OPTERON_M32: #define __tune_k8__ 1 +// CHECK_OPTERON_M32: #define i386 1 +// RUN: %clang -march=opteron -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_M64 +// CHECK_OPTERON_M64: #define __3dNOW_A__ 1 +// CHECK_OPTERON_M64: #define __3dNOW__ 1 +// CHECK_OPTERON_M64: #define __MMX__ 1 +// CHECK_OPTERON_M64: #define __SSE2_MATH__ 1 +// CHECK_OPTERON_M64: #define __SSE2__ 1 +// CHECK_OPTERON_M64: #define __SSE_MATH__ 1 +// CHECK_OPTERON_M64: #define __SSE__ 1 +// CHECK_OPTERON_M64: #define __amd64 1 +// CHECK_OPTERON_M64: #define __amd64__ 1 +// CHECK_OPTERON_M64: #define __k8 1 +// CHECK_OPTERON_M64: #define __k8__ 1 +// CHECK_OPTERON_M64: #define __tune_k8__ 1 +// CHECK_OPTERON_M64: #define __x86_64 1 +// CHECK_OPTERON_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=opteron-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_SSE3_M32 +// CHECK_OPTERON_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_OPTERON_SSE3_M32: #define __3dNOW__ 1 +// CHECK_OPTERON_SSE3_M32: #define __MMX__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE2__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE3__ 1 +// CHECK_OPTERON_SSE3_M32: #define __SSE__ 1 +// CHECK_OPTERON_SSE3_M32: #define __i386 1 +// CHECK_OPTERON_SSE3_M32: #define __i386__ 1 +// CHECK_OPTERON_SSE3_M32: #define __k8 1 +// CHECK_OPTERON_SSE3_M32: #define __k8__ 1 +// CHECK_OPTERON_SSE3_M32: #define __tune_k8__ 1 +// CHECK_OPTERON_SSE3_M32: #define i386 1 +// RUN: %clang -march=opteron-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_OPTERON_SSE3_M64 +// CHECK_OPTERON_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_OPTERON_SSE3_M64: #define __3dNOW__ 1 +// CHECK_OPTERON_SSE3_M64: #define __MMX__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE2__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE3__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_OPTERON_SSE3_M64: #define __SSE__ 1 +// CHECK_OPTERON_SSE3_M64: #define __amd64 1 +// CHECK_OPTERON_SSE3_M64: #define __amd64__ 1 +// CHECK_OPTERON_SSE3_M64: #define __k8 1 +// CHECK_OPTERON_SSE3_M64: #define __k8__ 1 +// CHECK_OPTERON_SSE3_M64: #define __tune_k8__ 1 +// CHECK_OPTERON_SSE3_M64: #define __x86_64 1 +// CHECK_OPTERON_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon64 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_M32 +// CHECK_ATHLON64_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_M32: #define __3dNOW__ 1 +// CHECK_ATHLON64_M32: #define __MMX__ 1 +// CHECK_ATHLON64_M32: #define __SSE2__ 1 +// CHECK_ATHLON64_M32: #define __SSE__ 1 +// CHECK_ATHLON64_M32: #define __i386 1 +// CHECK_ATHLON64_M32: #define __i386__ 1 +// CHECK_ATHLON64_M32: #define __k8 1 +// CHECK_ATHLON64_M32: #define __k8__ 1 +// CHECK_ATHLON64_M32: #define __tune_k8__ 1 +// CHECK_ATHLON64_M32: #define i386 1 +// RUN: %clang -march=athlon64 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_M64 +// CHECK_ATHLON64_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_M64: #define __3dNOW__ 1 +// CHECK_ATHLON64_M64: #define __MMX__ 1 +// CHECK_ATHLON64_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON64_M64: #define __SSE2__ 1 +// CHECK_ATHLON64_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON64_M64: #define __SSE__ 1 +// CHECK_ATHLON64_M64: #define __amd64 1 +// CHECK_ATHLON64_M64: #define __amd64__ 1 +// CHECK_ATHLON64_M64: #define __k8 1 +// CHECK_ATHLON64_M64: #define __k8__ 1 +// CHECK_ATHLON64_M64: #define __tune_k8__ 1 +// CHECK_ATHLON64_M64: #define __x86_64 1 +// CHECK_ATHLON64_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon64-sse3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_SSE3_M32 +// CHECK_ATHLON64_SSE3_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __3dNOW__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __MMX__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE2__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE3__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __SSE__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __i386 1 +// CHECK_ATHLON64_SSE3_M32: #define __i386__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __k8 1 +// CHECK_ATHLON64_SSE3_M32: #define __k8__ 1 +// CHECK_ATHLON64_SSE3_M32: #define __tune_k8__ 1 +// CHECK_ATHLON64_SSE3_M32: #define i386 1 +// RUN: %clang -march=athlon64-sse3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON64_SSE3_M64 +// CHECK_ATHLON64_SSE3_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __3dNOW__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __MMX__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE2__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE3__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __SSE__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __amd64 1 +// CHECK_ATHLON64_SSE3_M64: #define __amd64__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __k8 1 +// CHECK_ATHLON64_SSE3_M64: #define __k8__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __tune_k8__ 1 +// CHECK_ATHLON64_SSE3_M64: #define __x86_64 1 +// CHECK_ATHLON64_SSE3_M64: #define __x86_64__ 1 +// +// RUN: %clang -march=athlon-fx -m32 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_FX_M32 +// CHECK_ATHLON_FX_M32: #define __3dNOW_A__ 1 +// CHECK_ATHLON_FX_M32: #define __3dNOW__ 1 +// CHECK_ATHLON_FX_M32: #define __MMX__ 1 +// CHECK_ATHLON_FX_M32: #define __SSE2__ 1 +// CHECK_ATHLON_FX_M32: #define __SSE__ 1 +// CHECK_ATHLON_FX_M32: #define __i386 1 +// CHECK_ATHLON_FX_M32: #define __i386__ 1 +// CHECK_ATHLON_FX_M32: #define __k8 1 +// CHECK_ATHLON_FX_M32: #define __k8__ 1 +// CHECK_ATHLON_FX_M32: #define __tune_k8__ 1 +// CHECK_ATHLON_FX_M32: #define i386 1 +// RUN: %clang -march=athlon-fx -m64 -E -dM %s -o - 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_FX_M64 +// CHECK_ATHLON_FX_M64: #define __3dNOW_A__ 1 +// CHECK_ATHLON_FX_M64: #define __3dNOW__ 1 +// CHECK_ATHLON_FX_M64: #define __MMX__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE2_MATH__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE2__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE_MATH__ 1 +// CHECK_ATHLON_FX_M64: #define __SSE__ 1 +// CHECK_ATHLON_FX_M64: #define __amd64 1 +// CHECK_ATHLON_FX_M64: #define __amd64__ 1 +// CHECK_ATHLON_FX_M64: #define __k8 1 +// CHECK_ATHLON_FX_M64: #define __k8__ 1 +// CHECK_ATHLON_FX_M64: #define __tune_k8__ 1 +// CHECK_ATHLON_FX_M64: #define __x86_64 1 +// CHECK_ATHLON_FX_M64: #define __x86_64__ 1 +// +// End X86/GCC/Linux tests ------------------ diff --git a/test/Preprocessor/predefined-exceptions.m b/test/Preprocessor/predefined-exceptions.m new file mode 100644 index 000000000000..c13f429e3763 --- /dev/null +++ b/test/Preprocessor/predefined-exceptions.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -x objective-c -fobjc-exceptions -fexceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-NOCXX %s +// CHECK-OBJC-NOCXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-OBJC-NOCXX-NOT: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c++ -fobjc-exceptions -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-OBJC-CXX %s +// CHECK-OBJC-CXX: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-OBJC-CXX: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c++ -fexceptions -fcxx-exceptions -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-CXX %s +// CHECK-NOOBJC-CXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-NOOBJC-CXX: #define __EXCEPTIONS 1 + +// RUN: %clang_cc1 -x objective-c -E -dM %s | FileCheck -check-prefix=CHECK-NOOBJC-NOCXX %s +// CHECK-NOOBJC-NOCXX-NOT: #define OBJC_ZEROCOST_EXCEPTIONS 1 +// CHECK-NOOBJC-NOCXX-NOT: #define __EXCEPTIONS 1 diff --git a/test/Preprocessor/warning_tests.c b/test/Preprocessor/warning_tests.c new file mode 100644 index 000000000000..96b96efc7e69 --- /dev/null +++ b/test/Preprocessor/warning_tests.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +#ifndef __has_warning +#error Should have __has_warning +#endif + +#if __has_warning("not valid") // expected-warning {{__has_warning expected option name}} +#endif + +#if __has_warning("-Wparentheses") +#warning Should have -Wparentheses // expected-warning {{Should have -Wparentheses}} +#endif + +#if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}} +#endif + +#if __has_warning("-Wnot-a-valid-warning-flag-at-all") +#else +#warning Not a valid warning flag // expected-warning {{Not a valid warning flag}} +#endif
\ No newline at end of file diff --git a/test/Rewriter/inner-block-helper-funcs.mm b/test/Rewriter/inner-block-helper-funcs.mm new file mode 100644 index 000000000000..33567bc3d7aa --- /dev/null +++ b/test/Rewriter/inner-block-helper-funcs.mm @@ -0,0 +1,32 @@ +// 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 +// rdar://9846759 + +typedef void (^dispatch_block_t)(void); + +extern int printf(const char*, ...); + +extern "C" dispatch_block_t Block_copy(dispatch_block_t aBlock); + +int main (int argc, char *argv[]) { + + dispatch_block_t innerBlock = ^{printf("argc = %d\n", argc); }; + id innerObject = 0; + + printf("innerBlock is %x\n", innerBlock); + + dispatch_block_t wrapperBlock = ^{ + printf("innerBlock is %x %x\n", innerBlock, innerObject); + }; + + wrapperBlock(); + + dispatch_block_t copiedBlock = Block_copy(wrapperBlock); + copiedBlock(); + + return 0; +} +// CHECK-LP: _Block_object_assign((void*)&dst->innerBlock, (void*)src->innerBlock, 7 +// CHECK-LP: _Block_object_dispose((void*)src->innerBlock, 7 +// CHECK-LP: _Block_object_assign((void*)&dst->innerObject, (void*)src->innerObject, 3 +// CHECK-LP: _Block_object_dispose((void*)src->innerObject, 3 diff --git a/test/Rewriter/instancetype-test.mm b/test/Rewriter/instancetype-test.mm new file mode 100644 index 000000000000..97fbe0950da5 --- /dev/null +++ b/test/Rewriter/instancetype-test.mm @@ -0,0 +1,75 @@ +// 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"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp + +void *sel_registerName(const char *); + +@interface Root ++ (instancetype)alloc; +- (instancetype)init; // expected-note{{overridden method is part of the 'init' method family}} +- (instancetype)self; +- (Class)class; + +@property (assign) Root *selfProp; +- (instancetype)selfProp; +@end + +@protocol Proto1 +@optional +- (instancetype)methodInProto1; +@end + +@protocol Proto2 +@optional +- (instancetype)methodInProto2; // expected-note{{overridden method returns an instance of its class type}} +- (instancetype)otherMethodInProto2; // expected-note{{overridden method returns an instance of its class type}} +@end + +@interface Subclass1 : Root +- (instancetype)initSubclass1; +- (void)methodOnSubclass1; ++ (instancetype)allocSubclass1; +@end + +@interface Subclass2 : Root +- (instancetype)initSubclass2; +- (void)methodOnSubclass2; +@end + +// Sanity check: the basic initialization pattern. +void test_instancetype_alloc_init_simple() { + Root *r1 = [[Root alloc] init]; + Subclass1 *sc1 = [[Subclass1 alloc] init]; +} + +// Test that message sends to instancetype methods have the right type. +void test_instancetype_narrow_method_search() { + // instancetype on class methods + Subclass1 *sc1 = [[Subclass1 alloc] initSubclass2]; // expected-warning{{'Subclass1' may not respond to 'initSubclass2'}} + Subclass2 *sc2 = [[Subclass2 alloc] initSubclass2]; // okay + + // instancetype on instance methods + [[[Subclass1 alloc] init] methodOnSubclass2]; // expected-warning{{'Subclass1' may not respond to 'methodOnSubclass2'}} + [[[Subclass2 alloc] init] methodOnSubclass2]; + + // instancetype on class methods using protocols + [[Subclass1<Proto1> alloc] methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [[Subclass1<Proto2> alloc] methodInProto2]; + + // instancetype on instance methods + Subclass1<Proto1> *sc1proto1 = 0; + [[sc1proto1 self] methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + Subclass1<Proto2> *sc1proto2 = 0; + [[sc1proto2 self] methodInProto2]; + + // Exact type checks + // Message sends to Class. + // FIXME. This is not supported due to missing capability in rewriter and not due to instancetype issues + // Subclass1<Proto1> *sc1proto1_2 = [[[sc1proto1 class] alloc] init]; + + // Property access + [sc1proto1.self methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [sc1proto2.self methodInProto2]; + + [sc1proto1.selfProp methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [sc1proto2.selfProp methodInProto2]; +} diff --git a/test/Rewriter/protocol-rewrite-2.m b/test/Rewriter/protocol-rewrite-2.m new file mode 100644 index 000000000000..b3eb16a5f119 --- /dev/null +++ b/test/Rewriter/protocol-rewrite-2.m @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -rewrite-objc %s -o %t.cpp +// RUN: %clang_cc1 -fsyntax-only %t.cpp + +// rdar://10234024 +@protocol Foo; +@protocol Foo +@end diff --git a/test/Rewriter/rewrite-cast-to-bool.mm b/test/Rewriter/rewrite-cast-to-bool.mm new file mode 100644 index 000000000000..0e9f3640fb39 --- /dev/null +++ b/test/Rewriter/rewrite-cast-to-bool.mm @@ -0,0 +1,17 @@ +// 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 9899834 + +void *sel_registerName(const char *); + +@interface NSURLDownload +-(void)setBool:(bool)Arg; +@end + +@implementation NSURLDownload +- (void) Meth +{ + [self setBool:(signed char)1]; +} +@end + diff --git a/test/Rewriter/rewrite-foreach-in-block.mm b/test/Rewriter/rewrite-foreach-in-block.mm new file mode 100644 index 000000000000..971330c6bfe9 --- /dev/null +++ b/test/Rewriter/rewrite-foreach-in-block.mm @@ -0,0 +1,28 @@ +// 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"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp +// rdar:// 9878420 + +void objc_enumerationMutation(id); +void *sel_registerName(const char *); +typedef void (^CoreDAVCompletionBlock)(void); + +@interface I +- (void)M; +- (id) ARR; +@property (readwrite, copy, nonatomic) CoreDAVCompletionBlock c; +@end + +@implementation I +- (void)M { + I* ace; + self.c = ^() { + // sanity test for the changes. + [ace ARR]; + for (I *privilege in [ace ARR]) { } + }; + self.c = ^() { + // sanity test for the changes. + [ace ARR]; + }; +} +@end diff --git a/test/Rewriter/rewrite-forward-class.m b/test/Rewriter/rewrite-forward-class.m index 5a50f53a480f..1d3af6f366c3 100644 --- a/test/Rewriter/rewrite-forward-class.m +++ b/test/Rewriter/rewrite-forward-class.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -rewrite-objc -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 // rdar://6969189 @class XX; @@ -6,3 +7,29 @@ @class ISyncClient, SMSession, ISyncManager, ISyncSession, SMDataclassInfo, SMClientInfo, DMCConfiguration, DMCStatusEntry; +@interface QQ + +@end + +@interface SMDataclassInfo : QQ +- (XX*) Meth; +- (DMCStatusEntry*)Meth2; +@end + +@implementation SMDataclassInfo +- (XX*) Meth { return 0; } +- (DMCStatusEntry*)Meth2 { return 0; } +@end + +@interface YY +{ + ISyncClient *p1; + ISyncSession *p2; +} +@property (copy) ISyncClient *p1; +@end + +@implementation YY +@synthesize p1; +@end + diff --git a/test/Rewriter/rewrite-forward-class.mm b/test/Rewriter/rewrite-forward-class.mm new file mode 100644 index 000000000000..74c0508fc78a --- /dev/null +++ b/test/Rewriter/rewrite-forward-class.mm @@ -0,0 +1,44 @@ +// 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 + +extern "C" { +@class XX; +@class YY, ZZ, QQ; +@class ISyncClient, SMSession, ISyncManager, ISyncSession, SMDataclassInfo, SMClientInfo, + DMCConfiguration, DMCStatusEntry; + +@interface QQ + +@end + +@interface SMDataclassInfo : QQ +- (XX*) Meth; +- (DMCStatusEntry*)Meth2; +@end + +@implementation SMDataclassInfo +- (XX*) Meth { return 0; } +- (DMCStatusEntry*)Meth2 { return 0; } +@end + +@interface YY +{ + ISyncClient *p1; + ISyncSession *p2; +} +@property (copy) ISyncClient *p1; +@end + +@implementation YY +@synthesize p1; +@end + +extern "C" { +@class CCC; +@class Protocol, P , Q; +int I,J,K; +}; + +}; + + diff --git a/test/Sema/2007-10-01-BuildArrayRef.c b/test/Sema/2007-10-01-BuildArrayRef.c new file mode 100644 index 000000000000..4692731b5c25 --- /dev/null +++ b/test/Sema/2007-10-01-BuildArrayRef.c @@ -0,0 +1,20 @@ +// RUN: not %clang_cc1_only -c %s -o - > /dev/null +// PR 1603 +void func() +{ + const int *arr; + arr[0] = 1; // expected-error {{assignment of read-only location}} +} + +struct foo { + int bar; +}; +struct foo sfoo = { 0 }; + +int func2() +{ + const struct foo *fp; + fp = &sfoo; + fp[0].bar = 1; // expected-error {{ assignment of read-only member}} + return sfoo.bar; +} diff --git a/test/Sema/2009-03-09-WeakDeclarations-1.c b/test/Sema/2009-03-09-WeakDeclarations-1.c new file mode 100644 index 000000000000..f219de6b848f --- /dev/null +++ b/test/Sema/2009-03-09-WeakDeclarations-1.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -triple i686-apple-darwin +// Insist upon warnings for inappropriate weak attributes. + +// O.K. +extern int ext_weak_import __attribute__ ((__weak_import__)); + +// These are inappropriate, and should generate warnings: +int decl_weak_import __attribute__ ((__weak_import__)); // expected-warning {'weak_import' attribute cannot be specified on a definition} +int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13; // expected-warning {'weak_import' attribute cannot be specified on a definition} + +// O.K. +extern int ext_f(void) __attribute__ ((__weak_import__)); + +// These are inappropriate, and should generate warnings: +int def_f(void) __attribute__ ((__weak_import__)); +int __attribute__ ((__weak_import__)) decl_f(void) {return 0;}; diff --git a/test/Sema/2009-04-22-UnknownSize.c b/test/Sema/2009-04-22-UnknownSize.c new file mode 100644 index 000000000000..9f717408b5ea --- /dev/null +++ b/test/Sema/2009-04-22-UnknownSize.c @@ -0,0 +1,4 @@ +// RUN: not %clang_cc1 %s -emit-llvm -o - +// PR2958 +static struct foo s; // expected-error { tentative definition has type 'struct foo' that is never completed } +struct foo *p = &s; diff --git a/test/Sema/2009-07-17-VoidParameter.c b/test/Sema/2009-07-17-VoidParameter.c new file mode 100644 index 000000000000..68d1b1ec33ad --- /dev/null +++ b/test/Sema/2009-07-17-VoidParameter.c @@ -0,0 +1,4 @@ +// RUN: not %clang_cc1 -emit-llvm %s -o - +// PR4214 +typedef void vt; +void (*func_ptr)(vt my_vt); // expected-error {argument may not have 'void' type} diff --git a/test/Sema/2010-05-31-palignr.c b/test/Sema/2010-05-31-palignr.c new file mode 100644 index 000000000000..12be29af95c0 --- /dev/null +++ b/test/Sema/2010-05-31-palignr.c @@ -0,0 +1,22 @@ +// RUN: not %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o /dev/null %s + +#include <tmmintrin.h> + +extern int i; + +int main () +{ +#if defined( __SSSE3__ ) + + typedef int16_t vSInt16 __attribute__ ((__vector_size__ (16))); + + short dtbl[] = {1,2,3,4,5,6,7,8}; + vSInt16 *vdtbl = (vSInt16*) dtbl; + + vSInt16 v0; + v0 = *vdtbl; + v0 = _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}} + + return 0; +#endif +} diff --git a/test/Sema/Inputs/pragma-arc-cf-code-audited.h b/test/Sema/Inputs/pragma-arc-cf-code-audited.h new file mode 100644 index 000000000000..6ea360c34bb5 --- /dev/null +++ b/test/Sema/Inputs/pragma-arc-cf-code-audited.h @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +#pragma clang arc_cf_code_audited begin diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c index a53bb4da0003..24799daa9e50 100644 --- a/test/Sema/address_spaces.c +++ b/test/Sema/address_spaces.c @@ -44,3 +44,7 @@ void test3(void) { extern void test3_helper(char *p); // expected-note {{passing argument to parameter 'p' here}} test3_helper(test3_array); // expected-error {{changes address space of pointer}} } + +typedef void ft(void); +_AS1 ft qf; // expected-error {{function type may not be qualified with an address space}} +typedef _AS1 ft qft; // expected-error {{function type may not be qualified with an address space}} diff --git a/test/Sema/alignas.c b/test/Sema/alignas.c new file mode 100644 index 000000000000..5832393e3b61 --- /dev/null +++ b/test/Sema/alignas.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c1x %s + +_Alignas(3) int align_illegal; //expected-error {{requested alignment is not a power of 2}} +_Alignas(int) char align_big; +_Alignas(1) int align_small; // FIXME: this should be rejected +_Alignas(1) unsigned _Alignas(8) int _Alignas(1) align_multiple; + +struct align_member { + _Alignas(8) int member; +}; + +typedef _Alignas(8) char align_typedef; // FIXME: this should be rejected + +_Static_assert(__alignof(align_big) == __alignof(int), "k's alignment is wrong"); +_Static_assert(__alignof(align_small) == 1, "j's alignment is wrong"); +_Static_assert(__alignof(align_multiple) == 8, "l's alignment is wrong"); +_Static_assert(__alignof(struct align_member) == 8, "quuux's alignment is wrong"); +_Static_assert(sizeof(struct align_member) == 8, "quuux's size is wrong"); +_Static_assert(__alignof(align_typedef) == 8, "typedef's alignment is wrong"); diff --git a/test/Sema/annotate.c b/test/Sema/annotate.c index 6f81491f1ffa..5b2727752bbd 100644 --- a/test/Sema/annotate.c +++ b/test/Sema/annotate.c @@ -4,4 +4,7 @@ void __attribute__((annotate("foo"))) foo(float *a) { __attribute__((annotate("bar"))) int x; __attribute__((annotate(1))) int y; // expected-error {{argument to annotate attribute was not a string literal}} __attribute__((annotate("bar", 1))) int z; // expected-error {{attribute takes one argument}} + int u = __builtin_annotation(z, (char*) 0); // expected-error {{__builtin_annotation requires a non wide string constant}} + int v = __builtin_annotation(z, (char*) L"bar"); // expected-error {{__builtin_annotation requires a non wide string constant}} + int w = __builtin_annotation(z, "foo"); } diff --git a/test/Sema/array-bounds-ptr-arith.c b/test/Sema/array-bounds-ptr-arith.c new file mode 100644 index 000000000000..c0e0d0ea785d --- /dev/null +++ b/test/Sema/array-bounds-ptr-arith.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify -Warray-bounds-pointer-arithmetic %s + +// Test case from PR10615 +struct ext2_super_block{ + unsigned char s_uuid[8]; // expected-note {{declared here}} +}; +void* ext2_statfs (struct ext2_super_block *es,int a) +{ + return (void *)es->s_uuid + sizeof(int); // no-warning +} +void* broken (struct ext2_super_block *es,int a) +{ + return (void *)es->s_uuid + 80; // expected-warning {{refers past the end of the array}} +} diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c index 345ab6981b17..bc958c3eea60 100644 --- a/test/Sema/array-init.c +++ b/test/Sema/array-init.c @@ -53,7 +53,7 @@ void func() { void test() { int y1[3] = { - { 1, 2, 3 } // expected-warning{{braces around scalar initializer}} expected-warning{{excess elements in scalar initializer}} + { 1, 2, 3 } // expected-warning{{excess elements in scalar initializer}} }; int y3[4][3] = { { 1, 3, 5 }, diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c new file mode 100644 index 000000000000..51b46bd5d0ea --- /dev/null +++ b/test/Sema/atomic-ops.c @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only + +// Basic parsing/Sema tests for __atomic_* + +// FIXME: Need to implement __atomic_is_lock_free + +typedef enum memory_order { + memory_order_relaxed, memory_order_consume, memory_order_acquire, + memory_order_release, memory_order_acq_rel, memory_order_seq_cst +} memory_order; + +void f(_Atomic(int) *i, _Atomic(int*) *p, _Atomic(float) *d) { + __atomic_load(0); // expected-error {{too few arguments to function}} + __atomic_load(0,0,0); // expected-error {{too many arguments to function}} + __atomic_store(0,0,0); // expected-error {{first argument to atomic operation}} + __atomic_store((int*)0,0,0); // expected-error {{first argument to atomic operation}} + + __atomic_load(i, memory_order_seq_cst); + __atomic_load(p, memory_order_seq_cst); + __atomic_load(d, memory_order_seq_cst); + + __atomic_store(i, 1, memory_order_seq_cst); + __atomic_store(p, 1, memory_order_seq_cst); // expected-warning {{incompatible integer to pointer conversion}} + (int)__atomic_store(d, 1, memory_order_seq_cst); // expected-error {{operand of type 'void'}} + + __atomic_fetch_add(i, 1, memory_order_seq_cst); + __atomic_fetch_add(p, 1, memory_order_seq_cst); + __atomic_fetch_add(d, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer or pointer}} + + __atomic_fetch_and(i, 1, memory_order_seq_cst); + __atomic_fetch_and(p, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer}} + __atomic_fetch_and(d, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer}} + + __atomic_compare_exchange_strong(i, 0, 1, memory_order_seq_cst, memory_order_seq_cst); + __atomic_compare_exchange_strong(p, 0, (int*)1, memory_order_seq_cst, memory_order_seq_cst); + __atomic_compare_exchange_strong(d, (int*)0, 1, memory_order_seq_cst, memory_order_seq_cst); // expected-warning {{incompatible pointer types}} +} diff --git a/test/Sema/atomic-type.c b/test/Sema/atomic-type.c new file mode 100644 index 000000000000..8e725403ae90 --- /dev/null +++ b/test/Sema/atomic-type.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only + +// Basic parsing/Sema tests for _Atomic +// No operations are actually supported on objects of this type yet. +// The qualifier syntax is not supported yet. +_Atomic(int) t1; +_Atomic(int) *t2 = &t1; +void testf(void*); +void f(void) { + _Atomic(_Atomic(int)*) t3; + _Atomic(_Atomic(int)*) *t4[2] = { &t3, 0 }; + testf(t4); +} +extern _Atomic(int (*)(int(*)[], int(*)[10])) mergetest; +extern _Atomic(int (*)(int(*)[10], int(*)[])) mergetest; +extern _Atomic(int (*)(int(*)[10], int(*)[10])) mergetest; + +_Atomic(int()) error1; // expected-error {{_Atomic cannot be applied to function type}} +_Atomic(struct ErrorS) error2; // expected-error {{_Atomic cannot be applied to incomplete type}} +_Atomic(int[10]) error3; // expected-error {{_Atomic cannot be applied to array type}} +_Atomic(const int) error4; // expected-error {{_Atomic cannot be applied to qualified type}} +_Atomic(_Atomic(int)) error5; // expected-error {{_Atomic cannot be applied to atomic type}} diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c index 1314cf5a5b03..f6ed13190ed8 100644 --- a/test/Sema/attr-availability.c +++ b/test/Sema/attr-availability.c @@ -2,5 +2,6 @@ void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}} void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0))); // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}} +void f2() __attribute__((availability(ios,introduced=2.1,deprecated=2.1))); -void f2() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}} +void f3() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}} diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c index eeef0d757a70..2889f8fa1146 100644 --- a/test/Sema/attr-deprecated.c +++ b/test/Sema/attr-deprecated.c @@ -109,7 +109,7 @@ enum __attribute__((deprecated)) Test20 { void test20() { enum Test20 f; // expected-warning {{'Test20' is deprecated}} f = test20_a; // expected-warning {{'test20_a' is deprecated}} - f = test20_b; + f = test20_b; // expected-warning {{'Test20' is deprecated}} } char test21[__has_feature(attribute_deprecated_with_message) ? 1 : -1]; diff --git a/test/Sema/attr-returns-twice.c b/test/Sema/attr-returns-twice.c new file mode 100644 index 000000000000..13f53e36de79 --- /dev/null +++ b/test/Sema/attr-returns-twice.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only + +int a __attribute__((returns_twice)); // expected-warning {{'returns_twice' attribute only applies to functions}} + +__attribute__((returns_twice)) void t0(void) { +} + +void t1() __attribute__((returns_twice)); + +void t2() __attribute__((returns_twice(2))); // expected-error {{attribute takes no arguments}} + +typedef void (*t3)(void) __attribute__((returns_twice)); // expected-warning {{'returns_twice' attribute only applies to functions}} diff --git a/test/Sema/attr-sentinel.c b/test/Sema/attr-sentinel.c index 5ca6a8d00113..abc108fdc785 100644 --- a/test/Sema/attr-sentinel.c +++ b/test/Sema/attr-sentinel.c @@ -4,13 +4,15 @@ #define ATTR __attribute__ ((__sentinel__)) -void foo1 (int x, ...) ATTR; // expected-note 2 {{function has been explicitly marked sentinel here}} +void foo1 (int x, ...) ATTR; // expected-note 3 {{function has been explicitly marked sentinel here}} void foo5 (int x, ...) __attribute__ ((__sentinel__(1))); // expected-note {{function has been explicitly marked sentinel here}} void foo6 (int x, ...) __attribute__ ((__sentinel__(5))); // expected-note {{function has been explicitly marked sentinel here}} void foo7 (int x, ...) __attribute__ ((__sentinel__(0))); // expected-note {{function has been explicitly marked sentinel here}} void foo10 (int x, ...) __attribute__ ((__sentinel__(1,1))); void foo12 (int x, ... ) ATTR; // expected-note {{function has been explicitly marked sentinel here}} +#define FOOMACRO(...) foo1(__VA_ARGS__) + void test1() { foo1(1, NULL); // OK foo1(1, 0) ; // expected-warning {{missing sentinel in function call}} @@ -30,6 +32,9 @@ void test1() { struct A a, b, c; foo1(3, &a, &b, &c); // expected-warning {{missing sentinel in function call}} foo1(3, &a, &b, &c, (struct A*) 0); + + // PR11002 + FOOMACRO(1, 2); // expected-warning {{missing sentinel in function call}} } diff --git a/test/Sema/attr-unavailable-message.c b/test/Sema/attr-unavailable-message.c index 9f663fc4efd4..9b0c3debd8a7 100644 --- a/test/Sema/attr-unavailable-message.c +++ b/test/Sema/attr-unavailable-message.c @@ -26,3 +26,24 @@ void unavail(void) { void (*fp)() = &bar; double (*fp4)(double) = dfoo; } + +// rdar://10201690 +enum foo { + a = 1, + b __attribute__((deprecated())) = 2, + c = 3 +}__attribute__((deprecated())); + +enum fee { // expected-note 2 {{declaration has been explicitly marked unavailable here}} + r = 1, + s = 2, + t = 3 +}__attribute__((unavailable())); + +enum fee f() { // expected-error {{error: 'fee' is unavailable}} + int i = a; // expected-warning {{'foo' is deprecated }} + + i = b; // expected-warning {{'b' is deprecated}} + + return r; // expected-error {{'fee' is unavailable}} +} diff --git a/test/Sema/complex-init-list.c b/test/Sema/complex-init-list.c new file mode 100644 index 000000000000..5b5d7ce1436b --- /dev/null +++ b/test/Sema/complex-init-list.c @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic + +// This file tests the clang extension which allows initializing the components +// of a complex number individually using an initialization list. Basically, +// if you have an explicit init list for a complex number that contains two +// initializers, this extension kicks in to turn it into component-wise +// initialization. +// +// This extension is useful because there isn't any way to accurately build +// a complex number at the moment besides setting the components with +// __real__ and __imag__, which is inconvenient and not usable for constants. +// (Of course, there are other extensions we could implement that would +// allow this, like some sort of __builtin_build_complex.) +// +// FIXME: It would be a good idea to have a warnings for implicit +// real->complex and complex->real conversions; as-is, it's way too easy +// to get implicit conversions when they are not intended. + +// Basic testcase +_Complex float valid1 = { 1.0f, 2.0f }; // expected-warning {{specifying real and imaginary components is an extension}} + + +// Struct for nesting tests +struct teststruct { _Complex float x; }; + + +// Random other valid stuff +_Complex int valid2 = { 1, 2 }; // expected-warning {{complex integer}} expected-warning {{specifying real and imaginary components is an extension}} +struct teststruct valid3 = { { 1.0f, 2.0f} }; // expected-warning {{specifying real and imaginary components is an extension}} +_Complex float valid4[2] = { {1.0f, 1.0f}, {1.0f, 1.0f} }; // expected-warning 2 {{specifying real and imaginary components is an extension}} +// FIXME: We need some sort of warning for valid5 +_Complex float valid5 = {1.0f, 1.0fi}; // expected-warning {{imaginary constants}} expected-warning {{specifying real and imaginary components is an extension}} + + +// Random invalid stuff +struct teststruct invalid1 = { 1, 2 }; // expected-warning {{excess elements}} +_Complex float invalid2 = { 1, 2, 3 }; // expected-warning {{excess elements}} +_Complex float invalid3 = {}; // expected-error {{scalar initializer cannot be empty}} expected-warning {{GNU empty initializer}} + + +// Check incomplete array sizing +_Complex float sizetest1[] = { {1.0f, 1.0f}, {1.0f, 1.0f} }; // expected-warning 2 {{specifying real and imaginary components is an extension}} +_Complex float sizecheck1[(sizeof(sizetest1) == sizeof(*sizetest1)*2) ? 1 : -1]; +_Complex float sizetest2[] = { 1.0f, 1.0f, {1.0f, 1.0f} }; // expected-warning {{specifying real and imaginary components is an extension}} +_Complex float sizecheck2[(sizeof(sizetest2) == sizeof(*sizetest2)*3) ? 1 : -1]; diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 7a8c9e9f3612..436ecdbebce8 100644 --- a/test/Sema/conditional-expr.c +++ b/test/Sema/conditional-expr.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-compare %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wsign-conversion %s void foo() { *(0 ? (double *)0 : (void *)0) = 0; // FIXME: GCC doesn't consider the the following two statements to be errors. @@ -36,12 +36,12 @@ void foo() { *(0 ? (asdf) 0 : &x) = 10; unsigned long test0 = 5; - test0 = test0 ? (long) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (int) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (short) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (long) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (int) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (short) test0; // expected-warning {{operands of ? are integers of different signs}} + test0 = test0 ? (long) test0 : test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? (int) test0 : test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? (short) test0 : test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} + test0 = test0 ? test0 : (long) test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? test0 : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test0 : (short) test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) 10; test0 = test0 ? test0 : (int) 10; test0 = test0 ? test0 : (short) 10; @@ -49,12 +49,17 @@ void foo() { test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; + int test1; enum Enum { EVal }; test0 = test0 ? EVal : test0; - test0 = test0 ? EVal : (int) test0; // okay: EVal is an int - test0 = test0 ? // expected-warning {{operands of ? are integers of different signs}} + test1 = test0 ? EVal : (int) test0; + test0 = test0 ? (unsigned) EVal - : (int) test0; + : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + + test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + } int Postgresql() { diff --git a/test/Sema/conversion.c b/test/Sema/conversion.c index 03204c63e965..842641bf1056 100644 --- a/test/Sema/conversion.c +++ b/test/Sema/conversion.c @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wconversion -nostdinc -isystem %S/Inputs -triple x86_64-apple-darwin %s -Wno-unreachable-code +// RUN: %clang_cc1 -fsyntax-only -verify -Wconversion \ +// RUN: -nostdsysteminc -nobuiltininc -isystem %S/Inputs \ +// RUN: -triple x86_64-apple-darwin %s -Wno-unreachable-code #include <conversion.h> diff --git a/test/Sema/crash-invalid-array.c b/test/Sema/crash-invalid-array.c new file mode 100644 index 000000000000..a3bc03b70b56 --- /dev/null +++ b/test/Sema/crash-invalid-array.c @@ -0,0 +1,17 @@ +// RUN: not %clang_cc1 -O1 %s -emit-llvm +// PR6913 + +#include <stdio.h> + +int main() +{ + int x[10][10]; + int (*p)[] = x; // expected-error {{invalid use of array with unspecified bounds} + + int i; + + for(i = 0; i < 10; ++i) + { + p[i][i] = i; + } +} diff --git a/test/Sema/dllimport-dllexport.c b/test/Sema/dllimport-dllexport.c index f09e3cf69ab5..610059ec9f6b 100644 --- a/test/Sema/dllimport-dllexport.c +++ b/test/Sema/dllimport-dllexport.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -verify %s inline void __attribute__((dllexport)) foo1(){} // expected-warning{{dllexport attribute ignored}} inline void __attribute__((dllimport)) foo2(){} // expected-warning{{dllimport attribute ignored}} diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index 9ce1481f16c5..72cff65f4837 100644 --- a/test/Sema/exprs.c +++ b/test/Sema/exprs.c @@ -163,7 +163,7 @@ void test17(int x) { } // PR6501 -void test18_a(int a); // expected-note {{'test18_a' declared here}} +void test18_a(int a); // expected-note 2 {{'test18_a' declared here}} void test18(int b) { test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}} test18_a(); // expected-error {{too few arguments to function call, expected 1, have 0}} @@ -183,7 +183,9 @@ void test19() { } int test20(int x) { - return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && 4; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x && sizeof(int) == 4; // no warning, RHS is logical op. @@ -192,20 +194,32 @@ int test20(int x) { return x || 0; return x || 1; - return x || -1; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || 5; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} + return x || -1; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || 5; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} return x && 0; return x && 1; - return x && -1; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && 5; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && -1; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && 5; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x || (0); return x || (1); - return x || (-1); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || (5); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} + return x || (-1); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || (5); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} return x && (0); return x && (1); - return x && (-1); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && (5); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && (-1); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && (5); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} } diff --git a/test/Sema/flexible-array-init.c b/test/Sema/flexible-array-init.c index 12f5d4f5d605..78fc7c5e0df3 100644 --- a/test/Sema/flexible-array-init.c +++ b/test/Sema/flexible-array-init.c @@ -7,9 +7,7 @@ struct one { struct one x2 = { 5, 1, 2, 3 }; // expected-warning{{flexible array initialization is a GNU extension}} void test() { - struct one x3 = {5, {1, 2, 3}}; // \ - // expected-warning{{flexible array initialization is a GNU extension}} \ - // expected-error {{non-static initialization of a variable with flexible array member}} + struct one x3 = {5, {1, 2, 3}}; // expected-error{{initialization of flexible array member is not allowed}} struct one x3a = { 5 }; struct one x3b = { .a = 5 }; struct one x3c = { 5, {} }; // expected-warning{{use of GNU empty initializer extension}} \ @@ -19,22 +17,23 @@ void test() { struct foo { int x; - int y[]; // expected-note 6 {{initialized flexible array member 'y' is here}} + int y[]; // expected-note 8 {{initialized flexible array member 'y' is here}} }; struct bar { struct foo z; }; // expected-warning {{'z' may not be nested in a struct due to flexible array member}} struct foo a = { 1, { 2, 3, 4 } }; // expected-warning{{flexible array initialization is a GNU extension}} -struct bar b = { { 1, { 2, 3, 4 } } }; // expected-error{{non-empty initialization of flexible array member inside subobject}} +struct bar b = { { 1, { 2, 3, 4 } } }; // expected-error{{initialization of flexible array member is not allowed}} struct bar c = { { 1, { } } }; // // expected-warning{{flexible array initialization is a GNU extension}} \ // expected-warning{{use of GNU empty initializer extension}} \ // expected-warning{{zero size arrays are an extension}} struct foo d[1] = { { 1, { 2, 3, 4 } } }; // expected-warning{{'struct foo' may not be used as an array element due to flexible array member}} \ - // expected-error{{non-empty initialization of flexible array member inside subobject}} + // expected-error{{initialization of flexible array member is not allowed}} -struct foo desig_foo = { .y = {2, 3, 4} }; +struct foo desig_foo = { .y = {2, 3, 4} }; // expected-warning{{flexible array initialization is a GNU extension}} struct bar desig_bar = { .z.y = { } }; // expected-warning{{use of GNU empty initializer extension}} \ - // expected-warning{{zero size arrays are an extension}} -struct bar desig_bar2 = { .z.y = { 2, 3, 4} }; // expected-error{{non-empty initialization of flexible array member inside subobject}} + // expected-warning{{zero size arrays are an extension}} \ + // expected-warning{{flexible array initialization is a GNU extension}} +struct bar desig_bar2 = { .z.y = { 2, 3, 4} }; // expected-error{{initialization of flexible array member is not allowed}} struct foo design_foo2 = { .y = 2 }; // expected-error{{flexible array requires brace-enclosed initializer}} struct point { @@ -68,13 +67,25 @@ struct Y { // PR8217 struct PR8217a { int i; - char v[]; + char v[]; // expected-note 2 {{initialized flexible array member 'v' is here}} }; void PR8217() { - struct PR8217a foo1 = { .i = 0, .v = "foo" }; // expected-error {{non-static initialization of a variable with flexible array member}} + struct PR8217a foo1 = { .i = 0, .v = "foo" }; // expected-error {{initialization of flexible array member is not allowed}} struct PR8217a foo2 = { .i = 0 }; - struct PR8217a foo3 = { .i = 0, .v = { 'b', 'a', 'r', '\0' } }; // expected-error {{non-static initialization of a variable with flexible array member}} + struct PR8217a foo3 = { .i = 0, .v = { 'b', 'a', 'r', '\0' } }; // expected-error {{initialization of flexible array member is not allowed}} struct PR8217a bar; } +typedef struct PR10648 { + unsigned long n; + int v[]; // expected-note {{initialized flexible array member 'v' is here}} +} PR10648; +int f10648() { + return (PR10648){2, {3, 4}}.v[1]; // expected-error {{initialization of flexible array member is not allowed}} +} + +struct FlexWithUnnamedBitfield { int : 10; int x; int y[]; }; // expected-note {{initialized flexible array member 'y' is here}} +void TestFlexWithUnnamedBitfield() { + struct FlexWithUnnamedBitfield x = {10, {3}}; // expected-error {{initialization of flexible array member is not allowed}} +} diff --git a/test/Sema/format-strings-fixit.c b/test/Sema/format-strings-fixit.c index c2fa2f770745..d03cccb601f3 100644 --- a/test/Sema/format-strings-fixit.c +++ b/test/Sema/format-strings-fixit.c @@ -1,5 +1,5 @@ // RUN: cp %s %t -// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true +// RUN: %clang_cc1 -pedantic -Wall -fixit %t // RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t // RUN: %clang_cc1 -E -o - %t | FileCheck %s diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index b47d3ca2616c..6b5f7e2c2662 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -87,7 +87,12 @@ void check_empty_format_string(char* buf, ...) va_list ap; va_start(ap,buf); vprintf("",ap); // expected-warning {{format string is empty}} - sprintf(buf,""); // expected-warning {{format string is empty}} + sprintf(buf, "", 1); // expected-warning {{format string is empty}} + + // Don't warn about empty format strings when there are no data arguments. + // This can arise from macro expansions and non-standard format string + // functions. + sprintf(buf, ""); // no-warning } void check_wide_string(char* b, ...) @@ -372,3 +377,13 @@ void check_char(unsigned char x, signed char y) { printf("%c", x); // no-warning printf("%hhu", y); // no-warning } + +// Test suppression of individual warnings. + +void test_suppress_invalid_specifier() { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-invalid-specifier" + printf("%@", 12); // no-warning +#pragma clang diagnostic pop +} + diff --git a/test/Sema/fp16-sema.c b/test/Sema/fp16-sema.c new file mode 100644 index 000000000000..e678f9a829e4 --- /dev/null +++ b/test/Sema/fp16-sema.c @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Functions cannot have parameters of type __fp16. +extern void f (__fp16); // expected-error {{parameters cannot have __fp16 type; did you forget * ?}} +extern void g (__fp16 *); + +extern void (*pf) (__fp16); // expected-error {{parameters cannot have __fp16 type; did you forget * ?}} +extern void (*pg) (__fp16*); + +typedef void(*tf) (__fp16); // expected-error {{parameters cannot have __fp16 type; did you forget * ?}} +typedef void(*tg) (__fp16*); + +void kf(a) + __fp16 a; { // expected-error {{parameters cannot have __fp16 type; did you forget * ?}} +} + +void kg(a) + __fp16 *a; { +} + +// Functions cannot return type __fp16. +extern __fp16 f1 (void); // expected-error {{function return value cannot have __fp16 type; did you forget * ?}} +extern __fp16 *g1 (void); + +extern __fp16 (*pf1) (void); // expected-error {{function return value cannot have __fp16 type; did you forget * ?}} +extern __fp16 *(*gf1) (void); + +typedef __fp16 (*tf1) (void); // expected-error {{function return value cannot have __fp16 type; did you forget * ?}} +typedef __fp16 *(*tg1) (void); + diff --git a/test/Sema/fpack-struct.c b/test/Sema/fpack-struct.c new file mode 100644 index 000000000000..37c8444ae9f8 --- /dev/null +++ b/test/Sema/fpack-struct.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -DEXPECTED_STRUCT_SIZE=5 -fpack-struct 1 %s +// RUN: %clang_cc1 -DEXPECTED_STRUCT_SIZE=6 -fpack-struct 2 %s + +struct s0 { + int x; + char c; +}; + +int t0[sizeof(struct s0) == EXPECTED_STRUCT_SIZE ?: -1]; diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c index 1aac51e204f1..9b50916f85ff 100644 --- a/test/Sema/i-c-e.c +++ b/test/Sema/i-c-e.c @@ -53,7 +53,8 @@ char z[__builtin_constant_p(4) ? 1 : -1]; // Comma tests int comma1[0?1,2:3]; // expected-warning {{expression result unused}} int comma2[1||(1,2)]; // expected-warning {{expression result unused}} \ - // expected-warning {{use of logical || with constant operand}} + // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} \ // expected-warning {{expression result unused}} diff --git a/test/Sema/implicit-int.c b/test/Sema/implicit-int.c index 1bb9a8385306..3063db66ed85 100644 --- a/test/Sema/implicit-int.c +++ b/test/Sema/implicit-int.c @@ -24,9 +24,5 @@ h19_insline(n) // expected-warning {{parameter 'n' was not declared, defaulting } struct foo { - __extension__ __attribute__((packed)) x : 4; + __extension__ __attribute__((packed)) x : 4; // expected-warning {{type specifier missing, defaults to 'int'}} }; - - - - diff --git a/test/Sema/init.c b/test/Sema/init.c index f8110079d0eb..2527e14fcbe9 100644 --- a/test/Sema/init.c +++ b/test/Sema/init.c @@ -144,3 +144,7 @@ int PR4386_b = ((void *) PR4386_foo) != 0; // expected-error{{initializer elemen int PR4386_c = ((void *) PR4386_zed) != 0; int PR4386_zed() __attribute((weak)); +// <rdar://problem/10185490> (derived from SPEC vortex benchmark) +typedef char strty[10]; +struct vortexstruct { strty s; }; +struct vortexstruct vortexvar = { "asdf" }; diff --git a/test/Sema/initialize-noreturn.c b/test/Sema/initialize-noreturn.c new file mode 100644 index 000000000000..55578628716b --- /dev/null +++ b/test/Sema/initialize-noreturn.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// rdar://10095762 + +typedef void (*Fn_noret)(void) __attribute__((noreturn)); +typedef void (*Fn_ret)(void); + +void foo(void); +void foo_noret(void) __attribute__((noreturn)); + +void test() { + Fn_noret fn2 = &foo; // expected-warning {{incompatible pointer types initializing 'Fn_noret'}} + Fn_noret fn3 = &foo_noret; + Fn_ret fn4 = &foo_noret; + Fn_ret fn5 = &foo; +} + diff --git a/test/Sema/knr-def-call.c b/test/Sema/knr-def-call.c index 6243af619398..f41275d1e618 100644 --- a/test/Sema/knr-def-call.c +++ b/test/Sema/knr-def-call.c @@ -36,8 +36,6 @@ void proto(x) } void use_proto() { - proto(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} - (&proto)(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} + proto(42.1); // expected-warning{{implicit conversion turns literal floating-point number into integer}} + (&proto)(42.1); // expected-warning{{implicit conversion turns literal floating-point number into integer}} } diff --git a/test/Sema/many-parameters.c b/test/Sema/many-parameters.c new file mode 100644 index 000000000000..1473c941109a --- /dev/null +++ b/test/Sema/many-parameters.c @@ -0,0 +1,310 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c99 %s + +// This test simply tests that the compiler does not crash. An optimization +// in ParmVarDecls means that functions with fewer than 256 parameters use a fast path, +// while those with >= 256 parameters use a slow path. +// +// Crash was reported in PR 10538. + +void foo( +int x0, +int x1, +int x2, +int x3, +int x4, +int x5, +int x6, +int x7, +int x8, +int x9, +int x10, +int x11, +int x12, +int x13, +int x14, +int x15, +int x16, +int x17, +int x18, +int x19, +int x20, +int x21, +int x22, +int x23, +int x24, +int x25, +int x26, +int x27, +int x28, +int x29, +int x30, +int x31, +int x32, +int x33, +int x34, +int x35, +int x36, +int x37, +int x38, +int x39, +int x40, +int x41, +int x42, +int x43, +int x44, +int x45, +int x46, +int x47, +int x48, +int x49, +int x50, +int x51, +int x52, +int x53, +int x54, +int x55, +int x56, +int x57, +int x58, +int x59, +int x60, +int x61, +int x62, +int x63, +int x64, +int x65, +int x66, +int x67, +int x68, +int x69, +int x70, +int x71, +int x72, +int x73, +int x74, +int x75, +int x76, +int x77, +int x78, +int x79, +int x80, +int x81, +int x82, +int x83, +int x84, +int x85, +int x86, +int x87, +int x88, +int x89, +int x90, +int x91, +int x92, +int x93, +int x94, +int x95, +int x96, +int x97, +int x98, +int x99, +int x100, +int x101, +int x102, +int x103, +int x104, +int x105, +int x106, +int x107, +int x108, +int x109, +int x110, +int x111, +int x112, +int x113, +int x114, +int x115, +int x116, +int x117, +int x118, +int x119, +int x120, +int x121, +int x122, +int x123, +int x124, +int x125, +int x126, +int x127, +int x128, +int x129, +int x130, +int x131, +int x132, +int x133, +int x134, +int x135, +int x136, +int x137, +int x138, +int x139, +int x140, +int x141, +int x142, +int x143, +int x144, +int x145, +int x146, +int x147, +int x148, +int x149, +int x150, +int x151, +int x152, +int x153, +int x154, +int x155, +int x156, +int x157, +int x158, +int x159, +int x160, +int x161, +int x162, +int x163, +int x164, +int x165, +int x166, +int x167, +int x168, +int x169, +int x170, +int x171, +int x172, +int x173, +int x174, +int x175, +int x176, +int x177, +int x178, +int x179, +int x180, +int x181, +int x182, +int x183, +int x184, +int x185, +int x186, +int x187, +int x188, +int x189, +int x190, +int x191, +int x192, +int x193, +int x194, +int x195, +int x196, +int x197, +int x198, +int x199, +int x200, +int x201, +int x202, +int x203, +int x204, +int x205, +int x206, +int x207, +int x208, +int x209, +int x210, +int x211, +int x212, +int x213, +int x214, +int x215, +int x216, +int x217, +int x218, +int x219, +int x220, +int x221, +int x222, +int x223, +int x224, +int x225, +int x226, +int x227, +int x228, +int x229, +int x230, +int x231, +int x232, +int x233, +int x234, +int x235, +int x236, +int x237, +int x238, +int x239, +int x240, +int x241, +int x242, +int x243, +int x244, +int x245, +int x246, +int x247, +int x248, +int x249, +int x250, +int x251, +int x252, +int x253, +int x254, +int x255, +int x256, +int x257, +int x258, +int x259, +int x260, +int x261, +int x262, +int x263, +int x264, +int x265, +int x266, +int x267, +int x268, +int x269, +int x270, +int x271, +int x272, +int x273, +int x274, +int x275, +int x276, +int x277, +int x278, +int x279, +int x280, +int x281, +int x282, +int x283, +int x284, +int x285, +int x286, +int x287, +int x288, +int x289, +int x290, +int x291, +int x292, +int x293, +int x294, +int x295, +int x296, +int x297, +int x298, +int x299 +); diff --git a/test/Sema/ms-fuzzy-asm.c b/test/Sema/ms-fuzzy-asm.c deleted file mode 100644 index 250e3222564d..000000000000 --- a/test/Sema/ms-fuzzy-asm.c +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %clang_cc1 %s -verify -fms-extensions - -#define M __asm int 0x2c -#define M2 int - -void t1(void) { M } -void t2(void) { __asm int 0x2c } -void t3(void) { __asm M2 0x2c } -void* t4(void) { __asm mov eax, fs:[0x10] } diff --git a/test/Sema/ms_class_layout.cpp b/test/Sema/ms_class_layout.cpp new file mode 100644 index 000000000000..13c90b0c9ed1 --- /dev/null +++ b/test/Sema/ms_class_layout.cpp @@ -0,0 +1,176 @@ +// RUN: %clang_cc1 -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>&1 \ +// RUN: | FileCheck %s + +#pragma pack(push, 8) + +class B { +public: + virtual void b(){} + int b_field; +protected: +private: +}; + +class A : public B { +public: + int a_field; + virtual void a(){} + char one; +protected: +private: +}; + +class D { +public: + virtual void b(){} + double a; +}; + +class C : public virtual A, + public D, public B { +public: + double c1_field; + int c2_field; + double c3_field; + int c4_field; + virtual void foo(){} + virtual void bar(){} +protected: +private: +}; + +struct BaseStruct +{ + BaseStruct(){} + double v0; + float v1; + C fg; +}; + +struct DerivedStruct : public BaseStruct { + int x; +}; + +struct G +{ + virtual ~G(){} + int a; + double b; +}; + +#pragma pack(pop) + +// This needs only for building layouts. +// Without this clang doesn`t dump record layouts. +int main() { + // This avoid "Can't yet mangle constructors!" for MS ABI. + C* c; + c->foo(); + DerivedStruct* v; + G* g; + BaseStruct* u; + return 0; +} + +// CHECK: 0 | class D +// CHECK-NEXT: 0 | (D vtable pointer) +// CHECK-NEXT: 8 | double a + +// CHECK-NEXT: sizeof=16, dsize=16, align=8 +// CHECK-NEXT: nvsize=16, nvalign=8 + +// CHECK: 0 | class B +// CHECK-NEXT: 0 | (B vtable pointer) +// CHECK-NEXT: 4 | int b_field + +// CHECK-NEXT: sizeof=8, dsize=8, align=4 +// CHECK-NEXT: nvsize=8, nvalign=4 + +// CHECK: 0 | class A +// CHECK-NEXT: 0 | class B (primary base) +// CHECK-NEXT: 0 | (B vtable pointer) +// CHECK-NEXT: 4 | int b_field +// CHECK-NEXT: 8 | int a_field +// CHECK-NEXT: 12 | char one + +// CHECK-NEXT: sizeof=16, dsize=16, align=4 +// CHECK-NEXT: nvsize=16, nvalign=4 + +// CHECK: 0 | class C +// CHECK-NEXT: 0 | class D (primary base) +// CHECK-NEXT: 0 | (D vtable pointer) +// CHECK-NEXT: 8 | double a +// CHECK-NEXT: 16 | class B (base) +// CHECK-NEXT: 16 | (B vtable pointer) +// CHECK-NEXT: 20 | int b_field +// CHECK-NEXT: 24 | (C vbtable pointer) +// CHECK-NEXT: 32 | double c1_field +// CHECK-NEXT: 40 | int c2_field +// CHECK-NEXT: 48 | double c3_field +// CHECK-NEXT: 56 | int c4_field +// CHECK-NEXT: 64 | class A (virtual base) +// CHECK-NEXT: 64 | class B (primary base) +// CHECK-NEXT: 64 | (B vtable pointer) +// CHECK-NEXT: 68 | int b_field +// CHECK-NEXT: 72 | int a_field +// CHECK-NEXT: 76 | char one + +// CHECK-NEXT: sizeof=80, dsize=80, align=8 +// CHECK-NEXT: nvsize=80, nvalign=8 + +// CHECK: 0 | struct BaseStruct +// CHECK-NEXT: 0 | double v0 +// CHECK-NEXT: 8 | float v1 +// CHECK-NEXT: 16 | class C fg +// CHECK-NEXT: 16 | class D (primary base) +// CHECK-NEXT: 16 | (D vtable pointer) +// CHECK-NEXT: 24 | double a +// CHECK-NEXT: 32 | class B (base) +// CHECK-NEXT: 32 | (B vtable pointer) +// CHECK-NEXT: 36 | int b_field +// CHECK-NEXT: 40 | (C vbtable pointer) +// CHECK-NEXT: 48 | double c1_field +// CHECK-NEXT: 56 | int c2_field +// CHECK-NEXT: 64 | double c3_field +// CHECK-NEXT: 72 | int c4_field +// CHECK-NEXT: 80 | class A (virtual base) +// CHECK-NEXT: 80 | class B (primary base) +// CHECK-NEXT: 80 | (B vtable pointer) +// CHECK-NEXT: 84 | int b_field +// CHECK-NEXT: 88 | int a_field +// CHECK-NEXT: 92 | char one + +// CHECK-NEXT: sizeof=80, dsize=80, align=8 +// CHECK-NEXT: nvsize=80, nvalign=8 + +// CHECK: sizeof=96, dsize=96, align=8 +// CHECK-NEXT: nvsize=96, nvalign=8 + +// CHECK: 0 | struct DerivedStruct +// CHECK-NEXT: 0 | struct BaseStruct (base) +// CHECK-NEXT: 0 | double v0 +// CHECK-NEXT: 8 | float v1 +// CHECK-NEXT: 16 | class C fg +// CHECK-NEXT: 16 | class D (primary base) +// CHECK-NEXT: 16 | (D vtable pointer) +// CHECK-NEXT: 24 | double a +// CHECK-NEXT: 32 | class B (base) +// CHECK-NEXT: 32 | (B vtable pointer) +// CHECK-NEXT: 36 | int b_field +// CHECK-NEXT: 40 | (C vbtable pointer) +// CHECK-NEXT: 48 | double c1_field +// CHECK-NEXT: 56 | int c2_field +// CHECK-NEXT: 64 | double c3_field +// CHECK-NEXT: 72 | int c4_field +// CHECK-NEXT: 80 | class A (virtual base) +// CHECK-NEXT: 80 | class B (primary base) +// CHECK-NEXT: 80 | (B vtable pointer) +// CHECK-NEXT: 84 | int b_field +// CHECK-NEXT: 88 | int a_field +// CHECK-NEXT: 92 | char one +// CHECK-NEXT: sizeof=80, dsize=80, align=8 +// CHECK-NEXT: nvsize=80, nvalign=8 + +// CHECK: 96 | int x +// CHECK-NEXT: sizeof=104, dsize=104, align=8 +// CHECK-NEXT: nvsize=104, nvalign=8 diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c index 13ea3ecbe16a..9751336018b7 100644 --- a/test/Sema/parentheses.c +++ b/test/Sema/parentheses.c @@ -52,6 +52,8 @@ void conditional_op(int x, int y, _Bool b) { // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ // expected-note {{place parentheses around the '+' expression to silence this warning}} + (void)((x + someConditionFunc()) ? 1 : 2); // no warning + (void)(x - b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '-'}} \ // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ // expected-note {{place parentheses around the '-' expression to silence this warning}} @@ -64,7 +66,6 @@ void conditional_op(int x, int y, _Bool b) { // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ // expected-note {{place parentheses around the '/' expression to silence this warning}} - (void)(x % 2 ? 1 : 2); // no warning } diff --git a/test/Sema/parentheses.cpp b/test/Sema/parentheses.cpp index 252455dcad49..767416677e00 100644 --- a/test/Sema/parentheses.cpp +++ b/test/Sema/parentheses.cpp @@ -40,6 +40,8 @@ void test(S *s, bool (S::*m_ptr)()) { // expected-note {{place parentheses around the '?:' expression to evaluate it first}} \ // expected-note {{place parentheses around the '+' expression to silence this warning}} + (void)((*s + true) ? "foo" : "bar"); // No warning. + // Don't crash on unusual member call expressions. (void)((s->*m_ptr)() ? "foo" : "bar"); } diff --git a/test/Sema/pragma-arc-cf-code-audited.c b/test/Sema/pragma-arc-cf-code-audited.c new file mode 100644 index 000000000000..b646e8966c61 --- /dev/null +++ b/test/Sema/pragma-arc-cf-code-audited.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#pragma clang arc_cf_code_audited foo // expected-error {{expected 'begin' or 'end'}} + +#pragma clang arc_cf_code_audited begin foo // expected-warning {{extra tokens at end of #pragma directive}} + +#pragma clang arc_cf_code_audited end +#pragma clang arc_cf_code_audited end // expected-error {{not currently inside '#pragma clang arc_cf_code_audited'}} + +#pragma clang arc_cf_code_audited begin // expected-note {{#pragma entered here}} +#pragma clang arc_cf_code_audited begin // expected-error {{already inside '#pragma clang arc_cf_code_audited'}} expected-note {{#pragma entered here}} + +#include "Inputs/pragma-arc-cf-code-audited.h" // expected-error {{cannot #include files inside '#pragma clang arc_cf_code_audited'}} + +// This is actually on the #pragma line in the header. +// expected-error {{'#pragma clang arc_cf_code_audited' was not ended within this file}} + +#pragma clang arc_cf_code_audited begin // expected-error {{'#pragma clang arc_cf_code_audited' was not ended within this file}} diff --git a/test/Sema/return-noreturn.c b/test/Sema/return-noreturn.c index ff43754a4299..448fce77cd85 100644 --- a/test/Sema/return-noreturn.c +++ b/test/Sema/return-noreturn.c @@ -1,8 +1,8 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks -Wmissing-noreturn -Wno-unreachable-code int j; -void test1() { // expected-warning {{function could be attribute 'noreturn'}} - ^ (void) { while (1) { } }(); // expected-warning {{block could be attribute 'noreturn'}} +void test1() { // expected-warning {{function 'test1' could be declared with attribute 'noreturn'}} + ^ (void) { while (1) { } }(); // expected-warning {{block could be declared with attribute 'noreturn'}} ^ (void) { if (j) while (1) { } }(); while (1) { } } diff --git a/test/Sema/types.c b/test/Sema/types.c index f3244f7799b6..332b525e33a8 100644 --- a/test/Sema/types.c +++ b/test/Sema/types.c @@ -37,3 +37,16 @@ _Decimal32 x; // expected-error {{GNU decimal type extension not supported}} // rdar://6880951 int __attribute__ ((vector_size (8), vector_size (8))) v; // expected-error {{invalid vector element type}} + +void test(int i) { + char c = (char __attribute__((align(8)))) i; // expected-error {{'align' attribute ignored when parsing type}} +} + +// http://llvm.org/PR11082 +// +// FIXME: This may or may not be the correct approach (no warning or error), +// but large amounts of Linux and FreeBSD code need this attribute to not be +// a hard error in order to work correctly. +void test2(int i) { + char c = (char __attribute__((may_alias))) i; +} diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index 0caab3df18c0..49af4f322629 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -1,7 +1,10 @@ // RUN: %clang_cc1 -fsyntax-only -Wuninitialized -Wconditional-uninitialized -fsyntax-only -fblocks %s -verify +typedef __typeof(sizeof(int)) size_t; +void *malloc(size_t); + int test1() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} return x; // expected-warning{{variable 'x' is uninitialized when used here}} } @@ -17,25 +20,25 @@ int test3() { } int test4() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} ++x; // expected-warning{{variable 'x' is uninitialized when used here}} return x; } int test5() { - int x, y; // expected-note{{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int x, y; // expected-note{{initialize the variable 'y' to silence this warning}} x = y; // expected-warning{{variable 'y' is uninitialized when used here}} return x; } int test6() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} x += 2; // expected-warning{{variable 'x' is uninitialized when used here}} return x; } int test7(int y) { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} if (y) x = 1; return x; // expected-warning{{variable 'x' may be uninitialized when used here}} @@ -51,7 +54,7 @@ int test8(int y) { } int test9(int n) { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} for (unsigned i = 0 ; i < n; ++i) { if (i == n - 1) break; @@ -61,7 +64,7 @@ int test9(int n) { } int test10(unsigned n) { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} for (unsigned i = 0 ; i < n; ++i) { x = 1; } @@ -69,7 +72,7 @@ int test10(unsigned n) { } int test11(unsigned n) { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} for (unsigned i = 0 ; i <= n; ++i) { x = 1; } @@ -77,7 +80,7 @@ int test11(unsigned n) { } void test12(unsigned n) { - for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' may be uninitialized when used here}} expected-note{{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}} + for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' is uninitialized when used here}} expected-note{{initialize the variable 'i' to silence this warning}} } int test13() { @@ -91,10 +94,15 @@ void test14() { for (;;) {} } -int test15() { - int x = x; // no-warning: signals intended lack of initialization. \ - // expected-note{{variable 'x' is declared here}} - return x; // expected-warning{{variable 'x' is uninitialized when used here}} +void test15() { + int x = x; // no-warning: signals intended lack of initialization. +} + +int test15b() { + // Warn here with the self-init, since it does result in a use of + // an unintialized variable and this is the root cause. + int x = x; // expected-warning {{variable 'x' is uninitialized when used within its own initialization}} + return x; } // Don't warn in the following example; shows dataflow confluence. @@ -108,7 +116,7 @@ void test16() { void test17() { // Don't warn multiple times about the same uninitialized variable // along the same path. - int *x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int *x; // expected-note{{initialize the variable 'x' to silence this warning}} *x = 1; // expected-warning{{variable 'x' is uninitialized when used here}} *x = 1; // no-warning } @@ -132,14 +140,14 @@ int test19() { } int test20() { - int z; // expected-note{{variable 'z' is declared here}} expected-note{{add initialization to silence this warning}} + int z; // expected-note{{initialize the variable 'z' to silence this warning}} if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z)) return z; // expected-warning{{variable 'z' may be uninitialized when used here}} return 0; } int test21(int x, int y) { - int z; // expected-note{{variable 'z' is declared here}} expected-note{{add initialization to silence this warning}} + int z; // expected-note{{initialize the variable 'z' to silence this warning}} if ((x && y) || test19_aux3(&z) || test19_aux2()) return z; // expected-warning{{variable 'z' may be uninitialized when used here}} return 0; @@ -164,7 +172,7 @@ int test23() { // conditionals. This possibly can be handled by making the CFG itself // represent such control-dependencies, but it is a niche case. int test24(int flag) { - unsigned val; // expected-note{{variable 'val' is declared here}} expected-note{{add initialization to silence this warning}} + unsigned val; // expected-note{{initialize the variable 'val' to silence this warning}} if (flag) val = 1; if (!flag) @@ -173,13 +181,13 @@ int test24(int flag) { } float test25() { - float x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + float x; // expected-note{{initialize the variable 'x' to silence this warning}} return x; // expected-warning{{variable 'x' is uninitialized when used here}} } typedef int MyInt; MyInt test26() { - MyInt x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + MyInt x; // expected-note{{initialize the variable 'x' to silence this warning}} return x; // expected-warning{{variable 'x' is uninitialized when used here}} } @@ -190,12 +198,12 @@ int test27() { } int test28() { - int len; // expected-note{{variable 'len' is declared here}} expected-note{{add initialization to silence this warning}} + int len; // expected-note{{initialize the variable 'len' to silence this warning}} return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}} } void test29() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} (void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}} } @@ -220,7 +228,7 @@ void test_33() { } int test_34() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} (void) x; return x; // expected-warning{{variable 'x' is uninitialized when used here}} } @@ -234,10 +242,10 @@ void test35(int x) { // Test handling of indirect goto. void test36() { - void **pc; // expected-note{{variable 'pc' is declared here}} expected-note{{add initialization to silence this warning}} + void **pc; // expected-note{{initialize the variable 'pc' to silence this warning}} void *dummy[] = { &&L1, &&L2 }; L1: - goto *pc; // expected-warning{{variable 'pc' may be uninitialized when used here}} + goto *pc; // expected-warning{{variable 'pc' is uninitialized when used here}} L2: goto *pc; } @@ -263,19 +271,19 @@ int test38(int r, int x, int y) } int test39(int x) { - int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int y; // expected-note{{initialize the variable 'y' to silence this warning}} int z = x + y; // expected-warning {{variable 'y' is uninitialized when used here}} return z; } int test40(int x) { - int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int y; // expected-note{{initialize the variable 'y' to silence this warning}} return x ? 1 : y; // expected-warning {{variable 'y' is uninitialized when used here}} } int test41(int x) { - int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int y; // expected-note{{initialize the variable 'y' to silence this warning}} if (x) y = 1; // no-warning return y; // expected-warning {{variable 'y' may be uninitialized when used here}} } @@ -287,17 +295,17 @@ void test42() { void test43_aux(int x); void test43(int i) { - int x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} for (i = 0 ; i < 10; i++) - test43_aux(x++); // expected-warning {{variable 'x' may be uninitialized when used here}} + test43_aux(x++); // expected-warning {{variable 'x' is uninitialized when used here}} } void test44(int i) { int x = i; - int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}} + int y; // expected-note{{initialize the variable 'y' to silence this warning}} for (i = 0; i < 10; i++ ) { test43_aux(x++); // no-warning - x += y; // expected-warning {{variable 'y' may be uninitialized when used here}} + x += y; // expected-warning {{variable 'y' is uninitialized when used here}} } } @@ -310,7 +318,7 @@ int test45(int j) { void test46() { - int i; // expected-note {{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}} + int i; // expected-note{{initialize the variable 'i' to silence this warning}} int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}} } @@ -341,7 +349,7 @@ int test51(void) // FIXME: This is a false positive, but it tests logical operations in switch statements. int test52(int a, int b) { - int x; // expected-note {{variable 'x' is declared here}} expected-note {{add initialization to silence this warning}} + int x; // expected-note {{initialize the variable 'x' to silence this warning}} switch (a || b) { // expected-warning {{switch condition has boolean value}} case 0: x = 1; @@ -353,10 +361,15 @@ int test52(int a, int b) { return x; // expected-warning {{variable 'x' may be uninitialized when used here}} } +void test53() { + int x; // expected-note {{initialize the variable 'x' to silence this warning}} + int y = (x); // expected-warning {{variable 'x' is uninitialized when used here}} +} + // This CFG caused the uninitialized values warning to inf-loop. extern int PR10379_g(); void PR10379_f(int *len) { - int new_len; // expected-note {{variable 'new_len' is declared here}} expected-note{{add initialization to silence this warning}} + int new_len; // expected-note{{initialize the variable 'new_len' to silence this warning}} for (int i = 0; i < 42 && PR10379_g() == 0; i++) { if (PR10379_g() == 1) continue; @@ -367,3 +380,39 @@ void PR10379_f(int *len) { *len += new_len; // expected-warning {{variable 'new_len' may be uninitialized when used here}} } } + +// Test that sizeof(VLA) doesn't trigger a warning. +void test_vla_sizeof(int x) { + double (*memory)[2][x] = malloc(sizeof(*memory)); // no-warning +} + +// Test absurd case of deadcode + use of blocks. This previously was a false positive +// due to an analysis bug. +int test_block_and_dead_code() { + __block int x; + ^{ x = 1; }(); + if (0) + return x; + return x; // no-warning +} + +// This previously triggered an infinite loop in the analysis. +void PR11069(int a, int b) { + unsigned long flags; + for (;;) { + if (a && !b) + break; + } + for (;;) { + // This does not trigger a warning because it isn't a real use. + (void)(flags); // no-warning + } +} + +// Test uninitialized value used in loop condition. +void rdar9432305(float *P) { + int i; // expected-note {{initialize the variable 'i' to silence this warning}} + for (; i < 10000; ++i) // expected-warning {{variable 'i' is uninitialized when used here}} + P[i] = 0.0f; +} + diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c index 9949887b23e7..97611168f1a2 100644 --- a/test/Sema/unused-expr.c +++ b/test/Sema/unused-expr.c @@ -7,11 +7,11 @@ double sqrt(double X); // implicitly const because of no -fmath-errno! void bar(volatile int *VP, int *P, int A, _Complex double C, volatile _Complex double VC) { - VP == P; // expected-warning {{expression result unused}} + VP < P; // expected-warning {{expression result unused}} (void)A; (void)foo(1,2); // no warning. - A == foo(1, 2); // expected-warning {{expression result unused}} + A < foo(1, 2); // expected-warning {{expression result unused}} foo(1,2)+foo(4,3); // expected-warning {{expression result unused}} @@ -54,23 +54,23 @@ void t4(int a) { int b = 0; if (a) - b == 1; // expected-warning{{expression result unused}} + b < 1; // expected-warning{{expression result unused}} else - b == 2; // expected-warning{{expression result unused}} + b < 2; // expected-warning{{expression result unused}} while (1) - b == 3; // expected-warning{{expression result unused}} + b < 3; // expected-warning{{expression result unused}} do - b == 4; // expected-warning{{expression result unused}} + b < 4; // expected-warning{{expression result unused}} while (1); for (;;) - b == 5; // expected-warning{{expression result unused}} + b < 5; // expected-warning{{expression result unused}} - for (b == 1;;) {} // expected-warning{{expression result unused}} - for (;b == 1;) {} - for (;;b == 1) {} // expected-warning{{expression result unused}} + for (b < 1;;) {} // expected-warning{{expression result unused}} + for (;b < 1;) {} + for (;;b < 1) {} // expected-warning{{expression result unused}} } // rdar://7186119 diff --git a/test/Sema/warn-cast-align.c b/test/Sema/warn-cast-align.c index 11e3c4163642..93352c253a2e 100644 --- a/test/Sema/warn-cast-align.c +++ b/test/Sema/warn-cast-align.c @@ -28,7 +28,7 @@ void test1(void *P) { } // Aligned struct. -__attribute__((align(16))) struct A { +__attribute__((aligned(16))) struct A { char buffer[16]; }; void test2(char *P) { diff --git a/test/Sema/warn-strlcpycat-size.c b/test/Sema/warn-strlcpycat-size.c new file mode 100644 index 000000000000..8babdde276fa --- /dev/null +++ b/test/Sema/warn-strlcpycat-size.c @@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -Wstrlcpy-strlcat-size -verify -fsyntax-only %s + +typedef __SIZE_TYPE__ size_t; +size_t strlcpy (char * restrict dst, const char * restrict src, size_t size); +size_t strlcat (char * restrict dst, const char * restrict src, size_t size); +size_t strlen (const char *s); + +char s1[100]; +char s2[200]; +char * s3; + +struct { + char f1[100]; + char f2[100][3]; +} s4, **s5; + +int x; + +void f(void) +{ + strlcpy(s1, s2, sizeof(s1)); // no warning + strlcpy(s1, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} + strlcpy(s1, s3, strlen(s3)+1); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} + strlcat(s2, s3, sizeof(s3)); // expected-warning {{size argument in 'strlcat' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} + strlcpy(s4.f1, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} + strlcpy((*s5)->f2[x], s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} + strlcpy(s1+3, s2, sizeof(s2)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} +} + +// Don't issue FIXIT for flexible arrays. +struct S { + int y; + char x[]; +}; + +void flexible_arrays(struct S *s) { + char str[] = "hi"; + strlcpy(s->x, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} +} + +// Don't issue FIXIT for destinations of size 1. +void size_1() { + char z[1]; + char str[] = "hi"; + + strlcpy(z, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} +} + +// Support VLAs. +void vlas(int size) { + char z[size]; + char str[] = "hi"; + + strlcpy(z, str, sizeof(str)); // expected-warning {{size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination}} expected-note {{change size argument to be the size of the destination}} +} diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c index 20e0c3172401..8db36b710012 100644 --- a/test/Sema/warn-unreachable.c +++ b/test/Sema/warn-unreachable.c @@ -80,8 +80,8 @@ void test2() { - // expected-warning {{will never be executed}} halt(); case 8: - i - += // expected-warning {{will never be executed}} + i // expected-warning {{will never be executed}} + += halt(); case 9: halt() @@ -93,8 +93,8 @@ void test2() { case 11: { int a[5]; live(), - a[halt() - ]; // expected-warning {{will never be executed}} + a[halt() // expected-warning {{will never be executed}} + ]; } } } @@ -114,3 +114,15 @@ int test_enum_cases(enum Cases C) { } } +// Handle unreachable code triggered by macro expansions. +void __myassert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__)); + +#define myassert(e) \ + (__builtin_expect(!(e), 0) ? __myassert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0) + +void test_assert() { + myassert(0 && "unreachable"); + return; // no-warning +} + + diff --git a/test/Sema/warn-unused-parameters.c b/test/Sema/warn-unused-parameters.c index e47ddd5e00d5..af048e77e886 100644 --- a/test/Sema/warn-unused-parameters.c +++ b/test/Sema/warn-unused-parameters.c @@ -19,4 +19,12 @@ static void achor() {}; // CHECK: 5:12: warning: unused parameter 'y' // CHECK: 12:15: warning: unused parameter 'y' -// CHECK-unused: 1 warning generated
\ No newline at end of file +// CHECK-unused: 1 warning generated + +// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything %s 2>&1 | FileCheck -check-prefix=CHECK-everything %s +// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Werror %s 2>&1 | FileCheck -check-prefix=CHECK-everything-error %s +// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Wno-unused %s 2>&1 | FileCheck -check-prefix=CHECK-everything-no-unused %s +// CHECK-everything: 6 warnings generated +// CHECK-everything-error: 5 errors generated +// CHECK-everything-no-unused: 5 warnings generated + diff --git a/test/SemaCUDA/cuda.h b/test/SemaCUDA/cuda.h index e3aeb99ed220..26a8df0440f1 100644 --- a/test/SemaCUDA/cuda.h +++ b/test/SemaCUDA/cuda.h @@ -10,7 +10,7 @@ struct dim3 { unsigned x, y, z; - dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} + __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {} }; typedef struct cudaStream *cudaStream_t; diff --git a/test/SemaCUDA/function-target.cu b/test/SemaCUDA/function-target.cu new file mode 100644 index 000000000000..c7a55e2fad83 --- /dev/null +++ b/test/SemaCUDA/function-target.cu @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#include "cuda.h" + +__host__ void h1h(void); +__device__ void h1d(void); // expected-note {{candidate function not viable: call to __device__ function from __host__ function}} +__host__ __device__ void h1hd(void); +__global__ void h1g(void); + +struct h1ds { // expected-note {{requires 1 argument}} + __device__ h1ds(); // expected-note {{candidate constructor not viable: call to __device__ function from __host__ function}} +}; + +__host__ void h1(void) { + h1h(); + h1d(); // expected-error {{no matching function}} + h1hd(); + h1g<<<1, 1>>>(); + h1ds x; // expected-error {{no matching constructor}} +} + +__host__ void d1h(void); // expected-note {{candidate function not viable: call to __host__ function from __device__ function}} +__device__ void d1d(void); +__host__ __device__ void d1hd(void); +__global__ void d1g(void); // expected-note {{'d1g' declared here}} + +__device__ void d1(void) { + d1h(); // expected-error {{no matching function}} + d1d(); + d1hd(); + d1g<<<1, 1>>>(); // expected-error {{reference to __global__ function 'd1g' in __device__ function}} +} + +__host__ void hd1h(void); // expected-note {{candidate function not viable: call to __host__ function from __host__ __device__ function}} +__device__ void hd1d(void); // expected-note {{candidate function not viable: call to __device__ function from __host__ __device__ function}} +__host__ __device__ void hd1hd(void); +__global__ void hd1g(void); // expected-note {{'hd1g' declared here}} + +__host__ __device__ void hd1(void) { + hd1h(); // expected-error {{no matching function}} + hd1d(); // expected-error {{no matching function}} + hd1hd(); + hd1g<<<1, 1>>>(); // expected-error {{reference to __global__ function 'hd1g' in __host__ __device__ function}} +} diff --git a/test/SemaCUDA/kernel-call.cu b/test/SemaCUDA/kernel-call.cu index 7bc7ae113159..91b1d49e2d06 100644 --- a/test/SemaCUDA/kernel-call.cu +++ b/test/SemaCUDA/kernel-call.cu @@ -13,6 +13,9 @@ int h2(int x) { return 1; } int main(void) { g1<<<1, 1>>>(42); + g1(42); // expected-error {{call to global function g1 not configured}} + g1<<<1>>>(42); // expected-error {{too few execution configuration arguments to kernel function call}} + g1<<<1, 1, 0, 0, 0>>>(42); // expected-error {{too many execution configuration arguments to kernel function call}} t1(1); diff --git a/test/SemaCXX/2008-01-11-BadWarning.cpp b/test/SemaCXX/2008-01-11-BadWarning.cpp new file mode 100644 index 000000000000..b84e7c1cf862 --- /dev/null +++ b/test/SemaCXX/2008-01-11-BadWarning.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s +// rdar://5683899 +void** f(void **Buckets, unsigned NumBuckets) { + return Buckets + NumBuckets; +} diff --git a/test/SemaCXX/MicrosoftCompatibility.cpp b/test/SemaCXX/MicrosoftCompatibility.cpp new file mode 100644 index 000000000000..dfc47d6fc956 --- /dev/null +++ b/test/SemaCXX/MicrosoftCompatibility.cpp @@ -0,0 +1,158 @@ +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions + + + +namespace ms_conversion_rules { + +void f(float a); +void f(int a); + +void test() +{ + long a = 0; + f((long)0); + f(a); +} + +} + + + +namespace ms_protected_scope { + struct C { C(); }; + + int jump_over_variable_init(bool b) { + if (b) + goto foo; // expected-warning {{illegal goto into protected scope}} + C c; // expected-note {{jump bypasses variable initialization}} + foo: + return 1; + } + +struct Y { + ~Y(); +}; + +void jump_over_var_with_dtor() { + goto end; // expected-warning{{goto into protected scope}} + Y y; // expected-note {{jump bypasses variable initialization}} + end: + ; +} + + void jump_over_variable_case(int c) { + switch (c) { + case 0: + int x = 56; // expected-note {{jump bypasses variable initialization}} + case 1: // expected-error {{switch case is in protected scope}} + x = 10; + } + } + + +void exception_jump() { + goto l2; // expected-error {{illegal goto into protected scope}} + try { // expected-note {{jump bypasses initialization of try block}} + l2: ; + } catch(int) { + } +} + +int jump_over_indirect_goto() { + static void *ps[] = { &&a0 }; + goto *&&a0; // expected-warning {{goto into protected scope}} + int a = 3; // expected-note {{jump bypasses variable initialization}} + a0: + return 0; +} + +} + + + +namespace ms_using_declaration_bug {
+
+class A {
+public:
+ int f();
+};
+
+class B : public A {
+private:
+ using A::f;
+};
+
+class C : public B {
+private:
+ using B::f; // expected-warning {{using declaration refers to inaccessible member 'ms_using_declaration_bug::B::f', which refers to accessible member 'ms_using_declaration_bug::A::f', accepted for Microsoft compatibility}}
+};
+
+}
+
+
+namespace MissingTypename {
+
+template<class T> class A {
+public:
+ typedef int TYPE;
+};
+
+template<class T> class B {
+public:
+ typedef int TYPE;
+};
+
+
+template<class T, class U>
+class C : private A<T>, public B<U> {
+public:
+ typedef A<T> Base1;
+ typedef B<U> Base2;
+ typedef A<U> Base3;
+
+ A<T>::TYPE a1; // expected-warning {{missing 'typename' prior to dependent type name}}
+ Base1::TYPE a2; // expected-warning {{missing 'typename' prior to dependent type name}}
+
+ B<U>::TYPE a3; // expected-warning {{missing 'typename' prior to dependent type name}}
+ Base2::TYPE a4; // expected-warning {{missing 'typename' prior to dependent type name}}
+
+ A<U>::TYPE a5; // expected-error {{missing 'typename' prior to dependent type name}}
+ Base3::TYPE a6; // expected-error {{missing 'typename' prior to dependent type name}}
+ };
+
+class D {
+public:
+ typedef int Type;
+};
+
+template <class T>
+void function_missing_typename(const T::Type param)// expected-warning {{missing 'typename' prior to dependent type name}}
+{
+ const T::Type var = 2; // expected-warning {{missing 'typename' prior to dependent type name}}
+}
+
+template void function_missing_typename<D>(const D::Type param);
+
+}
+
+
+
+namespace lookup_dependent_bases_id_expr {
+
+template<class T> class A {
+public:
+ int var;
+};
+
+
+template<class T>
+class B : public A<T> {
+public:
+ void f() {
+ var = 3;
+ }
+};
+
+template class B<int>;
+
+}
\ No newline at end of file diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp index 9b03feb53909..63e058b36daa 100644 --- a/test/SemaCXX/MicrosoftExtensions.cpp +++ b/test/SemaCXX/MicrosoftExtensions.cpp @@ -81,6 +81,10 @@ struct M { float __stdcall subtractP(); }; +// __unaligned handling +typedef char __unaligned *aligned_type; + + template<typename T> void h1(T (__stdcall M::* const )()) { } void m1() { @@ -148,40 +152,6 @@ template <class T> void BB<T>::f(int g = 0) { } // expected-warning {{redefinition of default argument}} -namespace MissingTypename { - -template<class T> class A { -public: - typedef int TYPE; -}; - -template<class T> class B { -public: - typedef int TYPE; -}; - - -template<class T, class U> -class C : private A<T>, public B<U> { -public: - typedef A<T> Base1; - typedef B<U> Base2; - typedef A<U> Base3; - - A<T>::TYPE a1; // expected-warning {{missing 'typename' prior to dependent type name}} - Base1::TYPE a2; // expected-warning {{missing 'typename' prior to dependent type name}} - - B<U>::TYPE a3; // expected-warning {{missing 'typename' prior to dependent type name}} - Base2::TYPE a4; // expected-warning {{missing 'typename' prior to dependent type name}} - - A<U>::TYPE a5; // expected-error {{missing 'typename' prior to dependent type name}} - Base3::TYPE a6; // expected-error {{missing 'typename' prior to dependent type name}} - }; - -} - - - extern void static_func(); void static_func(); // expected-note {{previous declaration is here}} @@ -209,26 +179,6 @@ void pointer_to_integral_type_conv(char* ptr) { sh = (short)ptr; } -namespace ms_using_declaration_bug { - -class A { -public: - int f(); -}; - -class B : public A { -private: - using A::f; -}; - -class C : public B { -private: - using B::f; // expected-warning {{using declaration refers to inaccessible member 'ms_using_declaration_bug::B::f', which refers to accessible member 'ms_using_declaration_bug::A::f', accepted for Microsoft compatibility}} -}; - -} - - namespace friend_as_a_forward_decl { @@ -251,4 +201,5 @@ void f() Z* b; } - }
\ No newline at end of file +} + diff --git a/test/SemaCXX/PR10243.cpp b/test/SemaCXX/PR10243.cpp index 9a5851049803..129ff80e2d2e 100644 --- a/test/SemaCXX/PR10243.cpp +++ b/test/SemaCXX/PR10243.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct S; // expected-note 4{{forward declaration of 'S'}} diff --git a/test/SemaCXX/PR10458.cpp b/test/SemaCXX/PR10458.cpp new file mode 100644 index 000000000000..57588ebcf1f0 --- /dev/null +++ b/test/SemaCXX/PR10458.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 + +void f() { + int arr[] = { 1, 2, 3 }; + for (auto &i : arr) { // expected-warning {{'auto' type specifier is a C++11 extension}} expected-warning {{range-based for loop is a C++11 extension}} + } +} diff --git a/test/SemaCXX/PR5086-ambig-resolution-enum.cpp b/test/SemaCXX/PR5086-ambig-resolution-enum.cpp index 720566a69b05..b5aac5f09c16 100644 --- a/test/SemaCXX/PR5086-ambig-resolution-enum.cpp +++ b/test/SemaCXX/PR5086-ambig-resolution-enum.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 class C { public: diff --git a/test/SemaCXX/PR7944.cpp b/test/SemaCXX/PR7944.cpp index a998a15c3e0b..51b3f6bccec0 100644 --- a/test/SemaCXX/PR7944.cpp +++ b/test/SemaCXX/PR7944.cpp @@ -8,5 +8,5 @@ struct A { B* b() { return new B; } }; void g() { A a; - MACRO(a.b->f()); // expected-error{{base of member reference is a function}} + MACRO(a.b->f()); // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}} } diff --git a/test/SemaCXX/PR8012.cpp b/test/SemaCXX/PR8012.cpp index f2f07ad36400..9cfc2b000c01 100644 --- a/test/SemaCXX/PR8012.cpp +++ b/test/SemaCXX/PR8012.cpp @@ -1,3 +1,3 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 void foo (int operator+); // expected-error{{cannot be the name of a parameter}} diff --git a/test/SemaCXX/PR9572.cpp b/test/SemaCXX/PR9572.cpp index 25c0c017b7f6..b0bbfa6318cd 100644 --- a/test/SemaCXX/PR9572.cpp +++ b/test/SemaCXX/PR9572.cpp @@ -3,7 +3,7 @@ class Base { virtual ~Base(); // expected-note {{implicitly declared private here}} }; struct Foo : public Base { // expected-error {{base class 'Base' has private destructor}} - const int kBlah = 3; // expected-warning {{accepted as a C++0x extension}} + const int kBlah = 3; // expected-warning {{accepted as a C++11 extension}} Foo(); }; struct Bar : public Foo { diff --git a/test/SemaCXX/PR9902.cpp b/test/SemaCXX/PR9902.cpp index ec76789b9657..80086e445c5d 100644 --- a/test/SemaCXX/PR9902.cpp +++ b/test/SemaCXX/PR9902.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template <class _Tp, class _Up, bool = false> struct __allocator_traits_rebind diff --git a/test/SemaCXX/PR9908.cpp b/test/SemaCXX/PR9908.cpp index 3b98b724dd87..fc090cc42f92 100644 --- a/test/SemaCXX/PR9908.cpp +++ b/test/SemaCXX/PR9908.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template <class _Tp, class _Up> struct __allocator_traits_rebind diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp index c262230962f9..b164d9eda6a5 100644 --- a/test/SemaCXX/abstract.cpp +++ b/test/SemaCXX/abstract.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define __CONCAT(__X, __Y) __CONCAT1(__X, __Y) diff --git a/test/SemaCXX/address-of.cpp b/test/SemaCXX/address-of.cpp index a7e712b04c1d..69fcaff8f1ed 100644 --- a/test/SemaCXX/address-of.cpp +++ b/test/SemaCXX/address-of.cpp @@ -33,3 +33,14 @@ void test2() { // PR clang/3222 void xpto(); void (*xyz)(void) = &xpto; + +struct PR11066 { + static int foo(short); + static int foo(float); + void test(); +}; + +void PR11066::test() { + int (PR11066::*ptr)(int) = & &PR11066::foo; // expected-error{{address expression must be an lvalue or a function designator}} +} + diff --git a/test/SemaCXX/aggregate-initialization.cpp b/test/SemaCXX/aggregate-initialization.cpp index b9e69b00b7fe..3c0e4483c441 100644 --- a/test/SemaCXX/aggregate-initialization.cpp +++ b/test/SemaCXX/aggregate-initialization.cpp @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Verify that we can't initialize non-aggregates with an initializer // list. -// FIXME: Note that due to a (likely) standard bug, this is technically an -// aggregate. +// Note that due to a (likely) standard bug, this is technically an aggregate, +// but we do not treat it as one. struct NonAggr1 { NonAggr1(int) { } @@ -24,7 +24,7 @@ struct NonAggr4 { virtual void f(); }; -NonAggr1 na1 = { 17 }; +NonAggr1 na1 = { 17 }; // expected-error{{non-aggregate type 'NonAggr1' cannot be initialized with an initializer list}} NonAggr2 na2 = { 17 }; // expected-error{{non-aggregate type 'NonAggr2' cannot be initialized with an initializer list}} NonAggr3 na3 = { 17 }; // expected-error{{non-aggregate type 'NonAggr3' cannot be initialized with an initializer list}} NonAggr4 na4 = { 17 }; // expected-error{{non-aggregate type 'NonAggr4' cannot be initialized with an initializer list}} diff --git a/test/SemaCXX/alias-template.cpp b/test/SemaCXX/alias-template.cpp index f29a9327dab3..6cff4206faa4 100644 --- a/test/SemaCXX/alias-template.cpp +++ b/test/SemaCXX/alias-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify -std=c++0x %s +// RUN: %clang_cc1 -verify -std=c++11 %s namespace RedeclAliasTypedef { template<typename U> using T = int; diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp index 93ba203ae112..ccdf45e52dd7 100644 --- a/test/SemaCXX/alignof-sizeof-reference.cpp +++ b/test/SemaCXX/alignof-sizeof-reference.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct s0; // expected-note {{forward declaration}} char ar[sizeof(s0&)]; // expected-error {{invalid application of 'sizeof' to an incomplete type}} @@ -8,14 +8,15 @@ void test() { static_assert(sizeof(r) == 1, "bad size"); } -void f(); // expected-note{{candidate function}} -void f(int); // expected-note{{candidate function}} +void f(); // expected-note{{possible target for call}} +void f(int); // expected-note{{possible target for call}} void g() { - sizeof(&f); // expected-error{{cannot resolve overloaded function 'f' from context}} + sizeof(&f); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} \ + // expected-warning{{expression result unused}} } -template<typename T> void f_template(); // expected-note{{candidate function}} -template<typename T> void f_template(T*); // expected-note{{candidate function}} +template<typename T> void f_template(); // expected-note{{possible target for call}} +template<typename T> void f_template(T*); // expected-note{{possible target for call}} void rdar9659191() { - (void)alignof(f_template<int>); // expected-error{{cannot resolve overloaded function 'f_template' from context}} + (void)alignof(f_template<int>); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} } diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp index bf45e5d4d888..1a3c102f034c 100644 --- a/test/SemaCXX/ambig-user-defined-conversions.cpp +++ b/test/SemaCXX/ambig-user-defined-conversions.cpp @@ -53,7 +53,7 @@ namespace test1 { E b; f1(b); // expected-error {{call to 'f1' is ambiguous}} // ambiguous because b -> C via constructor and - // b → A via constructor or conversion function. + // b -> A via constructor or conversion function. } } diff --git a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp index 836e319f8404..6e96e03f7245 100644 --- a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp +++ b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct A { operator int&(); diff --git a/test/SemaCXX/array-bounds-ptr-arith.cpp b/test/SemaCXX/array-bounds-ptr-arith.cpp new file mode 100644 index 000000000000..ce1ace6f2fb6 --- /dev/null +++ b/test/SemaCXX/array-bounds-ptr-arith.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -verify -Warray-bounds-pointer-arithmetic %s + +void swallow (const char *x) { (void)x; } +void test_pointer_arithmetic(int n) { + const char hello[] = "Hello world!"; // expected-note 2 {{declared here}} + const char *helloptr = hello; + + swallow("Hello world!" + 6); // no-warning + swallow("Hello world!" - 6); // expected-warning {{refers before the beginning of the array}} + swallow("Hello world!" + 14); // expected-warning {{refers past the end of the array}} + swallow("Hello world!" + 13); // no-warning + + swallow(hello + 6); // no-warning + swallow(hello - 6); // expected-warning {{refers before the beginning of the array}} + swallow(hello + 14); // expected-warning {{refers past the end of the array}} + swallow(hello + 13); // no-warning + + swallow(helloptr + 6); // no-warning + swallow(helloptr - 6); // no-warning + swallow(helloptr + 14); // no-warning + swallow(helloptr + 13); // no-warning + + double numbers[2]; // expected-note {{declared here}} + swallow((char*)numbers + sizeof(double)); // no-warning + swallow((char*)numbers + 60); // expected-warning {{refers past the end of the array}} + + char buffer[5]; // expected-note 2 {{declared here}} + // TODO: Add FixIt notes for adding parens around non-ptr part of arith expr + swallow(buffer + sizeof("Hello")-1); // expected-warning {{refers past the end of the array}} + swallow(buffer + (sizeof("Hello")-1)); // no-warning + if (n > 0 && n <= 6) swallow(buffer + 6 - n); // expected-warning {{refers past the end of the array}} + if (n > 0 && n <= 6) swallow(buffer + (6 - n)); // no-warning +} diff --git a/test/SemaCXX/array-bounds.cpp b/test/SemaCXX/array-bounds.cpp index 3bd6c35420d7..555ac33af559 100644 --- a/test/SemaCXX/array-bounds.cpp +++ b/test/SemaCXX/array-bounds.cpp @@ -3,9 +3,11 @@ int foo() { int x[2]; // expected-note 4 {{array 'x' declared here}} int y[2]; // expected-note 2 {{array 'y' declared here}} + int z[1]; // expected-note {{array 'z' declared here}} int *p = &y[2]; // no-warning (void) sizeof(x[2]); // no-warning y[2] = 2; // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}} + z[1] = 'x'; // expected-warning {{array index of '1' indexes past the end of an array (that contains 1 element)}} return x[2] + // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}} y[-1] + // expected-warning {{array index of '-1' indexes before the beginning of the array}} x[sizeof(x)] + // expected-warning {{array index of '8' indexes past the end of an array (that contains 2 elements)}} @@ -24,8 +26,8 @@ void f1(int a[1]) { int val = a[3]; // no warning for function argumnet } -void f2(const int (&a)[1]) { // expected-note {{declared here}} - int val = a[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}} +void f2(const int (&a)[2]) { // expected-note {{declared here}} + int val = a[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} } void test() { @@ -35,15 +37,20 @@ void test() { s2.a[3] = 0; // no warning for 0-sized array union { - short a[2]; // expected-note {{declared here}} + short a[2]; // expected-note 4 {{declared here}} char c[4]; } u; u.a[3] = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} u.c[3] = 1; // no warning + short *p = &u.a[2]; // no warning + p = &u.a[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} + *(&u.a[2]) = 1; // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}} + *(&u.a[3]) = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} + *(&u.c[3]) = 1; // no warning const int const_subscript = 3; - int array[1]; // expected-note {{declared here}} - array[const_subscript] = 0; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}} + int array[2]; // expected-note {{declared here}} + array[const_subscript] = 0; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} int *ptr; ptr[3] = 0; // no warning for pointer references @@ -58,8 +65,8 @@ void test() { const char str2[] = "foo"; // expected-note {{declared here}} char c2 = str2[5]; // expected-warning {{array index of '5' indexes past the end of an array (that contains 4 elements)}} - int (*array_ptr)[1]; - (*array_ptr)[3] = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}} + int (*array_ptr)[2]; + (*array_ptr)[3] = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}} } template <int I> struct S { @@ -151,8 +158,7 @@ void test_switch() { enum enumA { enumA_A, enumA_B, enumA_C, enumA_D, enumA_E }; enum enumB { enumB_X, enumB_Y, enumB_Z }; static enum enumB myVal = enumB_X; -void test_nested_switch() -{ +void test_nested_switch() { switch (enumA_E) { // expected-warning {{no case matching constant}} switch (myVal) { // expected-warning {{enumeration values 'enumB_X' and 'enumB_Z' not handled in switch}} case enumB_Y: ; @@ -173,3 +179,59 @@ void test_all_enums_covered(enum Values v) { } x[2] = 0; // no-warning } + +namespace tailpad { + struct foo { + char c1[1]; // expected-note {{declared here}} + int x; + char c2[1]; + }; + + char bar(struct foo *F) { + return F->c1[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 element)}} + return F->c2[3]; // no warning, foo could have tail padding allocated. + } +} + +namespace metaprogramming { +#define ONE 1 + struct foo { char c[ONE]; }; // expected-note {{declared here}} + template <int N> struct bar { char c[N]; }; // expected-note {{declared here}} + + char test(foo *F, bar<1> *B) { + return F->c[3] + // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 element)}} + B->c[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 element)}} + } +} + +void bar(int x) {} +int test_more() { + int foo[5]; // expected-note 5 {{array 'foo' declared here}} + bar(foo[5]); // expected-warning {{array index of '5' indexes past the end of an array (that contains 5 elements)}} + ++foo[5]; // expected-warning {{array index of '5' indexes past the end of an array (that contains 5 elements)}} + if (foo[6]) // expected-warning {{array index of '6' indexes past the end of an array (that contains 5 elements)}} + return --foo[6]; // expected-warning {{array index of '6' indexes past the end of an array (that contains 5 elements)}} + else + return foo[5]; // expected-warning {{array index of '5' indexes past the end of an array (that contains 5 elements)}} +} + +void test_pr10771() { + double foo[4096]; // expected-note {{array 'foo' declared here}} + + ((char*)foo)[sizeof(foo) - 1] = '\0'; // no-warning + *(((char*)foo) + sizeof(foo) - 1) = '\0'; // no-warning + + ((char*)foo)[sizeof(foo)] = '\0'; // expected-warning {{array index of '32768' indexes past the end of an array (that contains 32768 elements)}} + + // TODO: This should probably warn, too. + *(((char*)foo) + sizeof(foo)) = '\0'; // no-warning +} + +int test_pr11007_aux(const char * restrict, ...); + +// Test checking with varargs. +void test_pr11007() { + double a[5]; // expected-note {{array 'a' declared here}} + test_pr11007_aux("foo", a[1000]); // expected-warning {{array index of '1000' indexes past the end of an array}} +} + diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp index 725f0182db50..de9d7d1c2a6e 100644 --- a/test/SemaCXX/attr-cxx0x.cpp +++ b/test/SemaCXX/attr-cxx0x.cpp @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -int align_illegal [[align(3)]]; //expected-error {{requested alignment is not a power of 2}} -char align_big [[align(int)]]; -int align_small [[align(1)]]; // FIXME: this should be rejected -int align_multiple [[align(1), align(8), align(1)]]; +int align_illegal alignas(3); //expected-error {{requested alignment is not a power of 2}} +char align_big alignas(int); +int align_small alignas(1); // FIXME: this should be rejected +int align_multiple alignas(1) alignas(8) alignas(1); struct align_member { - int member [[align(8)]]; + int member alignas(8); }; -typedef char align_typedef [[align(8)]]; +typedef char align_typedef alignas(8); template<typename T> using align_alias_template = align_typedef; static_assert(alignof(align_big) == alignof(int), "k's alignment is wrong"); diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp index fe7c833d322b..945aff363eb1 100644 --- a/test/SemaCXX/attr-deprecated.cpp +++ b/test/SemaCXX/attr-deprecated.cpp @@ -198,7 +198,7 @@ namespace test6 { }; void testA() { A x; // expected-warning {{'A' is deprecated}} - x = a0; + x = a0; // expected-warning {{'A' is deprecated}} } enum B { @@ -218,7 +218,7 @@ namespace test6 { }; void testC() { C<int>::Enum x; // expected-warning {{'Enum' is deprecated}} - x = C<int>::c0; + x = C<int>::c0; // expected-warning {{'Enum' is deprecated}} } template <class T> struct D { diff --git a/test/SemaCXX/auto-cxx0x.cpp b/test/SemaCXX/auto-cxx0x.cpp index f9246beff92a..a8f9e84423a7 100644 --- a/test/SemaCXX/auto-cxx0x.cpp +++ b/test/SemaCXX/auto-cxx0x.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 void f() { - auto int a; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}} + auto int a; // expected-warning {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} int auto b; // expected-error{{cannot combine with previous 'int' declaration specifier}} } diff --git a/test/SemaCXX/auto-cxx98.cpp b/test/SemaCXX/auto-cxx98.cpp index fe028114880a..6c401ba11a93 100644 --- a/test/SemaCXX/auto-cxx98.cpp +++ b/test/SemaCXX/auto-cxx98.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 void f() { - auto int a; - int auto b; + auto int a; // expected-warning {{'auto' storage class specifier is redundant and incompatible with C++11}} + int auto b; // expected-warning {{'auto' storage class specifier is redundant and incompatible with C++11}} + auto c; // expected-warning {{C++11 extension}} expected-error {{requires an initializer}} + static auto d = 0; // expected-warning {{C++11 extension}} + auto static e = 0; // expected-warning {{C++11 extension}} } diff --git a/test/SemaCXX/auto-subst-failure.cpp b/test/SemaCXX/auto-subst-failure.cpp index 442c7e82ccdb..b323dfc6b049 100644 --- a/test/SemaCXX/auto-subst-failure.cpp +++ b/test/SemaCXX/auto-subst-failure.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 void f() { auto a = f(); // expected-error {{variable has incomplete type 'void'}} diff --git a/test/SemaCXX/bool.cpp b/test/SemaCXX/bool.cpp index 726fa6cb60fc..2b3ab68848eb 100644 --- a/test/SemaCXX/bool.cpp +++ b/test/SemaCXX/bool.cpp @@ -25,6 +25,9 @@ void static_assert_arg_is_bool(T x) { void test2() { int n = 2; - static_assert_arg_is_bool(n && 4); // expected-warning {{use of logical && with constant operand}} - static_assert_arg_is_bool(n || 5); // expected-warning {{use of logical || with constant operand}} + static_assert_arg_is_bool(n && 4); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + static_assert_arg_is_bool(n || 5); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} } diff --git a/test/SemaCXX/builtin-ptrtomember-ambig.cpp b/test/SemaCXX/builtin-ptrtomember-ambig.cpp index 32a893dafcef..61e347879a75 100644 --- a/test/SemaCXX/builtin-ptrtomember-ambig.cpp +++ b/test/SemaCXX/builtin-ptrtomember-ambig.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct A {}; diff --git a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp index f736394a4caa..2d93c6b2dff3 100644 --- a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp +++ b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct A {}; struct E {}; diff --git a/test/SemaCXX/builtin-ptrtomember-overload.cpp b/test/SemaCXX/builtin-ptrtomember-overload.cpp index 6c132366199b..c7b5173a4fbe 100644 --- a/test/SemaCXX/builtin-ptrtomember-overload.cpp +++ b/test/SemaCXX/builtin-ptrtomember-overload.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct A {}; diff --git a/test/SemaCXX/cast-conversion.cpp b/test/SemaCXX/cast-conversion.cpp index 80707d13d20b..dd2bc98e02cc 100644 --- a/test/SemaCXX/cast-conversion.cpp +++ b/test/SemaCXX/cast-conversion.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct R { R(int); @@ -8,7 +8,8 @@ struct A { A(R); }; -struct B { // expected-note 3 {{candidate constructor (the implicit copy constructor) not viable}} +struct B { // expected-note 3 {{candidate constructor (the implicit copy constructor) not viable}} \ + expected-note 3 {{candidate constructor (the implicit move constructor) not viable}} B(A); // expected-note 3 {{candidate constructor not viable}} }; diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp index 44fa0ce7ec9f..160f365f4bbf 100644 --- a/test/SemaCXX/class.cpp +++ b/test/SemaCXX/class.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s class C { public: - auto int errx; // expected-error {{error: storage class specified for a member declaration}} + auto int errx; // expected-error {{error: storage class specified for a member declaration}} expected-warning {{'auto' storage class specifier is redundant}} register int erry; // expected-error {{error: storage class specified for a member declaration}} extern int errz; // expected-error {{error: storage class specified for a member declaration}} @@ -34,11 +34,12 @@ public: enum E1 { en1, en2 }; - int i = 0; // expected-warning {{in-class initialization of non-static data member accepted as a C++0x extension}} + int i = 0; // expected-warning {{in-class initialization of non-static data member accepted as a C++11 extension}} static int si = 0; // expected-error {{non-const static data member must be initialized out of line}} static const NestedC ci = 0; // expected-error {{static data member of type 'const C::NestedC' must be initialized out of line}} static const int nci = vs; // expected-error {{in-class initializer is not a constant expression}} static const int vi = 0; + static const volatile int cvi = 0; // ok, illegal in C++11 static const E evi = 0; void m() { @@ -172,8 +173,8 @@ namespace rdar8367341 { float foo(); struct A { - static const float x = 5.0f; // expected-warning {{in-class initializer for static data member of type 'const float' is a C++0x extension}} - static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a C++0x extension}} expected-error {{in-class initializer is not a constant expression}} + static const float x = 5.0f; // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} + static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a GNU extension}} expected-error {{in-class initializer is not a constant expression}} }; } @@ -188,3 +189,7 @@ void f() { S::c; // expected-error {{invalid use of nonstatic data member}} } } + +struct PR9989 { + static int const PR9989_Member = sizeof PR9989_Member; +}; diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp index ca8af2186f74..28e2dd0ad51a 100644 --- a/test/SemaCXX/compare.cpp +++ b/test/SemaCXX/compare.cpp @@ -212,3 +212,14 @@ static const unsigned int kMax = 0; int pr7536() { return (kMax > 0); } + +// -Wsign-compare should not warn when ?: operands have different signedness. +// This will be caught by -Wsign-conversion +void test3() { + unsigned long a; + signed long b; + (void) (true ? a : b); + (void) (true ? (unsigned int)a : (signed int)b); + (void) (true ? b : a); + (void) (true ? (unsigned char)b : (signed char)a); +} diff --git a/test/SemaCXX/complex-init-list.cpp b/test/SemaCXX/complex-init-list.cpp new file mode 100644 index 000000000000..e75833a37dbc --- /dev/null +++ b/test/SemaCXX/complex-init-list.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic + +// This file tests the clang extension which allows initializing the components +// of a complex number individually using an initialization list. Basically, +// if you have an explicit init list for a complex number that contains two +// initializers, this extension kicks in to turn it into component-wise +// initialization. +// +// See also the testcase for the C version of this extension in +// test/Sema/complex-init-list.c. + +// Basic testcase +// (No pedantic warning is necessary because _Complex is not part of C++.) +_Complex float valid1 = { 1.0f, 2.0f }; diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index b95700e9ba18..5648d022b522 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -Wsign-compare %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wsign-conversion %s // C++ rules for ?: are a lot stricter than C rules, and have to take into // account more conversion options. @@ -180,12 +180,12 @@ void test() unsigned long test0 = 5; - test0 = test0 ? (long) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (int) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? (short) test0 : test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (long) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (int) test0; // expected-warning {{operands of ? are integers of different signs}} - test0 = test0 ? test0 : (short) test0; // expected-warning {{operands of ? are integers of different signs}} + test0 = test0 ? (long) test0 : test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? (int) test0 : test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? (short) test0 : test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} + test0 = test0 ? test0 : (long) test0; // expected-warning {{operand of ? changes signedness: 'long' to 'unsigned long'}} + test0 = test0 ? test0 : (int) test0; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test0 : (short) test0; // expected-warning {{operand of ? changes signedness: 'short' to 'unsigned long'}} test0 = test0 ? test0 : (long) 10; test0 = test0 ? test0 : (int) 10; test0 = test0 ? test0 : (short) 10; @@ -193,8 +193,15 @@ void test() test0 = test0 ? (int) 10 : test0; test0 = test0 ? (short) 10 : test0; + int test1; test0 = test0 ? EVal : test0; - test0 = test0 ? EVal : (int) test0; + test1 = test0 ? EVal : (int) test0; + + test0 = test0 ? EVal : test1; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + test0 = test0 ? test1 : EVal; // expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}} + + test1 = test0 ? EVal : (int) test0; + test1 = test0 ? (int) test0 : EVal; // Note the thing that this does not test: since DR446, various situations // *must* create a separate temporary copy of class objects. This can only diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp index 862ae5ae02bb..0f298a819fa3 100644 --- a/test/SemaCXX/conversion-delete-expr.cpp +++ b/test/SemaCXX/conversion-delete-expr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // Test1 struct B { diff --git a/test/SemaCXX/convert-to-bool.cpp b/test/SemaCXX/convert-to-bool.cpp index 4cd22e90c0e0..c9a355549fdf 100644 --- a/test/SemaCXX/convert-to-bool.cpp +++ b/test/SemaCXX/convert-to-bool.cpp @@ -8,7 +8,7 @@ struct ConvToInt { }; struct ExplicitConvToBool { - explicit operator bool(); // expected-warning{{explicit conversion functions are a C++0x extension}} + explicit operator bool(); // expected-warning{{explicit conversion functions are a C++11 extension}} }; void test_conv_to_bool(ConvToBool ctb, ConvToInt cti, ExplicitConvToBool ecb) { @@ -39,7 +39,7 @@ void test_conv_to_bool(ConvToBool ctb, ConvToInt cti, ExplicitConvToBool ecb) { void accepts_bool(bool) { } // expected-note{{candidate function}} struct ExplicitConvToRef { - explicit operator int&(); // expected-warning{{explicit conversion functions are a C++0x extension}} + explicit operator int&(); // expected-warning{{explicit conversion functions are a C++11 extension}} }; void test_explicit_bool(ExplicitConvToBool ecb) { @@ -56,7 +56,7 @@ void test_explicit_conv_to_ref(ExplicitConvToRef ecr) { struct A { }; struct B { }; struct C { - explicit operator A&(); // expected-warning{{explicit conversion functions are a C++0x extension}} + explicit operator A&(); // expected-warning{{explicit conversion functions are a C++11 extension}} operator B&(); // expected-note{{candidate}} }; diff --git a/test/SemaCXX/cxx0x-class.cpp b/test/SemaCXX/cxx0x-class.cpp new file mode 100644 index 000000000000..3527ccb55577 --- /dev/null +++ b/test/SemaCXX/cxx0x-class.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +int vs = 0; + +class C { +public: + struct NestedC { + NestedC(int); + }; + + int i = 0; + static int si = 0; // expected-error {{non-const static data member must be initialized out of line}} + static const NestedC ci = 0; // expected-error {{static data member of type 'const C::NestedC' must be initialized out of line}} + static const int nci = vs; // expected-error {{in-class initializer is not a constant expression}} + static const int vi = 0; + static const volatile int cvi = 0; // expected-error {{static const volatile data member must be initialized out of line}} +}; + +namespace rdar8367341 { + float foo(); + + struct A { + static const float x = 5.0f; // expected-warning {{GNU extension}} expected-note {{use 'constexpr' specifier to silence this warning}} + static const float y = foo(); // expected-warning {{GNU extension}} expected-note {{use 'constexpr' specifier to silence this warning}} expected-error {{in-class initializer is not a constant expression}} + static constexpr float x2 = 5.0f; + static constexpr float y2 = foo(); // expected-error {{must be initialized by a constant expression}} + }; +} diff --git a/test/SemaCXX/cxx0x-compat.cpp b/test/SemaCXX/cxx0x-compat.cpp new file mode 100644 index 000000000000..a01b26c5f91b --- /dev/null +++ b/test/SemaCXX/cxx0x-compat.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++0x-compat -verify %s + +namespace N { + template<typename T> void f(T) {} // expected-note {{here}} + namespace M { + template void f<int>(int); // expected-warning {{explicit instantiation of 'N::f' must occur in namespace 'N'}} + } +} + +template<typename T> void f(T) {} // expected-note {{here}} +namespace M { + template void f<int>(int); // expected-warning {{explicit instantiation of 'f' must occur in the global namespace}} +} + +void f() { + auto int n = 0; // expected-warning {{'auto' storage class specifier is redundant and incompatible with C++11}} +} + +int n; +struct S { + char c; +} +s = { n }, // expected-warning {{non-constant-expression cannot be narrowed from type 'int' to 'char' in initializer list in C++11}} expected-note {{explicit cast}} +t = { 1234 }; // expected-warning {{constant expression evaluates to 1234 which cannot be narrowed to type 'char' in C++11}} expected-warning {{changes value}} expected-note {{explicit cast}} diff --git a/test/SemaCXX/cxx0x-constexpr-const.cpp b/test/SemaCXX/cxx0x-constexpr-const.cpp index 79e6dda3e11c..197edeb097b6 100644 --- a/test/SemaCXX/cxx0x-constexpr-const.cpp +++ b/test/SemaCXX/cxx0x-constexpr-const.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s constexpr int x = 1; constexpr int id(int x) { return x; } diff --git a/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 61aee0e45633..17933c2f009a 100644 --- a/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct non_copiable { non_copiable(const non_copiable&) = delete; // expected-note {{marked deleted here}} @@ -35,7 +35,7 @@ struct bad_decls { bad_decls(volatile bad_decls&) = default; // expected-error {{may not be volatile}} bad_decls&& operator = (bad_decls) = default; // expected-error 2{{lvalue reference}} bad_decls& operator = (volatile bad_decls&) = default; // expected-error {{may not be volatile}} - bad_decls& operator = (const bad_decls&) const = default; // expected-error {{may not have 'const' or 'volatile' qualifiers}} + bad_decls& operator = (const bad_decls&) const = default; // expected-error {{may not have 'const', 'constexpr' or 'volatile' qualifiers}} }; struct A {}; struct B {}; diff --git a/test/SemaCXX/cxx0x-defaulted-functions.cpp b/test/SemaCXX/cxx0x-defaulted-functions.cpp index 86c5fd10e23c..d01f63bedb6b 100644 --- a/test/SemaCXX/cxx0x-defaulted-functions.cpp +++ b/test/SemaCXX/cxx0x-defaulted-functions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s void fn() = default; // expected-error {{only special member}} struct foo { diff --git a/test/SemaCXX/cxx0x-delegating-ctors.cpp b/test/SemaCXX/cxx0x-delegating-ctors.cpp index a3e6ff3b4f92..2d49f0fc599d 100644 --- a/test/SemaCXX/cxx0x-delegating-ctors.cpp +++ b/test/SemaCXX/cxx0x-delegating-ctors.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s struct foo { int i; diff --git a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp index dcb6ba2790be..16c56642c06b 100644 --- a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp +++ b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct non_trivial { non_trivial(); @@ -118,3 +118,15 @@ struct late_delete { late_delete(); }; late_delete::late_delete() = default; // expected-error {{would delete it}} + +// See also rdar://problem/8125400. +namespace empty { + static union {}; // expected-error {{deleted constructor}} expected-note {{here}} + static union { union {}; }; + static union { struct {}; }; + static union { union { union {}; }; }; + static union { union { struct {}; }; }; + static union { struct { union {}; }; }; // expected-error {{deleted constructor}} expected-note {{here}} + static union { struct { struct {}; }; }; +} + diff --git a/test/SemaCXX/cxx0x-initializer-scalars.cpp b/test/SemaCXX/cxx0x-initializer-scalars.cpp new file mode 100644 index 000000000000..41fc2193891c --- /dev/null +++ b/test/SemaCXX/cxx0x-initializer-scalars.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +namespace integral { + + void initialization() { + { const int a{}; static_assert(a == 0, ""); } + { const int a = {}; static_assert(a == 0, ""); } + { const int a{1}; static_assert(a == 1, ""); } + { const int a = {1}; static_assert(a == 1, ""); } + { const int a{1, 2}; } // expected-error {{excess elements}} + { const int a = {1, 2}; } // expected-error {{excess elements}} + // FIXME: Redundant warnings. + { const short a{100000}; } // expected-error {{cannot be narrowed}} expected-note {{inserting an explicit cast}} expected-warning {{changes value}} + { const short a = {100000}; } // expected-error {{cannot be narrowed}} expected-note {{inserting an explicit cast}} expected-warning {{changes value}} + } + + int direct_usage() { + int ar[10]; + (void) ar[{1}]; // expected-error {{array subscript is not an integer}} + + return {1}; + } + + void inline_init() { + (void) int{1}; + (void) new int{1}; + } + + struct A { + int i; + A() : i{1} {} + }; + +} diff --git a/test/SemaCXX/cxx0x-nontrivial-union.cpp b/test/SemaCXX/cxx0x-nontrivial-union.cpp index 666e64be66ab..6275af6bac52 100644 --- a/test/SemaCXX/cxx0x-nontrivial-union.cpp +++ b/test/SemaCXX/cxx0x-nontrivial-union.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s struct non_trivial { non_trivial(); diff --git a/test/SemaCXX/cxx0x-return-init-list.cpp b/test/SemaCXX/cxx0x-return-init-list.cpp index 2005a7f9f676..b786922b71a8 100644 --- a/test/SemaCXX/cxx0x-return-init-list.cpp +++ b/test/SemaCXX/cxx0x-return-init-list.cpp @@ -1,17 +1,17 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // This test checks for a teeny tiny subset of the functionality in -// the C++0x generalized initializer lists feature, which happens to +// the C++11 generalized initializer lists feature, which happens to // be used in libstdc++ 4.5. We accept only this syntax so that Clang // can handle the libstdc++ 4.5 headers. int test0(int i) { - return { i }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}} + return { i }; // expected-warning{{generalized initializer lists are a C++11 extension unsupported in Clang}} } template<typename T, typename U> T test1(U u) { - return { u }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}} + return { u }; // expected-warning{{generalized initializer lists are a C++11 extension unsupported in Clang}} } template int test1(char); diff --git a/test/SemaCXX/cxx0x-type-convert-construct.cpp b/test/SemaCXX/cxx0x-type-convert-construct.cpp new file mode 100644 index 000000000000..6a7fe45281f5 --- /dev/null +++ b/test/SemaCXX/cxx0x-type-convert-construct.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -std=gnu++11 -fsyntax-only -verify %s + +void f() { + char *u8str; + u8str = u8"a UTF-8 string"; // expected-error {{assigning to 'char *' from incompatible type 'const char [15]'}} + char16_t *ustr; + ustr = u"a UTF-16 string"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [16]'}} + char32_t *Ustr; + Ustr = U"a UTF-32 string"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [16]'}} + + char *Rstr; + Rstr = R"foo(a raw string)foo"; // expected-warning{{conversion from string literal to 'char *' is deprecated}} + wchar_t *LRstr; + LRstr = LR"foo(a wide raw string)foo"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}} + char *u8Rstr; + u8Rstr = u8R"foo(a UTF-8 raw string)foo"; // expected-error {{assigning to 'char *' from incompatible type 'const char [19]'}} + char16_t *uRstr; + uRstr = uR"foo(a UTF-16 raw string)foo"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [20]'}} + char32_t *URstr; + URstr = UR"foo(a UTF-32 raw string)foo"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [20]'}} +} diff --git a/test/SemaCXX/cxx98-compat-pedantic.cpp b/test/SemaCXX/cxx98-compat-pedantic.cpp new file mode 100644 index 000000000000..2ca0ae4d1ec8 --- /dev/null +++ b/test/SemaCXX/cxx98-compat-pedantic.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat-pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror %s + +// -Wc++98-compat-pedantic warns on C++11 features which we accept without a +// warning in C++98 mode. + +#line 32767 // ok +#line 32768 // expected-warning {{#line number greater than 32767 is incompatible with C++98}} + +#define VA_MACRO(x, ...) x // expected-warning {{variadic macros are incompatible with C++98}} +VA_MACRO(,x) // expected-warning {{empty macro argument list is incompatible with C++98}} diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp new file mode 100644 index 000000000000..6a3881cf4217 --- /dev/null +++ b/test/SemaCXX/cxx98-compat.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s + +template<typename ...T> // expected-warning {{variadic templates are incompatible with C++98}} +class Variadic1 {}; + +template<template<typename> class ...T> // expected-warning {{variadic templates are incompatible with C++98}} +class Variadic2 {}; + +template<int ...I> // expected-warning {{variadic templates are incompatible with C++98}} +class Variadic3 {}; + +int alignas(8) with_alignas; // expected-warning {{'alignas' is incompatible with C++98}} +int with_attribute [[ ]]; // expected-warning {{attributes are incompatible with C++98}} + +void Literals() { + (void)u8"str"; // expected-warning {{unicode literals are incompatible with C++98}} + (void)u"str"; // expected-warning {{unicode literals are incompatible with C++98}} + (void)U"str"; // expected-warning {{unicode literals are incompatible with C++98}} + (void)u'x'; // expected-warning {{unicode literals are incompatible with C++98}} + (void)U'x'; // expected-warning {{unicode literals are incompatible with C++98}} + + (void)u8R"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} + (void)uR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} + (void)UR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} + (void)R"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} + (void)LR"X(str)X"; // expected-warning {{raw string literals are incompatible with C++98}} +} + +template<typename T> struct S {}; +S<::S<void> > s; // expected-warning {{'<::' is treated as digraph '<:' (aka '[') followed by ':' in C++98}} diff --git a/test/SemaCXX/decl-init-ref.cpp b/test/SemaCXX/decl-init-ref.cpp index 34c4578e9d6d..4c635c1a2447 100644 --- a/test/SemaCXX/decl-init-ref.cpp +++ b/test/SemaCXX/decl-init-ref.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct A {}; diff --git a/test/SemaCXX/decltype-crash.cpp b/test/SemaCXX/decltype-crash.cpp index f94ba453ffb4..50b3e49b78a5 100644 --- a/test/SemaCXX/decltype-crash.cpp +++ b/test/SemaCXX/decltype-crash.cpp @@ -3,5 +3,5 @@ int& a(); void f() { - decltype(a()) c; // expected-error {{use of undeclared identifier 'decltype'}} + decltype(a()) c; // expected-warning {{'decltype' is a keyword in C++11}} expected-error {{use of undeclared identifier 'decltype'}} } diff --git a/test/SemaCXX/decltype-overloaded-functions.cpp b/test/SemaCXX/decltype-overloaded-functions.cpp index f4aacd64ddbc..b0a43a999bb6 100644 --- a/test/SemaCXX/decltype-overloaded-functions.cpp +++ b/test/SemaCXX/decltype-overloaded-functions.cpp @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -void f(); // expected-note{{candidate function}} -void f(int); // expected-note{{candidate function}} -decltype(f) a; // expected-error{{cannot resolve overloaded function 'f' from context}} +void f(); // expected-note{{possible target for call}} +void f(int); // expected-note{{possible target for call}} +decltype(f) a; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{variable has incomplete type 'decltype(f())' (aka 'void')}} template<typename T> struct S { - decltype(T::f) * f; // expected-error{{cannot resolve overloaded function 'f' from context}} + decltype(T::f) * f; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{call to non-static member function without an object argument}} }; struct K { - void f(); // expected-note{{candidate function}} - void f(int); // expected-note{{candidate function}} + void f(); // expected-note{{possible target for call}} + void f(int); // expected-note{{possible target for call}} }; S<K> b; // expected-note{{in instantiation of template class 'S<K>' requested here}} diff --git a/test/SemaCXX/decltype-pr4444.cpp b/test/SemaCXX/decltype-pr4444.cpp index 456b22c5f7f2..2f95075067a4 100644 --- a/test/SemaCXX/decltype-pr4444.cpp +++ b/test/SemaCXX/decltype-pr4444.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 template<typename T, T t> struct TestStruct { diff --git a/test/SemaCXX/decltype-pr4448.cpp b/test/SemaCXX/decltype-pr4448.cpp index ead24ce0ca86..9d33ce7341a2 100644 --- a/test/SemaCXX/decltype-pr4448.cpp +++ b/test/SemaCXX/decltype-pr4448.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 template< typename T, T t, decltype(t+2) v > struct Convoluted {}; diff --git a/test/SemaCXX/decltype-this.cpp b/test/SemaCXX/decltype-this.cpp index f9bf49973b5c..a13416f089dd 100644 --- a/test/SemaCXX/decltype-this.cpp +++ b/test/SemaCXX/decltype-this.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<typename T, typename U> struct is_same { static const bool value = false; diff --git a/test/SemaCXX/decltype.cpp b/test/SemaCXX/decltype.cpp index f61a92b71e1e..78fb8ef02078 100644 --- a/test/SemaCXX/decltype.cpp +++ b/test/SemaCXX/decltype.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // PR5290 int const f0(); diff --git a/test/SemaCXX/defaulted-ctor-loop.cpp b/test/SemaCXX/defaulted-ctor-loop.cpp index 6a41972cf75a..6416336c6eed 100644 --- a/test/SemaCXX/defaulted-ctor-loop.cpp +++ b/test/SemaCXX/defaulted-ctor-loop.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // WARNING: This test may recurse infinitely if failing. diff --git a/test/SemaCXX/delete.cpp b/test/SemaCXX/delete.cpp index 4567888a37b1..5824facc507b 100644 --- a/test/SemaCXX/delete.cpp +++ b/test/SemaCXX/delete.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: cp %s %t // RUN: %clang_cc1 -fixit -x c++ %t -// RUN: FileCheck -input-file=%t %s +// RUN: %clang_cc1 -E -o - %t | FileCheck %s void f(int a[10][20]) { // CHECK: delete[] a; diff --git a/test/SemaCXX/deleted-function.cpp b/test/SemaCXX/deleted-function.cpp index 6a8965ceb578..4620a19d46fb 100644 --- a/test/SemaCXX/deleted-function.cpp +++ b/test/SemaCXX/deleted-function.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s int i = delete; // expected-error {{only functions can have deleted definitions}} diff --git a/test/SemaCXX/deleted-operator.cpp b/test/SemaCXX/deleted-operator.cpp new file mode 100644 index 000000000000..e357401bf942 --- /dev/null +++ b/test/SemaCXX/deleted-operator.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +struct PR10757 { + bool operator~() = delete; // expected-note {{explicitly deleted}} + bool operator==(const PR10757&) = delete; // expected-note {{explicitly deleted}} + operator float(); +}; +int PR10757f() { + PR10757 a1; + // FIXME: We get a ridiculous number of "built-in candidate" notes here... + if(~a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 6 {{built-in candidate}} + if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 81 {{built-in candidate}} +} diff --git a/test/SemaCXX/dependent-auto.cpp b/test/SemaCXX/dependent-auto.cpp index 52b15eda7324..1be1566bb3b0 100644 --- a/test/SemaCXX/dependent-auto.cpp +++ b/test/SemaCXX/dependent-auto.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 template<typename T> struct only { diff --git a/test/SemaCXX/dependent-noexcept-unevaluated.cpp b/test/SemaCXX/dependent-noexcept-unevaluated.cpp index 5bf6f9e96a12..8066b859f189 100644 --- a/test/SemaCXX/dependent-noexcept-unevaluated.cpp +++ b/test/SemaCXX/dependent-noexcept-unevaluated.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s template <class T> T&& diff --git a/test/SemaCXX/dependent-types.cpp b/test/SemaCXX/dependent-types.cpp index 053e79bb6981..13ed72f7231e 100644 --- a/test/SemaCXX/dependent-types.cpp +++ b/test/SemaCXX/dependent-types.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++11 %s template<typename T> using U = int &; diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp index ec0539b81901..14a0cda8df35 100644 --- a/test/SemaCXX/destructor.cpp +++ b/test/SemaCXX/destructor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -verify %s class A { public: ~A(); diff --git a/test/SemaCXX/enum-bitfield.cpp b/test/SemaCXX/enum-bitfield.cpp index a766116b1c3c..1a657408f8a6 100644 --- a/test/SemaCXX/enum-bitfield.cpp +++ b/test/SemaCXX/enum-bitfield.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify -triple x86_64-apple-darwin %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify -triple x86_64-apple-darwin %s enum E {}; diff --git a/test/SemaCXX/enum-scoped.cpp b/test/SemaCXX/enum-scoped.cpp index 73e7578ecb6e..35ba1b4017ae 100644 --- a/test/SemaCXX/enum-scoped.cpp +++ b/test/SemaCXX/enum-scoped.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify -triple x86_64-apple-darwin %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify -triple x86_64-apple-darwin %s enum class E1 { Val1 = 1L diff --git a/test/SemaCXX/explicit.cpp b/test/SemaCXX/explicit.cpp index 717ed1e3caf2..11b9672a8501 100644 --- a/test/SemaCXX/explicit.cpp +++ b/test/SemaCXX/explicit.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace Constructor { struct A { A(int); @@ -36,4 +36,149 @@ namespace Conversion { void f(A a, B b) { b.f(a); } + + void testExplicit() + { + // Taken from 12.3.2p2 + class Y { }; // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Conversion::Z' to 'const Conversion::Y &' for 1st argument}} \ + expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'Conversion::Z' to 'Conversion::Y &&' for 1st argument}} \ + expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Conversion::Z' to 'const Conversion::Y &' for 1st argument}} \ + expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'Conversion::Z' to 'Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Conversion::Z' to 'const Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'Conversion::Z' to 'Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}} \ + expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Conversion::Z' to 'const Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'Conversion::Z' to 'Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}} \ + expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Conversion::Z' to 'const Conversion::Y' for 1st argument}} \ + expected-note {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'Conversion::Z' to 'Conversion::Y &&' for 1st argument}} \ + expected-note {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}} + struct Z { + explicit operator Y() const; + explicit operator int() const; + }; + + Z z; + // 13.3.1.4p1 & 8.5p16: + Y y2 = z; // expected-error {{no viable conversion from 'Conversion::Z' to 'Conversion::Y'}} + // FIXME: These are well-formed per C++0x 13.3.1.4p1 (see DR899). + Y y3 = (Y)z; // expected-error {{no matching conversion for C-style cast from 'Conversion::Z' to 'Conversion::Y''}} + Y y4 = Y(z); // expected-error {{no matching conversion for functional-style cast from 'Conversion::Z' to 'Conversion::Y'}} + Y y5 = static_cast<Y>(z); // expected-error {{no matching conversion for static_cast from 'Conversion::Z' to 'Conversion::Y'}} + // 13.3.1.5p1 & 8.5p16: + int i1 = (int)z; + int i2 = int(z); + int i3 = static_cast<int>(z); + int i4(z); + // 13.3.1.6p1 & 8.5.3p5: + const Y& y6 = z; // expected-error {{no viable conversion from 'Conversion::Z' to 'const Conversion::Y'}} + const int& y7(z); + } + + void testBool() { + struct Bool { + operator bool(); + }; + + struct NotBool { + explicit operator bool(); // expected-note {{conversion to integral type 'bool'}} + }; + Bool b; + NotBool n; + + (void) (1 + b); + (void) (1 + n); // expected-error {{invalid operands to binary expression ('int' and 'Conversion::NotBool')}} + + // 5.3.1p9: + (void) (!b); + (void) (!n); + + // 5.14p1: + (void) (b && true); + (void) (n && true); + + // 5.15p1: + (void) (b || true); + (void) (n || true); + + // 5.16p1: + (void) (b ? 0 : 1); + (void) (n ? 0: 1); + + // 5.19p5: + // TODO: After constexpr has been implemented + + // 6.4p4: + if (b) {} + if (n) {} + + // 6.4.2p2: + switch (b) {} // expected-warning {{switch condition has boolean value}} + switch (n) {} // expected-error {{switch condition type 'Conversion::NotBool' requires explicit conversion to 'bool'}} \ + expected-warning {{switch condition has boolean value}} + + // 6.5.1: + while (b) {} + while (n) {} + + // 6.5.2p1: + do {} while (b); + do {} while (n); + + // 6.5.3: + for (;b;) {} + for (;n;) {} + } + + void testNew() + { + // 5.3.4p6: + struct Int { + operator int(); + }; + struct NotInt { + explicit operator int(); // expected-note {{conversion to integral type 'int' declared here}} + }; + + Int i; + NotInt ni; + + new int[i]; + new int[ni]; // expected-error {{array size expression of type 'Conversion::NotInt' requires explicit conversion to type 'int'}} + } + + void testDelete() + { + // 5.3.5pp2: + struct Ptr { + operator int*(); + }; + struct NotPtr { + explicit operator int*(); + }; + + Ptr p; + NotPtr np; + + delete p; + delete np; // expected-error {{cannot delete expression of type 'Conversion::NotPtr'}} + } + + void testFunctionPointer() + { + // 13.3.1.1.2p2: + using Func = void(*)(int); + + struct FP { + operator Func(); + }; + struct NotFP { + explicit operator Func(); + }; + + FP fp; + NotFP nfp; + fp(1); + nfp(1); // expected-error {{type 'Conversion::NotFP' does not provide a call operator}} + } } diff --git a/test/SemaCXX/expression-traits.cpp b/test/SemaCXX/expression-traits.cpp index 4555192280f0..32b3ff91e95b 100644 --- a/test/SemaCXX/expression-traits.cpp +++ b/test/SemaCXX/expression-traits.cpp @@ -136,7 +136,7 @@ void conv_ptr_1() void expr_6() { - // expr/6: If an expression initially has the type “reference to T†+ // expr/6: If an expression initially has the type "reference to T" // (8.3.2, 8.5.3), ... the expression is an lvalue. int x = 0; int& referenceToInt = x; @@ -185,8 +185,8 @@ struct Class : BaseClass template <class T> struct NestedClassTemplate {}; - template <class T> - static int& NestedFuncTemplate() { return variable; } // expected-note{{candidate function}} + template <class T> // expected-note{{possible target for call}} + static int& NestedFuncTemplate() { return variable; } template <class T> int& NestedMemfunTemplate() { return variable; } @@ -234,13 +234,13 @@ struct Class : BaseClass // doesn't come up in legal pure C++ programs). This language // extension simply rejects them as requiring additional context __is_lvalue_expr(::Class::NestedFuncTemplate); // qualified-id: template \ - // expected-error{{cannot resolve overloaded function 'NestedFuncTemplate' from context}} + // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} __is_lvalue_expr(::Class::NestedMemfunTemplate); // qualified-id: template \ - // expected-error{{a bound member function may only be called}} + // expected-error{{reference to non-static member function must be called}} __is_lvalue_expr(::Class::operator+); // operator-function-id: template \ - // expected-error{{a bound member function may only be called}} + // expected-error{{reference to non-static member function must be called}} //ASSERT_RVALUE(::Class::operator*); // operator-function-id: member function } @@ -310,9 +310,9 @@ void expr_sub_1(int* pointer) { // expr.sub/1 A postfix expression followed by an expression in // square brackets is a postfix expression. One of the expressions - // shall have the type “pointer to T†and the other shall have + // shall have the type "pointer to T" and the other shall have // enumeration or integral type. The result is an lvalue of type - // “T.†+ // "T." ASSERT_LVALUE(pointer[1]); // The expression E1[E2] is identical (by definition) to *((E1)+(E2)). @@ -348,32 +348,32 @@ void expr_ref_4() { // Applies to expressions of the form E1.E2 - // If E2 is declared to have type “reference to Tâ€, then E1.E2 is + // If E2 is declared to have type "reference to T", then E1.E2 is // an lvalue;.... Otherwise, one of the following rules applies. ASSERT_LVALUE(Class().staticReferenceDataMember); ASSERT_LVALUE(Class().referenceDataMember); - // — If E2 is a static data member, and the type of E2 is T, then + // - If E2 is a static data member, and the type of E2 is T, then // E1.E2 is an lvalue; ... ASSERT_LVALUE(Class().staticNonreferenceDataMember); ASSERT_LVALUE(Class().staticReferenceDataMember); - // — If E2 is a non-static data member, ... If E1 is an lvalue, + // - If E2 is a non-static data member, ... If E1 is an lvalue, // then E1.E2 is an lvalue... Class lvalue; ASSERT_LVALUE(lvalue.dataMember); ASSERT_RVALUE(Class().dataMember); - // — If E1.E2 refers to a static member function, ... then E1.E2 + // - If E1.E2 refers to a static member function, ... then E1.E2 // is an lvalue ASSERT_LVALUE(Class().StaticMemberFunction); - // — Otherwise, if E1.E2 refers to a non-static member function, + // - Otherwise, if E1.E2 refers to a non-static member function, // then E1.E2 is not an lvalue. //ASSERT_RVALUE(Class().NonstaticMemberFunction); - // — If E2 is a member enumerator, and the type of E2 is T, the + // - If E2 is a member enumerator, and the type of E2 is T, the // expression E1.E2 is not an lvalue. The type of E1.E2 is T. ASSERT_RVALUE(Class().Enumerator); ASSERT_RVALUE(lvalue.Enumerator); @@ -404,8 +404,8 @@ void expr_dynamic_cast_2() void expr_dynamic_cast_5() { - // expr.dynamic.cast/5: If T is “reference to cv1 B†and v has type - // “cv2 D†such that B is a base class of D, the result is an + // expr.dynamic.cast/5: If T is "reference to cv1 B" and v has type + // "cv2 D" such that B is a base class of D, the result is an // lvalue for the unique B sub-object of the D object referred // to by v. typedef BaseClass B; @@ -416,13 +416,13 @@ void expr_dynamic_cast_5() // expr.dynamic.cast/8: The run-time check logically executes as follows: // -// — If, in the most derived object pointed (referred) to by v, v +// - If, in the most derived object pointed (referred) to by v, v // points (refers) to a public base class subobject of a T object, and // if only one object of type T is derived from the sub-object pointed // (referred) to by v, the result is a pointer (an lvalue referring) // to that T object. // -// — Otherwise, if v points (refers) to a public base class sub-object +// - Otherwise, if v points (refers) to a public base class sub-object // of the most derived object, and the type of the most derived object // has a base class, of type T, that is unambiguous and public, the // result is a pointer (an lvalue referring) to the T sub-object of @@ -525,7 +525,7 @@ void expr_cond(bool cond) // conversions are performed on the second and third operands, and one // of the following shall hold: // - // — The second or the third operand (but not both) is a + // - The second or the third operand (but not both) is a // throw-expression (15.1); the result is of the type of the other and // is an rvalue. @@ -535,7 +535,7 @@ void expr_cond(bool cond) ASSERT_RVALUE(cond ? throw 1 : classLvalue); ASSERT_RVALUE(cond ? classLvalue : throw 1); - // — Both the second and the third operands have type void; the result + // - Both the second and the third operands have type void; the result // is of type void and is an rvalue. [Note: this includes the case // where both operands are throw-expressions. ] ASSERT_RVALUE(cond ? (void)1 : (void)0); diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp index 8a294face380..355833e693fa 100644 --- a/test/SemaCXX/expressions.cpp +++ b/test/SemaCXX/expressions.cpp @@ -34,7 +34,9 @@ namespace test1 { } int test2(int x) { - return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && 4; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x && sizeof(int) == 4; // no warning, RHS is logical op. return x && true; @@ -42,38 +44,69 @@ int test2(int x) { return x || true; return x || false; - return x && (unsigned)0; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x && (unsigned)0; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} - return x || (unsigned)1; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} + return x || (unsigned)1; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} - return x || 0; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || 1; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || -1; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || 5; // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x && 0; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && 1; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && -1; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && 5; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x || (0); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || (1); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || (-1); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x || (5); // expected-warning {{use of logical || with constant operand; switch to bitwise | or remove constant}} - return x && (0); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && (1); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && (-1); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} - return x && (5); // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + return x || 0; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || 1; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || -1; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || 5; // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x && 0; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && 1; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && -1; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && 5; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x || (0); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || (1); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || (-1); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x || (5); // expected-warning {{use of logical '||' with constant operand}} \ + // expected-note {{use '|' for a bitwise operation}} + return x && (0); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && (1); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && (-1); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} + return x && (5); // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} } template<unsigned int A, unsigned int B> struct S { enum { e1 = A && B, - e2 = A && 7 // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + e2 = A && 7 // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} }; int foo() { int x = A && B; - int y = B && 3; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + int y = B && 3; // expected-warning {{use of logical '&&' with constant operand}} \ + // expected-note {{use '&' for a bitwise operation}} \ + // expected-note {{remove constant to silence this warning}} return x + y; } diff --git a/test/SemaCXX/for-range-examples.cpp b/test/SemaCXX/for-range-examples.cpp index 810f1de441a1..b994e8c10bd6 100644 --- a/test/SemaCXX/for-range-examples.cpp +++ b/test/SemaCXX/for-range-examples.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 namespace value_range_detail { template<typename T> diff --git a/test/SemaCXX/for-range-no-std.cpp b/test/SemaCXX/for-range-no-std.cpp index 8cc71e5111a2..dae41f1bb296 100644 --- a/test/SemaCXX/for-range-no-std.cpp +++ b/test/SemaCXX/for-range-no-std.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions struct S { int *begin(); diff --git a/test/SemaCXX/for-range-unused.cpp b/test/SemaCXX/for-range-unused.cpp index 7b7d84d3f9c8..ce6b379cc192 100644 --- a/test/SemaCXX/for-range-unused.cpp +++ b/test/SemaCXX/for-range-unused.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x -Wunused +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -Wunused // PR9968: We used to warn that __range is unused in a dependent for-range. diff --git a/test/SemaCXX/function-overload-typo-crash.cpp b/test/SemaCXX/function-overload-typo-crash.cpp index 0fea312a97f2..8c5cec8af3a9 100644 --- a/test/SemaCXX/function-overload-typo-crash.cpp +++ b/test/SemaCXX/function-overload-typo-crash.cpp @@ -1,12 +1,28 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // PR10283 -void min(); +void min(); //expected-note {{'min' declared here}} void min(int); -template <typename T> void max(T); +template <typename T> void max(T); //expected-note {{'max' declared here}} void f() { fin(); //expected-error {{use of undeclared identifier 'fin'; did you mean 'min'}} fax(0); //expected-error {{use of undeclared identifier 'fax'; did you mean 'max'}} } + +template <typename T> void somefunc(T*, T*); //expected-note {{'somefunc' declared here}} +template <typename T> void somefunc(const T[]); //expected-note {{'somefunc' declared here}} +template <typename T1, typename T2> void somefunc(T1*, T2*); //expected-note {{'somefunc' declared here}} +template <typename T1, typename T2> void somefunc(T1*, const T2[]); //expected-note 2 {{'somefunc' declared here}} + +void c() { + int *i = 0, *j = 0; + const int x[] = {1, 2, 3}; + long *l = 0; + somefun(i, j); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}} + somefun(x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}} + somefun(i, l); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}} + somefun(l, x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}} + somefun(i, x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}} +} diff --git a/test/SemaCXX/function-redecl.cpp b/test/SemaCXX/function-redecl.cpp index b15d86616585..0d9ecf334e6a 100644 --- a/test/SemaCXX/function-redecl.cpp +++ b/test/SemaCXX/function-redecl.cpp @@ -24,3 +24,74 @@ namespace N { } } } + +class A { + void typocorrection(); // expected-note {{'typocorrection' declared here}} +}; + +void A::Notypocorrection() { // expected-error {{out-of-line definition of 'Notypocorrection' does not match any declaration in 'A'; did you mean 'typocorrection'}} +} + + +namespace test0 { + void dummy() { + void Bar(); // expected-note {{'Bar' declared here}} + class A { + friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean 'Bar'}} + }; + } +} + + +class B { + void typocorrection(const int); // expected-note {{'typocorrection' declared here}} + void typocorrection(double); +}; + +void B::Notypocorrection(int) { // expected-error {{out-of-line definition of 'Notypocorrection' does not match any declaration in 'B'; did you mean 'typocorrection'}} +} + +struct X { int f(); }; +struct Y : public X {}; +int Y::f() { return 3; } // expected-error {{out-of-line definition of 'f' does not match any declaration in 'Y'}} + +namespace test1 { +struct Foo { + class Inner { }; +}; +} + +class Bar { + void f(test1::Foo::Inner foo) const; // expected-note {{member declaration does not match because it is const qualified}} +}; + +using test1::Foo; + +void Bar::f(Foo::Inner foo) { // expected-error {{out-of-line definition of 'f' does not match any declaration in 'Bar'}} + (void)foo; +} + +class Crash { + public: + void GetCart(int count) const; +}; +// This out-of-line definition was fine... +void Crash::cart(int count) const {} // expected-error {{out-of-line definition of 'cart' does not match any declaration in 'Crash'}} +// ...while this one crashed clang +void Crash::chart(int count) const {} // expected-error {{out-of-line definition of 'chart' does not match any declaration in 'Crash'}} + +class TestConst { + public: + int getit() const; // expected-note {{member declaration does not match because it is const qualified}} + void setit(int); // expected-note {{member declaration does not match because it is not const qualified}} +}; + +int TestConst::getit() { // expected-error {{out-of-line definition of 'getit' does not match any declaration in 'TestConst'}} + return 1; +} + +void TestConst::setit(int) const { // expected-error {{out-of-line definition of 'setit' does not match any declaration in 'TestConst'}} +} + +struct J { int typo() const; }; +int J::typo_() { return 3; } // expected-error {{out-of-line definition of 'typo_' does not match any declaration in 'J'}} diff --git a/test/SemaCXX/generalized-initializers.cpp b/test/SemaCXX/generalized-initializers.cpp index 6e2bee7e301d..a1891c9c322e 100644 --- a/test/SemaCXX/generalized-initializers.cpp +++ b/test/SemaCXX/generalized-initializers.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s // XFAIL: * template <typename T, typename U> @@ -40,25 +40,9 @@ namespace std { namespace integral { - void initialization() { - { const int a{}; static_assert(a == 0, ""); } - { const int a = {}; static_assert(a == 0, ""); } - { const int a{1}; static_assert(a == 1, ""); } - { const int a = {1}; static_assert(a == 1, ""); } - { const int a{1, 2}; } // expected-error {{excess elements}} - { const int a = {1, 2}; } // expected-error {{excess elements}} - { const short a{100000}; } // expected-error {{narrowing conversion}} - { const short a = {100000}; } // expected-error {{narrowing conversion}} - } - int function_call() { void takes_int(int); takes_int({1}); - - int ar[10]; - (void) ar[{1}]; // expected-error {{initializer list is illegal with the built-in index operator}} - - return {1}; } void inline_init() { @@ -76,11 +60,6 @@ namespace integral { for (int i : {1, 2, 3, 4}) {} } - struct A { - int i; - A() : i{1} {} - }; - } namespace objects { diff --git a/test/SemaCXX/generic-selection.cpp b/test/SemaCXX/generic-selection.cpp index b171fce540d8..c0a5d89fff67 100644 --- a/test/SemaCXX/generic-selection.cpp +++ b/test/SemaCXX/generic-selection.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template <typename T, typename U = void*> struct A { diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp index 186e32126a39..4d02ca8f174e 100644 --- a/test/SemaCXX/i-c-e-cxx.cpp +++ b/test/SemaCXX/i-c-e-cxx.cpp @@ -54,4 +54,10 @@ struct A { int foo() { return A::B; } } +// PR11040 +const int x = 10; +int* y = reinterpret_cast<const char&>(x); // expected-error {{cannot initialize}} +// This isn't an integral constant expression, but make sure it folds anyway. +struct PR8836 { char _; long long a; }; +int PR8836test[(__typeof(sizeof(int)))&reinterpret_cast<const volatile char&>((((PR8836*)0)->a))]; diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp index 81babc043ff7..559c3013f7e9 100644 --- a/test/SemaCXX/implicit-exception-spec.cpp +++ b/test/SemaCXX/implicit-exception-spec.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++0x -Wall %s +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 -Wall %s template<bool b> struct ExceptionIf { static int f(); }; template<> struct ExceptionIf<false> { typedef int f; }; diff --git a/test/SemaCXX/issue547.cpp b/test/SemaCXX/issue547.cpp index 03c5b7c978aa..5b82dc6b145e 100644 --- a/test/SemaCXX/issue547.cpp +++ b/test/SemaCXX/issue547.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> struct classify_function { diff --git a/test/SemaCXX/libstdcxx_is_pod_hack.cpp b/test/SemaCXX/libstdcxx_is_pod_hack.cpp index 3581c796ce91..3ac233627ccb 100644 --- a/test/SemaCXX/libstdcxx_is_pod_hack.cpp +++ b/test/SemaCXX/libstdcxx_is_pod_hack.cpp @@ -27,3 +27,7 @@ struct test_is_signed { }; bool check_signed = test_is_signed::__is_signed; + +#if __has_feature(is_pod) +# error __is_pod won't work now anyway +#endif diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp index b5a10a795ebc..cb7e32c05d88 100644 --- a/test/SemaCXX/linkage-spec.cpp +++ b/test/SemaCXX/linkage-spec.cpp @@ -89,3 +89,16 @@ extern "C++" using N::value; // PR7076 extern "C" const char *Version_string = "2.9"; + +namespace PR9162 { + extern "C" { + typedef struct _ArtsSink ArtsSink; + struct _ArtsSink { + int sink; + }; + } + int arts_sink_get_type() + { + return sizeof(ArtsSink); + } +} diff --git a/test/SemaCXX/literal-operators.cpp b/test/SemaCXX/literal-operators.cpp index ec585a61da9f..06ef49fc0ae1 100644 --- a/test/SemaCXX/literal-operators.cpp +++ b/test/SemaCXX/literal-operators.cpp @@ -1,41 +1,41 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s #include <stddef.h> struct tag { - void operator "" tag_bad (const char *); // expected-error {{literal operator 'operator "" tag_bad' must be in a namespace or global scope}} - friend void operator "" tag_good (const char *); + void operator "" _tag_bad (const char *); // expected-error {{literal operator 'operator "" _tag_bad' must be in a namespace or global scope}} + friend void operator "" _tag_good (const char *); }; -namespace ns { void operator "" ns_good (const char *); } +namespace ns { void operator "" _ns_good (const char *); } // Check extern "C++" declarations -extern "C++" void operator "" extern_good (const char *); -extern "C++" { void operator "" extern_good (const char *); } +extern "C++" void operator "" _extern_good (const char *); +extern "C++" { void operator "" _extern_good (const char *); } -void fn () { void operator "" fn_bad (const char *); } // expected-error {{literal operator 'operator "" fn_bad' must be in a namespace or global scope}} +void fn () { void operator "" _fn_bad (const char *); } // expected-error {{literal operator 'operator "" _fn_bad' must be in a namespace or global scope}} // One-param declarations (const char * was already checked) -void operator "" good (char); -void operator "" good (wchar_t); -void operator "" good (char16_t); -void operator "" good (char32_t); -void operator "" good (unsigned long long); -void operator "" good (long double); +void operator "" _good (char); +void operator "" _good (wchar_t); +void operator "" _good (char16_t); +void operator "" _good (char32_t); +void operator "" _good (unsigned long long); +void operator "" _good (long double); // Two-param declarations -void operator "" good (const char *, size_t); -void operator "" good (const wchar_t *, size_t); -void operator "" good (const char16_t *, size_t); -void operator "" good (const char32_t *, size_t); +void operator "" _good (const char *, size_t); +void operator "" _good (const wchar_t *, size_t); +void operator "" _good (const char16_t *, size_t); +void operator "" _good (const char32_t *, size_t); // Check typedef and array equivalences -void operator "" good (const char[]); +void operator "" _good (const char[]); typedef const char c; -void operator "" good (c*); +void operator "" _good (c*); // Check extra cv-qualifiers -void operator "" cv_good (volatile const char *, const size_t); +void operator "" _cv_good (volatile const char *, const size_t); // Template delcaration (not implemented yet) // template <char...> void operator "" good (); diff --git a/test/SemaCXX/literal-type.cpp b/test/SemaCXX/literal-type.cpp index 6a61823adb28..60bfcf00cf0b 100644 --- a/test/SemaCXX/literal-type.cpp +++ b/test/SemaCXX/literal-type.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s static_assert(__is_literal(int), "fail"); static_assert(__is_literal_type(int), "fail"); // alternate spelling for GCC diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp index 981bae7c770b..2e3fd73d7ff5 100644 --- a/test/SemaCXX/member-expr.cpp +++ b/test/SemaCXX/member-expr.cpp @@ -28,7 +28,7 @@ struct B { A *f0(); }; int f0(B *b) { - return b->f0->f0; // expected-error{{perhaps you meant to call it with no arguments}} + return b->f0->f0; // expected-error{{did you mean to call it with no arguments}} } int i; @@ -118,32 +118,32 @@ namespace rdar8231724 { namespace PR9025 { struct S { int x; }; - S fun(); - int fun(int i); + S fun(); // expected-note{{possible target for call}} + int fun(int i); // expected-note{{possible target for call}} int g() { - return fun.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}} + return fun.x; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} } - S fun2(); - S fun2(int i); + S fun2(); // expected-note{{possible target for call}} + S fun2(int i); // expected-note{{possible target for call}} int g2() { - return fun2.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}} + return fun2.x; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} } - S fun3(int i=0); - int fun3(int i, int j); + S fun3(int i=0); // expected-note{{possible target for call}} + int fun3(int i, int j); // expected-note{{possible target for call}} int g3() { - return fun3.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}} + return fun3.x; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} } - template <typename T> S fun4(); + template <typename T> S fun4(); // expected-note{{possible target for call}} int g4() { - return fun4.x; // expected-error{{base of member reference is a function; perhaps you meant to call it?}} + return fun4.x; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} } - S fun5(int i); // expected-note{{possibly valid overload here}} - S fun5(float f); // expected-note{{possibly valid overload here}} + S fun5(int i); // expected-note{{possible target for call}} + S fun5(float f); // expected-note{{possible target for call}} int g5() { - return fun5.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it?}} + return fun5.x; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} } } diff --git a/test/SemaCXX/member-init.cpp b/test/SemaCXX/member-init.cpp index 7ca1f0e4513e..819c8d13db89 100644 --- a/test/SemaCXX/member-init.cpp +++ b/test/SemaCXX/member-init.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++0x -Wall %s +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 -Wall %s struct Bitfield { int n : 3 = 7; // expected-error {{bitfield member cannot have an in-class initializer}} @@ -52,3 +52,21 @@ struct CheckExcSpecFail { struct TypedefInit { typedef int A = 0; // expected-error {{illegal initializer}} }; + +// PR10578 / <rdar://problem/9877267> +namespace PR10578 { + template<typename T> + struct X { + X() { + T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + } + }; + + struct Y : X<int> { + Y(); + }; + + Y::Y() try { // expected-note{{in instantiation of member function 'PR10578::X<int>::X' requested here}} + } catch(...) { + } +} diff --git a/test/SemaCXX/microsoft-cxx0x.cpp b/test/SemaCXX/microsoft-cxx0x.cpp new file mode 100644 index 000000000000..3f78eda79cd5 --- /dev/null +++ b/test/SemaCXX/microsoft-cxx0x.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++0x-narrowing -Wmicrosoft -verify -fms-extensions -std=c++11 + + +struct A { + unsigned int a; +}; +int b = 3; +A var = { b }; // expected-warning {{ cannot be narrowed }} expected-note {{override}} + + diff --git a/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp b/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp index fd0c976bdd78..76ceea1d4d5b 100644 --- a/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp +++ b/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp @@ -1,8 +1,10 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++0x-extensions %s -namespace fizbin { class Foobar; } // expected-note{{'fizbin::Foobar' declared here}} -Foobar *my_bar = new Foobar; // expected-error{{unknown type name 'Foobar'; did you mean 'fizbin::Foobar'?}} \ - // expected-error{{expected a type}} +namespace fizbin { class Foobar {}; } // expected-note 2 {{'fizbin::Foobar' declared here}} \ + // expected-note {{'Foobar' declared here}} +Foobar *my_bar // expected-error{{unknown type name 'Foobar'; did you mean 'fizbin::Foobar'?}} + = new Foobar; // expected-error{{unknown type name 'Foobar'; did you mean 'fizbin::Foobar'?}} +fizbin::Foobar *my_foo = new fizbin::FooBar; // expected-error{{unknown type name 'FooBar'; did you mean 'Foobar'?}} namespace barstool { int toFoobar() { return 1; } } // expected-note 3 {{'barstool::toFoobar' declared here}} int Double(int x) { return x + x; } @@ -62,11 +64,13 @@ void f() { // Test case from http://llvm.org/bugs/show_bug.cgi?id=10318 namespace llvm { - template <typename T> class GraphWriter {}; // expected-note{{'llvm::GraphWriter' declared here}} + template <typename T> class GraphWriter {}; // expected-note {{'llvm::GraphWriter' declared here}} \ + // expected-note {{'GraphWriter' declared here}} } struct S {}; void bar() { GraphWriter<S> x; //expected-error{{no template named 'GraphWriter'; did you mean 'llvm::GraphWriter'?}} - + (void)new llvm::GraphWriter; // expected-error {{expected a type}} + (void)new llvm::Graphwriter<S>; // expected-error {{no template named 'Graphwriter' in namespace 'llvm'; did you mean 'GraphWriter'?}} } diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index ee6ca8857374..e13030cc38a8 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -27,10 +27,10 @@ int A::C::cx = 17; static int A::C::cx2 = 17; // expected-error{{'static' can}} class C2 { - void m(); // expected-note{{member declaration nearly matches}} + void m(); // expected-note{{member declaration does not match because it is not const qualified}} - void f(const int& parm); // expected-note{{member declaration nearly matches}} - void f(int) const; // expected-note{{member declaration nearly matches}} + void f(const int& parm); // expected-note{{type of 1st parameter of member declaration does not match definition ('const int &' vs 'int')}} + void f(int) const; // expected-note{{member declaration does not match because it is const qualified}} void f(float); int x; @@ -121,7 +121,7 @@ namespace E { class Operators { - Operators operator+(const Operators&) const; // expected-note{{member declaration nearly matches}} + Operators operator+(const Operators&) const; // expected-note{{member declaration does not match because it is const qualified}} operator bool(); }; @@ -140,7 +140,7 @@ Operators::operator bool() { } namespace A { - void g(int&); // expected-note{{member declaration nearly matches}} + void g(int&); // expected-note{{type of 1st parameter of member declaration does not match definition ('int &' vs 'const int &')}} } void A::f() {} // expected-error{{out-of-line definition of 'f' does not match any declaration in namespace 'A'}} diff --git a/test/SemaCXX/new-array-size-conv.cpp b/test/SemaCXX/new-array-size-conv.cpp index 80219a906209..e8bb67955f97 100644 --- a/test/SemaCXX/new-array-size-conv.cpp +++ b/test/SemaCXX/new-array-size-conv.cpp @@ -19,8 +19,8 @@ struct IndirectValueInt : ValueInt { }; struct TwoValueInts : ValueInt, IndirectValueInt { }; void test() { - (void)new int[ValueInt(10)]; // expected-warning{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++0x extension}} - (void)new int[ValueEnum()]; // expected-warning{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++0x extension}} + (void)new int[ValueInt(10)]; // expected-warning{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension}} + (void)new int[ValueEnum()]; // expected-warning{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension}} (void)new int[ValueBoth()]; // expected-error{{ambiguous conversion of array size expression of type 'ValueBoth' to an integral or enumeration type}} (void)new int[TwoValueInts()]; // expected-error{{ambiguous conversion of array size expression of type 'TwoValueInts' to an integral or enumeration type}} diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index efdfa0f066db..748ce7770097 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -397,3 +397,22 @@ namespace ArrayNewNeedsDtor { return new B[5]; // expected-note {{implicit default destructor for 'ArrayNewNeedsDtor::B' first required here}} } } + +namespace DeleteIncompleteClass { + struct A; // expected-note {{forward declaration}} + extern A x; + void f() { delete x; } // expected-error {{deleting incomplete class type}} +} + +namespace DeleteIncompleteClassPointerError { + struct A; // expected-note {{forward declaration}} + void f(A *x) { 1+delete x; } // expected-warning {{deleting pointer to incomplete type}} \ + // expected-error {{invalid operands to binary expression}} +} + +namespace PR10504 { + struct A { + virtual void foo() = 0; + }; + void f(A *x) { delete x; } // expected-warning {{delete called on 'PR10504::A' that is abstract but has non-virtual destructor}} +} diff --git a/test/SemaCXX/null_in_arithmetic_ops.cpp b/test/SemaCXX/null_in_arithmetic_ops.cpp index fab6f10ab785..24590ce633f2 100644 --- a/test/SemaCXX/null_in_arithmetic_ops.cpp +++ b/test/SemaCXX/null_in_arithmetic_ops.cpp @@ -64,12 +64,12 @@ void f() { a |= NULL; // expected-warning{{use of NULL in arithmetic operation}} a ^= NULL; // expected-warning{{use of NULL in arithmetic operation}} - b = a < NULL || NULL < a; // expected-warning 2{{use of NULL in arithmetic operation}} - b = a > NULL || NULL > a; // expected-warning 2{{use of NULL in arithmetic operation}} - b = a <= NULL || NULL <= a; // expected-warning 2{{use of NULL in arithmetic operation}} - b = a >= NULL || NULL >= a; // expected-warning 2{{use of NULL in arithmetic operation}} - b = a == NULL || NULL == a; // expected-warning 2{{use of NULL in arithmetic operation}} - b = a != NULL || NULL != a; // expected-warning 2{{use of NULL in arithmetic operation}} + b = a < NULL || a > NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}} + b = NULL < a || NULL > a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}} + b = a <= NULL || a >= NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}} + b = NULL <= a || NULL >= a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}} + b = a == NULL || a != NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}} + b = NULL == a || NULL != a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}} b = &a < NULL || NULL < &a || &a > NULL || NULL > &a; b = &a <= NULL || NULL <= &a || &a >= NULL || NULL >= &a; @@ -82,7 +82,7 @@ void f() { b = NULL <= NULL || NULL >= NULL; b = NULL == NULL || NULL != NULL; - b = ((NULL)) != a; // expected-warning{{use of NULL in arithmetic operation}} + b = ((NULL)) != a; // expected-warning{{comparison between NULL and non-pointer (NULL and 'int')}} // Check that even non-standard pointers don't warn. b = c == NULL || NULL == c || c != NULL || NULL != c; diff --git a/test/SemaCXX/nullptr.cpp b/test/SemaCXX/nullptr.cpp index d69af588a7d0..6f660366e998 100644 --- a/test/SemaCXX/nullptr.cpp +++ b/test/SemaCXX/nullptr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -ffreestanding %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -ffreestanding %s #include <stdint.h> typedef decltype(nullptr) nullptr_t; diff --git a/test/SemaCXX/nullptr_in_arithmetic_ops.cpp b/test/SemaCXX/nullptr_in_arithmetic_ops.cpp index e839ed116f8d..9671353907c7 100644 --- a/test/SemaCXX/nullptr_in_arithmetic_ops.cpp +++ b/test/SemaCXX/nullptr_in_arithmetic_ops.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fblocks -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -fblocks -std=c++11 -verify %s void foo() { int a; diff --git a/test/SemaCXX/out-of-line-def-mismatch.cpp b/test/SemaCXX/out-of-line-def-mismatch.cpp new file mode 100644 index 000000000000..6ade5b802b65 --- /dev/null +++ b/test/SemaCXX/out-of-line-def-mismatch.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s + +namespace N2 { + struct S1; + + namespace N1 { + class C1 {}; + + struct S2 { + void func(S1*); // expected-note {{type of 1st parameter of member declaration does not match definition ('N2::S1 *' vs 'N2::N1::S1 *')}} + void func(C1&, unsigned, const S1*); // expected-note {{type of 3rd parameter of member declaration does not match definition ('const N2::S1 *' vs 'const N2::N1::S1 *')}} + void func(const S1*, unsigned); //expected-note {{type of 1st parameter of member declaration does not match definition ('const N2::S1 *' vs 'N2::N1::S1')}} + void func(unsigned, const S1*); // expected-note {{type of 1st parameter of member declaration does not match definition ('unsigned int' vs 'unsigned int *')}} + }; + + struct S1 {}; + } +} + +void N2::N1::S2::func(S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}} +void N2::N1::S2::func(C1&, unsigned, const S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}} +void N2::N1::S2::func(S1*, double) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}} +void N2::N1::S2::func(S1, unsigned) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}} +void N2::N1::S2::func(unsigned*, S1*) {} // expected-error {{out-of-line definition of 'func' does not match any declaration in 'N2::N1::S2'}} diff --git a/test/SemaCXX/overload-0x.cpp b/test/SemaCXX/overload-0x.cpp new file mode 100644 index 000000000000..677d16a32c12 --- /dev/null +++ b/test/SemaCXX/overload-0x.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +namespace test0 { + struct A { // expected-note {{candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}} expected-note {{candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const test0::A', but method is not marked const}} + A &operator=(void*); // expected-note {{candidate function not viable: 'this' argument has type 'const test0::A', but method is not marked const}} + }; + + void test(const A &a) { + a = "help"; // expected-error {{no viable overloaded '='}} + } +} diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 9cc48993fde9..00f6a9460a7a 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -525,3 +525,12 @@ namespace PR9507 { f(n); // expected-error{{call to 'f' is ambiguous}} } } + +namespace rdar9803316 { + void foo(float); + int &foo(int); + + void bar() { + int &ir = (&foo)(0); + } +} diff --git a/test/SemaCXX/overloaded-builtin-operators-0x.cpp b/test/SemaCXX/overloaded-builtin-operators-0x.cpp index 32f199529064..6a5a162af679 100644 --- a/test/SemaCXX/overloaded-builtin-operators-0x.cpp +++ b/test/SemaCXX/overloaded-builtin-operators-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -std=c++11 -verify %s template <class T> struct X diff --git a/test/SemaCXX/overloaded-name.cpp b/test/SemaCXX/overloaded-name.cpp index 73f12a902723..a5ec51ced23d 100644 --- a/test/SemaCXX/overloaded-name.cpp +++ b/test/SemaCXX/overloaded-name.cpp @@ -1,15 +1,15 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -int ovl(int); // expected-note 3{{candidate function}} -float ovl(float); // expected-note 3{{candidate function}} +int ovl(int); // expected-note 3{{possible target for call}} +float ovl(float); // expected-note 3{{possible target for call}} -template<typename T> T ovl(T); // expected-note 3{{candidate function}} +template<typename T> T ovl(T); // expected-note 3{{possible target for call}} void test(bool b) { - (void)((void)0, ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}} + (void)((void)0, ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} // PR7863 - (void)(b? ovl : &ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}} - (void)(b? ovl<float> : &ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}} + (void)(b? ovl : &ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} + (void)(b? ovl<float> : &ovl); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} (void)(b? ovl<float> : ovl<float>); } @@ -21,10 +21,11 @@ namespace rdar9623945 { public: const char* text(void); void g(void) { + // FIXME: why 2x? f(text()); - f(text); // expected-error{{a bound member function may only be called}} + f(text); // expected-error 2{{reference to non-static member function must be called; did you mean to call it with no arguments?}} f(text()); - f(text); // expected-error{{a bound member function may only be called}} + f(text); // expected-error 2{{reference to non-static member function must be called; did you mean to call it with no arguments?}} } }; } diff --git a/test/SemaCXX/overloaded-operator-decl.cpp b/test/SemaCXX/overloaded-operator-decl.cpp index 5f8655cee70c..4519a2d1f9ad 100644 --- a/test/SemaCXX/overloaded-operator-decl.cpp +++ b/test/SemaCXX/overloaded-operator-decl.cpp @@ -43,3 +43,8 @@ namespace PR6238 { void operator()(); } plus; } + +struct PR10839 { + operator int; // expected-error{{'operator int' cannot be the name of a variable or data member}} + int operator+; // expected-error{{'operator+' cannot be the name of a variable or data member}} +}; diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 462d0234f39f..1e4a3b7514ba 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -36,7 +36,7 @@ A make_A(); bool operator==(A&, Z&); // expected-note 3{{candidate function}} void h(A a, const A ac, Z z) { - make_A() == z; + make_A() == z; // expected-warning{{equality comparison result unused}} a == z; // expected-error{{use of overloaded operator '==' is ambiguous}} ac == z; // expected-error{{invalid operands to binary expression ('const A' and 'Z')}} } @@ -45,7 +45,7 @@ struct B { bool operator==(const B&) const; void test(Z z) { - make_A() == z; + make_A() == z; // expected-warning{{equality comparison result unused}} } }; @@ -396,7 +396,7 @@ namespace rdar9136502 { }; void f(X x, Y y) { - y << x.i; // expected-error{{a bound member function may only be called}} + y << x.i; // expected-error{{reference to non-static member function must be called}} } } diff --git a/test/SemaCXX/ptrtomember-overload-resolution.cpp b/test/SemaCXX/ptrtomember-overload-resolution.cpp index 4c7908e1137e..787e33022aa3 100644 --- a/test/SemaCXX/ptrtomember-overload-resolution.cpp +++ b/test/SemaCXX/ptrtomember-overload-resolution.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 // 13.3.3.2 Ranking implicit conversion sequences // conversion of A::* to B::* is better than conversion of A::* to C::*, diff --git a/test/SemaCXX/ptrtomember.cpp b/test/SemaCXX/ptrtomember.cpp index c3917333a540..aee535e5593b 100644 --- a/test/SemaCXX/ptrtomember.cpp +++ b/test/SemaCXX/ptrtomember.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct S { int i; @@ -22,12 +22,12 @@ struct S3 { }; void f3(S3* p, void (S3::*m)()) { - p->*m; // expected-error {{a bound member function may only be called}} - (void)(p->*m); // expected-error {{a bound member function may only be called}} - (void)(void*)(p->*m); // expected-error {{a bound member function may only be called}} - (void)reinterpret_cast<void*>(p->*m); // expected-error {{a bound member function may only be called}} - if (p->*m) {} // expected-error {{a bound member function may only be called}} - if (!(p->*m)) {} // expected-error {{a bound member function may only be called}} - if (p->m) {}; // expected-error {{a bound member function may only be called}} - if (!p->m) {}; // expected-error {{a bound member function may only be called}} + p->*m; // expected-error {{reference to non-static member function must be called}} + (void)(p->*m); // expected-error {{reference to non-static member function must be called}} + (void)(void*)(p->*m); // expected-error {{reference to non-static member function must be called}} expected-error {{cannot cast from type 'void' to pointer type 'void *'}} + (void)reinterpret_cast<void*>(p->*m); // expected-error {{reference to non-static member function must be called}} expected-error {{reinterpret_cast from 'void' to 'void *' is not allowed}} + if (p->*m) {} // expected-error {{reference to non-static member function must be called}} expected-error {{value of type 'void' is not contextually convertible to 'bool'}} + if (!(p->*m)) {} // expected-error {{reference to non-static member function must be called}} expected-error {{invalid argument type 'void' to unary expression}} + if (p->m) {}; // expected-error {{reference to non-static member function must be called}} expected-error {{value of type 'void' is not contextually convertible to 'bool'}} + if (!p->m) {}; // expected-error {{reference to non-static member function must be called}} expected-error {{invalid argument type 'void' to unary expression}} } diff --git a/test/SemaCXX/redeclared-alias-template.cpp b/test/SemaCXX/redeclared-alias-template.cpp index b368fcfe5508..09e9d0d83bf5 100644 --- a/test/SemaCXX/redeclared-alias-template.cpp +++ b/test/SemaCXX/redeclared-alias-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<typename T> using A = int; // expected-note 2{{previous}} template<typename T> using A = char; // expected-error {{type alias template redefinition with different types ('char' vs 'int')}} diff --git a/test/SemaCXX/redeclared-auto.cpp b/test/SemaCXX/redeclared-auto.cpp index 34de54c0f01d..87ad6bd7e5d8 100644 --- a/test/SemaCXX/redeclared-auto.cpp +++ b/test/SemaCXX/redeclared-auto.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 extern int a; auto a = 0; // expected-note 2{{here}} diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp index 752a3484d025..ce47e10c9ae3 100644 --- a/test/SemaCXX/ref-init-ambiguous.cpp +++ b/test/SemaCXX/ref-init-ambiguous.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 enum E2 { }; diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp index ab44e78453b2..70d3799a0ea5 100644 --- a/test/SemaCXX/references.cpp +++ b/test/SemaCXX/references.cpp @@ -134,3 +134,6 @@ namespace PR7149 { namespace PR8608 { bool& f(unsigned char& c) { return (bool&)c; } } + +// The following crashed trying to recursively evaluate the LValue. +const int &do_not_crash = do_not_crash; diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp index 53ed0d724527..e06ba403efec 100644 --- a/test/SemaCXX/return-noreturn.cpp +++ b/test/SemaCXX/return-noreturn.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code +// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code // A destructor may be marked noreturn and should still influence the CFG. void pr6884_abort() __attribute__((noreturn)); @@ -8,23 +9,93 @@ struct pr6884_abort_struct { ~pr6884_abort_struct() __attribute__((noreturn)) { pr6884_abort(); } }; -int pr6884_f(int x) { - switch (x) { default: pr6884_abort(); } -} +struct other { ~other() {} }; -int pr6884_g(int x) { - switch (x) { default: pr6884_abort_struct(); } -} +// Ensure that destructors from objects are properly modeled in the CFG despite +// the presence of switches, case statements, labels, and blocks. These tests +// try to cover bugs reported in both PR6884 and PR10063. +namespace abort_struct_complex_cfgs { + int basic(int x) { + switch (x) { default: pr6884_abort(); } + } + int f1(int x) { + switch (x) default: pr6884_abort_struct(); + } + int f2(int x) { + switch (x) { default: pr6884_abort_struct(); } + } + int f2_positive(int x) { + switch (x) { default: ; } + } // expected-warning {{control reaches end of non-void function}} + int f3(int x) { + switch (x) { default: { pr6884_abort_struct(); } } + } + int f4(int x) { + switch (x) default: L1: L2: case 4: pr6884_abort_struct(); + } + int f5(int x) { + switch (x) default: L1: { L2: case 4: pr6884_abort_struct(); } + } + int f6(int x) { + switch (x) default: L1: L2: case 4: { pr6884_abort_struct(); } + } -int pr6884_g_positive(int x) { - switch (x) { default: ; } -} // expected-warning {{control reaches end of non-void function}} + // Test that these constructs work even when extraneous blocks are created + // before and after the switch due to implicit destructors. + int g1(int x) { + other o; + switch (x) default: pr6884_abort_struct(); + } + int g2(int x) { + other o; + switch (x) { default: pr6884_abort_struct(); } + } + int g2_positive(int x) { + other o; + switch (x) { default: ; } + } // expected-warning {{control reaches end of non-void function}} + int g3(int x) { + other o; + switch (x) { default: { pr6884_abort_struct(); } } + } + int g4(int x) { + other o; + switch (x) default: L1: L2: case 4: pr6884_abort_struct(); + } + int g5(int x) { + other o; + switch (x) default: L1: { L2: case 4: pr6884_abort_struct(); } + } + int g6(int x) { + other o; + switch (x) default: L1: L2: case 4: { pr6884_abort_struct(); } + } -int pr6884_h(int x) { - switch (x) { - default: { - pr6884_abort_struct a; - } + // Test that these constructs work even with variables carrying the no-return + // destructor instead of temporaries. + int h1(int x) { + other o; + switch (x) default: pr6884_abort_struct a; + } + int h2(int x) { + other o; + switch (x) { default: pr6884_abort_struct a; } + } + int h3(int x) { + other o; + switch (x) { default: { pr6884_abort_struct a; } } + } + int h4(int x) { + other o; + switch (x) default: L1: L2: case 4: pr6884_abort_struct a; + } + int h5(int x) { + other o; + switch (x) default: L1: { L2: case 4: pr6884_abort_struct a; } + } + int h6(int x) { + other o; + switch (x) default: L1: L2: case 4: { pr6884_abort_struct a; } } } diff --git a/test/SemaCXX/rval-references-examples.cpp b/test/SemaCXX/rval-references-examples.cpp index f4921a9b5168..110ae26fb5d2 100644 --- a/test/SemaCXX/rval-references-examples.cpp +++ b/test/SemaCXX/rval-references-examples.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename T> class unique_ptr { diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index 74afdbe41043..fc341e87f4a4 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s typedef int&& irr; typedef irr& ilr_c1; // Collapses to int& diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp index 3a90cc08f6a2..ad109f4d4e03 100644 --- a/test/SemaCXX/scope-check.cpp +++ b/test/SemaCXX/scope-check.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu++0x %s -Wno-unreachable-code +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu++11 %s -Wno-unreachable-code namespace test0 { struct D { ~D(); }; @@ -171,3 +171,39 @@ namespace test9 { } } } + +// http://llvm.org/PR10462 +namespace PR10462 { +enum MyEnum { + something_valid, + something_invalid +}; + +bool recurse() { + MyEnum K; + switch (K) { // expected-warning {{enumeration value 'something_invalid' not handled in switch}} + case something_valid: + case what_am_i_thinking: // expected-error {{use of undeclared identifier}} + int *X = 0; + if (recurse()) { + } + + break; + } +} + + +namespace test10 { +
+int test() {
+ static void *ps[] = { &&a0 };
+ goto *&&a0; // expected-error {{goto into protected scope}}
+ int a = 3; // expected-note {{jump bypasses variable initialization}}
+ a0:
+ return 0;
+} + +} + +} + diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp index 516243ec70e1..0991a5f89cc8 100644 --- a/test/SemaCXX/static-assert.cpp +++ b/test/SemaCXX/static-assert.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 int f(); diff --git a/test/SemaCXX/switch-0x.cpp b/test/SemaCXX/switch-0x.cpp index adaeb85bce17..2e74da0a4634 100644 --- a/test/SemaCXX/switch-0x.cpp +++ b/test/SemaCXX/switch-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s // PR5518 struct A { diff --git a/test/SemaCXX/trailing-return-0x.cpp b/test/SemaCXX/trailing-return-0x.cpp index b52b240da35d..e25939fa3ebf 100644 --- a/test/SemaCXX/trailing-return-0x.cpp +++ b/test/SemaCXX/trailing-return-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template <class T> struct only diff --git a/test/SemaCXX/trivial-constructor.cpp b/test/SemaCXX/trivial-constructor.cpp index 494d1ec0843f..bda206b61f9a 100644 --- a/test/SemaCXX/trivial-constructor.cpp +++ b/test/SemaCXX/trivial-constructor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct T1 { }; static_assert(__has_trivial_constructor(T1), "T1 has trivial constructor!"); diff --git a/test/SemaCXX/trivial-destructor.cpp b/test/SemaCXX/trivial-destructor.cpp index 29358d8bd228..db415cf9050a 100644 --- a/test/SemaCXX/trivial-destructor.cpp +++ b/test/SemaCXX/trivial-destructor.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct T1 { }; static_assert(__has_trivial_destructor(T1), "T1 has trivial destructor!"); diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp index 30cc6a3f1ce2..0914c7cf94e3 100644 --- a/test/SemaCXX/type-traits.cpp +++ b/test/SemaCXX/type-traits.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++0x %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 %s #define T(b) (b) ? 1 : -1 #define F(b) (b) ? -1 : 1 @@ -89,6 +89,13 @@ struct HasVirtDest { virtual ~HasVirtDest(); }; struct DerivedVirtDest : HasVirtDest {}; typedef HasVirtDest VirtDestAr[1]; +class AllPrivate { + AllPrivate() throw(); + AllPrivate(const AllPrivate&) throw(); + AllPrivate &operator=(const AllPrivate &) throw(); + ~AllPrivate() throw(); +}; + void is_pod() { { int arr[T(__is_pod(int))]; } @@ -1102,6 +1109,7 @@ void has_trivial_default_constructor() { { int arr[F(__has_trivial_constructor(void))]; } { int arr[F(__has_trivial_constructor(cvoid))]; } { int arr[F(__has_trivial_constructor(HasTemplateCons))]; } + { int arr[F(__has_trivial_constructor(AllPrivate))]; } } void has_trivial_copy_constructor() { @@ -1129,6 +1137,7 @@ void has_trivial_copy_constructor() { { int arr[F(__has_trivial_copy(VirtAr))]; } { int arr[F(__has_trivial_copy(void))]; } { int arr[F(__has_trivial_copy(cvoid))]; } + { int arr[F(__has_trivial_copy(AllPrivate))]; } } void has_trivial_copy_assignment() { @@ -1155,6 +1164,7 @@ void has_trivial_copy_assignment() { { int arr[F(__has_trivial_assign(VirtAr))]; } { int arr[F(__has_trivial_assign(void))]; } { int arr[F(__has_trivial_assign(cvoid))]; } + { int arr[F(__has_trivial_assign(AllPrivate))]; } } void has_trivial_destructor() { @@ -1181,6 +1191,7 @@ void has_trivial_destructor() { { int arr[F(__has_trivial_destructor(HasDest))]; } { int arr[F(__has_trivial_destructor(void))]; } { int arr[F(__has_trivial_destructor(cvoid))]; } + { int arr[F(__has_trivial_destructor(AllPrivate))]; } } struct A { ~A() {} }; @@ -1191,6 +1202,23 @@ void f() { { int arr[F(__has_trivial_destructor(B<int>))]; } } +class PR11110 { + template <int> int operator=( int ); + int operator=(PR11110); +}; + +class UsingAssign; + +class UsingAssignBase { +protected: + UsingAssign &operator=(const UsingAssign&) throw(); +}; + +class UsingAssign : public UsingAssignBase { +public: + using UsingAssignBase::operator=; +}; + void has_nothrow_assign() { { int arr[T(__has_nothrow_assign(Int))]; } { int arr[T(__has_nothrow_assign(IntAr))]; } @@ -1208,6 +1236,8 @@ void has_nothrow_assign() { { int arr[T(__has_nothrow_assign(HasNoThrowCopyAssign))]; } { int arr[T(__has_nothrow_assign(HasMultipleNoThrowCopyAssign))]; } { int arr[T(__has_nothrow_assign(HasVirtDest))]; } + { int arr[T(__has_nothrow_assign(AllPrivate))]; } + { int arr[T(__has_nothrow_assign(UsingAssign))]; } { int arr[F(__has_nothrow_assign(IntRef))]; } { int arr[F(__has_nothrow_assign(HasCopyAssign))]; } @@ -1219,6 +1249,7 @@ void has_nothrow_assign() { { int arr[F(__has_nothrow_assign(VirtAr))]; } { int arr[F(__has_nothrow_assign(void))]; } { int arr[F(__has_nothrow_assign(cvoid))]; } + { int arr[F(__has_nothrow_assign(PR11110))]; } } void has_nothrow_copy() { @@ -1243,6 +1274,7 @@ void has_nothrow_copy() { { int arr[T(__has_nothrow_copy(HasMultipleNoThrowCopy))]; } { int arr[T(__has_nothrow_copy(HasVirtDest))]; } { int arr[T(__has_nothrow_copy(HasTemplateCons))]; } + { int arr[T(__has_nothrow_copy(AllPrivate))]; } { int arr[F(__has_nothrow_copy(HasCopy))]; } { int arr[F(__has_nothrow_copy(HasMultipleCopy))]; } @@ -1272,6 +1304,7 @@ void has_nothrow_constructor() { { int arr[T(__has_nothrow_constructor(HasNoThrowConstructor))]; } { int arr[T(__has_nothrow_constructor(HasVirtDest))]; } // { int arr[T(__has_nothrow_constructor(VirtAr))]; } // not implemented + { int arr[T(__has_nothrow_constructor(AllPrivate))]; } { int arr[F(__has_nothrow_constructor(HasCons))]; } { int arr[F(__has_nothrow_constructor(HasRef))]; } @@ -1316,6 +1349,7 @@ void has_virtual_destructor() { { int arr[F(__has_virtual_destructor(VirtDestAr))]; } { int arr[F(__has_virtual_destructor(void))]; } { int arr[F(__has_virtual_destructor(cvoid))]; } + { int arr[F(__has_virtual_destructor(AllPrivate))]; } } diff --git a/test/SemaCXX/typo-correction.cpp b/test/SemaCXX/typo-correction.cpp new file mode 100644 index 000000000000..fa32c57fc7ed --- /dev/null +++ b/test/SemaCXX/typo-correction.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++0x-extensions %s + +struct errc { + int v_; + operator int() const {return v_;} +}; + +class error_condition +{ + int _val_; +public: + error_condition() : _val_(0) {} + + error_condition(int _val) + : _val_(_val) {} + + template <class E> + error_condition(E _e) { + // make_error_condition must not be typo corrected to error_condition + // even though the first declaration of make_error_condition has not + // yet been encountered. This was a bug in the first version of the type + // name typo correction patch that wasn't noticed until building LLVM with + // Clang failed. + *this = make_error_condition(_e); + } + +}; + +inline error_condition make_error_condition(errc _e) { + return error_condition(static_cast<int>(_e)); +} diff --git a/test/SemaCXX/underlying_type.cpp b/test/SemaCXX/underlying_type.cpp index 607d9ad843a4..dcfaab3c8b4d 100644 --- a/test/SemaCXX/underlying_type.cpp +++ b/test/SemaCXX/underlying_type.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -std=c++11 %s #include "limits.h" diff --git a/test/SemaCXX/uninit-variables-conditional.cpp b/test/SemaCXX/uninit-variables-conditional.cpp index 3324215621bf..3c44c7249d51 100644 --- a/test/SemaCXX/uninit-variables-conditional.cpp +++ b/test/SemaCXX/uninit-variables-conditional.cpp @@ -15,7 +15,7 @@ int init(double *); // the destructor in Foo fouls about the minor bit of path-sensitivity in // -Wuninitialized. double test() { - double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}} + double x; // expected-note{{initialize the variable 'x' to silence this warning}} if (bar() || baz() || Foo() || init(&x)) return 1.0; diff --git a/test/SemaCXX/uninit-variables.cpp b/test/SemaCXX/uninit-variables.cpp index a0180e3d3a15..358a5723563f 100644 --- a/test/SemaCXX/uninit-variables.cpp +++ b/test/SemaCXX/uninit-variables.cpp @@ -26,7 +26,7 @@ void unevaluated_tests() { // Warn for glvalue arguments to typeid whose type is polymorphic. struct A { virtual ~A() {} }; void polymorphic_test() { - A *a; // expected-note{{declared here}} expected-note{{add initialization}} + A *a; // expected-note{{initialize the variable 'a' to silence this warning}} (void)typeid(*a); // expected-warning{{variable 'a' is uninitialized when used here }} } @@ -50,7 +50,7 @@ unsigned test3_b() { return x; // no-warning } unsigned test3_c() { - unsigned x; // expected-note{{declared here}} expected-note{{add initialization}} + unsigned x; // expected-note{{initialize the variable 'x' to silence this warning}} const bool flag = false; if (flag && (x = test3_aux()) == 0) { x = 1; @@ -66,6 +66,16 @@ test4_A test4() { return a; // expected-warning{{variable 'a' is uninitialized when used here}} } +// Test variables getting invalidated by function calls with reference arguments +// *AND* there are multiple invalidated arguments. +void test5_aux(int &, int &); + +int test5() { + int x, y; + test5_aux(x, y); + return x + y; // no-warning +} + // This test previously crashed Sema. class Rdar9188004A { public: @@ -108,4 +118,26 @@ void RDar9251392() { } } +// Test handling of "no-op" casts. +void test_noop_cast() +{ + int x = 1; + int y = (int&)x; // no-warning +} + +void test_noop_cast2() { + int x; // expected-note {{initialize the variable 'x' to silence this warning}} + int y = (int&)x; // expected-warning {{uninitialized when used here}} +} + +// Test handling of bit casts. +void test_bitcasts() { + int x = 1; + int y = (float &)x; // no-warning +} + +void test_bitcasts_2() { + int x; // expected-note {{initialize the variable 'x' to silence this warning}} + int y = (float &)x; // expected-warning {{uninitialized when used here}} +} diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp index 0a3b5d938dd3..c25bd201d626 100644 --- a/test/SemaCXX/uninitialized.cpp +++ b/test/SemaCXX/uninitialized.cpp @@ -24,6 +24,78 @@ int i = boo(i); int j = far(j); int k = __alignof__(k); + +// Test self-references with record types. +class A { + // Non-POD class. + public: + enum count { ONE, TWO, THREE }; + int num; + static int count; + int get() const { return num; } + void set(int x) { num = x; } + static int zero() { return 0; } + + A() {} + A(A const &a) {} + A(int x) {} + A(int *x) {} + A(A *a) {} +}; + +A getA() { return A(); } +A getA(int x) { return A(); } +A getA(A* a) { return A(); } + +void setupA() { + A a1; + a1.set(a1.get()); + A a2(a1.get()); + A a3(a1); + A a4(&a4); + A a5(a5.zero()); + A a6(a6.ONE); + A a7 = getA(); + A a8 = getA(a8.TWO); + A a9 = getA(&a9); + A a10(a10.count); + + A a11(a11); // expected-warning {{variable 'a11' is uninitialized when used within its own initialization}} + A a12(a12.get()); // expected-warning {{variable 'a12' is uninitialized when used within its own initialization}} + A a13(a13.num); // expected-warning {{variable 'a13' is uninitialized when used within its own initialization}} + A a14 = A(a14); // expected-warning {{variable 'a14' is uninitialized when used within its own initialization}} + A a15 = getA(a15.num); // expected-warning {{variable 'a15' is uninitialized when used within its own initialization}} + A a16(&a16.num); // expected-warning {{variable 'a16' is uninitialized when used within its own initialization}} +} + +struct B { + // POD struct. + int x; + int *y; +}; + +B getB() { return B(); }; +B getB(int x) { return B(); }; +B getB(int *x) { return B(); }; +B getB(B *b) { return B(); }; + +void setupB() { + B b1; + B b2(b1); + B b3 = { 5, &b3.x }; + B b4 = getB(); + B b5 = getB(&b5); + B b6 = getB(&b6.x); + + // Silence unused warning + (void) b2; + (void) b4; + + B b7(b7); // expected-warning {{variable 'b7' is uninitialized when used within its own initialization}} + B b8 = getB(b8.x); // expected-warning {{variable 'b8' is uninitialized when used within its own initialization}} + B b9 = getB(b9.y); // expected-warning {{variable 'b9' is uninitialized when used within its own initialization}} +} + // Also test similar constructs in a field's initializer. struct S { int x; @@ -43,3 +115,5 @@ struct S { S(char (*)[5]) : x(boo(x)) {} S(char (*)[6]) : x(far(x)) {} }; + +struct C { char a[100], *e; } car = { .e = car.a }; diff --git a/test/SemaCXX/unknown-anytype.cpp b/test/SemaCXX/unknown-anytype.cpp index b0a2981f470d..ba52122bc490 100644 --- a/test/SemaCXX/unknown-anytype.cpp +++ b/test/SemaCXX/unknown-anytype.cpp @@ -34,3 +34,14 @@ namespace test3 { ((void(void)) foo)(); // expected-error {{variable 'foo' with unknown type cannot be given a function type}} } } + +// rdar://problem/9899447 +namespace test4 { + extern __unknown_anytype test0(...); + extern __unknown_anytype test1(...); + + void test() { + void (*fn)(int) = (void(*)(int)) test0; + int x = (int) test1; // expected-error {{function 'test1' with unknown type must be given a function type}} + } +} diff --git a/test/SemaCXX/unused-functions.cpp b/test/SemaCXX/unused-functions.cpp index f164bf276846..359808203892 100644 --- a/test/SemaCXX/unused-functions.cpp +++ b/test/SemaCXX/unused-functions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -Wunused -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wunused -verify %s static int foo(int x) { return x; } diff --git a/test/SemaCXX/user-defined-conversions.cpp b/test/SemaCXX/user-defined-conversions.cpp index 5de7f44be92c..43ec5a3d4ab9 100644 --- a/test/SemaCXX/user-defined-conversions.cpp +++ b/test/SemaCXX/user-defined-conversions.cpp @@ -82,3 +82,18 @@ float &f(...); void g(X2 b) { int &ir = f(b); // expected-error{{no viable constructor copying parameter of type 'X1'}} } + +namespace rdar10202900 { + class A { + public: + A(); + + private: + A(int i); // expected-note{{declared private here}} + }; + + void testA(A a) { + int b = 10; + a = b; // expected-error{{calling a private constructor of class 'rdar10202900::A'}} + } +} diff --git a/test/SemaCXX/using-decl-templates.cpp b/test/SemaCXX/using-decl-templates.cpp index 7b4da9d50d03..2f8abca02d6e 100644 --- a/test/SemaCXX/using-decl-templates.cpp +++ b/test/SemaCXX/using-decl-templates.cpp @@ -63,3 +63,20 @@ template <class T> struct Bar : public Foo<T>, Baz { }; template int Bar<int>::foo(); } + +// PR10883 +namespace PR10883 { + template <typename T> + class Base { + public: + typedef long Container; + }; + + template <typename T> + class Derived : public Base<T> { + public: + using Base<T>::Container; + + void foo(const Container& current); // expected-error {{unknown type name 'Container'}} + }; +} diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp index dfe0f46ea255..19be03af8f46 100644 --- a/test/SemaCXX/value-initialization.cpp +++ b/test/SemaCXX/value-initialization.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 struct A { //expected-note {{marked deleted here}} \ // expected-warning {{does not declare any constructor to initialize}} diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp index 3ca07b0215c3..42c27fb30e1b 100644 --- a/test/SemaCXX/vararg-non-pod.cpp +++ b/test/SemaCXX/vararg-non-pod.cpp @@ -118,4 +118,3 @@ void t8(int n, ...) { (void)__builtin_va_arg(list, Abstract); // expected-error{{second argument to 'va_arg' is of abstract type 'Abstract'}} __builtin_va_end(list); } - diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp index 23d86d37426e..b477438ee988 100644 --- a/test/SemaCXX/virtual-override.cpp +++ b/test/SemaCXX/virtual-override.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 namespace T1 { class A { diff --git a/test/SemaCXX/virtuals.cpp b/test/SemaCXX/virtuals.cpp index d8c26efcfb42..ea7d203ca70f 100644 --- a/test/SemaCXX/virtuals.cpp +++ b/test/SemaCXX/virtuals.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 %s class A { virtual void f(); diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp index c0ef35b252d8..04f2e7952547 100644 --- a/test/SemaCXX/warn-assignment-condition.cpp +++ b/test/SemaCXX/warn-assignment-condition.cpp @@ -109,6 +109,12 @@ void test() { if ((x == 5)) {} // expected-warning {{equality comparison with extraneous parentheses}} \ // expected-note {{use '=' to turn this equality comparison into an assignment}} \ // expected-note {{remove extraneous parentheses around the comparison to silence this warning}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wparentheses-equality" + if ((x == 5)) {} // no-warning +#pragma clang diagnostic pop + if ((5 == x)) {} #define EQ(x,y) ((x) == (y)) diff --git a/test/SemaCXX/warn-bad-memaccess.cpp b/test/SemaCXX/warn-bad-memaccess.cpp index 9a998f020cb4..3a02c84e9fc4 100644 --- a/test/SemaCXX/warn-bad-memaccess.cpp +++ b/test/SemaCXX/warn-bad-memaccess.cpp @@ -3,6 +3,7 @@ extern "C" void *memset(void *, int, unsigned); extern "C" void *memmove(void *s1, const void *s2, unsigned n); extern "C" void *memcpy(void *s1, const void *s2, unsigned n); +extern "C" void *memcmp(void *s1, const void *s2, unsigned n); // Several types that should not warn. struct S1 {} s1; @@ -27,16 +28,22 @@ void test_warn() { // expected-note {{explicitly cast the pointer to silence this warning}} memmove(&x1, 0, sizeof x1); // \ - // expected-warning{{destination for this 'memmove' call is a pointer to dynamic class}} \ + // expected-warning{{destination for this 'memmove' call is a pointer to dynamic class 'struct X1'; vtable pointer will be overwritten}} \ // expected-note {{explicitly cast the pointer to silence this warning}} memmove(0, &x1, sizeof x1); // \ - // expected-warning{{source of this 'memmove' call is a pointer to dynamic class}} \ + // expected-warning{{source of this 'memmove' call is a pointer to dynamic class 'struct X1'; vtable pointer will be moved}} \ // expected-note {{explicitly cast the pointer to silence this warning}} memcpy(&x1, 0, sizeof x1); // \ - // expected-warning{{destination for this 'memcpy' call is a pointer to dynamic class}} \ + // expected-warning{{destination for this 'memcpy' call is a pointer to dynamic class 'struct X1'; vtable pointer will be overwritten}} \ // expected-note {{explicitly cast the pointer to silence this warning}} memcpy(0, &x1, sizeof x1); // \ - // expected-warning{{source of this 'memcpy' call is a pointer to dynamic class}} \ + // expected-warning{{source of this 'memcpy' call is a pointer to dynamic class 'struct X1'; vtable pointer will be copied}} \ + // expected-note {{explicitly cast the pointer to silence this warning}} + memcmp(&x1, 0, sizeof x1); // \ + // expected-warning{{first operand of this 'memcmp' call is a pointer to dynamic class 'struct X1'; vtable pointer will be compared}} \ + // expected-note {{explicitly cast the pointer to silence this warning}} + memcmp(0, &x1, sizeof x1); // \ + // expected-warning{{second operand of this 'memcmp' call is a pointer to dynamic class 'struct X1'; vtable pointer will be compared}} \ // expected-note {{explicitly cast the pointer to silence this warning}} __builtin_memset(&x1, 0, sizeof x1); // \ @@ -108,5 +115,3 @@ namespace N { N::memset(&x1, 0, sizeof x1); } } - - diff --git a/test/SemaCXX/warn-bool-conversion.cpp b/test/SemaCXX/warn-bool-conversion.cpp index f6fa9f28369d..595c749bcecd 100644 --- a/test/SemaCXX/warn-bool-conversion.cpp +++ b/test/SemaCXX/warn-bool-conversion.cpp @@ -1,18 +1,18 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -int* j = false; // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} +int* j = false; // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} -void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} +void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} { - foo(false); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} + foo(false); // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} foo((int*)false); // no-warning: explicit cast foo(0); // no-warning: not a bool, even though its convertible to bool - foo(false == true); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} - foo((42 + 24) < 32); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} + foo(false == true); // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} + foo((42 + 24) < 32); // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} const bool kFlag = false; - foo(kFlag); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}} + foo(kFlag); // expected-warning{{ initialization of pointer of type 'int *' to null from a constant boolean expression}} } char f(struct Undefined*); diff --git a/test/SemaCXX/warn-dangling-field.cpp b/test/SemaCXX/warn-dangling-field.cpp new file mode 100644 index 000000000000..95f8c61ebb77 --- /dev/null +++ b/test/SemaCXX/warn-dangling-field.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fsyntax-only -Wdangling-field -verify %s + +struct X { + X(int); +}; +struct Y { + operator X*(); + operator X&(); +}; + +struct S { + int &x, *y; // expected-note {{reference member declared here}} \ + // expected-note {{pointer member declared here}} + S(int i) + : x(i), // expected-warning {{binding reference member 'x' to stack allocated parameter 'i'}} + y(&i) {} // expected-warning {{initializing pointer member 'y' with the stack address of parameter 'i'}} + S(int &i) : x(i), y(&i) {} // no-warning: reference parameter + S(int *i) : x(*i), y(i) {} // no-warning: pointer parameter +}; + +struct S2 { + const X &x; // expected-note {{reference member declared here}} + S2(int i) : x(i) {} // expected-warning {{binding reference member 'x' to a temporary}} +}; + +struct S3 { + X &x1, *x2; + S3(Y y) : x1(y), x2(y) {} // no-warning: conversion operator +}; + +template <typename T> struct S4 { + T x; // expected-note {{reference member declared here}} + S4(int i) : x(i) {} // expected-warning {{binding reference member 'x' to stack allocated parameter 'i'}} +}; + +template struct S4<int>; // no warning from this instantiation +template struct S4<int&>; // expected-note {{in instantiation}} diff --git a/test/SemaCXX/warn-literal-conversion.cpp b/test/SemaCXX/warn-literal-conversion.cpp index b9c952873b9f..5fcae5dc80e6 100644 --- a/test/SemaCXX/warn-literal-conversion.cpp +++ b/test/SemaCXX/warn-literal-conversion.cpp @@ -8,18 +8,13 @@ void test0() { int y0 = 1.2222F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} int y1 = (1.2222F); // expected-warning {{implicit conversion turns literal floating-point number into integer}} int y2 = (((1.2222F))); // expected-warning {{implicit conversion turns literal floating-point number into integer}} - int y3 = 12E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} - int y4 = 1.2E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} + int y3 = 12E-1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} + int y4 = 1.23E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} // Double int y5 = 1.2222; // expected-warning {{implicit conversion turns literal floating-point number into integer}} - int y6 = 12E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} - int y7 = 1.2E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} - int y8 = (1.2E1); // expected-warning {{implicit conversion turns literal floating-point number into integer}} \ - // expected-note {{this can be rewritten as an integer literal with the exact same value}} + int y6 = 12E-1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} + int y7 = 1.23E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} + int y8 = (1.23E1); // expected-warning {{implicit conversion turns literal floating-point number into integer}} // Test assignment to an existing variable. y8 = 2.22F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} @@ -30,8 +25,7 @@ void test0() { // Test passing a literal floating-point value to a function that takes an integer. foo(1.2F); // expected-warning {{implicit conversion turns literal floating-point number into integer}} - // FIXME: -Wconversion-literal doesn't catch "-1.2F". - int y10 = -1.2F; + int y10 = -1.2F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} // -Wconversion-literal does NOT catch const values. // (-Wconversion DOES catch them.) diff --git a/test/SemaCXX/warn-memset-bad-sizeof.cpp b/test/SemaCXX/warn-memset-bad-sizeof.cpp index 90ac50472e98..a018223cbdae 100644 --- a/test/SemaCXX/warn-memset-bad-sizeof.cpp +++ b/test/SemaCXX/warn-memset-bad-sizeof.cpp @@ -3,6 +3,7 @@ extern "C" void *memset(void *, int, unsigned); extern "C" void *memmove(void *s1, const void *s2, unsigned n); extern "C" void *memcpy(void *s1, const void *s2, unsigned n); +extern "C" void *memcmp(void *s1, const void *s2, unsigned n); struct S {int a, b, c, d;}; typedef S* PS; @@ -51,6 +52,11 @@ void f(Mat m, const Foo& const_foo, char *buffer) { memcpy(0, &s, sizeof(&s)); // \ // expected-warning {{argument to 'sizeof' in 'memcpy' call is the same expression as the source}} + memmove(ps, 0, sizeof(ps)); // \ + // expected-warning {{argument to 'sizeof' in 'memmove' call is the same expression as the destination}} + memcmp(ps, 0, sizeof(ps)); // \ + // expected-warning {{argument to 'sizeof' in 'memcmp' call is the same expression as the destination}} + /* Shouldn't warn */ memset((void*)&s, 0, sizeof(&s)); memset(&s, 0, sizeof(s)); @@ -99,3 +105,35 @@ void f(Mat m, const Foo& const_foo, char *buffer) { memcpy(&foo, &arr, sizeof(Foo)); memcpy(&arr, &foo, sizeof(Foo)); } + +namespace ns { +void memset(void* s, char c, int n); +void f(int* i) { + memset(i, 0, sizeof(i)); +} +} + +extern "C" int strncmp(const char *s1, const char *s2, unsigned n); +extern "C" int strncasecmp(const char *s1, const char *s2, unsigned n); +extern "C" char *strncpy(char *det, const char *src, unsigned n); +extern "C" char *strncat(char *dst, const char *src, unsigned n); +extern "C" char *strndup(const char *src, unsigned n); + +void strcpy_and_friends() { + const char* FOO = "<- should be an array instead"; + const char* BAR = "<- this, too"; + + strncmp(FOO, BAR, sizeof(FOO)); // \ + // expected-warning {{argument to 'sizeof' in 'strncmp' call is the same expression as the destination}} + strncasecmp(FOO, BAR, sizeof(FOO)); // \ + // expected-warning {{argument to 'sizeof' in 'strncasecmp' call is the same expression as the destination}} + + char buff[80]; + + strncpy(buff, BAR, sizeof(BAR)); // \ + // expected-warning {{argument to 'sizeof' in 'strncpy' call is the same expression as the source}} + strncat(buff, BAR, sizeof(BAR)); // \ + // expected-warning {{argument to 'sizeof' in 'strncat' call is the same expression as the source}} + strndup(FOO, sizeof(FOO)); // \ + // expected-warning {{argument to 'sizeof' in 'strndup' call is the same expression as the source}} +} diff --git a/test/SemaCXX/warn-missing-noreturn.cpp b/test/SemaCXX/warn-missing-noreturn.cpp index 4caff66af703..8072ac6b8249 100644 --- a/test/SemaCXX/warn-missing-noreturn.cpp +++ b/test/SemaCXX/warn-missing-noreturn.cpp @@ -1,27 +1,27 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type void f() __attribute__((noreturn)); -template<typename T> void g(T) { // expected-warning {{function could be attribute 'noreturn'}} +template<typename T> void g(T) { f(); } -template void g<int>(int); // expected-note {{in instantiation of function template specialization 'g<int>' requested here}} +template void g<int>(int); template<typename T> struct A { - void g() { // expected-warning {{function could be attribute 'noreturn'}} + void g() { f(); } }; -template struct A<int>; // expected-note {{in instantiation of member function 'A<int>::g' requested here}} +template struct A<int>; struct B { - template<typename T> void g(T) { // expected-warning {{function could be attribute 'noreturn'}} + template<typename T> void g(T) { f(); } }; -template void B::g<int>(int); // expected-note {{in instantiation of function template specialization 'B::g<int>' requested here}} +template void B::g<int>(int); // We don't want a warning here. struct X { @@ -61,7 +61,7 @@ namespace test2 { void *f; A() : f(0) { } - A(int) : f(h()) { } // expected-warning {{function could be attribute 'noreturn'}} + A(int) : f(h()) { } // expected-warning {{function 'A' could be declared with attribute 'noreturn'}} A(char) : f(j()) { } A(bool b) : f(b ? h() : j()) { } }; @@ -103,3 +103,23 @@ rdar8875247_B test_rdar8875247_B() { return f; } // no-warning +namespace PR10801 { + struct Foo { + void wibble() __attribute((__noreturn__)); + }; + + struct Bar { + void wibble(); + }; + + template <typename T> void thingy(T thing) { + thing.wibble(); + } + + void test() { + Foo f; + Bar b; + thingy(f); + thingy(b); + } +} diff --git a/test/SemaCXX/warn-sign-compare.cpp b/test/SemaCXX/warn-sign-compare.cpp deleted file mode 100644 index 3042bfde6e06..000000000000 --- a/test/SemaCXX/warn-sign-compare.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -Wsign-compare %s - -// NOTE: When a 'enumeral mismatch' warning is implemented then expect several -// of the following cases to be impacted. - -// namespace for anonymous enums tests -namespace test1 { - enum { A }; - enum { B = -1 }; - - template <typename T> struct Foo { - enum { C }; - enum { D = ~0U }; - }; - - enum { E = ~0U }; - - void doit_anonymous( int i ) { - int a1 = 1 ? i : A; - int a2 = 1 ? A : i; - - int b1 = 1 ? i : B; - int b2 = 1 ? B : i; - - int c1 = 1 ? i : Foo<bool>::C; - int c2 = 1 ? Foo<bool>::C : i; - - int d1 = 1 ? i : Foo<bool>::D; // expected-warning {{operands of ? are integers of different signs}} - int d2 = 1 ? Foo<bool>::D : i; // expected-warning {{operands of ? are integers of different signs}} - int d3 = 1 ? B : Foo<bool>::D; // expected-warning {{operands of ? are integers of different signs}} - int d4 = 1 ? Foo<bool>::D : B; // expected-warning {{operands of ? are integers of different signs}} - - int e1 = 1 ? i : E; // expected-warning {{operands of ? are integers of different signs}} - int e2 = 1 ? E : i; // expected-warning {{operands of ? are integers of different signs}} - int e3 = 1 ? E : B; // expected-warning {{operands of ? are integers of different signs}} - int e4 = 1 ? B : E; // expected-warning {{operands of ? are integers of different signs}} - } -} - -// namespace for named enums tests -namespace test2 { - enum Named1 { A }; - enum Named2 { B = -1 }; - - template <typename T> struct Foo { - enum Named3 { C }; - enum Named4 { D = ~0U }; - }; - - enum Named5 { E = ~0U }; - - void doit_anonymous( int i ) { - int a1 = 1 ? i : A; - int a2 = 1 ? A : i; - - int b1 = 1 ? i : B; - int b2 = 1 ? B : i; - - int c1 = 1 ? i : Foo<bool>::C; - int c2 = 1 ? Foo<bool>::C : i; - - int d1 = 1 ? i : Foo<bool>::D; // expected-warning {{operands of ? are integers of different signs}} - int d2 = 1 ? Foo<bool>::D : i; // expected-warning {{operands of ? are integers of different signs}} - int d3 = 1 ? B : Foo<bool>::D; // expected-warning {{operands of ? are integers of different signs}} - int d4 = 1 ? Foo<bool>::D : B; // expected-warning {{operands of ? are integers of different signs}} - - int e1 = 1 ? i : E; // expected-warning {{operands of ? are integers of different signs}} - int e2 = 1 ? E : i; // expected-warning {{operands of ? are integers of different signs}} - int e3 = 1 ? E : B; // expected-warning {{operands of ? are integers of different signs}} - int e4 = 1 ? B : E; // expected-warning {{operands of ? are integers of different signs}} - } -} diff --git a/test/SemaCXX/warn-sign-conversion.cpp b/test/SemaCXX/warn-sign-conversion.cpp new file mode 100644 index 000000000000..ba2bc9b3d026 --- /dev/null +++ b/test/SemaCXX/warn-sign-conversion.cpp @@ -0,0 +1,80 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -Wsign-conversion %s + +// NOTE: When a 'enumeral mismatch' warning is implemented then expect several +// of the following cases to be impacted. + +// namespace for anonymous enums tests +namespace test1 { + enum { A }; + enum { B = -1 }; + + template <typename T> struct Foo { + enum { C }; + enum { D = ~0U }; + }; + + enum { E = ~0U }; + + void doit_anonymous( int i ) { + int a1 = 1 ? i : A; + int a2 = 1 ? A : i; + + int b1 = 1 ? i : B; + int b2 = 1 ? B : i; + + int c1 = 1 ? i : Foo<bool>::C; + int c2 = 1 ? Foo<bool>::C : i; + + int d1a = 1 ? i : Foo<bool>::D; // expected-warning {{test1::Foo<bool>::<anonymous enum at }} + int d1b = 1 ? i : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} + int d2a = 1 ? Foo<bool>::D : i; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }} + int d2b = 1 ? Foo<bool>::D : i; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} + int d3a = 1 ? B : Foo<bool>::D; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }} + int d3b = 1 ? B : Foo<bool>::D; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} + int d4a = 1 ? Foo<bool>::D : B; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::<anonymous enum at }} + int d4b = 1 ? Foo<bool>::D : B; // expected-warning {{warn-sign-conversion.cpp:13:5>' to 'int'}} + + int e1a = 1 ? i : E; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }} + int e1b = 1 ? i : E; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}} + int e2a = 1 ? E : i; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }} + int e2b = 1 ? E : i; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}} + int e3a = 1 ? E : B; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }} + int e3b = 1 ? E : B; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}} + int e4a = 1 ? B : E; // expected-warning {{operand of ? changes signedness: 'test1::<anonymous enum at }} + int e4b = 1 ? B : E; // expected-warning {{warn-sign-conversion.cpp:16:3>' to 'int'}} + } +} + +// namespace for named enums tests +namespace test2 { + enum Named1 { A }; + enum Named2 { B = -1 }; + + template <typename T> struct Foo { + enum Named3 { C }; + enum Named4 { D = ~0U }; + }; + + enum Named5 { E = ~0U }; + + void doit_anonymous( int i ) { + int a1 = 1 ? i : A; + int a2 = 1 ? A : i; + + int b1 = 1 ? i : B; + int b2 = 1 ? B : i; + + int c1 = 1 ? i : Foo<bool>::C; + int c2 = 1 ? Foo<bool>::C : i; + + int d1 = 1 ? i : Foo<bool>::D; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}} + int d2 = 1 ? Foo<bool>::D : i; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}} + int d3 = 1 ? B : Foo<bool>::D; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}} + int d4 = 1 ? Foo<bool>::D : B; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}} + + int e1 = 1 ? i : E; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}} + int e2 = 1 ? E : i; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}} + int e3 = 1 ? E : B; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}} + int e4 = 1 ? B : E; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}} + } +} diff --git a/test/SemaCXX/warn-string-conversion.cpp b/test/SemaCXX/warn-string-conversion.cpp new file mode 100644 index 000000000000..23960e48df61 --- /dev/null +++ b/test/SemaCXX/warn-string-conversion.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -Wstring-conversion -verify %s + +// Warn on cases where a string literal is converted into a bool. +// An exception is made for this in logical operators. +void assert(bool condition); +void test0() { + bool b0 = "hi"; // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} + b0 = ""; // expected-warning{{implicit conversion turns string literal into bool: 'const char [1]' to 'bool'}} + b0 = 0 && ""; + assert("error"); // expected-warning{{implicit conversion turns string literal into bool: 'const char [6]' to 'bool'}} + assert(0 && "error"); + + while("hi") {} // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} + do {} while("hi"); // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} + for (;"hi";); // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} + if("hi") {} // expected-warning{{implicit conversion turns string literal into bool: 'const char [3]' to 'bool'}} +} + diff --git a/test/SemaCXX/warn-thread-safety-analysis.cpp b/test/SemaCXX/warn-thread-safety-analysis.cpp new file mode 100644 index 000000000000..90a8933150ac --- /dev/null +++ b/test/SemaCXX/warn-thread-safety-analysis.cpp @@ -0,0 +1,1422 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s + +#define LOCKABLE __attribute__ ((lockable)) +#define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) +#define GUARDED_BY(x) __attribute__ ((guarded_by(x))) +#define GUARDED_VAR __attribute__ ((guarded_var)) +#define PT_GUARDED_BY(x) __attribute__ ((pt_guarded_by(x))) +#define PT_GUARDED_VAR __attribute__ ((pt_guarded_var)) +#define ACQUIRED_AFTER(...) __attribute__ ((acquired_after(__VA_ARGS__))) +#define ACQUIRED_BEFORE(...) __attribute__ ((acquired_before(__VA_ARGS__))) +#define EXCLUSIVE_LOCK_FUNCTION(...) __attribute__ ((exclusive_lock_function(__VA_ARGS__))) +#define SHARED_LOCK_FUNCTION(...) __attribute__ ((shared_lock_function(__VA_ARGS__))) +#define EXCLUSIVE_TRYLOCK_FUNCTION(...) __attribute__ ((exclusive_trylock_function(__VA_ARGS__))) +#define SHARED_TRYLOCK_FUNCTION(...) __attribute__ ((shared_trylock_function(__VA_ARGS__))) +#define UNLOCK_FUNCTION(...) __attribute__ ((unlock_function(__VA_ARGS__))) +#define LOCK_RETURNED(x) __attribute__ ((lock_returned(x))) +#define LOCKS_EXCLUDED(...) __attribute__ ((locks_excluded(__VA_ARGS__))) +#define EXCLUSIVE_LOCKS_REQUIRED(...) \ + __attribute__ ((exclusive_locks_required(__VA_ARGS__))) +#define SHARED_LOCKS_REQUIRED(...) \ + __attribute__ ((shared_locks_required(__VA_ARGS__))) +#define NO_THREAD_SAFETY_ANALYSIS __attribute__ ((no_thread_safety_analysis)) + +//-----------------------------------------// +// Helper fields +//-----------------------------------------// + + +class __attribute__((lockable)) Mutex { + public: + void Lock() __attribute__((exclusive_lock_function)); + void ReaderLock() __attribute__((shared_lock_function)); + void Unlock() __attribute__((unlock_function)); + bool TryLock() __attribute__((exclusive_trylock_function(true))); + bool ReaderTryLock() __attribute__((shared_trylock_function(true))); + void LockWhen(const int &cond) __attribute__((exclusive_lock_function)); +}; + + +Mutex sls_mu; + +Mutex sls_mu2 __attribute__((acquired_after(sls_mu))); +int sls_guard_var __attribute__((guarded_var)) = 0; +int sls_guardby_var __attribute__((guarded_by(sls_mu))) = 0; + +bool getBool(); + +class MutexWrapper { +public: + Mutex mu; + int x __attribute__((guarded_by(mu))); + void MyLock() __attribute__((exclusive_lock_function(mu))); +}; + +MutexWrapper sls_mw; + +void sls_fun_0() { + sls_mw.mu.Lock(); + sls_mw.x = 5; + sls_mw.mu.Unlock(); +} + +void sls_fun_2() { + sls_mu.Lock(); + int x = sls_guard_var; + sls_mu.Unlock(); +} + +void sls_fun_3() { + sls_mu.Lock(); + sls_guard_var = 2; + sls_mu.Unlock(); +} + +void sls_fun_4() { + sls_mu2.Lock(); + sls_guard_var = 2; + sls_mu2.Unlock(); +} + +void sls_fun_5() { + sls_mu.Lock(); + int x = sls_guardby_var; + sls_mu.Unlock(); +} + +void sls_fun_6() { + sls_mu.Lock(); + sls_guardby_var = 2; + sls_mu.Unlock(); +} + +void sls_fun_7() { + sls_mu.Lock(); + sls_mu2.Lock(); + sls_mu2.Unlock(); + sls_mu.Unlock(); +} + +void sls_fun_8() { + sls_mu.Lock(); + if (getBool()) + sls_mu.Unlock(); + else + sls_mu.Unlock(); +} + +void sls_fun_9() { + if (getBool()) + sls_mu.Lock(); + else + sls_mu.Lock(); + sls_mu.Unlock(); +} + +void sls_fun_good_6() { + if (getBool()) { + sls_mu.Lock(); + } else { + if (getBool()) { + getBool(); // EMPTY + } else { + getBool(); // EMPTY + } + sls_mu.Lock(); + } + sls_mu.Unlock(); +} + +void sls_fun_good_7() { + sls_mu.Lock(); + while (getBool()) { + sls_mu.Unlock(); + if (getBool()) { + if (getBool()) { + sls_mu.Lock(); + continue; + } + } + sls_mu.Lock(); + } + sls_mu.Unlock(); +} + +void sls_fun_good_8() { + sls_mw.MyLock(); + sls_mw.mu.Unlock(); +} + +void sls_fun_bad_1() { + sls_mu.Unlock(); // \ + // expected-warning{{unlocking 'sls_mu' that was not locked}} +} + +void sls_fun_bad_2() { + sls_mu.Lock(); + sls_mu.Lock(); // \ + // expected-warning{{locking 'sls_mu' that is already locked}} + sls_mu.Unlock(); +} + +void sls_fun_bad_3() { + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of function 'sls_fun_bad_3'}} +} + +void sls_fun_bad_4() { + if (getBool()) + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + else + sls_mu2.Lock(); // \ + // expected-warning{{mutex 'sls_mu2' is still locked at the end of its scope}} +} + +void sls_fun_bad_5() { + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + if (getBool()) + sls_mu.Unlock(); +} + +void sls_fun_bad_6() { + if (getBool()) { + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + } else { + if (getBool()) { + getBool(); // EMPTY + } else { + getBool(); // EMPTY + } + } + sls_mu.Unlock(); // \ + // expected-warning{{unlocking 'sls_mu' that was not locked}} +} + +void sls_fun_bad_7() { + sls_mu.Lock(); // \ + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + while (getBool()) { + sls_mu.Unlock(); + if (getBool()) { + if (getBool()) { + continue; + } + } + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + } + sls_mu.Unlock(); +} + +void sls_fun_bad_8() { + sls_mu.Lock(); // \ + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + do { + sls_mu.Unlock(); + } while (getBool()); +} + +void sls_fun_bad_9() { + do { + sls_mu.Lock(); // \ + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + } while (getBool()); + sls_mu.Unlock(); +} + +void sls_fun_bad_10() { + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of function 'sls_fun_bad_10'}} \ + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + while(getBool()) { + sls_mu.Unlock(); + } +} + +void sls_fun_bad_11() { + while (getBool()) { + sls_mu.Lock(); // \ + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + } + sls_mu.Unlock(); // \ + // expected-warning{{unlocking 'sls_mu' that was not locked}} +} + +//-----------------------------------------// +// Handling lock expressions in attribute args +// -------------------------------------------// + +Mutex aa_mu; + +class GlobalLocker { +public: + void globalLock() __attribute__((exclusive_lock_function(aa_mu))); + void globalUnlock() __attribute__((unlock_function(aa_mu))); +}; + +GlobalLocker glock; + +void aa_fun_1() { + glock.globalLock(); + glock.globalUnlock(); +} + +void aa_fun_bad_1() { + glock.globalUnlock(); // \ + // expected-warning{{unlocking 'aa_mu' that was not locked}} +} + +void aa_fun_bad_2() { + glock.globalLock(); + glock.globalLock(); // \ + // expected-warning{{locking 'aa_mu' that is already locked}} + glock.globalUnlock(); +} + +void aa_fun_bad_3() { + glock.globalLock(); // \ + // expected-warning{{mutex 'aa_mu' is still locked at the end of function 'aa_fun_bad_3'}} +} + +//--------------------------------------------------// +// Regression tests for unusual method names +//--------------------------------------------------// + +Mutex wmu; + +// Test diagnostics for other method names. +class WeirdMethods { + WeirdMethods() { + wmu.Lock(); // \ + // expected-warning {{mutex 'wmu' is still locked at the end of function 'WeirdMethods'}} + } + ~WeirdMethods() { + wmu.Lock(); // \ + // expected-warning {{mutex 'wmu' is still locked at the end of function '~WeirdMethods'}} + } + void operator++() { + wmu.Lock(); // \ + // expected-warning {{mutex 'wmu' is still locked at the end of function 'operator++'}} + } + operator int*() { + wmu.Lock(); // \ + // expected-warning {{mutex 'wmu' is still locked at the end of function 'operator int *'}} + return 0; + } +}; + +//-----------------------------------------------// +// Errors for guarded by or guarded var variables +// ----------------------------------------------// + +int *pgb_gvar __attribute__((pt_guarded_var)); +int *pgb_var __attribute__((pt_guarded_by(sls_mu))); + +class PGBFoo { + public: + int x; + int *pgb_field __attribute__((guarded_by(sls_mu2))) + __attribute__((pt_guarded_by(sls_mu))); + void testFoo() { + pgb_field = &x; // \ + // expected-warning {{writing variable 'pgb_field' requires locking 'sls_mu2' exclusively}} + *pgb_field = x; // expected-warning {{reading variable 'pgb_field' requires locking 'sls_mu2'}} \ + // expected-warning {{writing the value pointed to by 'pgb_field' requires locking 'sls_mu' exclusively}} + x = *pgb_field; // expected-warning {{reading variable 'pgb_field' requires locking 'sls_mu2'}} \ + // expected-warning {{reading the value pointed to by 'pgb_field' requires locking 'sls_mu'}} + (*pgb_field)++; // expected-warning {{reading variable 'pgb_field' requires locking 'sls_mu2'}} \ + // expected-warning {{writing the value pointed to by 'pgb_field' requires locking 'sls_mu' exclusively}} + } +}; + +class GBFoo { + public: + int gb_field __attribute__((guarded_by(sls_mu))); + + void testFoo() { + gb_field = 0; // \ + // expected-warning {{writing variable 'gb_field' requires locking 'sls_mu' exclusively}} + } + + void testNoAnal() __attribute__((no_thread_safety_analysis)) { + gb_field = 0; + } +}; + +GBFoo GlobalGBFoo __attribute__((guarded_by(sls_mu))); + +void gb_fun_0() { + sls_mu.Lock(); + int x = *pgb_var; + sls_mu.Unlock(); +} + +void gb_fun_1() { + sls_mu.Lock(); + *pgb_var = 2; + sls_mu.Unlock(); +} + +void gb_fun_2() { + int x; + pgb_var = &x; +} + +void gb_fun_3() { + int *x = pgb_var; +} + +void gb_bad_0() { + sls_guard_var = 1; // \ + // expected-warning{{writing variable 'sls_guard_var' requires locking any mutex exclusively}} +} + +void gb_bad_1() { + int x = sls_guard_var; // \ + // expected-warning{{reading variable 'sls_guard_var' requires locking any mutex}} +} + +void gb_bad_2() { + sls_guardby_var = 1; // \ + // expected-warning {{writing variable 'sls_guardby_var' requires locking 'sls_mu' exclusively}} +} + +void gb_bad_3() { + int x = sls_guardby_var; // \ + // expected-warning {{reading variable 'sls_guardby_var' requires locking 'sls_mu'}} +} + +void gb_bad_4() { + *pgb_gvar = 1; // \ + // expected-warning {{writing the value pointed to by 'pgb_gvar' requires locking any mutex exclusively}} +} + +void gb_bad_5() { + int x = *pgb_gvar; // \ + // expected-warning {{reading the value pointed to by 'pgb_gvar' requires locking any mutex}} +} + +void gb_bad_6() { + *pgb_var = 1; // \ + // expected-warning {{writing the value pointed to by 'pgb_var' requires locking 'sls_mu' exclusively}} +} + +void gb_bad_7() { + int x = *pgb_var; // \ + // expected-warning {{reading the value pointed to by 'pgb_var' requires locking 'sls_mu'}} +} + +void gb_bad_8() { + GBFoo G; + G.gb_field = 0; // \ + // expected-warning {{writing variable 'gb_field' requires locking 'sls_mu'}} +} + +void gb_bad_9() { + sls_guard_var++; // \ + // expected-warning{{writing variable 'sls_guard_var' requires locking any mutex exclusively}} + sls_guard_var--; // \ + // expected-warning{{writing variable 'sls_guard_var' requires locking any mutex exclusively}} + ++sls_guard_var; // \ + // expected-warning{{writing variable 'sls_guard_var' requires locking any mutex exclusively}} + --sls_guard_var;// \ + // expected-warning{{writing variable 'sls_guard_var' requires locking any mutex exclusively}} +} + +//-----------------------------------------------// +// Warnings on variables with late parsed attributes +// ----------------------------------------------// + +class LateFoo { +public: + int a __attribute__((guarded_by(mu))); + int b; + + void foo() __attribute__((exclusive_locks_required(mu))) { } + + void test() { + a = 0; // \ + // expected-warning{{writing variable 'a' requires locking 'mu' exclusively}} + b = a; // \ + // expected-warning {{reading variable 'a' requires locking 'mu'}} + c = 0; // \ + // expected-warning {{writing variable 'c' requires locking 'mu' exclusively}} + } + + int c __attribute__((guarded_by(mu))); + + Mutex mu; +}; + +class LateBar { + public: + int a_ __attribute__((guarded_by(mu1_))); + int b_; + int *q __attribute__((pt_guarded_by(mu))); + Mutex mu1_; + Mutex mu; + LateFoo Foo; + LateFoo Foo2; + LateFoo *FooPointer; +}; + +LateBar b1, *b3; + +void late_0() { + LateFoo FooA; + LateFoo FooB; + FooA.mu.Lock(); + FooA.a = 5; + FooA.mu.Unlock(); +} + +void late_1() { + LateBar BarA; + BarA.FooPointer->mu.Lock(); + BarA.FooPointer->a = 2; + BarA.FooPointer->mu.Unlock(); +} + +void late_bad_0() { + LateFoo fooA; + LateFoo fooB; + fooA.mu.Lock(); + fooB.a = 5; // \ + // expected-warning{{writing variable 'a' requires locking 'mu' exclusively}} + fooA.mu.Unlock(); +} + +void late_bad_1() { + Mutex mu; + mu.Lock(); + b1.mu1_.Lock(); + int res = b1.a_ + b3->b_; + b3->b_ = *b1.q; // \ + // expected-warning{{reading the value pointed to by 'q' requires locking 'mu'}} + b1.mu1_.Unlock(); + b1.b_ = res; + mu.Unlock(); +} + +void late_bad_2() { + LateBar BarA; + BarA.FooPointer->mu.Lock(); + BarA.Foo.a = 2; // \ + // expected-warning{{writing variable 'a' requires locking 'mu' exclusively}} + BarA.FooPointer->mu.Unlock(); +} + +void late_bad_3() { + LateBar BarA; + BarA.Foo.mu.Lock(); + BarA.FooPointer->a = 2; // \ + // expected-warning{{writing variable 'a' requires locking 'mu' exclusively}} + BarA.Foo.mu.Unlock(); +} + +void late_bad_4() { + LateBar BarA; + BarA.Foo.mu.Lock(); + BarA.Foo2.a = 2; // \ + // expected-warning{{writing variable 'a' requires locking 'mu' exclusively}} + BarA.Foo.mu.Unlock(); +} + +//-----------------------------------------------// +// Extra warnings for shared vs. exclusive locks +// ----------------------------------------------// + +void shared_fun_0() { + sls_mu.Lock(); + do { + sls_mu.Unlock(); + sls_mu.Lock(); + } while (getBool()); + sls_mu.Unlock(); +} + +void shared_fun_1() { + sls_mu.ReaderLock(); // \ + // expected-warning {{mutex 'sls_mu' is locked exclusively and shared in the same scope}} + do { + sls_mu.Unlock(); + sls_mu.Lock(); // \ + // expected-note {{the other lock of mutex 'sls_mu' is here}} + } while (getBool()); + sls_mu.Unlock(); +} + +void shared_fun_3() { + if (getBool()) + sls_mu.Lock(); + else + sls_mu.Lock(); + *pgb_var = 1; + sls_mu.Unlock(); +} + +void shared_fun_4() { + if (getBool()) + sls_mu.ReaderLock(); + else + sls_mu.ReaderLock(); + int x = sls_guardby_var; + sls_mu.Unlock(); +} + +void shared_fun_8() { + if (getBool()) + sls_mu.Lock(); // \ + // expected-warning {{mutex 'sls_mu' is locked exclusively and shared in the same scope}} + else + sls_mu.ReaderLock(); // \ + // expected-note {{the other lock of mutex 'sls_mu' is here}} + sls_mu.Unlock(); +} + +void shared_bad_0() { + sls_mu.Lock(); // \ + // expected-warning {{mutex 'sls_mu' is locked exclusively and shared in the same scope}} + do { + sls_mu.Unlock(); + sls_mu.ReaderLock(); // \ + // expected-note {{the other lock of mutex 'sls_mu' is here}} + } while (getBool()); + sls_mu.Unlock(); +} + +void shared_bad_1() { + if (getBool()) + sls_mu.Lock(); // \ + // expected-warning {{mutex 'sls_mu' is locked exclusively and shared in the same scope}} + else + sls_mu.ReaderLock(); // \ + // expected-note {{the other lock of mutex 'sls_mu' is here}} + *pgb_var = 1; + sls_mu.Unlock(); +} + +void shared_bad_2() { + if (getBool()) + sls_mu.ReaderLock(); // \ + // expected-warning {{mutex 'sls_mu' is locked exclusively and shared in the same scope}} + else + sls_mu.Lock(); // \ + // expected-note {{the other lock of mutex 'sls_mu' is here}} + *pgb_var = 1; + sls_mu.Unlock(); +} + +// FIXME: Add support for functions (not only methods) +class LRBar { + public: + void aa_elr_fun() __attribute__((exclusive_locks_required(aa_mu))); + void aa_elr_fun_s() __attribute__((shared_locks_required(aa_mu))); + void le_fun() __attribute__((locks_excluded(sls_mu))); +}; + +class LRFoo { + public: + void test() __attribute__((exclusive_locks_required(sls_mu))); + void testShared() __attribute__((shared_locks_required(sls_mu2))); +}; + +void elr_fun() __attribute__((exclusive_locks_required(sls_mu))); +void elr_fun() {} + +LRFoo MyLRFoo; +LRBar Bar; + +void es_fun_0() { + aa_mu.Lock(); + Bar.aa_elr_fun(); + aa_mu.Unlock(); +} + +void es_fun_1() { + aa_mu.Lock(); + Bar.aa_elr_fun_s(); + aa_mu.Unlock(); +} + +void es_fun_2() { + aa_mu.ReaderLock(); + Bar.aa_elr_fun_s(); + aa_mu.Unlock(); +} + +void es_fun_3() { + sls_mu.Lock(); + MyLRFoo.test(); + sls_mu.Unlock(); +} + +void es_fun_4() { + sls_mu2.Lock(); + MyLRFoo.testShared(); + sls_mu2.Unlock(); +} + +void es_fun_5() { + sls_mu2.ReaderLock(); + MyLRFoo.testShared(); + sls_mu2.Unlock(); +} + +void es_fun_6() { + Bar.le_fun(); +} + +void es_fun_7() { + sls_mu.Lock(); + elr_fun(); + sls_mu.Unlock(); +} + +void es_fun_8() __attribute__((no_thread_safety_analysis)); + +void es_fun_8() { + Bar.aa_elr_fun_s(); +} + +void es_fun_9() __attribute__((shared_locks_required(aa_mu))); +void es_fun_9() { + Bar.aa_elr_fun_s(); +} + +void es_fun_10() __attribute__((exclusive_locks_required(aa_mu))); +void es_fun_10() { + Bar.aa_elr_fun_s(); +} + +void es_bad_0() { + Bar.aa_elr_fun(); // \ + // expected-warning {{calling function 'aa_elr_fun' requires exclusive lock on 'aa_mu'}} +} + +void es_bad_1() { + aa_mu.ReaderLock(); + Bar.aa_elr_fun(); // \ + // expected-warning {{calling function 'aa_elr_fun' requires exclusive lock on 'aa_mu'}} + aa_mu.Unlock(); +} + +void es_bad_2() { + Bar.aa_elr_fun_s(); // \ + // expected-warning {{calling function 'aa_elr_fun_s' requires shared lock on 'aa_mu'}} +} + +void es_bad_3() { + MyLRFoo.test(); // \ + // expected-warning {{calling function 'test' requires exclusive lock on 'sls_mu'}} +} + +void es_bad_4() { + MyLRFoo.testShared(); // \ + // expected-warning {{calling function 'testShared' requires shared lock on 'sls_mu2'}} +} + +void es_bad_5() { + sls_mu.ReaderLock(); + MyLRFoo.test(); // \ + // expected-warning {{calling function 'test' requires exclusive lock on 'sls_mu'}} + sls_mu.Unlock(); +} + +void es_bad_6() { + sls_mu.Lock(); + Bar.le_fun(); // \ + // expected-warning {{cannot call function 'le_fun' while mutex 'sls_mu' is locked}} + sls_mu.Unlock(); +} + +void es_bad_7() { + sls_mu.ReaderLock(); + Bar.le_fun(); // \ + // expected-warning {{cannot call function 'le_fun' while mutex 'sls_mu' is locked}} + sls_mu.Unlock(); +} + +//-----------------------------------------------// +// Unparseable lock expressions +// ----------------------------------------------// + +Mutex UPmu; +// FIXME: add support for lock expressions involving arrays. +Mutex mua[5]; + +int x __attribute__((guarded_by(UPmu = sls_mu))); // \ + // expected-warning{{cannot resolve lock expression to a specific lockable object}} +int y __attribute__((guarded_by(mua[0]))); // \ + // expected-warning{{cannot resolve lock expression to a specific lockable object}} + + +void testUnparse() { + // no errors, since the lock expressions are not resolved + x = 5; + y = 5; +} + +void testUnparse2() { + mua[0].Lock(); // \ + // expected-warning{{cannot resolve lock expression to a specific lockable object}} + (&(mua[0]) + 4)->Lock(); // \ + // expected-warning{{cannot resolve lock expression to a specific lockable object}} +} + + +//----------------------------------------------------------------------------// +// The following test cases are ported from the gcc thread safety implementation +// They are each wrapped inside a namespace with the test number of the gcc test +// +// FIXME: add all the gcc tests, once this analysis passes them. +//----------------------------------------------------------------------------// + +//-----------------------------------------// +// Good testcases (no errors) +//-----------------------------------------// + +namespace thread_annot_lock_20 { +class Bar { + public: + static int func1() EXCLUSIVE_LOCKS_REQUIRED(mu1_); + static int b_ GUARDED_BY(mu1_); + static Mutex mu1_; + static int a_ GUARDED_BY(mu1_); +}; + +Bar b1; + +int Bar::func1() +{ + int res = 5; + + if (a_ == 4) + res = b_; + return res; +} +} // end namespace thread_annot_lock_20 + +namespace thread_annot_lock_22 { +// Test various usage of GUARDED_BY and PT_GUARDED_BY annotations, especially +// uses in class definitions. +Mutex mu; + +class Bar { + public: + int a_ GUARDED_BY(mu1_); + int b_; + int *q PT_GUARDED_BY(mu); + Mutex mu1_ ACQUIRED_AFTER(mu); +}; + +Bar b1, *b3; +int *p GUARDED_BY(mu) PT_GUARDED_BY(mu); +int res GUARDED_BY(mu) = 5; + +int func(int i) +{ + int x; + mu.Lock(); + b1.mu1_.Lock(); + res = b1.a_ + b3->b_; + *p = i; + b1.a_ = res + b3->b_; + b3->b_ = *b1.q; + b1.mu1_.Unlock(); + b1.b_ = res; + x = res; + mu.Unlock(); + return x; +} +} // end namespace thread_annot_lock_22 + +namespace thread_annot_lock_27_modified { +// test lock annotations applied to function definitions +// Modified: applied annotations only to function declarations +Mutex mu1; +Mutex mu2 ACQUIRED_AFTER(mu1); + +class Foo { + public: + int method1(int i) SHARED_LOCKS_REQUIRED(mu2) EXCLUSIVE_LOCKS_REQUIRED(mu1); +}; + +int Foo::method1(int i) { + return i; +} + + +int foo(int i) EXCLUSIVE_LOCKS_REQUIRED(mu2) SHARED_LOCKS_REQUIRED(mu1); +int foo(int i) { + return i; +} + +static int bar(int i) EXCLUSIVE_LOCKS_REQUIRED(mu1); +static int bar(int i) { + return i; +} + +void main() { + Foo a; + + mu1.Lock(); + mu2.Lock(); + a.method1(1); + foo(2); + mu2.Unlock(); + bar(3); + mu1.Unlock(); +} +} // end namespace thread_annot_lock_27_modified + + +namespace thread_annot_lock_38 { +// Test the case where a template member function is annotated with lock +// attributes in a non-template class. +class Foo { + public: + void func1(int y) LOCKS_EXCLUDED(mu_); + template <typename T> void func2(T x) LOCKS_EXCLUDED(mu_); + private: + Mutex mu_; +}; + +Foo *foo; + +void main() +{ + foo->func1(5); + foo->func2(5); +} +} // end namespace thread_annot_lock_38 + +namespace thread_annot_lock_43 { +// Tests lock canonicalization +class Foo { + public: + Mutex *mu_; +}; + +class FooBar { + public: + Foo *foo_; + int GetA() EXCLUSIVE_LOCKS_REQUIRED(foo_->mu_) { return a_; } + int a_ GUARDED_BY(foo_->mu_); +}; + +FooBar *fb; + +void main() +{ + int x; + fb->foo_->mu_->Lock(); + x = fb->GetA(); + fb->foo_->mu_->Unlock(); +} +} // end namespace thread_annot_lock_43 + +namespace thread_annot_lock_49 { +// Test the support for use of lock expression in the annotations +class Foo { + public: + Mutex foo_mu_; +}; + +class Bar { + private: + Foo *foo; + Mutex bar_mu_ ACQUIRED_AFTER(foo->foo_mu_); + + public: + void Test1() { + foo->foo_mu_.Lock(); + bar_mu_.Lock(); + bar_mu_.Unlock(); + foo->foo_mu_.Unlock(); + } +}; + +void main() { + Bar bar; + bar.Test1(); +} +} // end namespace thread_annot_lock_49 + +namespace thread_annot_lock_61_modified { + // Modified to fix the compiler errors + // Test the fix for a bug introduced by the support of pass-by-reference + // paramters. + struct Foo { Foo &operator<< (bool) {return *this;} }; + Foo &getFoo(); + struct Bar { Foo &func () {return getFoo();} }; + struct Bas { void operator& (Foo &) {} }; + void mumble() + { + Bas() & Bar().func() << "" << ""; + Bas() & Bar().func() << ""; + } +} // end namespace thread_annot_lock_61_modified + + +namespace thread_annot_lock_65 { +// Test the fix for a bug in the support of allowing reader locks for +// non-const, non-modifying overload functions. (We didn't handle the builtin +// properly.) +enum MyFlags { + Zero, + One, + Two, + Three, + Four, + Five, + Six, + Seven, + Eight, + Nine +}; + +inline MyFlags +operator|(MyFlags a, MyFlags b) +{ + return MyFlags(static_cast<int>(a) | static_cast<int>(b)); +} + +inline MyFlags& +operator|=(MyFlags& a, MyFlags b) +{ + return a = a | b; +} +} // end namespace thread_annot_lock_65 + +namespace thread_annot_lock_66_modified { +// Modified: Moved annotation to function defn +// Test annotations on out-of-line definitions of member functions where the +// annotations refer to locks that are also data members in the class. +Mutex mu; + +class Foo { + public: + int method1(int i) SHARED_LOCKS_REQUIRED(mu1, mu, mu2); + int data GUARDED_BY(mu1); + Mutex *mu1; + Mutex *mu2; +}; + +int Foo::method1(int i) +{ + return data + i; +} + +void main() +{ + Foo a; + + a.mu2->Lock(); + a.mu1->Lock(); + mu.Lock(); + a.method1(1); + mu.Unlock(); + a.mu1->Unlock(); + a.mu2->Unlock(); +} +} // end namespace thread_annot_lock_66_modified + +namespace thread_annot_lock_68_modified { +// Test a fix to a bug in the delayed name binding with nested template +// instantiation. We use a stack to make sure a name is not resolved to an +// inner context. +template <typename T> +class Bar { + Mutex mu_; +}; + +template <typename T> +class Foo { + public: + void func(T x) { + mu_.Lock(); + count_ = x; + mu_.Unlock(); + } + + private: + T count_ GUARDED_BY(mu_); + Bar<T> bar_; + Mutex mu_; +}; + +void main() +{ + Foo<int> *foo; + foo->func(5); +} +} // end namespace thread_annot_lock_68_modified + +namespace thread_annot_lock_30_modified { +// Test delay parsing of lock attribute arguments with nested classes. +// Modified: trylocks replaced with exclusive_lock_fun +int a = 0; + +class Bar { + struct Foo; + + public: + void MyLock() EXCLUSIVE_LOCK_FUNCTION(mu); + + int func() { + MyLock(); +// if (foo == 0) { +// return 0; +// } + a = 5; + mu.Unlock(); + return 1; + } + + class FooBar { + int x; + int y; + }; + + private: + Mutex mu; +}; + +Bar *bar; + +void main() +{ + bar->func(); +} +} // end namespace thread_annot_lock_30_modified + +namespace thread_annot_lock_47 { +// Test the support for annotations on virtual functions. +// This is a good test case. (i.e. There should be no warning emitted by the +// compiler.) +class Base { + public: + virtual void func1() EXCLUSIVE_LOCKS_REQUIRED(mu_); + virtual void func2() LOCKS_EXCLUDED(mu_); + Mutex mu_; +}; + +class Child : public Base { + public: + virtual void func1() EXCLUSIVE_LOCKS_REQUIRED(mu_); + virtual void func2() LOCKS_EXCLUDED(mu_); +}; + +void main() { + Child *c; + Base *b = c; + + b->mu_.Lock(); + b->func1(); + b->mu_.Unlock(); + b->func2(); + + c->mu_.Lock(); + c->func1(); + c->mu_.Unlock(); + c->func2(); +} +} // end namespace thread_annot_lock_47 + +//-----------------------------------------// +// Tests which produce errors +//-----------------------------------------// + +namespace thread_annot_lock_13 { +Mutex mu1; +Mutex mu2; + +int g GUARDED_BY(mu1); +int w GUARDED_BY(mu2); + +class Foo { + public: + void bar() LOCKS_EXCLUDED(mu_, mu1); + int foo() SHARED_LOCKS_REQUIRED(mu_) EXCLUSIVE_LOCKS_REQUIRED(mu2); + + private: + int a_ GUARDED_BY(mu_); + public: + Mutex mu_ ACQUIRED_AFTER(mu1); +}; + +int Foo::foo() +{ + int res; + w = 5.2; + res = a_ + 5; + return res; +} + +void Foo::bar() +{ + int x; + mu_.Lock(); + x = foo(); // expected-warning {{calling function 'foo' requires exclusive lock on 'mu2'}} + a_ = x + 1; + mu_.Unlock(); + if (x > 5) { + mu1.Lock(); + g = 2.3; + mu1.Unlock(); + } +} + +void main() +{ + Foo f1, *f2; + f1.mu_.Lock(); + f1.bar(); // expected-warning {{cannot call function 'bar' while mutex 'mu_' is locked}} + mu2.Lock(); + f1.foo(); + mu2.Unlock(); + f1.mu_.Unlock(); + f2->mu_.Lock(); + f2->bar(); // expected-warning {{cannot call function 'bar' while mutex 'mu_' is locked}} + f2->mu_.Unlock(); + mu2.Lock(); + w = 2.5; + mu2.Unlock(); +} +} // end namespace thread_annot_lock_13 + +namespace thread_annot_lock_18_modified { +// Modified: Trylocks removed +// Test the ability to distnguish between the same lock field of +// different objects of a class. + class Bar { + public: + bool MyLock() EXCLUSIVE_LOCK_FUNCTION(mu1_); + void MyUnlock() UNLOCK_FUNCTION(mu1_); + int a_ GUARDED_BY(mu1_); + + private: + Mutex mu1_; +}; + +Bar *b1, *b2; + +void func() +{ + b1->MyLock(); + b1->a_ = 5; + b2->a_ = 3; // expected-warning {{writing variable 'a_' requires locking 'mu1_' exclusively}} + b2->MyLock(); + b2->MyUnlock(); + b1->MyUnlock(); +} +} // end namespace thread_annot_lock_18_modified + +namespace thread_annot_lock_21 { +// Test various usage of GUARDED_BY and PT_GUARDED_BY annotations, especially +// uses in class definitions. +Mutex mu; + +class Bar { + public: + int a_ GUARDED_BY(mu1_); + int b_; + int *q PT_GUARDED_BY(mu); + Mutex mu1_ ACQUIRED_AFTER(mu); +}; + +Bar b1, *b3; +int *p GUARDED_BY(mu) PT_GUARDED_BY(mu); + +int res GUARDED_BY(mu) = 5; + +int func(int i) +{ + int x; + b3->mu1_.Lock(); + res = b1.a_ + b3->b_; // expected-warning {{reading variable 'a_' requires locking 'mu1_'}} \ + // expected-warning {{writing variable 'res' requires locking 'mu' exclusively}} + *p = i; // expected-warning {{reading variable 'p' requires locking 'mu'}} \ + // expected-warning {{writing the value pointed to by 'p' requires locking 'mu' exclusively}} + b1.a_ = res + b3->b_; // expected-warning {{reading variable 'res' requires locking 'mu'}} \ + // expected-warning {{writing variable 'a_' requires locking 'mu1_' exclusively}} + b3->b_ = *b1.q; // expected-warning {{reading the value pointed to by 'q' requires locking 'mu'}} + b3->mu1_.Unlock(); + b1.b_ = res; // expected-warning {{reading variable 'res' requires locking 'mu'}} + x = res; // expected-warning {{reading variable 'res' requires locking 'mu'}} + return x; +} +} // end namespace thread_annot_lock_21 + +namespace thread_annot_lock_35_modified { +// Test the analyzer's ability to distinguish the lock field of different +// objects. +class Foo { + private: + Mutex lock_; + int a_ GUARDED_BY(lock_); + + public: + void Func(Foo* child) LOCKS_EXCLUDED(lock_) { + Foo *new_foo = new Foo; + + lock_.Lock(); + + child->Func(new_foo); // There shouldn't be any warning here as the + // acquired lock is not in child. + child->bar(7); // expected-warning {{calling function 'bar' requires exclusive lock on 'lock_'}} + child->a_ = 5; // expected-warning {{writing variable 'a_' requires locking 'lock_' exclusively}} + lock_.Unlock(); + } + + void bar(int y) EXCLUSIVE_LOCKS_REQUIRED(lock_) { + a_ = y; + } +}; + +Foo *x; + +void main() { + Foo *child = new Foo; + x->Func(child); +} +} // end namespace thread_annot_lock_35_modified + +namespace thread_annot_lock_36_modified { +// Modified to move the annotations to function defns. +// Test the analyzer's ability to distinguish the lock field of different +// objects +class Foo { + private: + Mutex lock_; + int a_ GUARDED_BY(lock_); + + public: + void Func(Foo* child) LOCKS_EXCLUDED(lock_); + void bar(int y) EXCLUSIVE_LOCKS_REQUIRED(lock_); +}; + +void Foo::Func(Foo* child) { + Foo *new_foo = new Foo; + + lock_.Lock(); + + child->lock_.Lock(); + child->Func(new_foo); // expected-warning {{cannot call function 'Func' while mutex 'lock_' is locked}} + child->bar(7); + child->a_ = 5; + child->lock_.Unlock(); + + lock_.Unlock(); +} + +void Foo::bar(int y) { + a_ = y; +} + + +Foo *x; + +void main() { + Foo *child = new Foo; + x->Func(child); +} +} // end namespace thread_annot_lock_36_modified + + +namespace thread_annot_lock_42 { +// Test support of multiple lock attributes of the same kind on a decl. +class Foo { + private: + Mutex mu1, mu2, mu3; + int x GUARDED_BY(mu1) GUARDED_BY(mu2); + int y GUARDED_BY(mu2); + + void f2() LOCKS_EXCLUDED(mu1) LOCKS_EXCLUDED(mu2) LOCKS_EXCLUDED(mu3) { + mu2.Lock(); + y = 2; + mu2.Unlock(); + } + + public: + void f1() EXCLUSIVE_LOCKS_REQUIRED(mu2) EXCLUSIVE_LOCKS_REQUIRED(mu1) { + x = 5; + f2(); // expected-warning {{cannot call function 'f2' while mutex 'mu1' is locked}} \ + // expected-warning {{cannot call function 'f2' while mutex 'mu2' is locked}} + } +}; + +Foo *foo; + +void func() +{ + foo->f1(); // expected-warning {{calling function 'f1' requires exclusive lock on 'mu2'}} \ + // expected-warning {{calling function 'f1' requires exclusive lock on 'mu1'}} +} +} // end namespace thread_annot_lock_42 + +namespace thread_annot_lock_46 { +// Test the support for annotations on virtual functions. +class Base { + public: + virtual void func1() EXCLUSIVE_LOCKS_REQUIRED(mu_); + virtual void func2() LOCKS_EXCLUDED(mu_); + Mutex mu_; +}; + +class Child : public Base { + public: + virtual void func1() EXCLUSIVE_LOCKS_REQUIRED(mu_); + virtual void func2() LOCKS_EXCLUDED(mu_); +}; + +void main() { + Child *c; + Base *b = c; + + b->func1(); // expected-warning {{calling function 'func1' requires exclusive lock on 'mu_'}} + b->mu_.Lock(); + b->func2(); // expected-warning {{cannot call function 'func2' while mutex 'mu_' is locked}} + b->mu_.Unlock(); + + c->func1(); // expected-warning {{calling function 'func1' requires exclusive lock on 'mu_'}} + c->mu_.Lock(); + c->func2(); // expected-warning {{cannot call function 'func2' while mutex 'mu_' is locked}} + c->mu_.Unlock(); +} +} // end namespace thread_annot_lock_46 + +namespace thread_annot_lock_67_modified { +// Modified: attributes on definitions moved to declarations +// Test annotations on out-of-line definitions of member functions where the +// annotations refer to locks that are also data members in the class. +Mutex mu; +Mutex mu3; + +class Foo { + public: + int method1(int i) SHARED_LOCKS_REQUIRED(mu1, mu, mu2, mu3); + int data GUARDED_BY(mu1); + Mutex *mu1; + Mutex *mu2; +}; + +int Foo::method1(int i) { + return data + i; +} + +void main() +{ + Foo a; + a.method1(1); // expected-warning {{calling function 'method1' requires shared lock on 'mu1'}} \ + // expected-warning {{calling function 'method1' requires shared lock on 'mu'}} \ + // expected-warning {{calling function 'method1' requires shared lock on 'mu2'}} \ + // expected-warning {{calling function 'method1' requires shared lock on 'mu3'}} +} +} // end namespace thread_annot_lock_67_modified + + diff --git a/test/SemaCXX/warn-thread-safety-parsing.cpp b/test/SemaCXX/warn-thread-safety-parsing.cpp new file mode 100644 index 000000000000..67882d08996e --- /dev/null +++ b/test/SemaCXX/warn-thread-safety-parsing.cpp @@ -0,0 +1,1255 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s + + +//-----------------------------------------// +// Helper fields +//-----------------------------------------// + +class __attribute__((lockable)) Mu { + public: + void Lock(); +}; + +class UnlockableMu{ +}; + +class MuWrapper { + public: + Mu mu; + Mu getMu() { + return mu; + } + Mu * getMuPointer() { + return μ + } +}; + + +class MuDoubleWrapper { + public: + MuWrapper* muWrapper; + MuWrapper* getWrapper() { + return muWrapper; + } +}; + +Mu mu1; +UnlockableMu umu; +Mu mu2; +MuWrapper muWrapper; +MuDoubleWrapper muDoubleWrapper; +Mu* muPointer; +Mu ** muDoublePointer = & muPointer; +Mu& muRef = mu1; + +//---------------------------------------// +// Scoping tests +//--------------------------------------// + +class Foo { + Mu foomu; + void needLock() __attribute__((exclusive_lock_function(foomu))); +}; + +class Foo2 { + void needLock() __attribute__((exclusive_lock_function(foomu))); + Mu foomu; +}; + +class Bar { + Mu barmu; + Mu barmu2 __attribute__((acquired_after(barmu))); +}; + + +//-----------------------------------------// +// No Thread Safety Analysis (noanal) // +//-----------------------------------------// + +// FIXME: Right now we cannot parse attributes put on function definitions +// We would like to patch this at some point. + +#if !__has_attribute(no_thread_safety_analysis) +#error "Should support no_thread_safety_analysis attribute" +#endif + +void noanal_fun() __attribute__((no_thread_safety_analysis)); + +void noanal_fun_args() __attribute__((no_thread_safety_analysis(1))); // \ + // expected-error {{attribute takes no arguments}} + +int noanal_testfn(int y) __attribute__((no_thread_safety_analysis)); + +int noanal_testfn(int y) { + int x __attribute__((no_thread_safety_analysis)) = y; // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} + return x; +}; + +int noanal_test_var __attribute__((no_thread_safety_analysis)); // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} + +class NoanalFoo { + private: + int test_field __attribute__((no_thread_safety_analysis)); // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} + void test_method() __attribute__((no_thread_safety_analysis)); +}; + +class __attribute__((no_thread_safety_analysis)) NoanalTestClass { // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} +}; + +void noanal_fun_params(int lvar __attribute__((no_thread_safety_analysis))); // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} + + +//-----------------------------------------// +// Guarded Var Attribute (gv) +//-----------------------------------------// + +#if !__has_attribute(guarded_var) +#error "Should support guarded_var attribute" +#endif + +int gv_var_noargs __attribute__((guarded_var)); + +int gv_var_args __attribute__((guarded_var(1))); // \ + // expected-error {{attribute takes no arguments}} + +class GVFoo { + private: + int gv_field_noargs __attribute__((guarded_var)); + int gv_field_args __attribute__((guarded_var(1))); // \ + // expected-error {{attribute takes no arguments}} +}; + +class __attribute__((guarded_var)) GV { // \ + // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} +}; + +void gv_function() __attribute__((guarded_var)); // \ + // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} + +void gv_function_params(int gv_lvar __attribute__((guarded_var))); // \ + // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} + +int gv_testfn(int y){ + int x __attribute__((guarded_var)) = y; // \ + // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} + return x; +} + +//-----------------------------------------// +// Pt Guarded Var Attribute (pgv) +//-----------------------------------------// + +//FIXME: add support for boost::scoped_ptr<int> fancyptr and references + +#if !__has_attribute(pt_guarded_var) +#error "Should support pt_guarded_var attribute" +#endif + +int *pgv_pt_var_noargs __attribute__((pt_guarded_var)); + +int pgv_var_noargs __attribute__((pt_guarded_var)); // \ + // expected-warning {{'pt_guarded_var' only applies to pointer types; type here is 'int'}} + +class PGVFoo { + private: + int *pt_field_noargs __attribute__((pt_guarded_var)); + int field_noargs __attribute__((pt_guarded_var)); // \ + // expected-warning {{'pt_guarded_var' only applies to pointer types; type here is 'int'}} + int *gv_field_args __attribute__((pt_guarded_var(1))); // \ + // expected-error {{attribute takes no arguments}} +}; + +class __attribute__((pt_guarded_var)) PGV { // \ + // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} +}; + +int *pgv_var_args __attribute__((pt_guarded_var(1))); // \ + // expected-error {{attribute takes no arguments}} + + +void pgv_function() __attribute__((pt_guarded_var)); // \ + // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} + +void pgv_function_params(int *gv_lvar __attribute__((pt_guarded_var))); // \ + // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} + +void pgv_testfn(int y){ + int *x __attribute__((pt_guarded_var)) = new int(0); // \ + // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} + delete x; +} + +//-----------------------------------------// +// Lockable Attribute (l) +//-----------------------------------------// + +//FIXME: In future we may want to add support for structs, ObjC classes, etc. + +#if !__has_attribute(lockable) +#error "Should support lockable attribute" +#endif + +class __attribute__((lockable)) LTestClass { +}; + +class __attribute__((lockable (1))) LTestClass_args { // \ + // expected-error {{attribute takes no arguments}} +}; + +void l_test_function() __attribute__((lockable)); // \ + // expected-warning {{'lockable' attribute only applies to classes}} + +int l_testfn(int y) { + int x __attribute__((lockable)) = y; // \ + // expected-warning {{'lockable' attribute only applies to classes}} + return x; +} + +int l_test_var __attribute__((lockable)); // \ + // expected-warning {{'lockable' attribute only applies to classes}} + +class LFoo { + private: + int test_field __attribute__((lockable)); // \ + // expected-warning {{'lockable' attribute only applies to classes}} + void test_method() __attribute__((lockable)); // \ + // expected-warning {{'lockable' attribute only applies to classes}} +}; + + +void l_function_params(int lvar __attribute__((lockable))); // \ + // expected-warning {{'lockable' attribute only applies to classes}} + + +//-----------------------------------------// +// Scoped Lockable Attribute (sl) +//-----------------------------------------// + +#if !__has_attribute(scoped_lockable) +#error "Should support scoped_lockable attribute" +#endif + +class __attribute__((scoped_lockable)) SLTestClass { +}; + +class __attribute__((scoped_lockable (1))) SLTestClass_args { // \ + // expected-error {{attribute takes no arguments}} +}; + +void sl_test_function() __attribute__((scoped_lockable)); // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} + +int sl_testfn(int y) { + int x __attribute__((scoped_lockable)) = y; // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} + return x; +} + +int sl_test_var __attribute__((scoped_lockable)); // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} + +class SLFoo { + private: + int test_field __attribute__((scoped_lockable)); // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} + void test_method() __attribute__((scoped_lockable)); // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} +}; + + +void sl_function_params(int lvar __attribute__((scoped_lockable))); // \ + // expected-warning {{'scoped_lockable' attribute only applies to classes}} + + +//-----------------------------------------// +// Guarded By Attribute (gb) +//-----------------------------------------// + +// FIXME: Eventually, would we like this attribute to take more than 1 arg? + +#if !__has_attribute(guarded_by) +#error "Should support guarded_by attribute" +#endif + +//1. Check applied to the right types & argument number + +int gb_var_arg __attribute__((guarded_by(mu1))); + +int gb_var_args __attribute__((guarded_by(mu1, mu2))); // \ + // expected-error {{attribute takes one argument}} + +int gb_var_noargs __attribute__((guarded_by)); // \ + // expected-error {{attribute takes one argument}} + +class GBFoo { + private: + int gb_field_noargs __attribute__((guarded_by)); // \ + // expected-error {{attribute takes one argument}} + int gb_field_args __attribute__((guarded_by(mu1))); +}; + +class __attribute__((guarded_by(mu1))) GB { // \ + // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} +}; + +void gb_function() __attribute__((guarded_by(mu1))); // \ + // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} + +void gb_function_params(int gv_lvar __attribute__((guarded_by(mu1)))); // \ + // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} + +int gb_testfn(int y){ + int x __attribute__((guarded_by(mu1))) = y; // \ + // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} + return x; +} + +//2. Check argument parsing. + +// legal attribute arguments +int gb_var_arg_1 __attribute__((guarded_by(muWrapper.mu))); +int gb_var_arg_2 __attribute__((guarded_by(muDoubleWrapper.muWrapper->mu))); +int gb_var_arg_3 __attribute__((guarded_by(muWrapper.getMu()))); +int gb_var_arg_4 __attribute__((guarded_by(*muWrapper.getMuPointer()))); +int gb_var_arg_5 __attribute__((guarded_by(&mu1))); +int gb_var_arg_6 __attribute__((guarded_by(muRef))); +int gb_var_arg_7 __attribute__((guarded_by(muDoubleWrapper.getWrapper()->getMu()))); +int gb_var_arg_8 __attribute__((guarded_by(muPointer))); + + +// illegal attribute arguments +int gb_var_arg_bad_1 __attribute__((guarded_by(1))); // \ + // expected-error {{'guarded_by' attribute requires arguments that are class type or point to class type}} +int gb_var_arg_bad_2 __attribute__((guarded_by("mu"))); // \ + // expected-error {{'guarded_by' attribute requires arguments that are class type or point to class type}} +int gb_var_arg_bad_3 __attribute__((guarded_by(muDoublePointer))); // \ + // expected-error {{'guarded_by' attribute requires arguments that are class type or point to class type}} +int gb_var_arg_bad_4 __attribute__((guarded_by(umu))); // \ + // expected-error {{'guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute}} + +//3. +// Thread Safety analysis tests + + +//-----------------------------------------// +// Pt Guarded By Attribute (pgb) +//-----------------------------------------// + +#if !__has_attribute(pt_guarded_by) +#error "Should support pt_guarded_by attribute" +#endif + +//1. Check applied to the right types & argument number + +int *pgb_var_noargs __attribute__((pt_guarded_by)); // \ + // expected-error {{attribute takes one argument}} + +int *pgb_ptr_var_arg __attribute__((pt_guarded_by(mu1))); + +int *pgb_ptr_var_args __attribute__((guarded_by(mu1, mu2))); // \ + // expected-error {{attribute takes one argument}} + +int pgb_var_args __attribute__((pt_guarded_by(mu1))); // \ + // expected-warning {{'pt_guarded_by' only applies to pointer types; type here is 'int'}} + +class PGBFoo { + private: + int *pgb_field_noargs __attribute__((pt_guarded_by)); // \ + // expected-error {{attribute takes one argument}} + int *pgb_field_args __attribute__((pt_guarded_by(mu1))); +}; + +class __attribute__((pt_guarded_by(mu1))) PGB { // \ + // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} +}; + +void pgb_function() __attribute__((pt_guarded_by(mu1))); // \ + // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} + +void pgb_function_params(int gv_lvar __attribute__((pt_guarded_by(mu1)))); // \ + // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} + +void pgb_testfn(int y){ + int *x __attribute__((pt_guarded_by(mu1))) = new int(0); // \ + // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} + delete x; +} + +//2. Check argument parsing. + +// legal attribute arguments +int * pgb_var_arg_1 __attribute__((pt_guarded_by(muWrapper.mu))); +int * pgb_var_arg_2 __attribute__((pt_guarded_by(muDoubleWrapper.muWrapper->mu))); +int * pgb_var_arg_3 __attribute__((pt_guarded_by(muWrapper.getMu()))); +int * pgb_var_arg_4 __attribute__((pt_guarded_by(*muWrapper.getMuPointer()))); +int * pgb_var_arg_5 __attribute__((pt_guarded_by(&mu1))); +int * pgb_var_arg_6 __attribute__((pt_guarded_by(muRef))); +int * pgb_var_arg_7 __attribute__((pt_guarded_by(muDoubleWrapper.getWrapper()->getMu()))); +int * pgb_var_arg_8 __attribute__((pt_guarded_by(muPointer))); + + +// illegal attribute arguments +int * pgb_var_arg_bad_1 __attribute__((pt_guarded_by(1))); // \ + // expected-error {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}} +int * pgb_var_arg_bad_2 __attribute__((pt_guarded_by("mu"))); // \ + // expected-error {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}} +int * pgb_var_arg_bad_3 __attribute__((pt_guarded_by(muDoublePointer))); // \ + // expected-error {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}} +int * pgb_var_arg_bad_4 __attribute__((pt_guarded_by(umu))); // \ + // expected-error {{'pt_guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + +//-----------------------------------------// +// Acquired After (aa) +//-----------------------------------------// + +// FIXME: Would we like this attribute to take more than 1 arg? + +#if !__has_attribute(acquired_after) +#error "Should support acquired_after attribute" +#endif + +Mu mu_aa __attribute__((acquired_after(mu1))); + +Mu aa_var_noargs __attribute__((acquired_after)); // \ + // expected-error {{attribute takes at least 1 argument}} + +class AAFoo { + private: + Mu aa_field_noargs __attribute__((acquired_after)); // \ + // expected-error {{attribute takes at least 1 argument}} + Mu aa_field_args __attribute__((acquired_after(mu1))); +}; + +class __attribute__((acquired_after(mu1))) AA { // \ + // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} +}; + +void aa_function() __attribute__((acquired_after(mu1))); // \ + // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} + +void aa_function_params(int gv_lvar __attribute__((acquired_after(mu1)))); // \ + // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} + +void aa_testfn(int y){ + Mu x __attribute__((acquired_after(mu1))) = Mu(); // \ + // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} +} + +//Check argument parsing. + +// legal attribute arguments +Mu aa_var_arg_1 __attribute__((acquired_after(muWrapper.mu))); +Mu aa_var_arg_2 __attribute__((acquired_after(muDoubleWrapper.muWrapper->mu))); +Mu aa_var_arg_3 __attribute__((acquired_after(muWrapper.getMu()))); +Mu aa_var_arg_4 __attribute__((acquired_after(*muWrapper.getMuPointer()))); +Mu aa_var_arg_5 __attribute__((acquired_after(&mu1))); +Mu aa_var_arg_6 __attribute__((acquired_after(muRef))); +Mu aa_var_arg_7 __attribute__((acquired_after(muDoubleWrapper.getWrapper()->getMu()))); +Mu aa_var_arg_8 __attribute__((acquired_after(muPointer))); + + +// illegal attribute arguments +Mu aa_var_arg_bad_1 __attribute__((acquired_after(1))); // \ + // expected-error {{'acquired_after' attribute requires arguments that are class type or point to class type}} +Mu aa_var_arg_bad_2 __attribute__((acquired_after("mu"))); // \ + // expected-error {{'acquired_after' attribute requires arguments that are class type or point to class type}} +Mu aa_var_arg_bad_3 __attribute__((acquired_after(muDoublePointer))); // \ + // expected-error {{'acquired_after' attribute requires arguments that are class type or point to class type}} +Mu aa_var_arg_bad_4 __attribute__((acquired_after(umu))); // \ + // expected-error {{'acquired_after' attribute requires arguments whose type is annotated with 'lockable' attribute}} +UnlockableMu aa_var_arg_bad_5 __attribute__((acquired_after(mu_aa))); // \ + // expected-error {{'acquired_after' attribute can only be applied in a context annotated with 'lockable' attribute}} + +//-----------------------------------------// +// Acquired Before (ab) +//-----------------------------------------// + +#if !__has_attribute(acquired_before) +#error "Should support acquired_before attribute" +#endif + +Mu mu_ab __attribute__((acquired_before(mu1))); + +Mu ab_var_noargs __attribute__((acquired_before)); // \ + // expected-error {{attribute takes at least 1 argument}} + +class ABFoo { + private: + Mu ab_field_noargs __attribute__((acquired_before)); // \ + // expected-error {{attribute takes at least 1 argument}} + Mu ab_field_args __attribute__((acquired_before(mu1))); +}; + +class __attribute__((acquired_before(mu1))) AB { // \ + // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} +}; + +void ab_function() __attribute__((acquired_before(mu1))); // \ + // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} + +void ab_function_params(int gv_lvar __attribute__((acquired_before(mu1)))); // \ + // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} + +void ab_testfn(int y){ + Mu x __attribute__((acquired_before(mu1))) = Mu(); // \ + // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} +} + +// Note: illegal int ab_int __attribute__((acquired_before(mu1))) will +// be taken care of by warnings that ab__int is not lockable. + +//Check argument parsing. + +// legal attribute arguments +Mu ab_var_arg_1 __attribute__((acquired_before(muWrapper.mu))); +Mu ab_var_arg_2 __attribute__((acquired_before(muDoubleWrapper.muWrapper->mu))); +Mu ab_var_arg_3 __attribute__((acquired_before(muWrapper.getMu()))); +Mu ab_var_arg_4 __attribute__((acquired_before(*muWrapper.getMuPointer()))); +Mu ab_var_arg_5 __attribute__((acquired_before(&mu1))); +Mu ab_var_arg_6 __attribute__((acquired_before(muRef))); +Mu ab_var_arg_7 __attribute__((acquired_before(muDoubleWrapper.getWrapper()->getMu()))); +Mu ab_var_arg_8 __attribute__((acquired_before(muPointer))); + + +// illegal attribute arguments +Mu ab_var_arg_bad_1 __attribute__((acquired_before(1))); // \ + // expected-error {{'acquired_before' attribute requires arguments that are class type or point to class type}} +Mu ab_var_arg_bad_2 __attribute__((acquired_before("mu"))); // \ + // expected-error {{'acquired_before' attribute requires arguments that are class type or point to class type}} +Mu ab_var_arg_bad_3 __attribute__((acquired_before(muDoublePointer))); // \ + // expected-error {{'acquired_before' attribute requires arguments that are class type or point to class type}} +Mu ab_var_arg_bad_4 __attribute__((acquired_before(umu))); // \ + // expected-error {{'acquired_before' attribute requires arguments whose type is annotated with 'lockable' attribute}} +UnlockableMu ab_var_arg_bad_5 __attribute__((acquired_before(mu_ab))); // \ + // expected-error {{'acquired_before' attribute can only be applied in a context annotated with 'lockable' attribute}} + + +//-----------------------------------------// +// Exclusive Lock Function (elf) +//-----------------------------------------// + +#if !__has_attribute(exclusive_lock_function) +#error "Should support exclusive_lock_function attribute" +#endif + +// takes zero or more arguments, all locks (vars/fields) + +void elf_function() __attribute__((exclusive_lock_function)); + +void elf_function_args() __attribute__((exclusive_lock_function(mu1, mu2))); + +int elf_testfn(int y) __attribute__((exclusive_lock_function)); + +int elf_testfn(int y) { + int x __attribute__((exclusive_lock_function)) = y; // \ + // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} + return x; +}; + +int elf_test_var __attribute__((exclusive_lock_function)); // \ + // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} + +class ElfFoo { + private: + int test_field __attribute__((exclusive_lock_function)); // \ + // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} + void test_method() __attribute__((exclusive_lock_function)); +}; + +class __attribute__((exclusive_lock_function)) ElfTestClass { // \ + // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} +}; + +void elf_fun_params(int lvar __attribute__((exclusive_lock_function))); // \ + // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} + +// Check argument parsing. + +// legal attribute arguments +int elf_function_1() __attribute__((exclusive_lock_function(muWrapper.mu))); +int elf_function_2() __attribute__((exclusive_lock_function(muDoubleWrapper.muWrapper->mu))); +int elf_function_3() __attribute__((exclusive_lock_function(muWrapper.getMu()))); +int elf_function_4() __attribute__((exclusive_lock_function(*muWrapper.getMuPointer()))); +int elf_function_5() __attribute__((exclusive_lock_function(&mu1))); +int elf_function_6() __attribute__((exclusive_lock_function(muRef))); +int elf_function_7() __attribute__((exclusive_lock_function(muDoubleWrapper.getWrapper()->getMu()))); +int elf_function_8() __attribute__((exclusive_lock_function(muPointer))); +int elf_function_9(Mu x) __attribute__((exclusive_lock_function(1))); +int elf_function_9(Mu x, Mu y) __attribute__((exclusive_lock_function(1,2))); + + +// illegal attribute arguments +int elf_function_bad_2() __attribute__((exclusive_lock_function("mu"))); // \ + // expected-error {{'exclusive_lock_function' attribute requires arguments that are class type or point to class type}} +int elf_function_bad_3() __attribute__((exclusive_lock_function(muDoublePointer))); // \ + // expected-error {{'exclusive_lock_function' attribute requires arguments that are class type or point to class type}} +int elf_function_bad_4() __attribute__((exclusive_lock_function(umu))); // \ + // expected-error {{'exclusive_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} + +int elf_function_bad_1() __attribute__((exclusive_lock_function(1))); // \ + // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} +int elf_function_bad_5(Mu x) __attribute__((exclusive_lock_function(0))); // \ + // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} +int elf_function_bad_6(Mu x, Mu y) __attribute__((exclusive_lock_function(0))); // \ + // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} +int elf_function_bad_7() __attribute__((exclusive_lock_function(0))); // \ + // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} + + +//-----------------------------------------// +// Shared Lock Function (slf) +//-----------------------------------------// + +#if !__has_attribute(shared_lock_function) +#error "Should support shared_lock_function attribute" +#endif + +// takes zero or more arguments, all locks (vars/fields) + +void slf_function() __attribute__((shared_lock_function)); + +void slf_function_args() __attribute__((shared_lock_function(mu1, mu2))); + +int slf_testfn(int y) __attribute__((shared_lock_function)); + +int slf_testfn(int y) { + int x __attribute__((shared_lock_function)) = y; // \ + // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} + return x; +}; + +int slf_test_var __attribute__((shared_lock_function)); // \ + // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} + +void slf_fun_params(int lvar __attribute__((shared_lock_function))); // \ + // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} + +class SlfFoo { + private: + int test_field __attribute__((shared_lock_function)); // \ + // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} + void test_method() __attribute__((shared_lock_function)); +}; + +class __attribute__((shared_lock_function)) SlfTestClass { // \ + // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int slf_function_1() __attribute__((shared_lock_function(muWrapper.mu))); +int slf_function_2() __attribute__((shared_lock_function(muDoubleWrapper.muWrapper->mu))); +int slf_function_3() __attribute__((shared_lock_function(muWrapper.getMu()))); +int slf_function_4() __attribute__((shared_lock_function(*muWrapper.getMuPointer()))); +int slf_function_5() __attribute__((shared_lock_function(&mu1))); +int slf_function_6() __attribute__((shared_lock_function(muRef))); +int slf_function_7() __attribute__((shared_lock_function(muDoubleWrapper.getWrapper()->getMu()))); +int slf_function_8() __attribute__((shared_lock_function(muPointer))); +int slf_function_9(Mu x) __attribute__((shared_lock_function(1))); +int slf_function_9(Mu x, Mu y) __attribute__((shared_lock_function(1,2))); + + +// illegal attribute arguments +int slf_function_bad_2() __attribute__((shared_lock_function("mu"))); // \ + // expected-error {{'shared_lock_function' attribute requires arguments that are class type or point to class type}} +int slf_function_bad_3() __attribute__((shared_lock_function(muDoublePointer))); // \ + // expected-error {{'shared_lock_function' attribute requires arguments that are class type or point to class type}} +int slf_function_bad_4() __attribute__((shared_lock_function(umu))); // \ + // expected-error {{'shared_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} + +int slf_function_bad_1() __attribute__((shared_lock_function(1))); // \ + // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} +int slf_function_bad_5(Mu x) __attribute__((shared_lock_function(0))); // \ + // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} +int slf_function_bad_6(Mu x, Mu y) __attribute__((shared_lock_function(0))); // \ + // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} +int slf_function_bad_7() __attribute__((shared_lock_function(0))); // \ + // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} + + +//-----------------------------------------// +// Exclusive TryLock Function (etf) +//-----------------------------------------// + +#if !__has_attribute(exclusive_trylock_function) +#error "Should support exclusive_trylock_function attribute" +#endif + +// takes a mandatory boolean or integer argument specifying the retval +// plus an optional list of locks (vars/fields) + +void etf_function() __attribute__((exclusive_trylock_function)); // \ + // expected-error {{attribute takes attribute takes at least 1 argument arguments}} + +void etf_function_args() __attribute__((exclusive_trylock_function(1, mu2))); + +void etf_function_arg() __attribute__((exclusive_trylock_function(1))); + +int etf_testfn(int y) __attribute__((exclusive_trylock_function(1))); + +int etf_testfn(int y) { + int x __attribute__((exclusive_trylock_function(1))) = y; // \ + // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} + return x; +}; + +int etf_test_var __attribute__((exclusive_trylock_function(1))); // \ + // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} + +class EtfFoo { + private: + int test_field __attribute__((exclusive_trylock_function(1))); // \ + // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} + void test_method() __attribute__((exclusive_trylock_function(1))); +}; + +class __attribute__((exclusive_trylock_function(1))) EtfTestClass { // \ + // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} +}; + +void etf_fun_params(int lvar __attribute__((exclusive_trylock_function(1)))); // \ + // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} + +// Check argument parsing. + +// legal attribute arguments +int etf_function_1() __attribute__((exclusive_trylock_function(1, muWrapper.mu))); +int etf_function_2() __attribute__((exclusive_trylock_function(1, muDoubleWrapper.muWrapper->mu))); +int etf_function_3() __attribute__((exclusive_trylock_function(1, muWrapper.getMu()))); +int etf_function_4() __attribute__((exclusive_trylock_function(1, *muWrapper.getMuPointer()))); +int etf_function_5() __attribute__((exclusive_trylock_function(1, &mu1))); +int etf_function_6() __attribute__((exclusive_trylock_function(1, muRef))); +int etf_function_7() __attribute__((exclusive_trylock_function(1, muDoubleWrapper.getWrapper()->getMu()))); +int etf_functetfn_8() __attribute__((exclusive_trylock_function(1, muPointer))); +int etf_function_9() __attribute__((exclusive_trylock_function(true))); + + +// illegal attribute arguments +int etf_function_bad_1() __attribute__((exclusive_trylock_function(mu1))); // \ + // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} +int etf_function_bad_2() __attribute__((exclusive_trylock_function("mu"))); // \ + // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} +int etf_function_bad_3() __attribute__((exclusive_trylock_function(muDoublePointer))); // \ + // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} + +int etf_function_bad_4() __attribute__((exclusive_trylock_function(1, "mu"))); // \ + // expected-error {{'exclusive_trylock_function' attribute requires arguments that are class type or point to class type}} +int etf_function_bad_5() __attribute__((exclusive_trylock_function(1, muDoublePointer))); // \ + // expected-error {{'exclusive_trylock_function' attribute requires arguments that are class type or point to class type}} +int etf_function_bad_6() __attribute__((exclusive_trylock_function(1, umu))); // \ + // expected-error {{'exclusive_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + +//-----------------------------------------// +// Shared TryLock Function (stf) +//-----------------------------------------// + +#if !__has_attribute(shared_trylock_function) +#error "Should support shared_trylock_function attribute" +#endif + +// takes a mandatory boolean or integer argument specifying the retval +// plus an optional list of locks (vars/fields) + +void stf_function() __attribute__((shared_trylock_function)); // \ + // expected-error {{attribute takes at least 1 argument}} + +void stf_function_args() __attribute__((shared_trylock_function(1, mu2))); + +void stf_function_arg() __attribute__((shared_trylock_function(1))); + +int stf_testfn(int y) __attribute__((shared_trylock_function(1))); + +int stf_testfn(int y) { + int x __attribute__((shared_trylock_function(1))) = y; // \ + // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} + return x; +}; + +int stf_test_var __attribute__((shared_trylock_function(1))); // \ + // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} + +void stf_fun_params(int lvar __attribute__((shared_trylock_function(1)))); // \ + // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} + + +class StfFoo { + private: + int test_field __attribute__((shared_trylock_function(1))); // \ + // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} + void test_method() __attribute__((shared_trylock_function(1))); +}; + +class __attribute__((shared_trylock_function(1))) StfTestClass { // \ + // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int stf_function_1() __attribute__((shared_trylock_function(1, muWrapper.mu))); +int stf_function_2() __attribute__((shared_trylock_function(1, muDoubleWrapper.muWrapper->mu))); +int stf_function_3() __attribute__((shared_trylock_function(1, muWrapper.getMu()))); +int stf_function_4() __attribute__((shared_trylock_function(1, *muWrapper.getMuPointer()))); +int stf_function_5() __attribute__((shared_trylock_function(1, &mu1))); +int stf_function_6() __attribute__((shared_trylock_function(1, muRef))); +int stf_function_7() __attribute__((shared_trylock_function(1, muDoubleWrapper.getWrapper()->getMu()))); +int stf_function_8() __attribute__((shared_trylock_function(1, muPointer))); +int stf_function_9() __attribute__((shared_trylock_function(true))); + + +// illegal attribute arguments +int stf_function_bad_1() __attribute__((shared_trylock_function(mu1))); // \ + // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} +int stf_function_bad_2() __attribute__((shared_trylock_function("mu"))); // \ + // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} +int stf_function_bad_3() __attribute__((shared_trylock_function(muDoublePointer))); // \ + // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} + +int stf_function_bad_4() __attribute__((shared_trylock_function(1, "mu"))); // \ + // expected-error {{'shared_trylock_function' attribute requires arguments that are class type or point to class type}} +int stf_function_bad_5() __attribute__((shared_trylock_function(1, muDoublePointer))); // \ + // expected-error {{'shared_trylock_function' attribute requires arguments that are class type or point to class type}} +int stf_function_bad_6() __attribute__((shared_trylock_function(1, umu))); // \ + // expected-error {{'shared_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + +//-----------------------------------------// +// Unlock Function (uf) +//-----------------------------------------// + +#if !__has_attribute(unlock_function) +#error "Should support unlock_function attribute" +#endif + +// takes zero or more arguments, all locks (vars/fields) + +void uf_function() __attribute__((unlock_function)); + +void uf_function_args() __attribute__((unlock_function(mu1, mu2))); + +int uf_testfn(int y) __attribute__((unlock_function)); + +int uf_testfn(int y) { + int x __attribute__((unlock_function)) = y; // \ + // expected-warning {{'unlock_function' attribute only applies to functions and methods}} + return x; +}; + +int uf_test_var __attribute__((unlock_function)); // \ + // expected-warning {{'unlock_function' attribute only applies to functions and methods}} + +class UfFoo { + private: + int test_field __attribute__((unlock_function)); // \ + // expected-warning {{'unlock_function' attribute only applies to functions and methods}} + void test_method() __attribute__((unlock_function)); +}; + +class __attribute__((no_thread_safety_analysis)) UfTestClass { // \ + // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} +}; + +void uf_fun_params(int lvar __attribute__((unlock_function))); // \ + // expected-warning {{'unlock_function' attribute only applies to functions and methods}} + +// Check argument parsing. + +// legal attribute arguments +int uf_function_1() __attribute__((unlock_function(muWrapper.mu))); +int uf_function_2() __attribute__((unlock_function(muDoubleWrapper.muWrapper->mu))); +int uf_function_3() __attribute__((unlock_function(muWrapper.getMu()))); +int uf_function_4() __attribute__((unlock_function(*muWrapper.getMuPointer()))); +int uf_function_5() __attribute__((unlock_function(&mu1))); +int uf_function_6() __attribute__((unlock_function(muRef))); +int uf_function_7() __attribute__((unlock_function(muDoubleWrapper.getWrapper()->getMu()))); +int uf_function_8() __attribute__((unlock_function(muPointer))); +int uf_function_9(Mu x) __attribute__((unlock_function(1))); +int uf_function_9(Mu x, Mu y) __attribute__((unlock_function(1,2))); + + +// illegal attribute arguments +int uf_function_bad_2() __attribute__((unlock_function("mu"))); // \ + // expected-error {{'unlock_function' attribute requires arguments that are class type or point to class type}} +int uf_function_bad_3() __attribute__((unlock_function(muDoublePointer))); // \ + // expected-error {{'unlock_function' attribute requires arguments that are class type or point to class type}} +int uf_function_bad_4() __attribute__((unlock_function(umu))); // \ + // expected-error {{'unlock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} + +int uf_function_bad_1() __attribute__((unlock_function(1))); // \ + // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: no parameters to index into}} +int uf_function_bad_5(Mu x) __attribute__((unlock_function(0))); // \ + // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} +int uf_function_bad_6(Mu x, Mu y) __attribute__((unlock_function(0))); // \ + // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} +int uf_function_bad_7() __attribute__((unlock_function(0))); // \ + // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: no parameters to index into}} + + +//-----------------------------------------// +// Lock Returned (lr) +//-----------------------------------------// + +#if !__has_attribute(lock_returned) +#error "Should support lock_returned attribute" +#endif + +// Takes exactly one argument, a var/field + +void lr_function() __attribute__((lock_returned)); // \ + // expected-error {{attribute takes one argument}} + +void lr_function_arg() __attribute__((lock_returned(mu1))); + +void lr_function_args() __attribute__((lock_returned(mu1, mu2))); // \ + // expected-error {{attribute takes one argument}} + +int lr_testfn(int y) __attribute__((lock_returned(mu1))); + +int lr_testfn(int y) { + int x __attribute__((lock_returned(mu1))) = y; // \ + // expected-warning {{'lock_returned' attribute only applies to functions and methods}} + return x; +}; + +int lr_test_var __attribute__((lock_returned(mu1))); // \ + // expected-warning {{'lock_returned' attribute only applies to functions and methods}} + +void lr_fun_params(int lvar __attribute__((lock_returned(mu1)))); // \ + // expected-warning {{'lock_returned' attribute only applies to functions and methods}} + +class LrFoo { + private: + int test_field __attribute__((lock_returned(mu1))); // \ + // expected-warning {{'lock_returned' attribute only applies to functions and methods}} + void test_method() __attribute__((lock_returned(mu1))); +}; + +class __attribute__((lock_returned(mu1))) LrTestClass { // \ + // expected-warning {{'lock_returned' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int lr_function_1() __attribute__((lock_returned(muWrapper.mu))); +int lr_function_2() __attribute__((lock_returned(muDoubleWrapper.muWrapper->mu))); +int lr_function_3() __attribute__((lock_returned(muWrapper.getMu()))); +int lr_function_4() __attribute__((lock_returned(*muWrapper.getMuPointer()))); +int lr_function_5() __attribute__((lock_returned(&mu1))); +int lr_function_6() __attribute__((lock_returned(muRef))); +int lr_function_7() __attribute__((lock_returned(muDoubleWrapper.getWrapper()->getMu()))); +int lr_function_8() __attribute__((lock_returned(muPointer))); + + +// illegal attribute arguments +int lr_function_bad_1() __attribute__((lock_returned(1))); // \ + // expected-error {{'lock_returned' attribute requires arguments that are class type or point to class type}} +int lr_function_bad_2() __attribute__((lock_returned("mu"))); // \ + // expected-error {{'lock_returned' attribute requires arguments that are class type or point to class type}} +int lr_function_bad_3() __attribute__((lock_returned(muDoublePointer))); // \ + // expected-error {{'lock_returned' attribute requires arguments that are class type or point to class type}} +int lr_function_bad_4() __attribute__((lock_returned(umu))); // \ + // expected-error {{'lock_returned' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + + +//-----------------------------------------// +// Locks Excluded (le) +//-----------------------------------------// + +#if !__has_attribute(locks_excluded) +#error "Should support locks_excluded attribute" +#endif + +// takes one or more arguments, all locks (vars/fields) + +void le_function() __attribute__((locks_excluded)); // \ + // expected-error {{attribute takes at least 1 argument}} + +void le_function_arg() __attribute__((locks_excluded(mu1))); + +void le_function_args() __attribute__((locks_excluded(mu1, mu2))); + +int le_testfn(int y) __attribute__((locks_excluded(mu1))); + +int le_testfn(int y) { + int x __attribute__((locks_excluded(mu1))) = y; // \ + // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} + return x; +}; + +int le_test_var __attribute__((locks_excluded(mu1))); // \ + // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} + +void le_fun_params(int lvar __attribute__((locks_excluded(mu1)))); // \ + // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} + +class LeFoo { + private: + int test_field __attribute__((locks_excluded(mu1))); // \ + // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} + void test_method() __attribute__((locks_excluded(mu1))); +}; + +class __attribute__((locks_excluded(mu1))) LeTestClass { // \ + // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int le_function_1() __attribute__((locks_excluded(muWrapper.mu))); +int le_function_2() __attribute__((locks_excluded(muDoubleWrapper.muWrapper->mu))); +int le_function_3() __attribute__((locks_excluded(muWrapper.getMu()))); +int le_function_4() __attribute__((locks_excluded(*muWrapper.getMuPointer()))); +int le_function_5() __attribute__((locks_excluded(&mu1))); +int le_function_6() __attribute__((locks_excluded(muRef))); +int le_function_7() __attribute__((locks_excluded(muDoubleWrapper.getWrapper()->getMu()))); +int le_function_8() __attribute__((locks_excluded(muPointer))); + + +// illegal attribute arguments +int le_function_bad_1() __attribute__((locks_excluded(1))); // \ + // expected-error {{'locks_excluded' attribute requires arguments that are class type or point to class type}} +int le_function_bad_2() __attribute__((locks_excluded("mu"))); // \ + // expected-error {{'locks_excluded' attribute requires arguments that are class type or point to class type}} +int le_function_bad_3() __attribute__((locks_excluded(muDoublePointer))); // \ + // expected-error {{'locks_excluded' attribute requires arguments that are class type or point to class type}} +int le_function_bad_4() __attribute__((locks_excluded(umu))); // \ + // expected-error {{'locks_excluded' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + + +//-----------------------------------------// +// Exclusive Locks Required (elr) +//-----------------------------------------// + +#if !__has_attribute(exclusive_locks_required) +#error "Should support exclusive_locks_required attribute" +#endif + +// takes one or more arguments, all locks (vars/fields) + +void elr_function() __attribute__((exclusive_locks_required)); // \ + // expected-error {{attribute takes at least 1 argument}} + +void elr_function_arg() __attribute__((exclusive_locks_required(mu1))); + +void elr_function_args() __attribute__((exclusive_locks_required(mu1, mu2))); + +int elr_testfn(int y) __attribute__((exclusive_locks_required(mu1))); + +int elr_testfn(int y) { + int x __attribute__((exclusive_locks_required(mu1))) = y; // \ + // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} + return x; +}; + +int elr_test_var __attribute__((exclusive_locks_required(mu1))); // \ + // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} + +void elr_fun_params(int lvar __attribute__((exclusive_locks_required(mu1)))); // \ + // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} + +class ElrFoo { + private: + int test_field __attribute__((exclusive_locks_required(mu1))); // \ + // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} + void test_method() __attribute__((exclusive_locks_required(mu1))); +}; + +class __attribute__((exclusive_locks_required(mu1))) ElrTestClass { // \ + // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int elr_function_1() __attribute__((exclusive_locks_required(muWrapper.mu))); +int elr_function_2() __attribute__((exclusive_locks_required(muDoubleWrapper.muWrapper->mu))); +int elr_function_3() __attribute__((exclusive_locks_required(muWrapper.getMu()))); +int elr_function_4() __attribute__((exclusive_locks_required(*muWrapper.getMuPointer()))); +int elr_function_5() __attribute__((exclusive_locks_required(&mu1))); +int elr_function_6() __attribute__((exclusive_locks_required(muRef))); +int elr_function_7() __attribute__((exclusive_locks_required(muDoubleWrapper.getWrapper()->getMu()))); +int elr_function_8() __attribute__((exclusive_locks_required(muPointer))); + + +// illegal attribute arguments +int elr_function_bad_1() __attribute__((exclusive_locks_required(1))); // \ + // expected-error {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}} +int elr_function_bad_2() __attribute__((exclusive_locks_required("mu"))); // \ + // expected-error {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}} +int elr_function_bad_3() __attribute__((exclusive_locks_required(muDoublePointer))); // \ + // expected-error {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}} +int elr_function_bad_4() __attribute__((exclusive_locks_required(umu))); // \ + // expected-error {{'exclusive_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + + + +//-----------------------------------------// +// Shared Locks Required (slr) +//-----------------------------------------// + +#if !__has_attribute(shared_locks_required) +#error "Should support shared_locks_required attribute" +#endif + +// takes one or more arguments, all locks (vars/fields) + +void slr_function() __attribute__((shared_locks_required)); // \ + // expected-error {{attribute takes at least 1 argument}} + +void slr_function_arg() __attribute__((shared_locks_required(mu1))); + +void slr_function_args() __attribute__((shared_locks_required(mu1, mu2))); + +int slr_testfn(int y) __attribute__((shared_locks_required(mu1))); + +int slr_testfn(int y) { + int x __attribute__((shared_locks_required(mu1))) = y; // \ + // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} + return x; +}; + +int slr_test_var __attribute__((shared_locks_required(mu1))); // \ + // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} + +void slr_fun_params(int lvar __attribute__((shared_locks_required(mu1)))); // \ + // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} + +class SlrFoo { + private: + int test_field __attribute__((shared_locks_required(mu1))); // \ + // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} + void test_method() __attribute__((shared_locks_required(mu1))); +}; + +class __attribute__((shared_locks_required(mu1))) SlrTestClass { // \ + // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} +}; + +// Check argument parsing. + +// legal attribute arguments +int slr_function_1() __attribute__((shared_locks_required(muWrapper.mu))); +int slr_function_2() __attribute__((shared_locks_required(muDoubleWrapper.muWrapper->mu))); +int slr_function_3() __attribute__((shared_locks_required(muWrapper.getMu()))); +int slr_function_4() __attribute__((shared_locks_required(*muWrapper.getMuPointer()))); +int slr_function_5() __attribute__((shared_locks_required(&mu1))); +int slr_function_6() __attribute__((shared_locks_required(muRef))); +int slr_function_7() __attribute__((shared_locks_required(muDoubleWrapper.getWrapper()->getMu()))); +int slr_function_8() __attribute__((shared_locks_required(muPointer))); + + +// illegal attribute arguments +int slr_function_bad_1() __attribute__((shared_locks_required(1))); // \ + // expected-error {{'shared_locks_required' attribute requires arguments that are class type or point to class type}} +int slr_function_bad_2() __attribute__((shared_locks_required("mu"))); // \ + // expected-error {{'shared_locks_required' attribute requires arguments that are class type or point to class type}} +int slr_function_bad_3() __attribute__((shared_locks_required(muDoublePointer))); // \ + // expected-error {{'shared_locks_required' attribute requires arguments that are class type or point to class type}} +int slr_function_bad_4() __attribute__((shared_locks_required(umu))); // \ + // expected-error {{'shared_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}} + + +//-----------------------------------------// +// Regression tests for unusual cases. +//-----------------------------------------// + +int trivially_false_edges(bool b) { + // Create NULL (never taken) edges in CFG + if (false) return 1; + else return 2; +} + +// Possible Clang bug -- method pointer in template parameter +class UnFoo { +public: + void foo(); +}; + +template<void (UnFoo::*methptr)()> +class MCaller { +public: + static void call_method_ptr(UnFoo *f) { + // FIXME: Possible Clang bug: + // getCalleeDecl() returns NULL in the following case: + (f->*methptr)(); + } +}; + +void call_method_ptr_inst(UnFoo* f) { + MCaller<&UnFoo::foo>::call_method_ptr(f); +} + +int temp; +void empty_back_edge() { + // Create a back edge to a block with with no statements + for (;;) { + ++temp; + if (temp > 10) break; + } +} + +struct Foomger { + void operator++(); +}; + +struct Foomgoper { + Foomger f; + + bool done(); + void invalid_back_edge() { + do { + // FIXME: Possible Clang bug: + // The first statement in this basic block has no source location + ++f; + } while (!done()); + } +}; + + +//----------------------------------------------------- +// Parsing of member variables and function parameters +//------------------------------------------------------ + +Mu gmu; + +class StaticMu { + static Mu statmu; +}; + +class FooLate { +public: + void foo1() __attribute__((exclusive_locks_required(gmu))) { } + void foo2() __attribute__((exclusive_locks_required(mu))) { } + void foo3(Mu *m) __attribute__((exclusive_locks_required(m))) { } + void foo3(FooLate *f) __attribute__((exclusive_locks_required(f->mu))) { } + void foo4(FooLate *f) __attribute__((exclusive_locks_required(f->mu))); + + static void foo5() __attribute__((exclusive_locks_required(mu))); // \ + // expected-error {{invalid use of member 'mu' in static member function}} + + template <class T> + void foo6() __attribute__((exclusive_locks_required(T::statmu))) { } + + template <class T> + void foo7(T* f) __attribute__((exclusive_locks_required(f->mu))) { } + + int a __attribute__((guarded_by(gmu))); + int b __attribute__((guarded_by(mu))); + int c __attribute__((guarded_by(this->mu))); + + Mu mu; +}; + diff --git a/test/SemaCXX/warn-unreachable.cpp b/test/SemaCXX/warn-unreachable.cpp index ea6755f2d6ce..604a3c0da381 100644 --- a/test/SemaCXX/warn-unreachable.cpp +++ b/test/SemaCXX/warn-unreachable.cpp @@ -45,8 +45,8 @@ void test3() { ? dead() : dead(); live(), - float // expected-warning {{will never be executed}} - (halt()); + float + (halt()); // expected-warning {{will never be executed}} } void test4() { @@ -73,6 +73,6 @@ void test6() { S(int i) { } }; live(), - S // expected-warning {{will never be executed}} - (halt()); + S + (halt()); // expected-warning {{will never be executed}} } diff --git a/test/SemaCXX/warn-unused-comparison.cpp b/test/SemaCXX/warn-unused-comparison.cpp new file mode 100644 index 000000000000..0153f213ba1f --- /dev/null +++ b/test/SemaCXX/warn-unused-comparison.cpp @@ -0,0 +1,94 @@ +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -Wno-unused -Wunused-comparison %s + +struct A { + bool operator==(const A&); + bool operator!=(const A&); + A operator|=(const A&); + operator bool(); +}; + +void test() { + int x, *p; + A a, b; + + x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + x != 7; // expected-warning {{inequality comparison result unused}} \ + // expected-note {{use '|=' to turn this inequality comparison into an or-assignment}} + 7 == x; // expected-warning {{equality comparison result unused}} + p == p; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} \ + // expected-warning {{self-comparison always evaluates to true}} + a == a; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + a == b; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + a != b; // expected-warning {{inequality comparison result unused}} \ + // expected-note {{use '|=' to turn this inequality comparison into an or-assignment}} + A() == b; // expected-warning {{equality comparison result unused}} + if (42) x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + else if (42) x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + else x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + do x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + while (false); + while (false) x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + for (x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + x == 7; // No warning -- result is used + x == 7) // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + switch (42) default: x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + switch (42) case 42: x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + switch (42) { + case 1: + case 2: + default: + case 3: + case 4: + x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + } + + (void)(x == 7); + (void)(p == p); // expected-warning {{self-comparison always evaluates to true}} + { bool b = x == 7; } + + { bool b = ({ x == 7; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + x == 7; }); } // no warning on the second, its result is used! + +#define EQ(x,y) (x) == (y) + EQ(x, 5); +#undef EQ +} + +namespace PR10291 { + template<typename T> + class X + { + public: + + X() : i(0) { } + + void foo() + { + throw + i == 0u ? + 5 : 6; + } + + private: + int i; + }; + + X<int> x; +} diff --git a/test/SemaCXX/warn-unused-value.cpp b/test/SemaCXX/warn-unused-value.cpp index 775c3cf01f24..80298ec6664a 100644 --- a/test/SemaCXX/warn-unused-value.cpp +++ b/test/SemaCXX/warn-unused-value.cpp @@ -15,3 +15,18 @@ namespace test0 { box->j; } } + +namespace test1 { +struct Foo { + int i; + bool operator==(const Foo& rhs) { + return i == rhs.i; + } +}; + +#define NOP(x) (x) +void b(Foo f1, Foo f2) { + NOP(f1 == f2); // expected-warning {{expression result unused}} +} +#undef NOP +} diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp index c0cfd74a3e52..912622f5a7e4 100644 --- a/test/SemaCXX/warn-weak-vtables.cpp +++ b/test/SemaCXX/warn-weak-vtables.cpp @@ -29,3 +29,30 @@ void uses(A &a, B<int> &b, C &c) { b.f(); c.f(); } + +// <rdar://problem/9979458> +class Parent { +public: + Parent() {} + virtual ~Parent(); + virtual void * getFoo() const = 0; +}; + +class Derived : public Parent { +public: + Derived(); + void * getFoo() const; +}; + +class VeryDerived : public Derived { // expected-warning{{'VeryDerived' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}} +public: + void * getFoo() const { return 0; } +}; + +Parent::~Parent() {} + +void uses(Parent &p, Derived &d, VeryDerived &vd) { + p.getFoo(); + d.getFoo(); + vd.getFoo(); +} diff --git a/test/SemaObjC/arc-bridged-cast.m b/test/SemaObjC/arc-bridged-cast.m index e883406db908..47476c83064d 100644 --- a/test/SemaObjC/arc-bridged-cast.m +++ b/test/SemaObjC/arc-bridged-cast.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fblocks -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fblocks %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fblocks %s typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; diff --git a/test/SemaObjC/arc-cf.m b/test/SemaObjC/arc-cf.m new file mode 100644 index 000000000000..c1df3e0489f1 --- /dev/null +++ b/test/SemaObjC/arc-cf.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify %s + +typedef const void *CFTypeRef; +typedef const struct __CFString *CFStringRef; + +extern CFStringRef CFMakeString0(void); +extern CFStringRef CFCreateString0(void); +void test0() { + id x; + x = (id) CFMakeString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} + x = (id) CFCreateString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} +} + +extern CFStringRef CFMakeString1(void) __attribute__((cf_returns_not_retained)); +extern CFStringRef CFCreateString1(void) __attribute__((cf_returns_retained)); +void test1() { + id x; + x = (id) CFMakeString1(); + x = (id) CFCreateString1(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} +} diff --git a/test/SemaObjC/arc-decls.m b/test/SemaObjC/arc-decls.m index e713d239a0cf..1084db86268f 100644 --- a/test/SemaObjC/arc-decls.m +++ b/test/SemaObjC/arc-decls.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify %s // rdar://8843524 @@ -62,3 +62,22 @@ void func() - new {return 0; }; @end + +// rdar://10187884 +@interface Super +- (void)bar:(id)b; // expected-note {{parameter declared here}} +- (void)bar1:(id) __attribute((ns_consumed)) b; +- (void)ok:(id) __attribute((ns_consumed)) b; +- (id)ns_non; // expected-note {{method declared here}} +- (id)not_ret:(id) b __attribute((ns_returns_not_retained)); // expected-note {{method declared here}} +- (id)both__returns_not_retained:(id) b __attribute((ns_returns_not_retained)); +@end + +@interface Sub : Super +- (void)bar:(id) __attribute((ns_consumed)) b; // expected-error {{overriding method has mismatched ns_consumed attribute on its parameter}} +- (void)bar1:(id)b; +- (void)ok:(id) __attribute((ns_consumed)) b; +- (id)ns_non __attribute((ns_returns_not_retained)); // expected-error {{overriding method has mismatched ns_returns_not_retained attributes}} +- (id)not_ret:(id) b __attribute((ns_returns_retained)); // expected-error {{overriding method has mismatched ns_returns_retained attributes}} +- (id)both__returns_not_retained:(id) b __attribute((ns_returns_not_retained)); +@end diff --git a/test/SemaObjC/arc-jump-block.m b/test/SemaObjC/arc-jump-block.m index 1c7b21e4e8cd..9b44606c59d3 100644 --- a/test/SemaObjC/arc-jump-block.m +++ b/test/SemaObjC/arc-jump-block.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s // rdar://9535237 typedef struct dispatch_queue_s *dispatch_queue_t; diff --git a/test/SemaObjC/arc-no-runtime.m b/test/SemaObjC/arc-no-runtime.m index 94299e235e81..49c439b16760 100644 --- a/test/SemaObjC/arc-no-runtime.m +++ b/test/SemaObjC/arc-no-runtime.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-arc -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fobjc-arc -verify %s // rdar://problem/9150784 void test(void) { diff --git a/test/SemaObjC/arc-non-pod-memaccess.m b/test/SemaObjC/arc-non-pod-memaccess.m index c9a77519694d..2b1223abbe78 100644 --- a/test/SemaObjC/arc-non-pod-memaccess.m +++ b/test/SemaObjC/arc-non-pod-memaccess.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s -// RUN: %clang_cc1 -x objective-c++ -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s #ifdef __cplusplus extern "C" { @@ -53,3 +53,11 @@ void test(id __strong *sip, id __weak *wip, id __autoreleasing *aip, // expected-note{{explicitly cast the pointer to silence this warning}} memmove(ptr, uip, 17); } + +void rdar9772982(int i, ...) { + __builtin_va_list ap; + + __builtin_va_start(ap, i); + __builtin_va_arg(ap, __strong id); // expected-error{{second argument to 'va_arg' is of ARC ownership-qualified type '__strong id'}} + __builtin_va_end(ap); +} diff --git a/test/SemaObjC/arc-nsconsumed-errors.m b/test/SemaObjC/arc-nsconsumed-errors.m new file mode 100644 index 000000000000..62e74aabaffd --- /dev/null +++ b/test/SemaObjC/arc-nsconsumed-errors.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// rdar://10187884 + +typedef void (^blk)(id arg1, __attribute((ns_consumed)) id arg2); +typedef void (^blk1)(__attribute((ns_consumed))id arg1, __attribute((ns_consumed)) id arg2); +blk a = ^void (__attribute((ns_consumed)) id arg1, __attribute((ns_consumed)) id arg2){}; // expected-error {{incompatible block pointer types initializing}} + +blk b = ^void (id arg1, __attribute((ns_consumed)) id arg2){}; + +blk c = ^void (__attribute((ns_consumed)) id arg1, __attribute((ns_consumed)) id arg2){}; // expected-error {{incompatible block pointer types initializing}} + +blk d = ^void (id arg1, id arg2) {}; // expected-error {{incompatible block pointer types initializing}} + +blk1 a1 = ^void (__attribute((ns_consumed)) id arg1, id arg2){}; // expected-error {{incompatible block pointer types initializing}} + +blk1 b2 = ^void (id arg1, __attribute((ns_consumed)) id arg2){}; // expected-error {{incompatible block pointer types initializing}} + +blk1 c3 = ^void (__attribute((ns_consumed)) id arg1, __attribute((ns_consumed)) id arg2){}; + +blk1 d4 = ^void (id arg1, id arg2) {}; // expected-error {{incompatible block pointer types initializing}} diff --git a/test/SemaObjC/arc-peformselector.m b/test/SemaObjC/arc-peformselector.m index e637f3d76ff4..c015eb871150 100644 --- a/test/SemaObjC/arc-peformselector.m +++ b/test/SemaObjC/arc-peformselector.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s // rdar://9659270 @interface NSObject diff --git a/test/SemaObjC/arc-property-decl-attrs.m b/test/SemaObjC/arc-property-decl-attrs.m index 0dd74b8ad5ce..1386241dd73c 100644 --- a/test/SemaObjC/arc-property-decl-attrs.m +++ b/test/SemaObjC/arc-property-decl-attrs.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s // rdar://9340606 @interface Foo { @@ -65,3 +65,17 @@ @property(unsafe_unretained) __weak id y; // expected-error {{property attributes 'unsafe_unretained' and 'weak' are mutually exclusive}} @property(unsafe_unretained) __autoreleasing id z; // expected-error {{unsafe_unretained property 'z' may not also be declared __autoreleasing}} @end + +// rdar://9396329 +@interface Super +@property (readonly, retain) id foo; +@property (readonly, weak) id fee; +@property (readonly, strong) id frr; +@end + +@interface Bugg : Super +@property (readwrite) id foo; +@property (readwrite) id fee; +@property (readwrite) id frr; +@end + diff --git a/test/SemaObjC/arc-property-lifetime.m b/test/SemaObjC/arc-property-lifetime.m index b1c84c75c058..9cc3ada15fad 100644 --- a/test/SemaObjC/arc-property-lifetime.m +++ b/test/SemaObjC/arc-property-lifetime.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s // rdar://9340606 @interface Foo { @@ -79,7 +79,7 @@ @implementation Gorf @synthesize x; -@synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}} +@synthesize y; // expected-error {{existing ivar 'y' for property 'y' with assign attribute must be __unsafe_unretained}} @synthesize z; @end @@ -94,7 +94,7 @@ @implementation Gorf2 @synthesize x; -@synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}} +@synthesize y; // expected-error {{existing ivar 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}} @synthesize z; @end @@ -110,3 +110,18 @@ @synthesize isAutosaving = _isAutosaving; @end +// rdar://10239594 +// Test for 'Class' properties being unretained. +@interface MyClass { +@private + Class _controllerClass; + id _controllerId; +} +@property (copy) Class controllerClass; +@property (copy) id controllerId; +@end + +@implementation MyClass +@synthesize controllerClass = _controllerClass; +@synthesize controllerId = _controllerId; +@end diff --git a/test/SemaObjC/arc-property.m b/test/SemaObjC/arc-property.m index 0651f1808dc9..299311859203 100644 --- a/test/SemaObjC/arc-property.m +++ b/test/SemaObjC/arc-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify %s // rdar://9309489 @interface MyClass { diff --git a/test/SemaObjC/arc-retain-block-property.m b/test/SemaObjC/arc-retain-block-property.m new file mode 100644 index 000000000000..c7d043004948 --- /dev/null +++ b/test/SemaObjC/arc-retain-block-property.m @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -verify %s +// rdar://9829425 + +extern void doSomething(); + +@interface Test +{ +@public + void (^aBlock)(void); +} +@property (retain) void (^aBlock)(void); // expected-warning {{retain'ed block property does not copy the block - use copy attribute instead}} +@property (weak, retain) void (^aBlockW)(void); // expected-error {{property attributes 'retain' and 'weak' are mutually exclusive}} +@property (strong, retain) void (^aBlockS)(void); // OK +@property (readonly, retain) void (^aBlockR)(void); // OK +@property (copy, retain) void (^aBlockC)(void); // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}} +@property (assign, retain) void (^aBlockA)(void); // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}} +@end + +@implementation Test +@synthesize aBlock; +@dynamic aBlockW, aBlockS, aBlockR, aBlockC, aBlockA; +@end + +int main() { + Test *t; + t.aBlock = ^{ doSomething(); }; + t.aBlockW = ^{ doSomething(); }; + t.aBlockS = ^{ doSomething(); }; +} + diff --git a/test/SemaObjC/arc-setter-property-match.m b/test/SemaObjC/arc-setter-property-match.m new file mode 100644 index 000000000000..0de0a11f1bbe --- /dev/null +++ b/test/SemaObjC/arc-setter-property-match.m @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s +// rdar://10156674 + +@class NSArray; + +@interface MyClass2 { +@private + NSArray *_names1; + NSArray *_names2; + NSArray *_names3; + NSArray *_names4; +} +@property (readwrite, strong) NSArray *names1; // <-- warning: Type of property.... +- (void)setNames1:(NSArray *)names; +@property (readwrite, strong) __strong NSArray *names2; // <-- warning: Type of property.... +- (void)setNames2:(NSArray *)names; +@property (readwrite, strong) __strong NSArray *names3; // <-- OK +- (void)setNames3:(__strong NSArray *)names; +@property (readwrite, strong) NSArray *names4; // <-- warning: Type of property.... +- (void)setNames4:(__strong NSArray *)names; + +@end + +@implementation MyClass2 +- (NSArray *)names1 { return _names1; } +- (void)setNames1:(NSArray *)names {} +- (NSArray *)names2 { return _names2; } +- (void)setNames2:(NSArray *)names {} +- (NSArray *)names3 { return _names3; } +- (void)setNames3:(__strong NSArray *)names {} +- (NSArray *)names4 { return _names4; } +- (void)setNames4:(__strong NSArray *)names {} + +@end + diff --git a/test/SemaObjC/arc-system-header.m b/test/SemaObjC/arc-system-header.m index 3f176577156f..1a7c39d4e1cd 100644 --- a/test/SemaObjC/arc-system-header.m +++ b/test/SemaObjC/arc-system-header.m @@ -1,6 +1,6 @@ // silly workaround expected-note {{marked unavailable here}} -// RUN: %clang_cc1 -fobjc-arc -fobjc-nonfragile-abi -isystem %S/Inputs %s -DNO_USE -// RUN: %clang_cc1 -fobjc-arc -fobjc-nonfragile-abi -isystem %S/Inputs %s -verify +// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE +// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify // another silly workaround expected-note {{marked unavailable here}} #include <arc-system-header.h> diff --git a/test/SemaObjC/arc-type-conversion.m b/test/SemaObjC/arc-type-conversion.m index 103db5695f49..01f61bd4b674 100644 --- a/test/SemaObjC/arc-type-conversion.m +++ b/test/SemaObjC/arc-type-conversion.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-weak -verify -fblocks %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks %s void * cvt(id arg) { diff --git a/test/SemaObjC/arc-unavailable-for-weakref.m b/test/SemaObjC/arc-unavailable-for-weakref.m index 104314e6b1d3..6db2155f8c64 100644 --- a/test/SemaObjC/arc-unavailable-for-weakref.m +++ b/test/SemaObjC/arc-unavailable-for-weakref.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s // rdar://9693477 __attribute__((objc_arc_weak_reference_unavailable)) diff --git a/test/SemaObjC/arc-unavailable-system-function.m b/test/SemaObjC/arc-unavailable-system-function.m new file mode 100644 index 000000000000..b0b70db641cb --- /dev/null +++ b/test/SemaObjC/arc-unavailable-system-function.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-arc -verify %s +// rdar://10186625 + +# 1 "<command line>" +# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3 +id * foo(); // expected-note {{function has been explicitly marked unavailable here}} + +# 1 "arc-unavailable-system-function.m" 2 +void ret() { + foo(); // expected-error {{'foo' is unavailable: this system declaration uses an unsupported type}} +} + + diff --git a/test/SemaObjC/arc-unbridged-cast.m b/test/SemaObjC/arc-unbridged-cast.m index 03c84cfce336..8b835a14986d 100644 --- a/test/SemaObjC/arc-unbridged-cast.m +++ b/test/SemaObjC/arc-unbridged-cast.m @@ -1,18 +1,72 @@ -// // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify %s -// rdar://9744349 +// // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s typedef const struct __CFString * CFStringRef; -@interface I -@property CFStringRef P; +@interface Object +@property CFStringRef property; +- (CFStringRef) implicitProperty; +- (CFStringRef) newString; +- (CFStringRef) makeString; @end -@implementation I -@synthesize P; -- (id) Meth { - I* p1 = (id)[p1 P]; - id p2 = (__bridge_transfer id)[p1 P]; - id p3 = (__bridge I*)[p1 P]; - return (id) p1.P; +extern Object *object; + +// rdar://9744349 +id test0(void) { + id p1 = (id)[object property]; + id p2 = (__bridge_transfer id)[object property]; + id p3 = (__bridge id)[object property]; + return (id) object.property; +} + +// rdar://10140692 +CFStringRef unauditedString(void); +CFStringRef plusOneString(void) __attribute__((cf_returns_retained)); + +#pragma clang arc_cf_code_audited begin +CFStringRef auditedString(void); +CFStringRef auditedCreateString(void); +#pragma clang arc_cf_code_audited end + +void test1(int cond) { + id x; + x = (id) auditedString(); + x = (id) (cond ? auditedString() : (void*) 0); + x = (id) (cond ? (void*) 0 : auditedString()); + x = (id) (cond ? (CFStringRef) @"help" : auditedString()); + + x = (id) unauditedString(); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? unauditedString() : (void*) 0); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? (void*) 0 : unauditedString()); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? (CFStringRef) @"help" : unauditedString()); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + + x = (id) auditedCreateString(); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? auditedCreateString() : (void*) 0); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? (void*) 0 : auditedCreateString()); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + x = (id) (cond ? (CFStringRef) @"help" : auditedCreateString()); // expected-error {{requires a bridged cast}} expected-note {{use __bridge to}} expected-note {{use __bridge_transfer to}} + + x = (id) [object property]; + x = (id) (cond ? [object property] : (void*) 0); + x = (id) (cond ? (void*) 0 : [object property]); + x = (id) (cond ? (CFStringRef) @"help" : [object property]); + + x = (id) object.property; + x = (id) (cond ? object.property : (void*) 0); + x = (id) (cond ? (void*) 0 : object.property); + x = (id) (cond ? (CFStringRef) @"help" : object.property); + + x = (id) object.implicitProperty; + x = (id) (cond ? object.implicitProperty : (void*) 0); + x = (id) (cond ? (void*) 0 : object.implicitProperty); + x = (id) (cond ? (CFStringRef) @"help" : object.implicitProperty); + + x = (id) [object makeString]; + x = (id) (cond ? [object makeString] : (void*) 0); + x = (id) (cond ? (void*) 0 : [object makeString]); + x = (id) (cond ? (CFStringRef) @"help" : [object makeString]); + + x = (id) [object newString]; + x = (id) (cond ? [object newString] : (void*) 0); + x = (id) (cond ? (void*) 0 : [object newString]); + x = (id) (cond ? (CFStringRef) @"help" : [object newString]); // a bit questionable } -@end diff --git a/test/SemaObjC/arc-unsafe-assigns.m b/test/SemaObjC/arc-unsafe-assigns.m index be8f90295e8b..6dba18ba073b 100644 --- a/test/SemaObjC/arc-unsafe-assigns.m +++ b/test/SemaObjC/arc-unsafe-assigns.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s // rdar://9495837 @interface Foo { diff --git a/test/SemaObjC/arc-unsafe_unretained.m b/test/SemaObjC/arc-unsafe_unretained.m index 77bdded1763b..a6c5f985df8f 100644 --- a/test/SemaObjC/arc-unsafe_unretained.m +++ b/test/SemaObjC/arc-unsafe_unretained.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-nonfragile-abi %s -// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fobjc-nonfragile-abi -fobjc-arc %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks %s +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fobjc-arc %s struct X { __unsafe_unretained id object; diff --git a/test/SemaObjC/arc.m b/test/SemaObjC/arc.m index 3d190e5c53a0..ed6e60d8dc2f 100644 --- a/test/SemaObjC/arc.m +++ b/test/SemaObjC/arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify %s typedef unsigned long NSUInteger; @@ -41,10 +41,10 @@ __weak __strong id x; // expected-error {{the type '__strong id' already has ret // rdar://8843638 @interface I -- (id)retain; -- (id)autorelease; -- (oneway void)release; -- (NSUInteger)retainCount; +- (id)retain; // expected-note {{method declared here}} +- (id)autorelease; // expected-note {{method declared here}} +- (oneway void)release; // expected-note {{method declared here}} +- (NSUInteger)retainCount; // expected-note {{method declared here}} @end @implementation I @@ -55,10 +55,14 @@ __weak __strong id x; // expected-error {{the type '__strong id' already has ret @end @implementation I(CAT) -- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}} -- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}} -- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}} -- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}} +- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}} \ + // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}} \ + // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}} \ + // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}} \ + // expected-warning {{category is implementing a method which will also be implemented by its primary class}} @end // rdar://8861761 @@ -483,19 +487,29 @@ void test26(id y) { @end // rdar://9525555 -@interface Test27 -@property id x; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}} \ - // expected-warning {{default property attribute 'assign' not appropriate for non-gc object}} \ - // expected-note {{declared here}} +@interface Test27 { + __weak id _myProp1; + id myProp2; +} +@property id x; @property (readonly) id ro; // expected-note {{declared here}} @property (readonly) id custom_ro; @property int y; + +@property (readonly) id myProp1; +@property (readonly) id myProp2; +@property (readonly) __strong id myProp3; @end @implementation Test27 -@synthesize x; // expected-error {{ARC forbids synthesizing a property of an Objective-C object with unspecified storage attribute}} -@synthesize ro; // expected-error {{ARC forbids synthesizing a property of an Objective-C object with unspecified storage attribute}} +@synthesize x; +@synthesize ro; // expected-error {{ARC forbids synthesizing a property of an Objective-C object with unspecified ownership or storage attribute}} @synthesize y; + +@synthesize myProp1 = _myProp1; +@synthesize myProp2; +@synthesize myProp3; + -(id)custom_ro { return 0; } @end @@ -626,3 +640,48 @@ void test36(int first, ...) { id obj = __builtin_va_arg(arglist, id); __builtin_va_end(arglist); } + +@class Test37; +void test37(Test37 *c) { + for (id y in c) { // expected-error {{collection expression type 'Test37' is a forward declaration}} + (void) y; + } + + (void)sizeof(id*); // no error. +} + +// rdar://problem/9887979 +@interface Test38 +@property int value; +@end +void test38() { + extern Test38 *test38_helper(void); + switch (test38_helper().value) { + case 0: + case 1: + ; + } +} + +// rdar://10186536 +@class NSColor; +void _NSCalc(NSColor* color, NSColor* bezelColors[]) __attribute__((unavailable("not available in automatic reference counting mode"))); + +void _NSCalcBeze(NSColor* color, NSColor* bezelColors[]); // expected-error {{must explicitly describe intended ownership of an object array parameter}} + +// rdar://9970739 +@interface RestaurantTableViewCell +- (void) restaurantLocation; +@end + +@interface Radar9970739 +- (void) Meth; +@end + +@implementation Radar9970739 +- (void) Meth { + RestaurantTableViewCell *cell; + [cell restaurantLocatoin]; // expected-error {{no visible @interface for 'RestaurantTableViewCell' declares the selector 'restaurantLocatoin'}} +} +@end + diff --git a/test/SemaObjC/assign-rvalue-message.m b/test/SemaObjC/assign-rvalue-message.m index 7e05c89afa43..8cbce8e2ee54 100644 --- a/test/SemaObjC/assign-rvalue-message.m +++ b/test/SemaObjC/assign-rvalue-message.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify %s // rdar://9005189 @interface Foo diff --git a/test/SemaObjC/at-defs.m b/test/SemaObjC/at-defs.m index bfa212375050..4c0c586fe838 100644 --- a/test/SemaObjC/at-defs.m +++ b/test/SemaObjC/at-defs.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -fsyntax-only +// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-fragile-abi %s -fsyntax-only @interface Test { double a; diff --git a/test/SemaObjC/atomoic-property-synnthesis-rules.m b/test/SemaObjC/atomoic-property-synnthesis-rules.m index af790e3159ad..2061a779dc57 100644 --- a/test/SemaObjC/atomoic-property-synnthesis-rules.m +++ b/test/SemaObjC/atomoic-property-synnthesis-rules.m @@ -240,8 +240,10 @@ GET(GetSet) SET(GetSet) -GET(Get) // expected-warning {{writable atomic property 'Get' cannot pair a synthesized setter/getter with a user defined setter/getter}} -SET(Set) // expected-warning {{writable atomic property 'Set' cannot pair a synthesized setter/getter with a user defined setter/getter}} +GET(Get) // expected-warning {{writable atomic property 'Get' cannot pair a synthesized setter with a user defined getter}} \ + // expected-note {{setter and getter must both be synthesized}} +SET(Set) // expected-warning {{writable atomic property 'Set' cannot pair a synthesized getter with a user defined setter}} \ + // expected-note {{setter and getter must both be synthesized}} GET(GetSet_Nonatomic) SET(GetSet_Nonatomic) GET(Get_Nonatomic) @@ -258,8 +260,10 @@ SET(Set_Nonatomic_ReadOnly) GET(GetSet_ReadWriteInExt) SET(GetSet_ReadWriteInExt) -GET(Get_ReadWriteInExt) // expected-warning {{writable atomic property 'Get_ReadWriteInExt' cannot pair a synthesized setter/getter with a user defined setter/getter}} -SET(Set_ReadWriteInExt) // expected-warning {{writable atomic property 'Set_ReadWriteInExt' cannot pair a synthesized setter/getter with a user defined setter/getter}} +GET(Get_ReadWriteInExt) // expected-warning {{writable atomic property 'Get_ReadWriteInExt' cannot pair a synthesized setter with a user defined getter}} \ + // expected-note {{setter and getter must both be synthesized}} +SET(Set_ReadWriteInExt) // expected-warning {{writable atomic property 'Set_ReadWriteInExt' cannot pair a synthesized getter with a user defined setter}} \ + // expected-note {{setter and getter must both be synthesized}} GET(GetSet_Nonatomic_ReadWriteInExt) SET(GetSet_Nonatomic_ReadWriteInExt) GET(Get_Nonatomic_ReadWriteInExt) @@ -268,8 +272,10 @@ SET(Set_Nonatomic_ReadWriteInExt) GET(GetSet_LateSynthesize) SET(GetSet_LateSynthesize) -GET(Get_LateSynthesize) // expected-warning {{writable atomic property 'Get_LateSynthesize' cannot pair a synthesized setter/getter with a user defined setter/getter}} -SET(Set_LateSynthesize) // expected-warning {{writable atomic property 'Set_LateSynthesize' cannot pair a synthesized setter/getter with a user defined setter/getter}} +GET(Get_LateSynthesize) // expected-warning {{writable atomic property 'Get_LateSynthesize' cannot pair a synthesized setter with a user defined getter}} \ + // expected-note {{setter and getter must both be synthesized}} +SET(Set_LateSynthesize) // expected-warning {{writable atomic property 'Set_LateSynthesize' cannot pair a synthesized getter with a user defined setter}} \ + // expected-note {{setter and getter must both be synthesized}} GET(GetSet_Nonatomic_LateSynthesize) SET(GetSet_Nonatomic_LateSynthesize) GET(Get_Nonatomic_LateSynthesize) @@ -286,8 +292,10 @@ SET(Set_Nonatomic_ReadOnly_LateSynthesize) GET(GetSet_ReadWriteInExt_LateSynthesize) SET(GetSet_ReadWriteInExt_LateSynthesize) -GET(Get_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Get_ReadWriteInExt_LateSynthesize' cannot pair a synthesized setter/getter with a user defined setter/getter}} -SET(Set_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Set_ReadWriteInExt_LateSynthesize' cannot pair a synthesized setter/getter with a user defined setter/getter}} +GET(Get_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Get_ReadWriteInExt_LateSynthesize' cannot pair a synthesized setter with a user defined getter}} \ + // expected-note {{setter and getter must both be synthesized}} +SET(Set_ReadWriteInExt_LateSynthesize) // expected-warning {{writable atomic property 'Set_ReadWriteInExt_LateSynthesize' cannot pair a synthesized getter with a user defined setter}} \ + // expected-note {{setter and getter must both be synthesized}} GET(GetSet_Nonatomic_ReadWriteInExt_LateSynthesize) SET(GetSet_Nonatomic_ReadWriteInExt_LateSynthesize) GET(Get_Nonatomic_ReadWriteInExt_LateSynthesize) diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m new file mode 100644 index 000000000000..d857bda77234 --- /dev/null +++ b/test/SemaObjC/attr-availability.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify %s +@interface A +- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); +@end + +@interface B : A +- (void)method; +@end + +void f(A *a, B *b) { + [a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}} + [b method]; +} diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m index d3d5f9537b73..ca267599288e 100644 --- a/test/SemaObjC/attr-deprecated.m +++ b/test/SemaObjC/attr-deprecated.m @@ -85,12 +85,21 @@ int t5() { __attribute ((deprecated)) @interface DEPRECATED { @public int ivar; + DEPRECATED *ivar2; // no warning. } - (int) instancemethod; +- (DEPRECATED *) meth; // no warning. @property int prop; @end -@interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}} +@interface DEPRECATED (Category) // no warning. +- (DEPRECATED *) meth2; // no warning. +@end + +@interface DEPRECATED (Category2) // no warning. +@end + +@implementation DEPRECATED (Category2) // expected-warning {{warning: 'DEPRECATED' is deprecated}} @end @interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}} @@ -108,3 +117,7 @@ void test(Test2 *foo) { foo.test2 = x; // expected-warning {{'test2' is deprecated}} [foo setTest2: x]; // expected-warning {{'setTest2:' is deprecated}} } + +__attribute__((deprecated)) +@interface A(Blah) // expected-error{{attributes may not be specified on a category}} +@end diff --git a/test/SemaObjC/attr-ns-bridged.m b/test/SemaObjC/attr-ns-bridged.m new file mode 100644 index 000000000000..1ab60a2b0d80 --- /dev/null +++ b/test/SemaObjC/attr-ns-bridged.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +typedef struct __attribute__((ns_bridged)) test0s *test0ref; + +void test0func(void) __attribute__((ns_bridged)); // expected-error {{'ns_bridged' attribute only applies to structs}} + +union __attribute__((ns_bridged)) test0u; // expected-error {{'ns_bridged' attribute only applies to structs}} + +struct __attribute__((ns_bridged(Test1))) test1s; + +@class Test2; +struct __attribute__((ns_bridged(Test2))) test2s; + +void Test3(void); // expected-note {{declared here}} +struct __attribute__((ns_bridged(Test3))) test3s; // expected-error {{parameter of 'ns_bridged' attribute does not name an Objective-C class}} diff --git a/test/SemaObjC/bad-property-synthesis-crash.m b/test/SemaObjC/bad-property-synthesis-crash.m new file mode 100644 index 000000000000..577faea9dadc --- /dev/null +++ b/test/SemaObjC/bad-property-synthesis-crash.m @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://10177744 + +@interface Foo +@property (nonatomic, retain) NSString* what; // expected-error {{unknown type name 'NSString'}} \ + // expected-error {{property with}} \ + // expected-note {{previous definition is here}} +@end + +@implementation Foo +- (void) setWhat: (NSString*) value { // expected-error {{expected a type}} \ + // expected-warning {{conflicting parameter types in implementation of}} + __what; // expected-error {{use of undeclared identifier}} \ + // expected-warning {{expression result unused}} +} +@synthesize what; // expected-note 2 {{'what' declared here}} +@end + +@implementation Bar // expected-warning {{cannot find interface declaration for}} +- (NSString*) what { // expected-error {{expected a type}} + return __what; // expected-error {{use of undeclared identifier}} +} +@end diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m index 15aa5811cc53..2d77a20fce03 100644 --- a/test/SemaObjC/blocks.m +++ b/test/SemaObjC/blocks.m @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s + +#define bool _Bool @protocol NSObject; void bar(id(^)(void)); @@ -21,9 +23,13 @@ void foo4(id (^objectCreationBlock)(int)) { return bar4(objectCreationBlock); } -void bar5(id(^)(void)); // expected-note{{passing argument to parameter here}} -void foo5(id (^objectCreationBlock)(int)) { - return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)' to parameter of type 'id (^)(void)'}} +void bar5(id(^)(void)); // expected-note 3{{passing argument to parameter here}} +void foo5(id (^objectCreationBlock)(bool)) { + bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(bool)' to parameter of type 'id (^)(void)'}} +#undef bool + bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(_Bool)' to parameter of type 'id (^)(void)'}} +#define bool int + bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(_Bool)' to parameter of type 'id (^)(void)'}} } void bar6(id(^)(int)); diff --git a/test/SemaObjC/builtin_objc_assign_ivar.m b/test/SemaObjC/builtin_objc_assign_ivar.m new file mode 100644 index 000000000000..5839bf444419 --- /dev/null +++ b/test/SemaObjC/builtin_objc_assign_ivar.m @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify +// rdar://9362887 + +typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t; +extern id objc_assign_ivar(id value, id dest, ptrdiff_t offset); + diff --git a/test/SemaObjC/class-bitfield.m b/test/SemaObjC/class-bitfield.m index c0393c2287c1..ae12e0498eea 100644 --- a/test/SemaObjC/class-bitfield.m +++ b/test/SemaObjC/class-bitfield.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify +// RUN: %clang_cc1 %s -fobjc-fragile-abi -fsyntax-only -verify @interface X { diff --git a/test/SemaObjC/class-protocol-method-match.m b/test/SemaObjC/class-protocol-method-match.m new file mode 100644 index 000000000000..04243e967757 --- /dev/null +++ b/test/SemaObjC/class-protocol-method-match.m @@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify %s +// rdar://9352731 + +@protocol Bar +@required +- (bycopy id)bud; // expected-note {{previous declaration is here}} +- (unsigned char) baz; // expected-note {{previous declaration is here}} +- (char) ok; +- (void) also_ok; +@end + +@protocol Bar1 +@required +- (unsigned char) baz; // expected-note {{previous declaration is here}} +- (unsigned char) also_ok; // expected-note {{previous declaration is here}} +- (void) ban : (int) arg, ...; // expected-note {{previous declaration is here}} +@end + +@protocol Baz <Bar, Bar1> +- (void) bar : (unsigned char)arg; // expected-note {{previous declaration is here}} +- (void) ok; +- (char) bak; // expected-note {{previous declaration is here}} +@end + +@interface Foo <Baz> +- (id)bud; // expected-warning {{conflicting distributed object modifiers on return type in declaration of 'bud'}} +- (void) baz; // expected-warning 2 {{conflicting return type in declaration of 'baz': 'unsigned char' vs 'void'}} +- (void) bar : (unsigned char*)arg; // expected-warning {{conflicting parameter types in declaration of 'bar:': 'unsigned char' vs 'unsigned char *'}} +- (void) ok; +- (void) also_ok; // expected-warning {{conflicting return type in declaration of 'also_ok': 'unsigned char' vs 'void'}} +- (void) still_ok; +- (void) ban : (int) arg; // expected-warning {{conflicting variadic declaration of method and its implementation}} +@end + +@interface Foo() +- (void) bak; +@end + +@implementation Foo +- (bycopy id)bud { return 0; } +- (void) baz {} +- (void) bar : (unsigned char*)arg {} +- (void) ok {} +- (void) also_ok {} +- (void) still_ok {} +- (void) ban : (int) arg {} +- (void) bak {} // expected-warning {{conflicting return type in declaration of 'bak': 'char' vs 'void'}} +@end diff --git a/test/SemaObjC/class-unavail-warning.m b/test/SemaObjC/class-unavail-warning.m index 408647ac11c1..b2bd38831101 100644 --- a/test/SemaObjC/class-unavail-warning.m +++ b/test/SemaObjC/class-unavail-warning.m @@ -2,17 +2,35 @@ // rdar://9092208 __attribute__((unavailable("not available"))) -@interface MyClass { // expected-note 5 {{declaration has been explicitly marked unavailable here}} +@interface MyClass { // expected-note 8 {{declaration has been explicitly marked unavailable here}} @public void *_test; + MyClass *ivar; // no error. } - (id)self; - new; + (void)addObject:(id)anObject; +- (MyClass *)meth; // no error. @end +@interface Foo { + MyClass *ivar; // expected-error {{unavailable}} +} +- (MyClass *)meth; // expected-error {{unavailable}} +@end + +@interface MyClass (Cat1) +- (MyClass *)meth; // no error. +@end + +@interface MyClass (Cat2) // no error. +@end + +@implementation MyClass (Cat2) // expected-error {{unavailable}} +@end + int main() { [MyClass new]; // expected-error {{'MyClass' is unavailable: not available}} [MyClass self]; // expected-error {{'MyClass' is unavailable: not available}} diff --git a/test/SemaObjC/comptypes-10.m b/test/SemaObjC/comptypes-10.m index 0a2219099fb6..1a6533a600ea 100644 --- a/test/SemaObjC/comptypes-10.m +++ b/test/SemaObjC/comptypes-10.m @@ -32,3 +32,21 @@ void test(id <NSCopying, NSPROTO, NSPROTO2> bar) { NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}} } + +// rdar://8843851 +@interface NSObject (CAT) ++ (struct S*)Meth : (struct S*)arg; +@end + +struct S { + char *types; +}; + +@interface I +@end + +@implementation I +- (struct S *)Meth : (struct S*)a { + return [NSObject Meth : a]; +} +@end diff --git a/test/SemaObjC/comptypes-7.m b/test/SemaObjC/comptypes-7.m index df627e5300ad..ef0f158c49ee 100644 --- a/test/SemaObjC/comptypes-7.m +++ b/test/SemaObjC/comptypes-7.m @@ -30,7 +30,7 @@ int main() obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id<MyProtocol>' from 'int'}} obj_p = j; // expected-warning {{ incompatible pointer types assigning to 'id<MyProtocol>' from 'int *'}} - obj_c = i; // expected-warning {{ incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}} + obj_c = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}} obj_c = j; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'int *'}} obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'Class' from 'int'}} diff --git a/test/SemaObjC/conflict-atomic-property.m b/test/SemaObjC/conflict-atomic-property.m new file mode 100644 index 000000000000..033980c38c73 --- /dev/null +++ b/test/SemaObjC/conflict-atomic-property.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://10260017 + +@interface Foo +@property (nonatomic, assign, atomic) float dummy; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} +@property (nonatomic, assign) float d1; +@property (atomic, assign) float d2; +@property (assign) float d3; +@property (atomic, nonatomic, assign) float d4; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} +@end diff --git a/test/SemaObjC/conflict-nonfragile-abi2.m b/test/SemaObjC/conflict-nonfragile-abi2.m index 5d6b2810fc10..7c95d5d57b5e 100644 --- a/test/SemaObjC/conflict-nonfragile-abi2.m +++ b/test/SemaObjC/conflict-nonfragile-abi2.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s +// RUN: %clang_cc1 -verify -fsyntax-only %s // rdar://8225011 int glob; diff --git a/test/SemaObjC/conflicting-ivar-test-1.m b/test/SemaObjC/conflicting-ivar-test-1.m index 1c68a23d7e28..01b35314aa98 100644 --- a/test/SemaObjC/conflicting-ivar-test-1.m +++ b/test/SemaObjC/conflicting-ivar-test-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fobjc-fragile-abi -fsyntax-only -verify %s @interface INTF { diff --git a/test/SemaObjC/continuation-class-property.m b/test/SemaObjC/continuation-class-property.m index c48a23d62a9b..a579184060b7 100644 --- a/test/SemaObjC/continuation-class-property.m +++ b/test/SemaObjC/continuation-class-property.m @@ -22,3 +22,22 @@ @property (readwrite, copy) id foos; @end + +// rdar://10142679 +@class NSString; + +typedef struct { + float width; + float length; +} NSRect; + +@interface MyClass { +} +@property (readonly) NSRect foo; // expected-note {{property declared here}} +@property (readonly, strong) NSString *bar; // expected-note {{property declared here}} +@end + +@interface MyClass () +@property (readwrite) NSString *foo; // expected-warning {{type of property 'NSString *' in continuation class does not match property type in primary class}} +@property (readwrite, strong) NSRect bar; // expected-warning {{type of property 'NSRect' in continuation class does not match property type in primary class}} +@end diff --git a/test/SemaObjC/crash-label.m b/test/SemaObjC/crash-label.m index 405d6bfd49e4..b0ca5b508ca4 100644 --- a/test/SemaObjC/crash-label.m +++ b/test/SemaObjC/crash-label.m @@ -1,10 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s - - (NSDictionary*) _executeScript:(NSString *)source { // expected-error 2 {{expected a type}} \ - // expected-error {{missing context for method declaration}} -Exit: [nilArgs release]; // expected-error {{use of undeclared identifier}} + - (NSDictionary*) _executeScript:(NSString *)source { // expected-error 2 {{expected a type}} \ + // expected-error {{missing context for method declaration}} +Exit: [nilArgs release]; } - (NSDictionary *) _setupKernelStandardMode:(NSString *)source { // expected-error 2 {{expected a type}} \ -expected-error {{missing context for method declaration}} \ -expected-note{{to match this '{'}} - Exit: if(_ciKernel && !success ) { // expected-error {{use of undeclared identifier}} // expected-error 2 {{expected}} expected-note{{to match this '{'}} expected-error{{use of undeclared identifier 'success'}} + // expected-error {{missing context for method declaration}} + Exit: if(_ciKernel && !success ) { diff --git a/test/SemaObjC/default-synthesize-1.m b/test/SemaObjC/default-synthesize-1.m index a55834dd3016..1e763af62c0a 100644 --- a/test/SemaObjC/default-synthesize-1.m +++ b/test/SemaObjC/default-synthesize-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s @interface NSObject - (void) release; @@ -25,12 +25,12 @@ //@synthesize howMany, what; - (int) howMany { - return howMany; + return _howMany; } // - (void) setHowMany: (int) value - (NSString*) what { - return what; + return _what; } // - (void) setWhat: (NSString*) value @end @@ -46,14 +46,14 @@ // - (int) howMany - (void) setHowMany: (int) value { - howMany = value; + _howMany = value; } // - (NSString*) what - (void) setWhat: (NSString*) value { - if (what != value) { - [what release]; - what = [value retain]; + if (_what != value) { + [_what release]; + _what = [value retain]; } } @end @@ -68,19 +68,19 @@ //@synthesize howMany, what; // REM: Redundant anyway - (int) howMany { - return howMany; + return howMany; // expected-error {{use of undeclared identifier 'howMany'}} } - (void) setHowMany: (int) value { - howMany = value; + howMany = value; // expected-error {{use of undeclared identifier 'howMany'}} } - (NSString*) what { - return what; + return what; // expected-error {{use of undeclared identifier 'what'}} } - (void) setWhat: (NSString*) value { - if (what != value) { - [what release]; - what = [value retain]; + if (what != value) { // expected-error {{use of undeclared identifier 'what'}} + [what release]; // expected-error {{use of undeclared identifier 'what'}} + what = [value retain]; // expected-error {{use of undeclared identifier 'what'}} } } @end diff --git a/test/SemaObjC/default-synthesize-2.m b/test/SemaObjC/default-synthesize-2.m new file mode 100644 index 000000000000..1ea492ef5795 --- /dev/null +++ b/test/SemaObjC/default-synthesize-2.m @@ -0,0 +1,116 @@ +// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify %s +// rdar://8843851 + +@interface StopAccessingIvarsDirectlyExample +@property(strong) id name, rank, serialNumber; +@end + +@implementation StopAccessingIvarsDirectlyExample + +- (void)identifyYourSelf { + if (self.name && self.rank && self.serialNumber) + self.name = 0; +} + +// @synthesize name, rank, serialNumber; +// default synthesis allows direct access to property ivars. +- (id)init { + _name = _rank = _serialNumber = 0; + return self; +} + +- (void)dealloc { +} +@end + + +// Test2 +@interface Test2 +@property(strong, nonatomic) id object; +@end + +// object has user declared setter/getter so it won't be +// default synthesized; thus causing user error. +@implementation Test2 +- (id) bar { return object; } // expected-error {{use of undeclared identifier 'object'}} +- (void)setObject:(id)newObject {} +- (id)object { return 0; } +@end + +// Test3 +@interface Test3 +{ + id uid; +} +@property (readwrite, assign) id uid; +@end + +@implementation Test3 +// Oops, forgot to write @synthesize! will be default synthesized +- (void) myMethod { + self.uid = 0; // Use of the “setter†+ uid = 0; // Use of the wrong instance variable + _uid = 0; // Use of the property instance variable +} +@end + +@interface Test4 { + id _var; +} +@property (readwrite, assign) id var; +@end + + +// default synthesize property named 'var' +@implementation Test4 +- (id) myMethod { + return self->_var; // compiles because 'var' is synthesized by default +} +@end + +@interface Test5 +{ + id _var; +} +@property (readwrite, assign) id var; +@end + +// default synthesis of property 'var' +@implementation Test5 +- (id) myMethod { + Test5 *foo = 0; + return foo->_var; // OK +} +@end + +@interface Test6 +{ + id _var; // expected-note {{'_var' declared here}} +} +@property (readwrite, assign) id var; +@end + +// no default synthesis. So error is expected. +@implementation Test6 +- (id) myMethod +{ + return var; // expected-error {{use of undeclared identifier 'var'}} +} +@synthesize var = _var; +@end + +int* _object; + +@interface Test7 +@property (readwrite, assign) id object; +@end + +// With default synthesis, '_object' is be the synthesized ivar not the global +// 'int*' object. So no error. +@implementation Test7 +- (id) myMethod { + return _object; +} +@end + diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m index 33e3bd6f3464..0d2f47339900 100644 --- a/test/SemaObjC/default-synthesize.m +++ b/test/SemaObjC/default-synthesize.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s @interface NSString @end @@ -97,10 +97,10 @@ // rdar://7920807 @interface C @end @interface C (Category) -@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \ - // expected-warning {{property 'p' requires method 'setP:' to be defined}} +@property int p; // expected-note 2 {{property declared here}} @end -@implementation C (Category) // expected-note 2 {{implementation is here}} +@implementation C (Category) // expected-warning {{property 'p' requires method 'p' to be defined}} \ + // expected-warning {{property 'p' requires method 'setP:' to be defined}} @end // Don't complain if a property is already @synthesized by usr. diff --git a/test/SemaObjC/deref-interface.m b/test/SemaObjC/deref-interface.m index 255e1d079814..490e3a565d2e 100644 --- a/test/SemaObjC/deref-interface.m +++ b/test/SemaObjC/deref-interface.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s +// RUN: %clang_cc1 -verify -fsyntax-only %s @interface NSView - (id)initWithView:(id)realView; diff --git a/test/SemaObjC/direct-synthesized-ivar-access.m b/test/SemaObjC/direct-synthesized-ivar-access.m index a72fb5f19c7a..7e57a29b18ac 100644 --- a/test/SemaObjC/direct-synthesized-ivar-access.m +++ b/test/SemaObjC/direct-synthesized-ivar-access.m @@ -1,14 +1,15 @@ -// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-default-synthesize-properties -verify %s // rdar://8673791 +// rdar://9943851 @interface I { } -@property int IVAR; // expected-note {{property declared here}} +@property int IVAR; - (int) OK; @end @implementation I -- (int) Meth { return IVAR; } // expected-warning {{direct access of synthesized ivar by using property access 'IVAR'}} +- (int) Meth { return _IVAR; } - (int) OK { return self.IVAR; } @end diff --git a/test/SemaObjC/duplicate-ivar-in-class-extension.m b/test/SemaObjC/duplicate-ivar-in-class-extension.m index 0507b352f602..9b9d58cc671d 100644 --- a/test/SemaObjC/duplicate-ivar-in-class-extension.m +++ b/test/SemaObjC/duplicate-ivar-in-class-extension.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s @interface Root @end diff --git a/test/SemaObjC/enum-fixed-type.m b/test/SemaObjC/enum-fixed-type.m new file mode 100644 index 000000000000..530ee0fe9995 --- /dev/null +++ b/test/SemaObjC/enum-fixed-type.m @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#if !__has_feature(objc_fixed_enum) +# error Enumerations with a fixed underlying type are not supported +#endif + +typedef long Integer; + +typedef enum : Integer { Enumerator1, Enumerator2 } Enumeration; + +int array[sizeof(Enumeration) == sizeof(long)? 1 : -1]; + + +enum Color { Red, Green, Blue }; + +struct X { + enum Color : 4; + enum Color field1: 4; + enum Other : Integer field2; + enum Other : Integer field3 : 4; + enum : Integer { Blah, Blarg } field4 : 4; +}; + +void test() { + long value = 2; + Enumeration e = value; +} diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m index 829c08228747..25fee051174b 100644 --- a/test/SemaObjC/error-property-gc-attr.m +++ b/test/SemaObjC/error-property-gc-attr.m @@ -3,7 +3,7 @@ @interface INTF { - id IVAR; + id IVAR; // expected-note {{ivar is declared here}} __weak id II; __weak id WID; id ID; diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m index 5c82c8308a43..6bfe31389546 100644 --- a/test/SemaObjC/iboutletcollection-attr.m +++ b/test/SemaObjC/iboutletcollection-attr.m @@ -19,12 +19,13 @@ typedef void *PV; __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}} __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}} __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}} - __attribute__((iboutletcollection(PV))) void *ivar4; // expected-error {{ivar with iboutletcollection attribute must have object type (invalid 'void *')}} + __attribute__((iboutletcollection(PV))) void *ivar4; // expected-error {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}} __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}} + __attribute__((iboutlet)) int ivar6; // expected-error {{ivar with 'iboutlet' attribute must be an object type}} } @property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}} @property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}} -@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with iboutletcollection attribute must have object type (invalid 'int')}} +@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}} @end diff --git a/test/SemaObjC/id-isa-ref.m b/test/SemaObjC/id-isa-ref.m index a75f2f336751..dfc0a5b9fdac 100644 --- a/test/SemaObjC/id-isa-ref.m +++ b/test/SemaObjC/id-isa-ref.m @@ -22,7 +22,7 @@ static void func() { Whatever *y; // GCC allows this, with the following warning: - // instance variable ‘isa’ is @protected; this will be a hard error in the future + // instance variable 'isa' is @protected; this will be a hard error in the future // // FIXME: see if we can avoid the 2 warnings that follow the error. [(*y).isa self]; // expected-error {{instance variable 'isa' is protected}} \ diff --git a/test/SemaObjC/incomplete-implementation.m b/test/SemaObjC/incomplete-implementation.m index 612c331ae8c2..f5c5a7cc1813 100644 --- a/test/SemaObjC/incomplete-implementation.m +++ b/test/SemaObjC/incomplete-implementation.m @@ -1,26 +1,27 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s @interface I -- Meth; // expected-note{{method definition for 'Meth' not found}} +- Meth; // expected-note{{method definition for 'Meth' not found}} \ + // expected-note{{method declared here}} @end @implementation I // expected-warning{{incomplete implementation}} @end @implementation I(CAT) -- Meth {return 0;} +- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}} @end #pragma GCC diagnostic ignored "-Wincomplete-implementation" @interface I2 -- Meth; +- Meth; // expected-note{{method declared here}} @end @implementation I2 @end @implementation I2(CAT) -- Meth {return 0;} +- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}} @end diff --git a/test/SemaObjC/instancetype.m b/test/SemaObjC/instancetype.m new file mode 100644 index 000000000000..13d6e0309f82 --- /dev/null +++ b/test/SemaObjC/instancetype.m @@ -0,0 +1,190 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#if !__has_feature(objc_instancetype) +# error Missing 'instancetype' feature macro. +#endif + +@interface Root ++ (instancetype)alloc; +- (instancetype)init; // expected-note{{overridden method is part of the 'init' method family}} +- (instancetype)self; +- (Class)class; + +@property (assign) Root *selfProp; +- (instancetype)selfProp; +@end + +@protocol Proto1 +@optional +- (instancetype)methodInProto1; +@end + +@protocol Proto2 +@optional +- (instancetype)methodInProto2; // expected-note{{overridden method returns an instance of its class type}} +- (instancetype)otherMethodInProto2; // expected-note{{overridden method returns an instance of its class type}} +@end + +@interface Subclass1 : Root +- (instancetype)initSubclass1; +- (void)methodOnSubclass1; ++ (instancetype)allocSubclass1; +@end + +@interface Subclass2 : Root +- (instancetype)initSubclass2; +- (void)methodOnSubclass2; +@end + +// Sanity check: the basic initialization pattern. +void test_instancetype_alloc_init_simple() { + Root *r1 = [[Root alloc] init]; + Subclass1 *sc1 = [[Subclass1 alloc] init]; +} + +// Test that message sends to instancetype methods have the right type. +void test_instancetype_narrow_method_search() { + // instancetype on class methods + Subclass1 *sc1 = [[Subclass1 alloc] initSubclass2]; // expected-warning{{'Subclass1' may not respond to 'initSubclass2'}} + Subclass2 *sc2 = [[Subclass2 alloc] initSubclass2]; // okay + + // instancetype on instance methods + [[[Subclass1 alloc] init] methodOnSubclass2]; // expected-warning{{'Subclass1' may not respond to 'methodOnSubclass2'}} + [[[Subclass2 alloc] init] methodOnSubclass2]; + + // instancetype on class methods using protocols + typedef Subclass1<Proto1> SC1Proto1; + typedef Subclass1<Proto2> SC1Proto2; + [[SC1Proto1 alloc] methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [[SC1Proto2 alloc] methodInProto2]; + + // instancetype on instance methods + Subclass1<Proto1> *sc1proto1 = 0; + [[sc1proto1 self] methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + Subclass1<Proto2> *sc1proto2 = 0; + [[sc1proto2 self] methodInProto2]; + + // Exact type checks + typeof([[Subclass1 alloc] init]) *ptr1 = (Subclass1 **)0; + typeof([[Subclass2 alloc] init]) *ptr2 = (Subclass2 **)0; + + // Message sends to Class. + Subclass1<Proto1> *sc1proto1_2 = [[[sc1proto1 class] alloc] init]; + + // Property access + [sc1proto1.self methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [sc1proto2.self methodInProto2]; + [Subclass1.alloc initSubclass2]; // expected-warning{{'Subclass1' may not respond to 'initSubclass2'}} + [Subclass2.alloc initSubclass2]; + + [sc1proto1.selfProp methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}} + [sc1proto2.selfProp methodInProto2]; +} + +// Test that message sends to super methods have the right type. +@interface Subsubclass1 : Subclass1 +- (instancetype)initSubclass1; ++ (instancetype)allocSubclass1; + +- (void)onlyInSubsubclass1; +@end + +@implementation Subsubclass1 +- (instancetype)initSubclass1 { + // Check based on method search. + [[super initSubclass1] methodOnSubclass2]; // expected-warning{{'Subsubclass1' may not respond to 'methodOnSubclass2'}} + [super.initSubclass1 methodOnSubclass2]; // expected-warning{{'Subsubclass1' may not respond to 'methodOnSubclass2'}} + + self = [super init]; // common pattern + + // Exact type check. + typeof([super initSubclass1]) *ptr1 = (Subsubclass1**)0; + + return self; +} + ++ (instancetype)allocSubclass1 { + // Check based on method search. + [[super allocSubclass1] methodOnSubclass2]; // expected-warning{{'Subsubclass1' may not respond to 'methodOnSubclass2'}} + + // The ASTs don't model super property accesses well enough to get this right + [super.allocSubclass1 methodOnSubclass2]; // expected-warning{{'Subsubclass1' may not respond to 'methodOnSubclass2'}} + + // Exact type check. + typeof([super allocSubclass1]) *ptr1 = (Subsubclass1**)0; + + return [super allocSubclass1]; +} + +- (void)onlyInSubsubclass1 {} +@end + +// Check compatibility rules for inheritance of related return types. +@class Subclass4; + +@interface Subclass3 <Proto1, Proto2> +- (Subclass3 *)methodInProto1; +- (Subclass4 *)methodInProto2; // expected-warning{{method is expected to return an instance of its class type 'Subclass3', but is declared to return 'Subclass4 *'}} +@end + +@interface Subclass4 : Root ++ (Subclass4 *)alloc; // okay +- (Subclass3 *)init; // expected-warning{{method is expected to return an instance of its class type 'Subclass4', but is declared to return 'Subclass3 *'}} +- (id)self; // expected-note{{overridden method is part of the 'self' method family}} +- (instancetype)initOther; +@end + +@protocol Proto3 <Proto1, Proto2> +@optional +- (id)methodInProto1; +- (Subclass1 *)methodInProto2; +- (int)otherMethodInProto2; // expected-warning{{protocol method is expected to return an instance of the implementing class, but is declared to return 'int'}} +@end + +@implementation Subclass4 ++ (id)alloc { + return self; // expected-warning{{incompatible pointer types returning 'Class' from a function with result type 'Subclass4 *'}} +} + +- (Subclass3 *)init { return 0; } // don't complain: we lost the related return type + +- (Subclass3 *)self { return 0; } // expected-warning{{method is expected to return an instance of its class type 'Subclass4', but is declared to return 'Subclass3 *'}} + +- (Subclass4 *)initOther { return 0; } + +@end + +// Check that inherited related return types influence the types of +// message sends. +void test_instancetype_inherited() { + [[Subclass4 alloc] initSubclass1]; // expected-warning{{'Subclass4' may not respond to 'initSubclass1'}} + [[Subclass4 alloc] initOther]; +} + +// Check that related return types tighten up the semantics of +// Objective-C method implementations. +@implementation Subclass2 +- (instancetype)initSubclass2 { + Subclass1 *sc1 = [[Subclass1 alloc] init]; + return sc1; // expected-warning{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} +} +- (void)methodOnSubclass2 {} +- (id)self { + Subclass1 *sc1 = [[Subclass1 alloc] init]; + return sc1; // expected-warning{{incompatible pointer types returning 'Subclass1 *' from a function with result type 'Subclass2 *'}} +} +@end + +@interface MyClass : Root ++ (int)myClassMethod; +@end + +@implementation MyClass ++ (int)myClassMethod { return 0; } + +- (void)blah { + int i = [[MyClass self] myClassMethod]; +} + +@end + diff --git a/test/SemaObjC/interface-1.m b/test/SemaObjC/interface-1.m index 91586c9bb34a..87c230742e35 100644 --- a/test/SemaObjC/interface-1.m +++ b/test/SemaObjC/interface-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -fsyntax-only -verify +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi %s -fsyntax-only -verify // rdar://5957506 @interface NSWhatever : diff --git a/test/SemaObjC/interface-layout.m b/test/SemaObjC/interface-layout.m index 72a7155644a0..a8a93f0a6eb3 100644 --- a/test/SemaObjC/interface-layout.m +++ b/test/SemaObjC/interface-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9 +// RUN: %clang_cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9 -fobjc-fragile-abi typedef struct objc_object {} *id; typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m index 23a7491aafb1..cecaa33bcfcc 100644 --- a/test/SemaObjC/ivar-in-class-extension-error.m +++ b/test/SemaObjC/ivar-in-class-extension-error.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fobjc-fragile-abi -fsyntax-only -verify %s // rdar://6812436 @interface A @end diff --git a/test/SemaObjC/ivar-in-class-extension.m b/test/SemaObjC/ivar-in-class-extension.m index b5772f6a4ca3..c9f138f40752 100644 --- a/test/SemaObjC/ivar-in-class-extension.m +++ b/test/SemaObjC/ivar-in-class-extension.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s @interface SomeClass @end diff --git a/test/SemaObjC/ivar-in-implementations.m b/test/SemaObjC/ivar-in-implementations.m index 74db3224007a..c4cfc10d5e40 100644 --- a/test/SemaObjC/ivar-in-implementations.m +++ b/test/SemaObjC/ivar-in-implementations.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s @interface Super @end diff --git a/test/SemaObjC/ivar-sem-check-2.m b/test/SemaObjC/ivar-sem-check-2.m index 28c795ee7fe1..bf884b3d9d27 100644 --- a/test/SemaObjC/ivar-sem-check-2.m +++ b/test/SemaObjC/ivar-sem-check-2.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s @interface Super { id value2; // expected-note {{previously declared 'value2' here}} diff --git a/test/SemaObjC/method-no-context.m b/test/SemaObjC/method-no-context.m index 3c45beef0426..c0875493b44b 100644 --- a/test/SemaObjC/method-no-context.m +++ b/test/SemaObjC/method-no-context.m @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -- im0 { // expected-note{{to match this '{'}} expected-error{{missing context for method declaration}} +- im0 { // expected-error{{missing context for method declaration}} int a; return 0; -// expected-error{{expected '}'}} diff --git a/test/SemaObjC/missing-atend-metadata.m b/test/SemaObjC/missing-atend-metadata.m index 434706d3fafc..9b79c52d9629 100644 --- a/test/SemaObjC/missing-atend-metadata.m +++ b/test/SemaObjC/missing-atend-metadata.m @@ -10,7 +10,7 @@ @end @implementation I1 // expected-error {{'@end' is missing in implementation context}} --(void) im0 { self = [super init]; } // expected-warning {{nstance method '-init' not found }} +-(void) im0 { self = [super init]; } @interface I2 : I0 - I2meth; diff --git a/test/SemaObjC/missing-method-return-type.m b/test/SemaObjC/missing-method-return-type.m new file mode 100644 index 000000000000..b62a0466ad35 --- /dev/null +++ b/test/SemaObjC/missing-method-return-type.m @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -Wmissing-method-return-type -fsyntax-only -verify %s +// rdar://9615045 + +@interface I +- initWithFoo:(id)foo; // expected-warning {{method has no return type specified; defaults to 'id' [-Wmissing-method-return-type]}} +@end + +@implementation I +- initWithFoo:(id)foo { return 0; } // expected-warning {{method has no return type specified; defaults to 'id' [-Wmissing-method-return-type]}} +@end + diff --git a/test/SemaObjC/nested-typedef-decl.m b/test/SemaObjC/nested-typedef-decl.m new file mode 100644 index 000000000000..70ca3a12cc0f --- /dev/null +++ b/test/SemaObjC/nested-typedef-decl.m @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -x objective-c -fsyntax-only -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s +// rdar://10041908 + +@interface Bar { + struct _A *_hardlinkList; +} +@end +@implementation Bar +typedef struct _A { + int dev; + int inode; +} A; + +- (void) idx:(int)idx ino:(int)ino dev:(int)dev +{ + _hardlinkList[idx].inode = ino; + _hardlinkList[idx].dev = dev; +} +@end + diff --git a/test/SemaObjC/objc-buffered-methods.m b/test/SemaObjC/objc-buffered-methods.m new file mode 100644 index 000000000000..78912aed8605 --- /dev/null +++ b/test/SemaObjC/objc-buffered-methods.m @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://8843851 + +int* global; + +@interface I +- (void) Meth; +@property int prop; +@property int prop1; +@end + +@implementation I ++ (void) _defaultMinSize { }; +static void _initCommon() { + Class graphicClass; + [graphicClass _defaultMinSize]; +} + +- (void) Meth { [self Forw]; } // No warning now +- (void) Forw {} +- (int) func { return prop; } // compiles - synthesized ivar will be accessible here. +- (int)get_g { return global; } // No warning here - synthesized ivar will be accessible here. +@synthesize prop; +@synthesize prop1=global; +@end diff --git a/test/SemaObjC/property-and-class-extension.m b/test/SemaObjC/property-and-class-extension.m index 926538af61c9..7040078416cd 100644 --- a/test/SemaObjC/property-and-class-extension.m +++ b/test/SemaObjC/property-and-class-extension.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s /** When processing @synthesize, treat ivars in a class extension the same as ivars in the class @interface, diff --git a/test/SemaObjC/property-and-ivar-use.m b/test/SemaObjC/property-and-ivar-use.m index 70e553469907..12874e7d201e 100644 --- a/test/SemaObjC/property-and-ivar-use.m +++ b/test/SemaObjC/property-and-ivar-use.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s // Do not issue error if 'ivar' used previously belongs to the inherited class // and has same name as @dynalic property in current class. diff --git a/test/SemaObjC/property-category-1.m b/test/SemaObjC/property-category-1.m index 26e73136d01f..6382826080fb 100644 --- a/test/SemaObjC/property-category-1.m +++ b/test/SemaObjC/property-category-1.m @@ -37,7 +37,7 @@ int main(int argc, char **argv) { /// @interface I0 -@property(readonly) int p0; // expected-warning {{property 'p0' requires method 'p0' to be defined}} +@property(readonly) int p0; // expected-note {{property declared here}} @end @interface I0 (Cat0) @@ -46,7 +46,7 @@ int main(int argc, char **argv) { @interface I0 (Cat1) @end -@implementation I0 // expected-note {{implementation is here}} +@implementation I0 // expected-warning {{property 'p0' requires method 'p0' to be define}} - (void) foo { self.p0 = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}} } diff --git a/test/SemaObjC/property-category-2.m b/test/SemaObjC/property-category-2.m index e63672bb0ad7..ecc368162bfa 100644 --- a/test/SemaObjC/property-category-2.m +++ b/test/SemaObjC/property-category-2.m @@ -4,8 +4,7 @@ @protocol MyProtocol @property float myFloat; -@property float anotherFloat; // expected-warning {{property 'anotherFloat' requires method 'anotherFloat' to be defined - use @dynamic}} \ - // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:' to be defined }} +@property float anotherFloat; // expected-note 2 {{property declared}} @end @interface MyObject { float anotherFloat; } @@ -14,7 +13,8 @@ @interface MyObject (CAT) <MyProtocol> @end -@implementation MyObject (CAT) // expected-note 2 {{implementation is here}} +@implementation MyObject (CAT) // expected-warning {{property 'anotherFloat' requires method}} \ + // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:'}} @dynamic myFloat; // OK @synthesize anotherFloat; // expected-error {{@synthesize not allowed in a category's implementation}} @end diff --git a/test/SemaObjC/property-category-3.m b/test/SemaObjC/property-category-3.m index 237de0f1f5fb..2a61d9272477 100644 --- a/test/SemaObjC/property-category-3.m +++ b/test/SemaObjC/property-category-3.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s @protocol P - @property(readonly) int X; + @property(readonly) int X; // expected-note {{property declared here}} @end @protocol P1<P> diff --git a/test/SemaObjC/property-category-impl.m b/test/SemaObjC/property-category-impl.m index 997949778c6e..21fdf1b6d4be 100644 --- a/test/SemaObjC/property-category-impl.m +++ b/test/SemaObjC/property-category-impl.m @@ -24,8 +24,8 @@ @end @interface MyClass (public) -@property(readwrite) int foo; // expected-warning {{property 'foo' requires method 'setFoo:' to be defined }} +@property(readwrite) int foo; // expected-note {{property declared here}} @end -@implementation MyClass (public)// expected-note {{implementation is here}} +@implementation MyClass (public)// expected-warning {{property 'foo' requires method 'setFoo:' to be defined }} @end diff --git a/test/SemaObjC/property-inherited.m b/test/SemaObjC/property-inherited.m index 11ef2befa99b..f5f1b420c229 100644 --- a/test/SemaObjC/property-inherited.m +++ b/test/SemaObjC/property-inherited.m @@ -21,7 +21,7 @@ id _delegate; } @property(nonatomic, assign) id<FooDelegate> delegate; -@property(nonatomic, assign) id<BarDelegate> delegate2; +@property(nonatomic, assign) id<BarDelegate> delegate2; // expected-note {{property declared here}} @end @interface Bar : Foo { } @@ -36,7 +36,7 @@ @interface Base : NSData @property(assign) id ref; @property(assign) Base *p_base; -@property(assign) NSMutableData *p_data; +@property(assign) NSMutableData *p_data; // expected-note {{property declared here}} @end @interface Data : Base diff --git a/test/SemaObjC/property-nonfragile-abi.m b/test/SemaObjC/property-nonfragile-abi.m index ae82cb7d9295..55bf91f383d4 100644 --- a/test/SemaObjC/property-nonfragile-abi.m +++ b/test/SemaObjC/property-nonfragile-abi.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s typedef signed char BOOL; diff --git a/test/SemaObjC/property-ns-returns-not-retained-attr.m b/test/SemaObjC/property-ns-returns-not-retained-attr.m index 187c93f3d3af..a209da884ed7 100644 --- a/test/SemaObjC/property-ns-returns-not-retained-attr.m +++ b/test/SemaObjC/property-ns-returns-not-retained-attr.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -verify %s // rdar://9636091 @interface I diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m index 4d00bd2b522d..7d1cb7a36160 100644 --- a/test/SemaObjC/property.m +++ b/test/SemaObjC/property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -fsyntax-only -verify %s @interface I { @@ -11,8 +11,7 @@ @end @interface I(CAT) -@property int d1; // expected-warning {{property 'd1' requires method 'd1' to be defined }} \ - // expected-warning {{property 'd1' requires method 'setD1:' to be defined }} +@property int d1; // expected-note 2 {{property declared here}} @end @implementation I @@ -23,7 +22,8 @@ @synthesize name; // OK! property with same name as an accessible ivar of same name @end -@implementation I(CAT) // expected-note 2 {{implementation is here}} +@implementation I(CAT) // expected-warning {{property 'd1' requires method 'd1' to be defined }} \ + // expected-warning {{property 'd1' requires method 'setD1:' to be defined }} @synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}} @dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}} @end @@ -63,3 +63,5 @@ typedef id BYObjectIdentifier; @property int treeController; // expected-error {{property has a previous declaration}} @end +// rdar://10127639 +@synthesize window; // expected-error {{missing context for property implementation declaration}} diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 138c43d1a83a..992d3e4798c1 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -33,3 +33,10 @@ typedef struct objc_class *Class; Class <SomeProtocol> UnfortunateGCCExtension; +// rdar://10238337 +@protocol Broken @end +@interface Crash @end +@implementation Crash +- (void)crashWith:(<Broken>)a { // expected-warning {{protocol qualifiers without 'id' is archaic}} +} +@end diff --git a/test/SemaObjC/protocol-implementing-class-methods.m b/test/SemaObjC/protocol-implementing-class-methods.m new file mode 100644 index 000000000000..f08a5a97d8b7 --- /dev/null +++ b/test/SemaObjC/protocol-implementing-class-methods.m @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://7020493 + +@protocol P1 +@optional +- (int) PMeth; +@required +- (void) : (double) arg; // expected-note {{method declared here}} +@end + +@interface NSImage <P1> +- (void) initialize; // expected-note {{method declared here}} +@end + +@interface NSImage (AirPortUI) +- (void) initialize; +@end + +@interface NSImage() +- (void) CEMeth; // expected-note {{method declared here}} +@end + +@implementation NSImage (AirPortUI) +- (void) initialize {NSImage *p=0; [p initialize]; } // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +- (int) PMeth{ return 0; } +- (void) : (double) arg{}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +- (void) CEMeth {}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}} +@end + +// rdar://10014946 +typedef char BOOL; +@interface I +{ + BOOL allowsDeleting; +} +@property (nonatomic, assign, readwrite) BOOL allowsDeleting; +@end + +@implementation I(CAT) +- (BOOL) allowsDeleting { return 1; } +@end diff --git a/test/SemaObjC/provisional-ivar-lookup.m b/test/SemaObjC/provisional-ivar-lookup.m index 04d6a4193095..007c21b726a5 100644 --- a/test/SemaObjC/provisional-ivar-lookup.m +++ b/test/SemaObjC/provisional-ivar-lookup.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s // rdar:// 8565343 @interface Foo { diff --git a/test/SemaObjC/qualified-protocol-method-conflicts.m b/test/SemaObjC/qualified-protocol-method-conflicts.m new file mode 100644 index 000000000000..0cff3ff46841 --- /dev/null +++ b/test/SemaObjC/qualified-protocol-method-conflicts.m @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -Woverriding-method-mismatch -fsyntax-only -verify %s +// rdar://6191214 + +@protocol Xint +-(void) setX: (int) arg0; // expected-note {{previous declaration is here}} ++(int) C; // expected-note {{previous declaration is here}} +@end + +@protocol Xfloat +-(void) setX: (float) arg0; // expected-note 2 {{previous declaration is here}} ++(float) C; // expected-note 2 {{previous declaration is here}} +@end + +@interface A <Xint, Xfloat> +@end + +@implementation A +-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}} ++(int) C {return 0; } // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}} +@end + +@interface B <Xfloat, Xint> +@end + +@implementation B +-(void) setX: (float) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'float'}} ++ (float) C {return 0.0; } // expected-warning {{conflicting return type in declaration of 'C': 'int' vs 'float'}} +@end + +@protocol Xint_float<Xint, Xfloat> +@end + +@interface C<Xint_float> +@end + +@implementation C +-(void) setX: (int) arg0 { } // expected-warning {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}} ++ (int) C {return 0;} // expected-warning {{conflicting return type in declaration of 'C': 'float' vs 'int'}} +@end diff --git a/test/SemaObjC/related-result-type-inference.m b/test/SemaObjC/related-result-type-inference.m index 094f19a67129..11b4b9602e14 100644 --- a/test/SemaObjC/related-result-type-inference.m +++ b/test/SemaObjC/related-result-type-inference.m @@ -149,8 +149,8 @@ void test_inference() { @end // <rdar://problem/9340699> -@interface G -- (id)_ABC_init __attribute__((objc_method_family(init))); +@interface G +- (id)_ABC_init __attribute__((objc_method_family(init))); // expected-note {{method declared here}} @end @interface G (Additions) @@ -158,7 +158,7 @@ void test_inference() { @end @implementation G (Additions) -- (id)_ABC_init { +- (id)_ABC_init { // expected-warning {{category is implementing a method which will also be implemented by its primary class}} return 0; } - (id)_ABC_init2 { diff --git a/test/SemaObjC/return.m b/test/SemaObjC/return.m index 3a626e369603..4e70bde1edc1 100644 --- a/test/SemaObjC/return.m +++ b/test/SemaObjC/return.m @@ -14,7 +14,7 @@ void test2(int a) { } // PR5286 -void test3(int a) { // expected-warning {{function could be attribute 'noreturn'}} +void test3(int a) { // expected-warning {{function 'test3' could be declared with attribute 'noreturn'}} while (1) { if (a) @throw (id)0; @@ -39,3 +39,12 @@ NSString *rdar_4289832() { // no-warning } } +void exit(int) __attribute__((noreturn)); +@interface rdar10098695 +@end + +@implementation rdar10098695 +- (void)method { // expected-warning{{method 'method' could be declared with attribute 'noreturn'}} + exit(1); +} +@end diff --git a/test/SemaObjC/self-declared-in-block.m b/test/SemaObjC/self-declared-in-block.m index 21310953c2c5..25ce8ba59933 100644 --- a/test/SemaObjC/self-declared-in-block.m +++ b/test/SemaObjC/self-declared-in-block.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -verify %s -// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify %s // rdar://9154582 @interface Blocky @end diff --git a/test/SemaObjC/sizeof-interface.m b/test/SemaObjC/sizeof-interface.m index 65c8e49e0b87..43870a17a30f 100644 --- a/test/SemaObjC/sizeof-interface.m +++ b/test/SemaObjC/sizeof-interface.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s +// RUN: %clang_cc1 -verify -fsyntax-only %s @class I0; diff --git a/test/SemaObjC/super-class-protocol-conformance.m b/test/SemaObjC/super-class-protocol-conformance.m index bf19c837f46a..32d5392ad4e0 100644 --- a/test/SemaObjC/super-class-protocol-conformance.m +++ b/test/SemaObjC/super-class-protocol-conformance.m @@ -4,7 +4,7 @@ @interface NSObject @end @protocol TopProtocol - @property (readonly) id myString; // expected-warning {{property 'myString' requires method 'myString' to be defined}} + @property (readonly) id myString; // expected-note {{property}} @end @protocol SubProtocol <TopProtocol> @@ -21,7 +21,7 @@ @implementation SubClass1 @end // Test1 - No Warning -@implementation TopClass // expected-note {{implementation is here}} +@implementation TopClass // expected-warning {{property 'myString' requires method 'myString' to be defined}} @end @implementation SubClass // Test3 - No Warning @@ -39,11 +39,11 @@ @implementation SubClass4 @end // Test 5 - No Warning @protocol NewProtocol - @property (readonly) id myNewString; // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}} + @property (readonly) id myNewString; // expected-note {{property}} @end @interface SubClass5 : SubClass4 <NewProtocol> @end -@implementation SubClass5 @end // expected-note {{implementation is here}} +@implementation SubClass5 @end // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}} // Radar 8035776 @@ -54,10 +54,10 @@ @end @protocol ProtocolWithProperty <SuperProtocol> -@property (readonly, assign) id invalidationBacktrace; // expected-warning {{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}} +@property (readonly, assign) id invalidationBacktrace; // expected-note {{property}} @end @interface INTF : Super <ProtocolWithProperty> @end -@implementation INTF @end // expected-note {{implementation is here}} +@implementation INTF @end // expected-warning{{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}} diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m index 33de173cc14b..8bf687811fd2 100644 --- a/test/SemaObjC/synth-provisional-ivars-1.m +++ b/test/SemaObjC/synth-provisional-ivars-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s // rdar://8913053 typedef unsigned char BOOL; diff --git a/test/SemaObjC/synth-provisional-ivars.m b/test/SemaObjC/synth-provisional-ivars.m index e8179aaa00dd..696eb9b38558 100644 --- a/test/SemaObjC/synth-provisional-ivars.m +++ b/test/SemaObjC/synth-provisional-ivars.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s int bar; @@ -18,7 +18,7 @@ int bar; @end @implementation I -- (int) Meth { return PROP; } // expected-note 2{{'PROP' declared here}} +- (int) Meth { return _PROP; } @dynamic PROP1; - (int) Meth1 { return PROP1; } // expected-error {{use of undeclared identifier 'PROP1'}} @@ -30,12 +30,12 @@ int bar; @synthesize PROP3=IVAR; - (int) Meth4 { return PROP4; } -@synthesize PROP4=PROP4; +@synthesize PROP4=PROP4; // expected-note 4 {{'PROP4' declared here}} -- (int) Meth5 { return bar; } // expected-error {{use of undeclared identifier 'bar'}} +- (int) Meth5 { return bar; } @synthesize bar = _bar; -- (int) Meth6 { return bar1; } +- (int) Meth6 { return _bar1; } @end @@ -45,6 +45,6 @@ int bar; @implementation I(r8251648) - (int) Meth1: (int) bar { - return bar; // expected-warning {{local declaration of 'bar' hides instance variable}} + return bar; } @end diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m index 4786d808fa2f..745fe77449ac 100644 --- a/test/SemaObjC/synthesized-ivar.m +++ b/test/SemaObjC/synthesized-ivar.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s @interface I { } @@ -31,8 +31,8 @@ int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is pri @implementation I1 - (int) Meth { - PROP_INMAIN = 1; - PROP_INCLASSEXT = 2; + _PROP_INMAIN = 1; + _PROP_INCLASSEXT = 2; protected_ivar = 1; // OK return private_ivar; // OK } @@ -45,8 +45,8 @@ int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is pri @implementation DER - (int) Meth { protected_ivar = 1; // OK - PROP_INMAIN = 1; // expected-error {{instance variable 'PROP_INMAIN' is private}} - PROP_INCLASSEXT = 2; // expected-error {{instance variable 'PROP_INCLASSEXT' is private}} + _PROP_INMAIN = 1; // expected-error {{instance variable '_PROP_INMAIN' is private}} + _PROP_INCLASSEXT = 2; // expected-error {{instance variable '_PROP_INCLASSEXT' is private}} return private_ivar; // expected-error {{instance variable 'private_ivar' is private}} } @end diff --git a/test/SemaObjC/undeclared-selector.m b/test/SemaObjC/undeclared-selector.m index 758e1d7f5602..af52fde8806e 100644 --- a/test/SemaObjC/undeclared-selector.m +++ b/test/SemaObjC/undeclared-selector.m @@ -18,7 +18,7 @@ typedef struct objc_selector *SEL; + (void) methodD { SEL d = @selector(methodD); /* Ok */ - SEL e = @selector(methodE); // expected-warning {{undeclared selector 'methodE'}} + SEL e = @selector(methodE); } - (void) methodE diff --git a/test/SemaObjC/unimplemented-protocol-prop.m b/test/SemaObjC/unimplemented-protocol-prop.m index d3de50efea58..fa3ed8ef121c 100644 --- a/test/SemaObjC/unimplemented-protocol-prop.m +++ b/test/SemaObjC/unimplemented-protocol-prop.m @@ -2,14 +2,12 @@ @protocol PROTOCOL0 @required -@property float MyProperty0; // expected-warning {{property 'MyProperty0' requires method 'MyProperty0' to be defined }} \ - // expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}} +@property float MyProperty0; // expected-note 2 {{property declared}} @end @protocol PROTOCOL<PROTOCOL0> @required -@property float MyProperty; // expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \ - // expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}} +@property float MyProperty; // expected-note 2 {{property declared}} @optional @property float OptMyProperty; @end @@ -17,4 +15,25 @@ @interface I <PROTOCOL> @end -@implementation I @end // expected-note 4 {{implementation is here}} +@implementation I @end // expected-warning {{property 'MyProperty0' requires method 'MyProperty0' to be defined}} \ + // expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}}\ + // expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \ + // expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}} + +// rdar://10120691 +// property is implemented in super class. No warning + +@protocol PROTOCOL1 +@property int MyProp; +@end + +@interface superclass +@property int MyProp; +@end + +@interface childclass : superclass <PROTOCOL1> +@end + +@implementation childclass +@end + diff --git a/test/SemaObjC/uninit-variables.m b/test/SemaObjC/uninit-variables.m index b5c49184f4bc..cad0f54b2dd3 100644 --- a/test/SemaObjC/uninit-variables.m +++ b/test/SemaObjC/uninit-variables.m @@ -3,7 +3,7 @@ // Duplicated from uninit-variables.c. // Test just to ensure the analysis is working. int test1() { - int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization}} + int x; // expected-note{{initialize the variable 'x' to silence this warning}} return x; // expected-warning{{variable 'x' is uninitialized when used here}} } diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m index 7bcd10cc3e06..60da7b0c41dc 100644 --- a/test/SemaObjC/warn-deprecated-implementations.m +++ b/test/SemaObjC/warn-deprecated-implementations.m @@ -26,7 +26,8 @@ __attribute__((deprecated)) @implementation CL // expected-warning {{Implementing deprecated class}} @end -@implementation CL ( SomeCategory ) // expected-warning {{Implementing deprecated category}} +@implementation CL ( SomeCategory ) // expected-warning {{'CL' is deprecated}} \ + // expected-warning {{Implementing deprecated category}} @end @interface CL_SUB : CL // expected-warning {{'CL' is deprecated}} diff --git a/test/SemaObjC/warn-implicit-atomic-property.m b/test/SemaObjC/warn-implicit-atomic-property.m index 0b4590a42db7..ec8e84e20f0c 100644 --- a/test/SemaObjC/warn-implicit-atomic-property.m +++ b/test/SemaObjC/warn-implicit-atomic-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -fobjc-default-synthesize-properties -verify %s // rdar://8774580 @interface Super diff --git a/test/SemaObjC/warn-missing-super.m b/test/SemaObjC/warn-missing-super.m new file mode 100644 index 000000000000..0169a6157258 --- /dev/null +++ b/test/SemaObjC/warn-missing-super.m @@ -0,0 +1,57 @@ +@protocol NSCopying @end + +@interface NSObject <NSCopying> +- (void)dealloc; +@end + +@implementation NSObject +- (void)dealloc { + // Root class, shouldn't warn +} +- (void)finalize { + // Root class, shouldn't warn +} +@end + +@interface Subclass1 : NSObject +- (void)dealloc; +- (void)finalize; +@end + +@implementation Subclass1 +- (void)dealloc { +} +- (void)finalize { +} +@end + +@interface Subclass2 : NSObject +- (void)dealloc; +- (void)finalize; +@end + +@implementation Subclass2 +- (void)dealloc { + [super dealloc]; // Shouldn't warn +} +- (void)finalize { + [super finalize]; // Shouldn't warn +} +@end + +// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s +// CHECK: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call +// CHECK: 1 warning generated. + +// RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s +// CHECK-GC: warn-missing-super.m:23:1: warning: method possibly missing a [super dealloc] call +// CHECK-GC: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call +// CHECK-GC: 2 warnings generated. + +// RUN: %clang_cc1 -fsyntax-only -fobjc-gc-only %s 2>&1 | FileCheck --check-prefix=CHECK-GC-ONLY %s +// CHECK-GC-ONLY: warn-missing-super.m:25:1: warning: method possibly missing a [super finalize] call +// CHECK-GC-ONLY: 1 warning generated. + +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s +// CHECK-ARC: warn-missing-super.m:35:4: error: ARC forbids explicit message send of 'dealloc' +// CHECK-ARC: 1 error generated. diff --git a/test/SemaObjC/warn-retain-cycle.m b/test/SemaObjC/warn-retain-cycle.m index 71385b8400bb..596858f83a3e 100644 --- a/test/SemaObjC/warn-retain-cycle.m +++ b/test/SemaObjC/warn-retain-cycle.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -verify %s @interface Test0 - (void) setBlock: (void(^)(void)) block; @@ -27,7 +27,7 @@ void test0(Test0 *x) { } @interface BlockOwner -@property (retain) void (^strong)(void); +@property (retain) void (^strong)(void); // expected-warning {{retain'ed block property does not copy the block - use copy attribute instead}} @end @interface Test1 { diff --git a/test/SemaObjC/weak-property.m b/test/SemaObjC/weak-property.m index f0006076413d..bea66281ea7b 100644 --- a/test/SemaObjC/weak-property.m +++ b/test/SemaObjC/weak-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fobjc-arc -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -verify %s // rdar://8899430 @interface WeakPropertyTest { diff --git a/test/SemaObjCXX/arc-0x.mm b/test/SemaObjCXX/arc-0x.mm index fa022af522e9..be9f1dc2e28c 100644 --- a/test/SemaObjCXX/arc-0x.mm +++ b/test/SemaObjCXX/arc-0x.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s // "Move" semantics, trivial version. void move_it(__strong id &&from) { diff --git a/test/SemaObjCXX/arc-bool-conversion.mm b/test/SemaObjCXX/arc-bool-conversion.mm index 86da3ca90cf1..d8f840e871e5 100644 --- a/test/SemaObjCXX/arc-bool-conversion.mm +++ b/test/SemaObjCXX/arc-bool-conversion.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s // rdar://9310049 bool fn(id obj) { diff --git a/test/SemaObjCXX/arc-bridged-cast.mm b/test/SemaObjCXX/arc-bridged-cast.mm index cbbe79eb2744..1ea67a347edd 100644 --- a/test/SemaObjCXX/arc-bridged-cast.mm +++ b/test/SemaObjCXX/arc-bridged-cast.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; diff --git a/test/SemaObjCXX/arc-libcxx.mm b/test/SemaObjCXX/arc-libcxx.mm deleted file mode 100644 index 7992f602f51a..000000000000 --- a/test/SemaObjCXX/arc-libcxx.mm +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-arc-cxxlib=libc++ -fobjc-nonfragile-abi -fobjc-runtime-has-weak -verify %s - -@interface A @end - -void f(__strong id &sir, __weak id &wir, __autoreleasing id &air, - __unsafe_unretained id &uir) { - __strong id *sip = std::addressof(sir); - __weak id *wip = std::addressof(wir); - __autoreleasing id *aip = std::addressof(air); - __unsafe_unretained id *uip = std::addressof(uir); -} diff --git a/test/SemaObjCXX/arc-libstdcxx.mm b/test/SemaObjCXX/arc-libstdcxx.mm index edb7a9ef486a..71771b4b1375 100644 --- a/test/SemaObjCXX/arc-libstdcxx.mm +++ b/test/SemaObjCXX/arc-libstdcxx.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-arc-cxxlib=libstdc++ -fobjc-nonfragile-abi -fobjc-runtime-has-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-arc-cxxlib=libstdc++ -fobjc-runtime-has-weak -verify %s @interface A @end diff --git a/test/SemaObjCXX/arc-memfunc.mm b/test/SemaObjCXX/arc-memfunc.mm index 75b94c64e727..274f873fd48a 100644 --- a/test/SemaObjCXX/arc-memfunc.mm +++ b/test/SemaObjCXX/arc-memfunc.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks %s struct X0 { static id makeObject1() __attribute__((ns_returns_retained)); diff --git a/test/SemaObjCXX/arc-non-pod.mm b/test/SemaObjCXX/arc-non-pod.mm index 6a47b3d85664..1c5cf7af3a18 100644 --- a/test/SemaObjCXX/arc-non-pod.mm +++ b/test/SemaObjCXX/arc-non-pod.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -Warc-abi -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Warc-abi -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s // Classes that have an Objective-C object pointer. struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}} diff --git a/test/SemaObjCXX/arc-nsconsumed-errors.mm b/test/SemaObjCXX/arc-nsconsumed-errors.mm new file mode 100644 index 000000000000..93f5d999675e --- /dev/null +++ b/test/SemaObjCXX/arc-nsconsumed-errors.mm @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s +// rdar://10187884 + +typedef void (^blk)(id, __attribute((ns_consumed)) id); +typedef void (^blk1)(__attribute((ns_consumed))id, __attribute((ns_consumed)) id); +blk a = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}} + +blk b = ^void (id, __attribute((ns_consumed)) id){}; + +blk c = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}} + +blk d = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk'}} + +blk1 a1 = ^void (__attribute((ns_consumed)) id, id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} + +blk1 b2 = ^void (id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} + +blk1 c3 = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; + +blk1 d4 = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk1'}} diff --git a/test/SemaObjCXX/arc-object-init-destroy.mm b/test/SemaObjCXX/arc-object-init-destroy.mm index 196f49371847..e10e3eac9fc7 100644 --- a/test/SemaObjCXX/arc-object-init-destroy.mm +++ b/test/SemaObjCXX/arc-object-init-destroy.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Warc-abi -fblocks -triple x86_64-apple-darwin10.0.0 %s +// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Warc-abi -fblocks -triple x86_64-apple-darwin10.0.0 %s typedef __strong id strong_id; typedef __weak id weak_id; diff --git a/test/SemaObjCXX/arc-overloading.mm b/test/SemaObjCXX/arc-overloading.mm index 06b332cec85f..dad5d0f7051f 100644 --- a/test/SemaObjCXX/arc-overloading.mm +++ b/test/SemaObjCXX/arc-overloading.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s +// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s // Simple ownership conversions + diagnostics. int &f0(id __strong const *); // expected-note{{candidate function not viable: 1st argument ('__weak id *') has __weak ownership, but parameter has __strong ownership}} @@ -173,3 +173,30 @@ void test_f9() { const __autoreleasing id& ar3 = unsafe_unretained_a; const __autoreleasing id& ar4 = weak_a; } + +// rdar://9790531 +void f9790531(void *inClientData); // expected-note {{candidate function not viable: cannot implicitly convert argument of type 'MixerEQGraphTestDelegate *const __strong' to 'void *' for 1st argument under ARC}} +void f9790531_1(struct S*inClientData); // expected-note {{candidate function not viable}} +void f9790531_2(char * inClientData); // expected-note {{candidate function not viable}} + +@class UIApplication; + +@interface MixerEQGraphTestDelegate +- (void)applicationDidFinishLaunching; +@end + +@implementation MixerEQGraphTestDelegate +- (void)applicationDidFinishLaunching { + f9790531(self); // expected-error {{no matching function for call to 'f9790531'}} + f9790531_1(self); // expected-error {{no matching function for call to 'f9790531_1'}} + f9790531_2(self); // expected-error {{no matching function for call to 'f9790531_2'}} +} +@end + +class rdar10142572 { + id f() __attribute__((ns_returns_retained)); + id g(); // expected-note{{previous declaration}} +}; + +id rdar10142572::f() { return 0; } // okay: merged down +id __attribute__((ns_returns_retained)) rdar10142572::g() { return 0; } // expected-error{{function declared with the ns_returns_retained attribute was previously declared without the ns_returns_retained attribute}} diff --git a/test/SemaObjCXX/arc-system-header.mm b/test/SemaObjCXX/arc-system-header.mm index cb2b85868ce1..107b5b5a53d2 100644 --- a/test/SemaObjCXX/arc-system-header.mm +++ b/test/SemaObjCXX/arc-system-header.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-arc -fobjc-nonfragile-abi -isystem %S/Inputs %s -verify +// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify #include <arc-system-header.h> diff --git a/test/SemaObjCXX/arc-templates.mm b/test/SemaObjCXX/arc-templates.mm index fa4e0a777642..931b21f5d47a 100644 --- a/test/SemaObjCXX/arc-templates.mm +++ b/test/SemaObjCXX/arc-templates.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s +// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s @interface A @end @@ -252,3 +252,17 @@ void test_qual_vs_unqual_a() { float &fr3 = qual_vs_unqual_ref(*aap); float &fr4 = qual_vs_unqual_ref(*uap); } + +namespace rdar9828157 { + // Template argument deduction involving lifetime qualifiers and + // non-lifetime types. + class A { }; + + template<typename T> float& f(T&); + template<typename T> int& f(__strong T&); + template<typename T> double& f(__weak T&); + + void test_f(A* ap) { + float &fr = (f)(ap); + } +} diff --git a/test/SemaObjCXX/arc-type-conversion.mm b/test/SemaObjCXX/arc-type-conversion.mm index f52f54a50cc4..48d1e4833b4c 100644 --- a/test/SemaObjCXX/arc-type-conversion.mm +++ b/test/SemaObjCXX/arc-type-conversion.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s +// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -fblocks %s // rdar://8843600 void * cvt(id arg) // expected-note{{candidate function not viable: cannot convert argument of incomplete type 'void *' to '__strong id'}} diff --git a/test/SemaObjCXX/arc-type-traits.mm b/test/SemaObjCXX/arc-type-traits.mm index f50904b03c73..b876018e2574 100644 --- a/test/SemaObjCXX/arc-type-traits.mm +++ b/test/SemaObjCXX/arc-type-traits.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-nonfragile-abi -fobjc-runtime-has-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s // Check the results of the various type-trait query functions on // lifetime-qualified types in ARC. diff --git a/test/SemaObjCXX/arc-unavailable-for-weakref.mm b/test/SemaObjCXX/arc-unavailable-for-weakref.mm index a7b357006843..24593ce5e4ed 100644 --- a/test/SemaObjCXX/arc-unavailable-for-weakref.mm +++ b/test/SemaObjCXX/arc-unavailable-for-weakref.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify %s // rdar://9693477 __attribute__((objc_arc_weak_reference_unavailable)) diff --git a/test/SemaObjCXX/exceptions-fragile.mm b/test/SemaObjCXX/exceptions-fragile.mm index 71e259aa6bba..91b70774e401 100644 --- a/test/SemaObjCXX/exceptions-fragile.mm +++ b/test/SemaObjCXX/exceptions-fragile.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fobjc-fragile-abi -fsyntax-only -verify %s @interface NSException @end void opaque(); diff --git a/test/SemaObjCXX/linkage-spec.mm b/test/SemaObjCXX/linkage-spec.mm index 1454e6a6782c..584571de9636 100644 --- a/test/SemaObjCXX/linkage-spec.mm +++ b/test/SemaObjCXX/linkage-spec.mm @@ -10,3 +10,12 @@ extern "C" { @interface I @end + +// rdar://10015110 +@protocol VKAnnotation; +extern "C" { + +@protocol VKAnnotation + @property (nonatomic, assign) id coordinate; +@end +} diff --git a/test/SemaObjCXX/message.mm b/test/SemaObjCXX/message.mm index 4f7f8bca5eb1..51a15d5773ba 100644 --- a/test/SemaObjCXX/message.mm +++ b/test/SemaObjCXX/message.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify %s @interface I1 - (int*)method; @end diff --git a/test/SemaObjCXX/nullptr.mm b/test/SemaObjCXX/nullptr.mm index 4a9d1a07de9d..2b29b043923a 100644 --- a/test/SemaObjCXX/nullptr.mm +++ b/test/SemaObjCXX/nullptr.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fblocks -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fblocks -fsyntax-only -verify %s @interface A @end diff --git a/test/SemaObjCXX/propert-dot-error.mm b/test/SemaObjCXX/propert-dot-error.mm index 7a5feb42e5b1..747efeb536b4 100644 --- a/test/SemaObjCXX/propert-dot-error.mm +++ b/test/SemaObjCXX/propert-dot-error.mm @@ -50,3 +50,20 @@ void g(B *b) { b->operator+ = 17; // expected-error{{'B' does not have a member named 'operator+'}} } @end + +// PR9759 +class Forward; +@interface D { +@public + int ivar; +} + +@property int property; +@end + +void testD(D *d) { + d.Forward::property = 17; // expected-error{{property access cannot be qualified with 'Forward::'}} + d->Forward::ivar = 12; // expected-error{{ivar access cannot be qualified with 'Forward::'}} + d.D::property = 17; // expected-error{{expected a class or namespace}} + d->D::ivar = 12; // expected-error{{expected a class or namespace}} +} diff --git a/test/SemaObjCXX/property-reference.mm b/test/SemaObjCXX/property-reference.mm index 5dc8061de70b..236dba61fc2d 100644 --- a/test/SemaObjCXX/property-reference.mm +++ b/test/SemaObjCXX/property-reference.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify %s // rdar://9070460 class TCPPObject @@ -29,7 +29,7 @@ typedef const TCPPObject& CREF_TCPPObject; @implementation TNSObject @synthesize cppObjectNonAtomic; -@synthesize cppObjectAtomic; +@synthesize cppObjectAtomic; // expected-warning{{atomic property of type 'CREF_TCPPObject' (aka 'const TCPPObject &') synthesizing setter using non-trivial assignment operator}} @dynamic cppObjectDynamic; - (const TCPPObject&) cppObjectNonAtomic diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm index c7a279cfd7a0..5ba4b70a2b69 100644 --- a/test/SemaObjCXX/property-synthesis-error.mm +++ b/test/SemaObjCXX/property-synthesis-error.mm @@ -10,7 +10,7 @@ NSMutableArray * _array; } -@property (readonly) NSArray * array; +@property (readonly) NSMutableArray * array; @end @@ -30,3 +30,45 @@ int main(void) { return 0; } + +// rdar://6137845 +class TCPPObject +{ +public: + TCPPObject(const TCPPObject& inObj); + TCPPObject(); + ~TCPPObject(); + TCPPObject& operator=(const TCPPObject& inObj); +private: + void* fData; +}; + +class Trivial +{ +public: + Trivial(const Trivial& inObj); + Trivial(); + ~Trivial(); +private: + void* fData; +}; + +@interface MyDocument +{ +@private + TCPPObject _cppObject; + TCPPObject _ncppObject; + Trivial _tcppObject; +} +@property (assign, readwrite) const TCPPObject& cppObject; +@property (assign, readwrite, nonatomic) const TCPPObject& ncppObject; +@property (assign, readwrite) const Trivial& tcppObject; +@end + +@implementation MyDocument + +@synthesize cppObject = _cppObject; // expected-warning {{atomic property of type 'const TCPPObject &' synthesizing setter using non-trivial assignment operator}} +@synthesize ncppObject = _ncppObject; + +@synthesize tcppObject = _tcppObject; +@end diff --git a/test/SemaObjCXX/unknown-anytype.mm b/test/SemaObjCXX/unknown-anytype.mm new file mode 100644 index 000000000000..163dddee708f --- /dev/null +++ b/test/SemaObjCXX/unknown-anytype.mm @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fdebugger-support -funknown-anytype -fsyntax-only -verify %s + +// rdar://problem/9416370 +namespace test0 { + void test(id x) { + [x foo]; // expected-error {{no known method '-foo'; cast the message send to the method's return type}} + } +} diff --git a/test/SemaOpenCL/local.cl b/test/SemaOpenCL/local.cl new file mode 100644 index 000000000000..8637cfff30d1 --- /dev/null +++ b/test/SemaOpenCL/local.cl @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +__kernel void foo(void) { + __local int i; + __local int j = 2; // expected-error {{'__local' variable cannot have an initializer}} +} diff --git a/test/SemaOpenCL/vector_conv_invalid.cl b/test/SemaOpenCL/vector_conv_invalid.cl new file mode 100644 index 000000000000..e6ef5a492f8c --- /dev/null +++ b/test/SemaOpenCL/vector_conv_invalid.cl @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify %s + +typedef unsigned int uint4 __attribute((ext_vector_type(4))); +typedef int int4 __attribute((ext_vector_type(4))); +typedef int int3 __attribute((ext_vector_type(3))); +typedef unsigned uint3 __attribute((ext_vector_type(3))); + +void vector_conv_invalid() { + uint4 u = (uint4)(1); + int4 i = u; // expected-error{{initializing 'int4' with an expression of incompatible type 'uint4'}} + int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' and 'uint4'}} + + uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' and 'uint4'}} +} diff --git a/test/SemaOpenCL/vector_literals_invalid.cl b/test/SemaOpenCL/vector_literals_invalid.cl index 957680f44ffe..e4e23cd85f00 100644 --- a/test/SemaOpenCL/vector_literals_invalid.cl +++ b/test/SemaOpenCL/vector_literals_invalid.cl @@ -8,6 +8,6 @@ void vector_literals_invalid() { int4 a = (int4)(1,2,3); // expected-error{{too few elements}} int4 b = (int4)(1,2,3,4,5); // expected-error{{excess elements in vector}} - ((float4)(1.0f))++; // expected-error{{expression is not assignable}} + ((float4)(1.0f))++; // expected-error{{cannot increment value of type 'float4'}} int8 d = (int8)(a,(float4)(1)); // expected-error{{initializing 'int' with an expression of incompatible type 'float4'}} } diff --git a/test/SemaTemplate/alias-church-numerals.cpp b/test/SemaTemplate/alias-church-numerals.cpp index 751cac73ae0f..69d77163ab67 100644 --- a/test/SemaTemplate/alias-church-numerals.cpp +++ b/test/SemaTemplate/alias-church-numerals.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<template<template<typename> class, typename> class T, template<typename> class V> struct PartialApply { template<typename W> using R = T<V, W>; diff --git a/test/SemaTemplate/alias-nested-nontag.cpp b/test/SemaTemplate/alias-nested-nontag.cpp index 1bb5ce336f90..4b5226b26ebb 100644 --- a/test/SemaTemplate/alias-nested-nontag.cpp +++ b/test/SemaTemplate/alias-nested-nontag.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<typename T> using Id = T; // expected-note {{type alias template 'Id' declared here}} struct U { static Id<int> V; }; diff --git a/test/SemaTemplate/alias-template-template-param.cpp b/test/SemaTemplate/alias-template-template-param.cpp index a847b0672a2a..c22fccb6788e 100644 --- a/test/SemaTemplate/alias-template-template-param.cpp +++ b/test/SemaTemplate/alias-template-template-param.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template<template<typename> class D> using C = D<int>; diff --git a/test/SemaTemplate/alias-templates.cpp b/test/SemaTemplate/alias-templates.cpp index f4c917c5ebc2..79d6849a6efe 100644 --- a/test/SemaTemplate/alias-templates.cpp +++ b/test/SemaTemplate/alias-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template<typename S> struct A { diff --git a/test/SemaTemplate/atomics.cpp b/test/SemaTemplate/atomics.cpp new file mode 100644 index 000000000000..7165bbe591e9 --- /dev/null +++ b/test/SemaTemplate/atomics.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR8345 +template<typename T> T f(T* value) { + return __sync_add_and_fetch(value, 1); +} +int g(long long* x) { return f(x); } +int g(int* x) { return f(x); } diff --git a/test/SemaTemplate/attributes.cpp b/test/SemaTemplate/attributes.cpp index e208bd2b8990..495f4a7ad389 100644 --- a/test/SemaTemplate/attributes.cpp +++ b/test/SemaTemplate/attributes.cpp @@ -19,3 +19,16 @@ namespace attribute_aligned { check_alignment<3>::t c3; // expected-note 2 {{in instantiation}} check_alignment<4>::t c4; } + +namespace PR9049 { + extern const void *CFRetain(const void *ref); + + template<typename T> __attribute__((cf_returns_retained)) + inline T WBCFRetain(T aValue) { return aValue ? (T)CFRetain(aValue) : (T)0; } + + + extern void CFRelease(const void *ref); + + template<typename T> + inline void WBCFRelease(__attribute__((cf_consumed)) T aValue) { if(aValue) CFRelease(aValue); } +} diff --git a/test/SemaTemplate/canonical-expr-type-0x.cpp b/test/SemaTemplate/canonical-expr-type-0x.cpp index 73cf3c29665c..94ae360b43ef 100644 --- a/test/SemaTemplate/canonical-expr-type-0x.cpp +++ b/test/SemaTemplate/canonical-expr-type-0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s void f(); diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index fe7213f14385..ccef811e2224 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -215,3 +215,23 @@ namespace PR9255 { }; }; } + +namespace rdar10194295 { + template<typename XT> + class X { + public: + enum Enum { Yes, No }; + template<Enum> void foo(); + template<Enum> class Inner; + }; + + template<typename XT> + template<typename X<XT>::Enum> + void X<XT>::foo() + { + } + + template<typename XT> + template<typename X<XT>::Enum> + class X<XT>::Inner { }; +} diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp index 0f7ba4678b8e..77143136c3d2 100644 --- a/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/test/SemaTemplate/default-arguments-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s // Test default template arguments for function templates. template<typename T = int> diff --git a/test/SemaTemplate/delegating-constructors.cpp b/test/SemaTemplate/delegating-constructors.cpp new file mode 100644 index 000000000000..d82343402b74 --- /dev/null +++ b/test/SemaTemplate/delegating-constructors.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify + +namespace PR10457 { + + class string + { + string(const char* str, unsigned); + + public: + template <unsigned N> + string(const char (&str)[N]) + : string(str) {} // expected-error{{constructor for 'string<6>' creates a delegation cycle}} + }; + + void f() { + string s("hello"); + } +} diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index 7bab5d18d1ad..36e1ad8f17f0 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s typedef double A; template<typename T> class B { diff --git a/test/SemaTemplate/instantiate-array.cpp b/test/SemaTemplate/instantiate-array.cpp index 97ea6cbb8e53..b8229d3f641a 100644 --- a/test/SemaTemplate/instantiate-array.cpp +++ b/test/SemaTemplate/instantiate-array.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 #ifndef __GXX_EXPERIMENTAL_CXX0X__ #define __CONCAT(__X, __Y) __CONCAT1(__X, __Y) diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index 7af59fd2d11b..896437488d68 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -170,3 +170,16 @@ namespace PR6424 { template void Y2<3>::f(); } + +namespace PR10864 { + template<typename T> class Vals {}; + template<> class Vals<int> { public: static const int i = 1; }; + template<> class Vals<float> { public: static const double i; }; + template<typename T> void test_asm_tied(T o) { + __asm("addl $1, %0" : "=r" (o) : "0"(Vals<T>::i)); // expected-error {{input with type 'double' matching output with type 'float'}} + } + void test_asm_tied() { + test_asm_tied(1); + test_asm_tied(1.f); // expected-note {{instantiation of}} + } +} diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index 521d2180d7ab..9483f9b28366 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -135,6 +135,23 @@ namespace PR5755 { } } +namespace PR10480 { + template<typename T> + struct X { + X(); + ~X() { + T *ptr = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + } + }; + + template<typename T> + void f() { + new X<int>[1]; // expected-note{{in instantiation of member function 'PR10480::X<int>::~X' requested here}} + } + + template void f<int>(); +} + // --------------------------------------------------------------------- // throw expressions // --------------------------------------------------------------------- diff --git a/test/SemaTemplate/instantiate-expr-basic.cpp b/test/SemaTemplate/instantiate-expr-basic.cpp index 074fe6941490..a266a6584b06 100644 --- a/test/SemaTemplate/instantiate-expr-basic.cpp +++ b/test/SemaTemplate/instantiate-expr-basic.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++11 %s template <typename T> struct S { diff --git a/test/SemaTemplate/instantiate-function-2.cpp b/test/SemaTemplate/instantiate-function-2.cpp index 087ede2b89cb..19a8b61ff193 100644 --- a/test/SemaTemplate/instantiate-function-2.cpp +++ b/test/SemaTemplate/instantiate-function-2.cpp @@ -46,7 +46,7 @@ namespace PR9654 { namespace AliasTagDef { template<typename T> T f() { - using S = struct { // expected-warning {{C++0x}} + using S = struct { // expected-warning {{C++11}} T g() { return T(); } diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index 1028b45cc0e1..c67eb4022a47 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -108,7 +108,7 @@ namespace test2 { namespace AliasTagDef { template<typename T> struct F { - using S = struct U { // expected-warning {{C++0x}} + using S = struct U { // expected-warning {{C++11}} T g() { return T(); } diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp index 0c0607524834..d2b0459ccc58 100644 --- a/test/SemaTemplate/instantiate-static-var.cpp +++ b/test/SemaTemplate/instantiate-static-var.cpp @@ -11,7 +11,7 @@ X<int, 0> xi0; // expected-note{{in instantiation of template class 'X<int, 0>' template<typename T> class Y { - static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a C++0x extension}} + static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a GNU extension}} }; Y<float> fy; // expected-note{{in instantiation of template class 'Y<float>' requested here}} diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp index f4ce0e173146..89cae03af08f 100644 --- a/test/SemaTemplate/instantiate-try-catch.cpp +++ b/test/SemaTemplate/instantiate-try-catch.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++11 -verify %s template<typename T> struct TryCatch0 { void f() { diff --git a/test/SemaTemplate/lookup-dependent-bases.cpp b/test/SemaTemplate/lookup-dependent-bases.cpp new file mode 100644 index 000000000000..2710caf22125 --- /dev/null +++ b/test/SemaTemplate/lookup-dependent-bases.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + +class C { +public: + static void foo2() { } +}; +template <class T> +class A { +public: + typedef C D; +}; + +template <class T> +class B : public A<T> { +public: + void foo() { + D::foo2(); + } +}; diff --git a/test/SemaTemplate/member-inclass-init-value-dependent.cpp b/test/SemaTemplate/member-inclass-init-value-dependent.cpp index d1ae4f2ded5f..5bff7f209579 100644 --- a/test/SemaTemplate/member-inclass-init-value-dependent.cpp +++ b/test/SemaTemplate/member-inclass-init-value-dependent.cpp @@ -9,3 +9,10 @@ void test() { foo<4> bar; } +struct S { + S(int n); +}; +template<typename> struct T { + S s = 0; +}; +T<int> t; diff --git a/test/SemaTemplate/missing-class-keyword-crash.cpp b/test/SemaTemplate/missing-class-keyword-crash.cpp new file mode 100644 index 000000000000..f0eee2ba2f8a --- /dev/null +++ b/test/SemaTemplate/missing-class-keyword-crash.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +class G {}; +template <Foo> // expected-error{{unknown type name 'Foo'}} \ + // expected-note{{template parameter is declared here}} +class Bar {}; + +class Bar<G> blah_test; // expected-error{{template argument for non-type template parameter must be an expression}} diff --git a/test/SemaTemplate/ms-function-specialization-class-scope.cpp b/test/SemaTemplate/ms-function-specialization-class-scope.cpp new file mode 100644 index 000000000000..bda87f99c9a1 --- /dev/null +++ b/test/SemaTemplate/ms-function-specialization-class-scope.cpp @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + + +class A { +public: + template <class U> + A(U p) { + } + template <> + A(int p) { // expected-warning{{explicit specialization of 'A' within class scope is a Microsoft extension}} + } + + template <class U> + void f(U p) { + } + + template <> + void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} + } + + void f(int p) { + } +}; + +void test1() +{ + A a(3); + char* b ; + a.f(b); + a.f<int>(99); + a.f(100); +} + + + + +template <class T> +class B { +public: + template <class U> + B(U p) { + } + template <> + B(int p) { // expected-warning{{explicit specialization of 'B<T>' within class scope is a Microsoft extension}} + } + + template <class U> + void f(U p) { + T y = 9; + } + + + template <> + void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} + T a = 3; + } + + void f(int p) { + T a = 3; + } +}; + +void test2() +{ + B<char> b(3); + char* ptr; + b.f(ptr); + b.f<int>(99); + b.f(100); +} + diff --git a/test/SemaTemplate/ms-lookup-template-base-classes.cpp b/test/SemaTemplate/ms-lookup-template-base-classes.cpp new file mode 100644 index 000000000000..910fa37e80d8 --- /dev/null +++ b/test/SemaTemplate/ms-lookup-template-base-classes.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s + + +template <class T> +class A { +public: + void f(T a) { }// expected-note {{must qualify identifier to find this declaration in dependent base class}} + void g();// expected-note {{must qualify identifier to find this declaration in dependent base class}} +}; + + +template <class T> +class B : public A<T> { +public: + void z(T a) + { + f(a); // expected-warning {{use of identifier 'f' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} + g(); // expected-warning {{use of identifier 'g' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}} + } +}; + +template class B<int>; // expected-note {{requested here}} +template class B<char>; + +void test() +{ + B<int> b; + b.z(3); +} + + diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp index 01ede32f9a08..ab647aa22675 100644 --- a/test/SemaTemplate/nested-template.cpp +++ b/test/SemaTemplate/nested-template.cpp @@ -125,4 +125,20 @@ X2<int>::Inner<X2_arg> x2i1; X2<float> x2a; // expected-note{{instantiation}} X2<long>::Inner<X2_arg> x2i3; // expected-error{{template template argument has different}} +namespace PR10896 { + template<typename TN> + class Foo { + + public: + void foo() {} + private: + + template<typename T> + T SomeField; // expected-error {{member 'SomeField' declared as a template}} + }; + void g() { + Foo<int> f; + f.foo(); + } +} diff --git a/test/SemaTemplate/operator-template.cpp b/test/SemaTemplate/operator-template.cpp index 4300755cf711..777b0f5f42a1 100644 --- a/test/SemaTemplate/operator-template.cpp +++ b/test/SemaTemplate/operator-template.cpp @@ -2,7 +2,8 @@ // Make sure we accept this template<class X>struct A{typedef X Y;}; -template<class X>bool operator==(A<X>,typename A<X>::Y); +template<class X>bool operator==(A<X>,typename A<X>::Y); // expected-note{{candidate template ignored: failed template argument deduction}} + int a(A<int> x) { return operator==(x,1); } int a0(A<int> x) { return x == 1; } @@ -10,7 +11,8 @@ int a0(A<int> x) { return x == 1; } // FIXME: the location information for the note isn't very good template<class X>struct B{typedef X Y;}; template<class X>bool operator==(B<X>*,typename B<X>::Y); // \ -expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ -expected-note{{in instantiation of function template specialization}} -int a(B<int> x) { return operator==(&x,1); } +// expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ +// expected-note{{in instantiation of function template specialization}} \ +// expected-note{{candidate template ignored: substitution failure [with X = int]}} +int a(B<int> x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} diff --git a/test/SemaTemplate/overload-uneval.cpp b/test/SemaTemplate/overload-uneval.cpp index 632d1cd521d9..8d8a2f42cf28 100644 --- a/test/SemaTemplate/overload-uneval.cpp +++ b/test/SemaTemplate/overload-uneval.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused %s // Tests that overload resolution is treated as an unevaluated context. // PR5541 diff --git a/test/SemaTemplate/resolve-single-template-id.cpp b/test/SemaTemplate/resolve-single-template-id.cpp index ef0a76307670..b9833d8609ef 100644 --- a/test/SemaTemplate/resolve-single-template-id.cpp +++ b/test/SemaTemplate/resolve-single-template-id.cpp @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s namespace std { class type_info {}; } void one() { } -void two() { } // expected-note 3{{candidate}} -void two(int) { } // expected-note 3{{candidate}} +void two() { } // expected-note 4{{possible target for call}} +void two(int) { } // expected-note 4{{possible target for call}} -template<class T> void twoT() { } // expected-note 5{{candidate}} -template<class T> void twoT(int) { } // expected-note 5{{candidate}} +template<class T> void twoT() { } // expected-note 5{{possible target for call}} +template<class T> void twoT(int) { } // expected-note 5{{possible target for call}} template<class T> void oneT() { } template<class T, class U> void oneT(U) { } @@ -29,29 +29,30 @@ template<void (*p)(int)> struct test { }; int main() { one; // expected-warning {{expression result unused}} - two; // expected-error {{cannot resolve overloaded function 'two' from context}} + two; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} oneT<int>; // expected-warning {{expression result unused}} - twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}} + twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} typeid(oneT<int>); // expected-warning{{expression result unused}} sizeof(oneT<int>); // expected-warning {{expression result unused}} - sizeof(twoT<int>); //expected-error {{cannot resolve overloaded function 'twoT' from context}} + sizeof(twoT<int>); //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} decltype(oneT<int>)* fun = 0; *one; // expected-warning {{expression result unused}} *oneT<int>; // expected-warning {{expression result unused}} - *two; //expected-error {{cannot resolve overloaded function 'two' from context}} - *twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} + *two; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{indirection requires pointer operand}} + *twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} !oneT<int>; // expected-warning {{expression result unused}} +oneT<int>; // expected-warning {{expression result unused}} -oneT<int>; //expected-error {{invalid argument type}} - oneT<int> == 0; // expected-warning {{expression result unused}} - 0 == oneT<int>; // expected-warning {{expression result unused}} - 0 != oneT<int>; // expected-warning {{expression result unused}} + oneT<int> == 0; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} + 0 == oneT<int>; // expected-warning {{equality comparison result unused}} + 0 != oneT<int>; // expected-warning {{inequality comparison result unused}} (false ? one : oneT<int>); // expected-warning {{expression result unused}} void (*p1)(int); p1 = oneT<int>; int i = (int) (false ? (void (*)(int))twoT<int> : oneT<int>); //expected-error {{incompatible operand}} - (twoT<int>) == oneT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} + (twoT<int>) == oneT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} bool b = oneT<int>; void (*p)() = oneT<int>; test<oneT<int> > ti; @@ -65,9 +66,10 @@ int main() oneT<int> < oneT<int>; //expected-warning {{self-comparison always evaluates to false}} \ //expected-warning {{expression result unused}} - two < two; //expected-error {{cannot resolve overloaded function 'two' from context}} - twoT<int> < twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}} - oneT<int> == 0; // expected-warning {{expression result unused}} + two < two; //expected-error 2 {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} expected-error {{invalid operands to binary expression ('void' and 'void')}} + twoT<int> < twoT<int>; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}} {{cannot resolve overloaded function 'twoT' from context}} + oneT<int> == 0; // expected-warning {{equality comparison result unused}} \ + // expected-note {{use '=' to turn this equality comparison into an assignment}} } @@ -76,5 +78,5 @@ struct rdar9108698 { }; void test_rdar9108698(rdar9108698 x) { - x.f<int>; // expected-error{{a bound member function may only be called}} + x.f<int>; // expected-error{{reference to non-static member function must be called}} } diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index 5be5a1303136..747ddcc4618e 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -7,7 +7,7 @@ A<int()> *a1; // expected-error{{template argument for non-type template paramet A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}} -A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}} +A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++11}} // C++ [temp.arg.nontype]p5: A<A> *a4; // expected-error{{must be an expression}} @@ -170,7 +170,7 @@ namespace pr6249 { namespace PR6723 { template<unsigned char C> void f(int (&a)[C]); // expected-note {{candidate template ignored}} \ - // expected-note{{candidate function [with C = '\x00'] not viable: no known conversion from 'int [512]' to 'int (&)[0]' for 1st argument}} + // expected-note{{substitution failure [with C = '\x00']}} void g() { int arr512[512]; f(arr512); // expected-error{{no matching function for call}} @@ -263,3 +263,63 @@ namespace PR9227 { void test_char_single_quote() { enable_if_char<'\''>::type i; } // expected-error{{enable_if_char<'\''>}} void test_char_backslash() { enable_if_char<'\\'>::type i; } // expected-error{{enable_if_char<'\\'>}} } + +namespace PR10579 { + namespace fcppt + { + namespace container + { + namespace bitfield + { + + template< + typename Enum, + Enum Size + > + class basic; + + template< + typename Enum, + Enum Size + > + class basic + { + public: + basic() + { + } + }; + + } + } + } + + namespace + { + + namespace testenum + { + enum type + { + foo, + bar, + size + }; + } + + } + + int main() + { + typedef fcppt::container::bitfield::basic< + testenum::type, + testenum::size + > bitfield_foo; + + bitfield_foo obj; + } + +} + +template <int& I> struct PR10766 { static int *ip; }; +template <int& I> int* PR10766<I>::ip = &I; diff --git a/test/SemaTemplate/temp_explicit_cxx0x.cpp b/test/SemaTemplate/temp_explicit_cxx0x.cpp index 215d2cfa0820..9d6dc80b5b0a 100644 --- a/test/SemaTemplate/temp_explicit_cxx0x.cpp +++ b/test/SemaTemplate/temp_explicit_cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s namespace N1 { template<typename T> struct X0 { }; // expected-note{{here}} diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 7898a20d6e17..9eb4f33de0b9 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -102,3 +102,16 @@ struct H { }; G<H> struct_G; + +namespace PR10925 { + template< int mydim, typename Traits > + class BasicGeometry + { + typedef int some_type_t; + }; + + template<class ctype, int mydim, int coorddim> + class MockGeometry : BasicGeometry<mydim, int>{ + using typename BasicGeometry<mydim, int>::operator[]; // expected-error {{typename is allowed for identifiers only}} + }; +} diff --git a/test/SemaTemplate/unresolved-construct.cpp b/test/SemaTemplate/unresolved-construct.cpp index 0d1ba17a0179..bb9ed8e4e081 100644 --- a/test/SemaTemplate/unresolved-construct.cpp +++ b/test/SemaTemplate/unresolved-construct.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s class A { public: diff --git a/test/lit.cfg b/test/lit.cfg index e18105df1916..8062aa72c1f1 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -165,7 +165,9 @@ config.substitutions.append( ### # Set available features we allow tests to conditionalize on. -if platform.system() != 'Windows': +# +# As of 2011.08, crash-recovery tests still do not pass on FreeBSD. +if platform.system() not in ['FreeBSD']: config.available_features.add('crash-recovery') # Shell execution |