diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
commit | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (patch) | |
tree | 2fd5819f49caecc5f520219b6b9254fe94ebb138 /test | |
parent | 1569ce68681d909594d64f9b056d71f5dd7563bf (diff) |
Notes
Diffstat (limited to 'test')
661 files changed, 4507 insertions, 990 deletions
diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index b23998cfc68f9..3c11465157ae8 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -1,8 +1,8 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c index f3d371cbde46f..76d7ebbf15fca 100644 --- a/test/Analysis/CFNumber.c +++ b/test/Analysis/CFNumber.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 04e9add58b5a1..16f8db21e835b 100644 --- a/test/Analysis/CFRetainRelease_NSAssertionHandler.m +++ b/test/Analysis/CFRetainRelease_NSAssertionHandler.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region typedef struct objc_selector *SEL; typedef signed char BOOL; diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c index ae628989cd61b..d69f86e9fd4a1 100644 --- a/test/Analysis/CGColorSpace.c +++ b/test/Analysis/CGColorSpace.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 219354b20fdf6..ec44b22aa4fc6 100644 --- a/test/Analysis/CheckNSError.m +++ b/test/Analysis/CheckNSError.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef signed char BOOL; diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m index 21460a1a324d0..cb5339a4cdab9 100644 --- a/test/Analysis/MissingDealloc.m +++ b/test/Analysis/MissingDealloc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-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 20e3efff4c607..c98a685b1f40b 100644 --- a/test/Analysis/NSPanel.m +++ b/test/Analysis/NSPanel.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s // BEGIN delta-debugging reduced header stuff diff --git a/test/Analysis/NSString-failed-cases.m b/test/Analysis/NSString-failed-cases.m new file mode 100644 index 0000000000000..b7f8be07cbcdf --- /dev/null +++ b/test/Analysis/NSString-failed-cases.m @@ -0,0 +1,115 @@ +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// XFAIL: * + +//===----------------------------------------------------------------------===// +// 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 directly including Foundation.h directly makes this test case +// both svelte and portable to non-Mac platforms. +//===----------------------------------------------------------------------===// + +#ifdef TEST_64 +typedef long long int64_t; +_Bool OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ); +#define COMPARE_SWAP_BARRIER OSAtomicCompareAndSwap64Barrier +typedef int64_t intptr_t; +#else +typedef int int32_t; +_Bool OSAtomicCompareAndSwap32Barrier( int32_t __oldValue, int32_t __newValue, volatile int32_t *__theValue ); +#define COMPARE_SWAP_BARRIER OSAtomicCompareAndSwap32Barrier +typedef int32_t intptr_t; +#endif + +typedef const void * CFTypeRef; +typedef const struct __CFString * CFStringRef; +typedef const struct __CFAllocator * CFAllocatorRef; +extern const CFAllocatorRef kCFAllocatorDefault; +extern CFTypeRef CFRetain(CFTypeRef cf); +void CFRelease(CFTypeRef cf); +typedef const struct __CFDictionary * CFDictionaryRef; +const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key); +extern CFStringRef CFStringCreateWithFormat(CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, ...); +typedef signed char BOOL; +typedef int NSInteger; +typedef unsigned int NSUInteger; +@class NSString, Protocol; +extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); +typedef NSInteger NSComparisonResult; +typedef struct _NSZone NSZone; +@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; +@protocol NSObject +- (BOOL)isEqual:(id)object; +- (oneway void)release; +- (id)retain; +- (id)autorelease; +@end +@protocol NSCopying +- (id)copyWithZone:(NSZone *)zone; +@end +@protocol NSMutableCopying +- (id)mutableCopyWithZone:(NSZone *)zone; +@end +@protocol NSCoding +- (void)encodeWithCoder:(NSCoder *)aCoder; +@end +@interface NSObject <NSObject> {} +- (id)init; ++ (id)alloc; +@end +extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); +typedef struct {} NSFastEnumerationState; +@protocol NSFastEnumeration +- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; +@end +@class NSString; +typedef struct _NSRange {} NSRange; +@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> +- (NSUInteger)count; +@end +@interface NSMutableArray : NSArray +- (void)addObject:(id)anObject; +- (id)initWithCapacity:(NSUInteger)numItems; +@end +typedef unsigned short unichar; +@class NSData, NSArray, NSDictionary, NSCharacterSet, NSData, NSURL, NSError, NSLocale; +typedef NSUInteger NSStringCompareOptions; +@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; +- (NSComparisonResult)compare:(NSString *)string; +- (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask; +- (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange; +- (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange locale:(id)locale; +- (NSComparisonResult)caseInsensitiveCompare:(NSString *)string; +- (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)separator; ++ (id)stringWithFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); +@end +@interface NSSimpleCString : NSString {} @end +@interface NSConstantString : NSSimpleCString @end +extern void *_NSConstantStringClassReference; + +//===----------------------------------------------------------------------===// +// Test cases. These should all be merged into NSString.m once these tests +// stop reporting leaks. +//===----------------------------------------------------------------------===// + +// FIXME: THIS TEST CASE INCORRECTLY REPORTS A LEAK. +void testOSCompareAndSwapXXBarrier_parameter(NSString **old) { + NSString *s = [[NSString alloc] init]; // no-warning + if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) old)) + [s release]; + else + [*old release]; +} + +// FIXME: THIS TEST CASE INCORRECTLY REPORTS A LEAK. +void testOSCompareAndSwapXXBarrier_parameter_no_direct_release(NSString **old) { + NSString *s = [[NSString alloc] init]; // no-warning + if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) old)) + return; + else + [*old release]; +} diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m index 481a94055ffd3..d7804dc5f42aa 100644 --- a/test/Analysis/NSString.m +++ b/test/Analysis/NSString.m @@ -1,13 +1,13 @@ -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s -// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s // ==-- FIXME: -analyzer-store=basic fails on this file (false negatives). --== -// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// NOTWORK: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && +// NOTWORK: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && +// NOTWORK: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && +// NOTWORK: clang -cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from @@ -291,7 +291,7 @@ void testOSCompareAndSwap() { [old release]; } -void testOSCompareAndSwapXXBarrier() { +void testOSCompareAndSwapXXBarrier_local() { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) &old)) @@ -300,9 +300,9 @@ void testOSCompareAndSwapXXBarrier() { [old release]; } -void testOSCompareAndSwapXXBarrier_positive() { +void testOSCompareAndSwapXXBarrier_local_no_direct_release() { NSString *old = 0; - NSString *s = [[NSString alloc] init]; // expected-warning{{leak}} + NSString *s = [[NSString alloc] init]; // no-warning if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) &old)) return; else @@ -315,7 +315,7 @@ int testOSCompareAndSwapXXBarrier_id(Class myclass, id xclass) { return 0; } -void test_objc_atomicCompareAndSwap() { +void test_objc_atomicCompareAndSwap_local() { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!objc_atomicCompareAndSwapPtr(0, s, &old)) @@ -324,15 +324,31 @@ void test_objc_atomicCompareAndSwap() { [old release]; } -void test_objc_atomicCompareAndSwap_positive() { +void test_objc_atomicCompareAndSwap_local_no_direct_release() { NSString *old = 0; - NSString *s = [[NSString alloc] init]; // expected-warning{{leak}} + NSString *s = [[NSString alloc] init]; // no-warning if (!objc_atomicCompareAndSwapPtr(0, s, &old)) return; else [old release]; } +void test_objc_atomicCompareAndSwap_parameter(NSString **old) { + NSString *s = [[NSString alloc] init]; // no-warning + if (!objc_atomicCompareAndSwapPtr(0, s, old)) + [s release]; + else + [*old release]; +} + +void test_objc_atomicCompareAndSwap_parameter_no_direct_release(NSString **old) { + NSString *s = [[NSString alloc] init]; // expected-warning{{leak}} + if (!objc_atomicCompareAndSwapPtr(0, s, old)) + return; + else + [*old release]; +} + // Test stringWithFormat (<rdar://problem/6815234>) void test_stringWithFormat() { diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m index 5eb6cf1e47704..6d017293cc682 100644 --- a/test/Analysis/NSWindow.m +++ b/test/Analysis/NSWindow.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -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 cf708b4f8970b..ad441a3b9b841 100644 --- a/test/Analysis/NoReturn.m +++ b/test/Analysis/NoReturn.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s #include <stdarg.h> diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m index 6c367f427d46d..89d8f9b297b1b 100644 --- a/test/Analysis/ObjCProperties.m +++ b/test/Analysis/ObjCProperties.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 60a85fd791ed8..416ef1c8eed87 100644 --- a/test/Analysis/ObjCRetSigs.m +++ b/test/Analysis/ObjCRetSigs.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-methodsigs -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-methodsigs -verify %s int printf(const char *, ...); diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m index fd5ae95d5842a..ea71ad2a237b4 100644 --- a/test/Analysis/PR2599.m +++ b/test/Analysis/PR2599.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=region -checker-cfref -fobjc-gc -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=region -checker-cfref -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 8a94fe848993e..428997f709c67 100644 --- a/test/Analysis/PR2978.m +++ b/test/Analysis/PR2978.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-objc-missing-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 53a6b5257a770..a1d465734df7e 100644 --- a/test/Analysis/PR3991.m +++ b/test/Analysis/PR3991.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s //===----------------------------------------------------------------------===// // Delta-debugging produced forward declarations. diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index c3822cdb443a9..2a833c48ff133 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s struct s { int data; diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m new file mode 100644 index 0000000000000..50a9d06e8f933 --- /dev/null +++ b/test/Analysis/blocks.m @@ -0,0 +1,69 @@ +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s + +//===----------------------------------------------------------------------===// +// The following code is reduced using delta-debugging from Mac OS X headers: +//===----------------------------------------------------------------------===// + +typedef __builtin_va_list va_list; +typedef unsigned int uint32_t; +typedef struct dispatch_queue_s *dispatch_queue_t; +typedef struct dispatch_queue_attr_s *dispatch_queue_attr_t; +typedef void (^dispatch_block_t)(void); +void dispatch_async(dispatch_queue_t queue, dispatch_block_t block); +__attribute__((visibility("default"))) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__nothrow__)) dispatch_queue_t dispatch_queue_create(const char *label, dispatch_queue_attr_t attr); +typedef long dispatch_once_t; +void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block); +typedef signed char BOOL; +typedef unsigned long NSUInteger; +typedef struct _NSZone NSZone; +@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; +@protocol NSObject +- (BOOL)isEqual:(id)object; +- (oneway void)release; +@end +@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end +@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end +@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end +@interface NSObject <NSObject> {} ++ (id)alloc; +@end +extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); +@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; +- ( const char *)UTF8String; +- (id)initWithFormat:(NSString *)format arguments:(va_list)argList __attribute__((format(__NSString__, 1, 0))); +@end +@class NSString, NSData; +typedef struct cssm_sample {} CSSM_SAMPLEGROUP, *CSSM_SAMPLEGROUP_PTR; +typedef struct __aslclient *aslclient; +typedef struct __aslmsg *aslmsg; +aslclient asl_open(const char *ident, const char *facility, uint32_t opts); +int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __attribute__((__format__ (__printf__, 4, 5))); + +//===----------------------------------------------------------------------===// +// Begin actual test cases. +//===----------------------------------------------------------------------===// + +// test1 - This test case exposed logic that caused the analyzer to crash because of a memory bug +// in BlockDataRegion. It represents real code that contains two block literals. Eventually +// via IPA 'logQueue' and 'client' should be updated after the call to 'dispatch_once'. +void test1(NSString *format, ...) { + static dispatch_queue_t logQueue; + static aslclient client; + static dispatch_once_t pred; + do { + if (__builtin_expect(*(&pred), ~0l) != ~0l) + dispatch_once(&pred, ^{ + logQueue = dispatch_queue_create("com.mycompany.myproduct.asl", ((void*)0)); + client = asl_open(((void*)0), "com.mycompany.myproduct", 0); + }); + } while (0); + + va_list args; + __builtin_va_start(args, format); + + NSString *str = [[NSString alloc] initWithFormat:format arguments:args]; + dispatch_async(logQueue, ^{ asl_log(client, ((void*)0), 4, "%s", [str UTF8String]); }); + [str release]; + + __builtin_va_end(args); +} diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index bee337a44572d..3c6b83b723917 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 69a4260537bd8..fb4252014b01a 100644 --- a/test/Analysis/casts.m +++ b/test/Analysis/casts.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 diff --git a/test/Analysis/cfref_PR2519.c b/test/Analysis/cfref_PR2519.c index d9367d4af61c5..48f757e51a71e 100644 --- a/test/Analysis/cfref_PR2519.c +++ b/test/Analysis/cfref_PR2519.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 a2b7477db8bca..27b4c51f96b70 100644 --- a/test/Analysis/cfref_rdar6080742.c +++ b/test/Analysis/cfref_rdar6080742.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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/complex.c b/test/Analysis/complex.c index 6b71a93e65a9d..605255e555ab7 100644 --- a/test/Analysis/complex.c +++ b/test/Analysis/complex.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s #include <stdint.h> diff --git a/test/Analysis/concrete-address.c b/test/Analysis/concrete-address.c index 96080bec3243e..fdede4beec706 100644 --- a/test/Analysis/concrete-address.c +++ b/test/Analysis/concrete-address.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s void foo() { int *p = (int*) 0x10000; // Should not crash here. diff --git a/test/Analysis/conditional-op-missing-lhs.c b/test/Analysis/conditional-op-missing-lhs.c index ed81d7b67200f..4b03785799010 100644 --- a/test/Analysis/conditional-op-missing-lhs.c +++ b/test/Analysis/conditional-op-missing-lhs.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -warn-uninit-values -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -warn-uninit-values -verify %s void f1() { diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index e29eefd8eb8b3..a0e889f2daa0b 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -1,8 +1,8 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s void f1() { int k, y; @@ -370,3 +370,60 @@ void f23_pos(int argc, char **argv) { f23_aux("I did too use it!\n"); }(); } + +void f24_A(int y) { + // FIXME: One day this should be reported as dead since 'z = x + y' is dead. + int x = (y > 2); // no-warning + ^ { + int z = x + y; // FIXME: Eventually this should be reported as a dead store. + }(); +} + +void f24_B(int y) { + // FIXME: One day this should be reported as dead since 'x' is just overwritten. + __block int x = (y > 2); // no-warning + ^{ + // FIXME: This should eventually be a dead store since it is never read either. + x = 5; // no-warning + }(); +} + +int f24_C(int y) { + // FIXME: One day this should be reported as dead since 'x' is just overwritten. + __block int x = (y > 2); // no-warning + ^{ + x = 5; // no-warning + }(); + return x; +} + +int f24_D(int y) { + __block int x = (y > 2); // no-warning + ^{ + if (y > 4) + x = 5; // no-warning + }(); + return x; +} + +// This example shows that writing to a variable captured by a block means that it might +// not be dead. +int f25(int y) { + __block int x = (y > 2); + __block int z = 0; + void (^foo)() = ^{ z = x + y; }; + x = 4; // no-warning + foo(); + return z; +} + +// This test is mostly the same as 'f25', but shows that the heuristic of pruning out dead +// stores for variables that are just marked '__block' is overly conservative. +int f25_b(int y) { + // FIXME: we should eventually report a dead store here. + __block int x = (y > 2); + __block int z = 0; + x = 4; // no-warning + return z; +} + diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp index 0bf32567f9dba..363cfdd98cc61 100644 --- a/test/Analysis/dead-stores.cpp +++ b/test/Analysis/dead-stores.cpp @@ -1,8 +1,12 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s + +//===----------------------------------------------------------------------===// +// Basic dead store checking (but in C++ mode). +//===----------------------------------------------------------------------===// int j; void f1() { @@ -17,3 +21,19 @@ void f1() { break; } } + +//===----------------------------------------------------------------------===// +// Dead store checking involving constructors. +//===----------------------------------------------------------------------===// + +class Test1 { + int &x; +public: + Test1(int &y) : x(y) {} + ~Test1() { ++x; } +}; + +int test_ctor_1(int x) { + { Test1 a(x); } // no-warning + return x; +} diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m index 0a5c0f8373016..4ad3c0a42da43 100644 --- a/test/Analysis/dead-stores.m +++ b/test/Analysis/dead-stores.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m index b854da6ec330e..df97866b85587 100644 --- a/test/Analysis/delegates.m +++ b/test/Analysis/delegates.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c index b6873ad899801..f3eee26342411 100644 --- a/test/Analysis/elementtype.c +++ b/test/Analysis/elementtype.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 098ec48f4ea3a..13f075de5ea18 100644 --- a/test/Analysis/exercise-ps.c +++ b/test/Analysis/exercise-ps.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 7ea6111bd48c7..e341918500362 100644 --- a/test/Analysis/fields.c +++ b/test/Analysis/fields.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify unsigned foo(); typedef struct bf { unsigned x:2; } bf; diff --git a/test/Analysis/func.c b/test/Analysis/func.c index 390a2793a497f..449a4c29ced8a 100644 --- a/test/Analysis/func.c +++ b/test/Analysis/func.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s void f(void) { void (*p)(void); diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index 6a17cba3497bf..0c5142ba4d3f1 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -1,7 +1,9 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s typedef __typeof(sizeof(int)) size_t; void *malloc(size_t); void free(void *); +void *realloc(void *ptr, size_t size); +void *calloc(size_t nmemb, size_t size); void f1() { int *p = malloc(10); @@ -35,3 +37,9 @@ int *f4() { p_f4 = malloc(10); return p_f4; // no-warning } + +int *f5() { + int *q = malloc(10); + q = realloc(q, 20); + return q; // no-warning +} diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m index f520784e11d31..ec4c3b4c65e9a 100644 --- a/test/Analysis/misc-ps-64.m +++ b/test/Analysis/misc-ps-64.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 index 2a982347a7b62..6af63f947291f 100644 --- a/test/Analysis/misc-ps-basic-store.m +++ b/test/Analysis/misc-ps-basic-store.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fblocks %s //--------------------------------------------------------------------------- // Test case 'checkaccess_union' differs for region store and basic store. diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m index e702cb968a578..e636c21b94908 100644 --- a/test/Analysis/misc-ps-eager-assume.m +++ b/test/Analysis/misc-ps-eager-assume.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume // Delta-reduced header stuff (needed for test cases). typedef signed char BOOL; @@ -120,3 +120,26 @@ void rdar7342806() { // be true when Pointer is not NULL. rdar7342806_aux(*Pointer); // no-warning } + +//===---------------------------------------------------------------------===// +// PR 5627 - http://llvm.org/bugs/show_bug.cgi?id=5627 +// This test case depends on using -analyzer-eagerly-assume and +// -analyzer-store=region. The '-analyzer-eagerly-assume' causes the path +// to bifurcate when evaluating the function call argument, and a state +// caching bug in GRExprEngine::CheckerVisit (and friends) caused the store +// to 'p' to not be evaluated along one path, but then an autotransition caused +// the path to keep on propagating with 'p' still set to an undefined value. +// We would then get a bogus report of returning uninitialized memory. +// Note: CheckerVisit mistakenly cleared an existing node, and the cleared +// node was resurrected by GRStmtNodeBuilder::~GRStmtNodeBuilder(), where +// 'p' was not assigned. +//===---------------------------------------------------------------------===// + +float *pr5627_f(int y); + +float *pr5627_g(int x) { + float *p; + p = pr5627_f(!x); + return p; // no-warning +} + diff --git a/test/Analysis/misc-ps-ranges.m b/test/Analysis/misc-ps-ranges.m index 058c903722c0d..92e20d647debf 100644 --- a/test/Analysis/misc-ps-ranges.m +++ b/test/Analysis/misc-ps-ranges.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 7b0d61bcbaeb5..f9df55270b66c 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-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 8c865ab27ff21..01d99f24c68f0 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-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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.m b/test/Analysis/misc-ps-region-store.m index e5113ba351c8f..e736e0f37cdb7 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s typedef struct objc_selector *SEL; typedef signed char BOOL; @@ -541,3 +541,98 @@ double rdar_6811085(void) { return u + 10; // expected-warning{{The left operand of '+' is a garbage value}} } +//===----------------------------------------------------------------------===// +// Path-sensitive tests for blocks. +//===----------------------------------------------------------------------===// + +void indirect_block_call(void (^f)()); + +int blocks_1(int *p, int z) { + __block int *q = 0; + void (^bar)() = ^{ q = p; }; + + if (z == 1) { + // The call to 'bar' might cause 'q' to be invalidated. + bar(); + *q = 0x1; // no-warning + } + else if (z == 2) { + // The function 'indirect_block_call' might invoke bar, thus causing + // 'q' to possibly be invalidated. + indirect_block_call(bar); + *q = 0x1; // no-warning + } + else { + *q = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}} + } + return z; +} + +int blocks_2(int *p, int z) { + int *q = 0; + void (^bar)(int **) = ^(int **r){ *r = p; }; + + if (z) { + // The call to 'bar' might cause 'q' to be invalidated. + bar(&q); + *q = 0x1; // no-warning + } + else { + *q = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}} + } + return z; +} + +//===----------------------------------------------------------------------===// +// <rdar://problem/7462324> - Test that variables passed using __blocks +// are not treated as being uninitialized. +//===----------------------------------------------------------------------===// + +typedef void (^RDar_7462324_Callback)(id obj); + +@interface RDar7462324 +- (void) foo:(id)target; +- (void) foo_positive:(id)target; + +@end + +@implementation RDar7462324 +- (void) foo:(id)target { + __block RDar_7462324_Callback builder = ((void*) 0); + builder = ^(id object) { + if (object) { + builder(self); // no-warning + } + }; + builder(target); +} +- (void) foo_positive:(id)target { + __block RDar_7462324_Callback builder = ((void*) 0); + builder = ^(id object) { + id x; + if (object) { + builder(x); // expected-warning{{Pass-by-value argument in function call is undefined}} + } + }; + builder(target); +} +@end + +//===----------------------------------------------------------------------===// +// <rdar://problem/7468209> - Scanning for live variables within a block should +// not crash on variables passed by reference via __block. +//===----------------------------------------------------------------------===// + +int rdar7468209_aux(); +void rdar7468209_aux2(); + +void rdar7468209() { + __block int x = 0; + ^{ + x = rdar7468209_aux(); + // We need a second statement so that 'x' would be removed from the store if it wasn't + // passed by reference. + rdar7468209_aux_2(); + }(); +} + diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 42168b9e3e4b3..c97ef951c5aa3 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -1,8 +1,8 @@ // NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued. -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s typedef struct objc_ivar *Ivar; typedef struct objc_selector *SEL; 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 75cdf6ed39329..227945620d78c 100644 --- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s -// RUN: clang-cc -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s +// RUN: clang -cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s +// RUN: clang -cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 af8db135926fe..eb4fc8d41aaec 100644 --- a/test/Analysis/no-exit-cfg.c +++ b/test/Analysis/no-exit-cfg.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 475a2116a7c83..8aa194d31b874 100644 --- a/test/Analysis/no-outofbounds.c +++ b/test/Analysis/no-outofbounds.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s -// RUN: clang-cc -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s +// RUN: clang -cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s +// RUN: clang -cc1 -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s // XFAIL: * //===----------------------------------------------------------------------===// diff --git a/test/Analysis/null-deref-ps-region.c b/test/Analysis/null-deref-ps-region.c index ab1151382573b..8f5fe9fb10c16 100644 --- a/test/Analysis/null-deref-ps-region.c +++ b/test/Analysis/null-deref-ps-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -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 c604653ea5162..8bfc1f337aa10 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef unsigned uintptr_t; diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index d1a07abf527f9..a866ad905b3bd 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s char f1() { char* s = "abcd"; diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c index e8ce7bdc66ddc..e17361ebe4182 100644 --- a/test/Analysis/override-werror.c +++ b/test/Analysis/override-werror.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=basic -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=region -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=basic -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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.m b/test/Analysis/plist-output.m index 971d47654fddc..7f49340b78855 100644 --- a/test/Analysis/plist-output.m +++ b/test/Analysis/plist-output.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s void test_null_init(void) { int *p = 0; diff --git a/test/Analysis/pr4209.m b/test/Analysis/pr4209.m index 60161b1b08a8f..3a32649ee722d 100644 --- a/test/Analysis/pr4209.m +++ b/test/Analysis/pr4209.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 ebb69028a7097..761448caf952e 100644 --- a/test/Analysis/pr_2542_rdar_6793404.m +++ b/test/Analysis/pr_2542_rdar_6793404.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 1768717739598..d38f4b3e2de27 100644 --- a/test/Analysis/pr_4164.c +++ b/test/Analysis/pr_4164.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // PR 4164: http://llvm.org/bugs/show_bug.cgi?id=4164 // diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c index b585c85d67fe3..2adbbe211d7fb 100644 --- a/test/Analysis/ptr-arith.c +++ b/test/Analysis/ptr-arith.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s void f1() { int a[10]; diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m index 1d8bbd39d8d16..28fa83a3af6ee 100644 --- a/test/Analysis/rdar-6442306-1.m +++ b/test/Analysis/rdar-6442306-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=region -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %s -analyzer-store=basic -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref %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 4d191d2f1e356..7940fc637b079 100644 --- a/test/Analysis/rdar-6540084.m +++ b/test/Analysis/rdar-6540084.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -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 5190a032df8aa..fbbf40814c9ae 100644 --- a/test/Analysis/rdar-6541136-region.c +++ b/test/Analysis/rdar-6541136-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s +// RUN: clang -cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -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 index d5fc2e0ff1bd3..18dc3c8460023 100644 --- a/test/Analysis/rdar-6541136.c +++ b/test/Analysis/rdar-6541136.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s +// RUN: clang -cc1 -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; diff --git a/test/Analysis/rdar-6562655.m b/test/Analysis/rdar-6562655.m index 0b837c6fa6e73..95f876efee50d 100644 --- a/test/Analysis/rdar-6562655.m +++ b/test/Analysis/rdar-6562655.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 index a4850c1332017..e1a06947d04b2 100644 --- a/test/Analysis/rdar-6582778-basic-store.c +++ b/test/Analysis/rdar-6582778-basic-store.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s typedef const void * CFTypeRef; typedef double CFTimeInterval; 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 9d6fe5b27d343..060a91a49e85c 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,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 6c34125d056ce..683dc745c6c40 100644 --- a/test/Analysis/rdar-7168531.m +++ b/test/Analysis/rdar-7168531.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic // 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 a4c290442a57e..417162b6dbf61 100644 --- a/test/Analysis/refcnt_naming.m +++ b/test/Analysis/refcnt_naming.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s typedef const struct __CFString * CFStringRef; typedef const struct __CFAllocator * CFAllocatorRef; diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m index 6a8ae49bba4b7..8d332cfb75013 100644 --- a/test/Analysis/region-1.m +++ b/test/Analysis/region-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -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 index b16c231ce23b1..744032ba77c5a 100644 --- a/test/Analysis/retain-release-basic-store.m +++ b/test/Analysis/retain-release-basic-store.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m index ab52938505f67..97fa6124484cf 100644 --- a/test/Analysis/retain-release-gc-only.m +++ b/test/Analysis/retain-release-gc-only.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -fobjc-gc-only -fblocks -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -fobjc-gc-only -fblocks -verify %s //===----------------------------------------------------------------------===// // Header stuff. diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m index eacac49c81271..2b75ff9ea89b1 100644 --- a/test/Analysis/retain-release-region-store.m +++ b/test/Analysis/retain-release-region-store.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -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 bc9f0b7ef4441..969249cdeeb30 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s -// RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s #if __has_feature(attribute_ns_returns_retained) #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m index bcdc65ebd4591..c63d58901e46c 100644 --- a/test/Analysis/security-syntax-checks.m +++ b/test/Analysis/security-syntax-checks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -warn-security-syntactic %s -verify +// RUN: clang -cc1 -triple i386-apple-darwin10 -analyze -warn-security-syntactic %s -verify // <rdar://problem/6336718> rule request: floating point used as loop // condition (FLP30-C, FLP-30-CPP) @@ -96,3 +96,9 @@ void test_rand() rand_r(&b); // expected-warning{{Function 'rand_r' is obsolete because it implements a poor random number generator. Use 'arc4random' instead}} random(); // expected-warning{{The 'random' function produces a sequence of values that an adversary may be able to predict. Use 'arc4random' instead}} } + +char *mktemp(char *buf); + +void test_mktemp() { + char *x = mktemp("/tmp/zxcv"); // expected-warning{{Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file}} +} diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c index e40c71857242e..eace4f873bc29 100644 --- a/test/Analysis/sizeofpointer.c +++ b/test/Analysis/sizeofpointer.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-sizeof-pointer -verify %s +// RUN: clang -cc1 -analyze -warn-sizeof-pointer -verify %s struct s { }; diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c index 5d1ce253fc35f..a358165a22deb 100644 --- a/test/Analysis/stack-addr-ps.c +++ b/test/Analysis/stack-addr-ps.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -fblocks -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -fblocks -verify %s int* f1() { int x = 0; diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m index 46e441f608d7f..6a2ada536f8ad 100644 --- a/test/Analysis/uninit-msg-expr.m +++ b/test/Analysis/uninit-msg-expr.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m index 7be32b4d157e2..594a6f0dcd885 100644 --- a/test/Analysis/uninit-ps-rdar6145427.m +++ b/test/Analysis/uninit-ps-rdar6145427.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -verify -analyzer-store=basic -checker-cfref %s -// RUN: clang-cc -analyze -verify -analyzer-store=region -checker-cfref %s +// RUN: clang -cc1 -analyze -verify -analyzer-store=basic -checker-cfref %s +// RUN: clang -cc1 -analyze -verify -analyzer-store=region -checker-cfref %s // Delta-Debugging reduced preamble. typedef signed char BOOL; diff --git a/test/Analysis/uninit-vals-ps-region.c b/test/Analysis/uninit-vals-ps-region.c index e927a92576e2d..5bcf74dcabc85 100644 --- a/test/Analysis/uninit-vals-ps-region.c +++ b/test/Analysis/uninit-vals-ps-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s struct s { int data; diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c index c8632a50300a6..a2824c023396b 100644 --- a/test/Analysis/uninit-vals-ps.c +++ b/test/Analysis/uninit-vals-ps.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s struct FPRec { void (*my_func)(int * x); diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c index 8428ca4f81cd5..c48544e3c555f 100644 --- a/test/Analysis/uninit-vals.c +++ b/test/Analysis/uninit-vals.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-uninit-values -verify %s +// RUN: clang -cc1 -analyze -warn-uninit-values -verify %s int f1() { int x; diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m index 6d1561eeb5119..43bab9e79134e 100644 --- a/test/Analysis/uninit-vals.m +++ b/test/Analysis/uninit-vals.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -verify %s typedef unsigned int NSUInteger; diff --git a/test/Analysis/unions-region.m b/test/Analysis/unions-region.m index be4f1852bf02c..1c48e798808d9 100644 --- a/test/Analysis/unions-region.m +++ b/test/Analysis/unions-region.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify +// RUN: clang -cc1 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify //===-- unions-region.m ---------------------------------------------------===// // diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m index bbbf6aec23dd4..55c482aa8b3f7 100644 --- a/test/Analysis/unused-ivars.m +++ b/test/Analysis/unused-ivars.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fblocks -analyze -warn-objc-unused-ivars %s -verify +// RUN: clang -cc1 -fblocks -analyze -warn-objc-unused-ivars %s -verify //===--- BEGIN: Delta-debugging reduced headers. --------------------------===// diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f39eb2accb45f..6796bbf60f39e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,7 +53,7 @@ if(PYTHONINTERP_FOUND) --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_BINARY_DIR}/${testdir} - DEPENDS clang clang-cc index-test c-index-test + DEPENDS clang index-test c-index-test COMMENT "Running Clang regression tests in ${testdir}") endforeach() @@ -64,7 +64,7 @@ if(PYTHONINTERP_FOUND) --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS clang clang-cc index-test c-index-test + DEPENDS clang index-test c-index-test COMMENT "Running Clang regression tests") add_custom_target(clang-c++tests @@ -74,6 +74,6 @@ if(PYTHONINTERP_FOUND) --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests - DEPENDS clang clang-cc index-test c-index-test + DEPENDS clang index-test c-index-test COMMENT "Running Clang regression tests") endif() diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp new file mode 100644 index 0000000000000..ae5590cd3c146 --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp @@ -0,0 +1,20 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// FIXME: embellish + +namespace test0 { + namespace A { + class Foo { + }; + + void foo(const Foo &foo); + } + + class Test { + enum E { foo = 0 }; + + void test() { + foo(A::Foo()); // expected-error {{not a function}} + } + }; +} diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp new file mode 100644 index 0000000000000..c752cec634a29 --- /dev/null +++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.allocation/p1.cpp @@ -0,0 +1,44 @@ +// RUN: clang-cc -fsyntax-only -verify %s +#include <stddef.h> + +struct A { + void *operator new(size_t); +}; + +namespace NS { + void *operator new(size_t);; // expected-error {{'operator new' cannot be declared inside a namespace}} +} + +static void *operator new(size_t); // expected-error {{'operator new' cannot be declared static in global scope}} + +struct B { + void operator new(size_t); // expected-error {{'operator new' must return type 'void *'}} +}; + +struct C { + void *operator new(); // expected-error {{'operator new' must have at least one parameter}} +}; + +struct D { + void *operator new(bool); // expected-error {{'operator new' takes type size_t}} +}; + +struct E { + void *operator new(size_t = 0); // expected-error {{parameter of 'operator new' cannot have a default argument}} +}; + +struct F { + template<typename T> void *operator new(size_t, int); +}; + +struct G { + template<typename T> T operator new(size_t, int); // expected-error {{'operator new' cannot have a dependent return type; use 'void *' instead}} +}; + +struct H { + template<typename T> void *operator new(T, int); // expected-error {{'operator new' cannot take a dependent type as first parameter; use size_t}} +}; + +struct I { + template<typename T> void *operator new(size_t); // expected-error {{'operator new' template must have at least two parameters}} +}; diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp new file mode 100644 index 0000000000000..04af5bc82ec5a --- /dev/null +++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p1.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct A { + void operator delete(void*); +}; + +namespace NS { + void operator delete(void *); // expected-error {{'operator delete' cannot be declared inside a namespace}} +} + +static void operator delete(void *); // expected-error {{'operator delete' cannot be declared static in global scope}} diff --git a/test/CXX/class.access/class.access.dcl/p1.cpp b/test/CXX/class.access/class.access.dcl/p1.cpp new file mode 100644 index 0000000000000..043a9bfb4e0d9 --- /dev/null +++ b/test/CXX/class.access/class.access.dcl/p1.cpp @@ -0,0 +1,199 @@ +// RUN: clang-cc -fsyntax-only -verify + +// This is just the test for [namespace.udecl]p4 with 'using' +// uniformly stripped out. + +// C++03 [namespace.udecl]p4: +// A using-declaration used as a member-declaration shall refer to a +// member of a base class of the class being defined, shall refer to +// a member of an anonymous union that is a member of a base class +// of the class being defined, or shall refer to an enumerator for +// an enumeration type that is a member of a base class of the class +// being defined. + +// There is no directly analogous paragraph in C++0x, and the feature +// works sufficiently differently there that it needs a separate test. + +namespace test0 { + namespace NonClass { + typedef int type; + struct hiding {}; + int hiding; + static union { double union_member; }; + enum tagname { enumerator }; + } + + class Test0 { + NonClass::type; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} + NonClass::hiding; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} + NonClass::union_member; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} + NonClass::enumerator; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} + }; +} + +struct Opaque0 {}; + +namespace test1 { + struct A { + typedef int type; + struct hiding {}; // expected-note {{previous use is here}} + Opaque0 hiding; + union { double union_member; }; + enum tagname { enumerator }; + }; + + struct B : A { + A::type; // expected-warning {{access declarations are deprecated}} + A::hiding; // expected-warning {{access declarations are deprecated}} + A::union_member; // expected-warning {{access declarations are deprecated}} + A::enumerator; // expected-warning {{access declarations are deprecated}} + A::tagname; // expected-warning {{access declarations are deprecated}} + + void test0() { + type t = 0; + } + + void test1() { + typedef struct A::hiding local; + struct hiding _ = local(); + } + + void test2() { + union hiding _; // expected-error {{tag type that does not match previous}} + } + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + + void test4() { + enum tagname _ = enumerator; + } + + void test5() { + Opaque0 _ = hiding; + } + }; +} + +namespace test2 { + struct A { + typedef int type; + struct hiding {}; // expected-note {{previous use is here}} + int hiding; + union { double union_member; }; + enum tagname { enumerator }; + }; + + template <class T> struct B : A { + A::type; // expected-warning {{access declarations are deprecated}} + A::hiding; // expected-warning {{access declarations are deprecated}} + A::union_member; // expected-warning {{access declarations are deprecated}} + A::enumerator; // expected-warning {{access declarations are deprecated}} + A::tagname; // expected-warning {{access declarations are deprecated}} + + void test0() { + type t = 0; + } + + void test1() { + typedef struct A::hiding local; + struct hiding _ = local(); + } + + void test2() { + union hiding _; // expected-error {{tag type that does not match previous}} + } + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + + void test4() { + enum tagname _ = enumerator; + } + + void test5() { + Opaque0 _ = hiding; + } + }; +} + +namespace test3 { + struct hiding {}; + + template <class T> struct A { + typedef int type; // expected-note {{target of using declaration}} + struct hiding {}; + Opaque0 hiding; + union { double union_member; }; + enum tagname { enumerator }; // expected-note {{target of using declaration}} + }; + + template <class T> struct B : A<T> { + A<T>::type; // expected-error {{dependent using declaration resolved to type without 'typename'}} // expected-warning {{access declarations are deprecated}} + A<T>::hiding; // expected-warning {{access declarations are deprecated}} + A<T>::union_member; // expected-warning {{access declarations are deprecated}} + A<T>::enumerator; // expected-warning {{access declarations are deprecated}} + A<T>::tagname; // expected-error {{dependent using declaration resolved to type without 'typename'}} // expected-warning {{access declarations are deprecated}} + + // FIXME: re-enable these when the various bugs involving tags are fixed +#if 0 + void test1() { + typedef struct A<T>::hiding local; + struct hiding _ = local(); + } + + void test2() { + typedef struct A<T>::hiding local; + union hiding _ = local(); + } +#endif + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + +#if 0 + void test4() { + enum tagname _ = enumerator; + } +#endif + + void test5() { + Opaque0 _ = hiding; + } + }; + + template struct B<int>; // expected-note {{in instantiation}} +} + +namespace test4 { + struct Base { + int foo(); + }; + + struct Unrelated { + int foo(); + }; + + struct Subclass : Base { + }; + + namespace InnerNS { + int foo(); + } + + // We should be able to diagnose these without instantiation. + template <class T> struct C : Base { + InnerNS::foo; // expected-error {{not a class}} expected-warning {{access declarations are deprecated}} + Base::bar; // expected-error {{no member named 'bar'}} expected-warning {{access declarations are deprecated}} + Unrelated::foo; // expected-error {{not a base class}} expected-warning {{access declarations are deprecated}} + C::foo; // legal in C++03 // expected-warning {{access declarations are deprecated}} + Subclass::foo; // legal in C++03 // expected-warning {{access declarations are deprecated}} + + int bar(); //expected-note {{target of using declaration}} + C::bar; // expected-error {{refers to its own class}} expected-warning {{access declarations are deprecated}} + }; +} + diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp new file mode 100644 index 0000000000000..b90661deefe63 --- /dev/null +++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp @@ -0,0 +1,93 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// [class.mfct.non-static]p3: +// When an id-expression (5.1) that is not part of a class member +// access syntax (5.2.5) and not used to form a pointer to member +// (5.3.1) is used in the body of a non-static member function of +// class X, if name lookup (3.4.1) resolves the name in the +// id-expression to a non-static non-type member of some class C, +// the id-expression is transformed into a class member access +// expression (5.2.5) using (*this) (9.3.2) as the +// postfix-expression to the left of the . operator. [ Note: if C is +// not X or a base class of X, the class member access expression is +// ill-formed. --end note] Similarly during name lookup, when an +// unqualified-id (5.1) used in the definition of a member function +// for class X resolves to a static member, an enumerator or a +// nested type of class X or of a base class of X, the +// unqualified-id is transformed into a qualified-id (5.1) in which +// the nested-name-specifier names the class of the member function. + +namespace test0 { + class A { + int data_member; + int instance_method(); + static int static_method(); + + bool test() { + return data_member + instance_method() < static_method(); + } + }; +} + +namespace test1 { + struct Opaque1 {}; struct Opaque2 {}; struct Opaque3 {}; + + struct A { + void foo(Opaque1); // expected-note {{candidate}} + void foo(Opaque2); // expected-note {{candidate}} + void test(); + }; + + struct B : A { + + }; + + void A::test() { + B::foo(Opaque1()); + B::foo(Opaque2()); + B::foo(Opaque3()); // expected-error {{no matching member function}} + } +} + +namespace test2 { + class Unrelated { + void foo(); + }; + + template <class T> struct B; + template <class T> struct C; + + template <class T> struct A { + void foo(); + + void test0() { + Unrelated::foo(); // expected-error {{call to non-static member function without an object argument}} + } + + void test1() { + B<T>::foo(); + } + + static void test2() { + B<T>::foo(); // expected-error {{call to non-static member function without an object argument}} + } + + void test3() { + C<T>::foo(); // expected-error {{no member named 'foo'}} + } + }; + + template <class T> struct B : A<T> { + }; + + template <class T> struct C { + }; + + int test() { + A<int> a; + a.test0(); // no instantiation note here, decl is ill-formed + a.test1(); + a.test2(); // expected-note {{in instantiation}} + a.test3(); // expected-note {{in instantiation}} + } +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp new file mode 100644 index 0000000000000..00d109e67516b --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp @@ -0,0 +1,33 @@ +// RUN: clang -fsyntax-only -verify %s + +namespace test0 { + namespace ns0 { + class tag; + int tag(); + } + + namespace ns1 { + using ns0::tag; + } + + namespace ns2 { + using ns0::tag; + } + + using ns1::tag; + using ns2::tag; +} + +// PR 5752 +namespace test1 { + namespace ns { + void foo(); + } + + using ns::foo; + void foo(int); + + namespace ns { + using test1::foo; + } +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp new file mode 100644 index 0000000000000..b4302d5b4b903 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p11.cpp @@ -0,0 +1,94 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// C++03 [namespace.udecl]p11: +// If a function declaration in namespace scope or block scope has +// the same name and the same parameter types as a function +// introduced by a using-declaration, the program is +// ill-formed. [Note: two using-declarations may introduce functions +// with the same name and the same parameter types. If, for a call +// to an unqualified function name, function overload resolution +// selects the functions introduced by such using-declarations, the +// function call is ill-formed. + +namespace test0 { + namespace ns { void foo(); } // expected-note {{target of using declaration}} + int foo(); // expected-note {{conflicting declaration}} + using ns::foo; // expected-error {{target of using declaration conflicts with declaration already in scope}} +} + +namespace test1 { + namespace ns { void foo(); } // expected-note {{target of using declaration}} + using ns::foo; //expected-note {{using declaration}} + int foo(); // expected-error {{declaration conflicts with target of using declaration already in scope}} +} + +namespace test2 { + namespace ns { void foo(); } // expected-note 2 {{target of using declaration}} + void test0() { + int foo(); // expected-note {{conflicting declaration}} + using ns::foo; // expected-error {{target of using declaration conflicts with declaration already in scope}} + } + + void test1() { + using ns::foo; //expected-note {{using declaration}} + int foo(); // expected-error {{declaration conflicts with target of using declaration already in scope}} + } +} + +namespace test3 { + namespace ns { void foo(); } // expected-note 2 {{target of using declaration}} + class Test0 { + void test() { + int foo(); // expected-note {{conflicting declaration}} + using ns::foo; // expected-error {{target of using declaration conflicts with declaration already in scope}} + } + }; + + class Test1 { + void test() { + using ns::foo; //expected-note {{using declaration}} + int foo(); // expected-error {{declaration conflicts with target of using declaration already in scope}} + } + }; +} + +namespace test4 { + namespace ns { void foo(); } // expected-note 2 {{target of using declaration}} + template <typename> class Test0 { + void test() { + int foo(); // expected-note {{conflicting declaration}} + using ns::foo; // expected-error {{target of using declaration conflicts with declaration already in scope}} + } + }; + + template <typename> class Test1 { + void test() { + using ns::foo; //expected-note {{using declaration}} + int foo(); // expected-error {{declaration conflicts with target of using declaration already in scope}} + } + }; +} + +// FIXME: we should be able to diagnose both of these, but we can't. +// ...I'm actually not sure why we can diagnose either of them; it's +// probably a bug. +namespace test5 { + namespace ns { void foo(int); } // expected-note {{target of using declaration}} + template <typename T> class Test0 { + void test() { + int foo(T); + using ns::foo; + } + }; + + template <typename T> class Test1 { + void test() { + using ns::foo; // expected-note {{using declaration}} + int foo(T); // expected-error {{declaration conflicts with target of using declaration already in scope}} + } + }; + + template class Test0<int>; + template class Test1<int>; // expected-note {{in instantiation of member function}} +} + diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp new file mode 100644 index 0000000000000..4cbe1be056e4b --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp @@ -0,0 +1,144 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// C++03 [namespace.udecl]p12: +// When a using-declaration brings names from a base class into a +// derived class scope, member functions in the derived class +// override and/or hide member functions with the same name and +// parameter types in a base class (rather than conflicting). + +template <unsigned n> struct Opaque {}; +template <unsigned n> void expect(Opaque<n> _) {} + +// PR5727 +// This just shouldn't crash. +namespace test0 { + template<typename> struct RefPtr { }; + template<typename> struct PtrHash { + static void f() { } + }; + template<typename T> struct PtrHash<RefPtr<T> > : PtrHash<T*> { + using PtrHash<T*>::f; + static void f() { f(); } + }; +} + +// Simple hiding. +namespace test1 { + struct Base { + Opaque<0> foo(Opaque<0>); + Opaque<0> foo(Opaque<1>); + Opaque<0> foo(Opaque<2>); + }; + + // using before decls + struct Test0 : Base { + using Base::foo; + Opaque<1> foo(Opaque<1>); + Opaque<1> foo(Opaque<3>); + + void test0() { Opaque<0> _ = foo(Opaque<0>()); } + void test1() { Opaque<1> _ = foo(Opaque<1>()); } + void test2() { Opaque<0> _ = foo(Opaque<2>()); } + void test3() { Opaque<1> _ = foo(Opaque<3>()); } + }; + + // using after decls + struct Test1 : Base { + Opaque<1> foo(Opaque<1>); + Opaque<1> foo(Opaque<3>); + using Base::foo; + + void test0() { Opaque<0> _ = foo(Opaque<0>()); } + void test1() { Opaque<1> _ = foo(Opaque<1>()); } + void test2() { Opaque<0> _ = foo(Opaque<2>()); } + void test3() { Opaque<1> _ = foo(Opaque<3>()); } + }; + + // using between decls + struct Test2 : Base { + Opaque<1> foo(Opaque<0>); + using Base::foo; + Opaque<1> foo(Opaque<2>); + Opaque<1> foo(Opaque<3>); + + void test0() { Opaque<1> _ = foo(Opaque<0>()); } + void test1() { Opaque<0> _ = foo(Opaque<1>()); } + void test2() { Opaque<1> _ = foo(Opaque<2>()); } + void test3() { Opaque<1> _ = foo(Opaque<3>()); } + }; +} + +// Crazy dependent hiding. +namespace test2 { + struct Base { + void foo(int); + }; + + template <typename T> struct Derived1 : Base { + using Base::foo; + void foo(T); + + void testUnresolved(int i) { foo(i); } + }; + + void test0(int i) { + Derived1<int> d1; + d1.foo(i); + d1.testUnresolved(i); + } + + // Same thing, except with the order of members reversed. + template <typename T> struct Derived2 : Base { + void foo(T); + using Base::foo; + + void testUnresolved(int i) { foo(i); } + }; + + void test1(int i) { + Derived2<int> d2; + d2.foo(i); + d2.testUnresolved(i); + } +} + +// Hiding of member templates. +namespace test3 { + struct Base { + template <class T> Opaque<0> foo() { return Opaque<0>(); } + template <int n> Opaque<1> foo() { return Opaque<1>(); } + }; + + struct Derived1 : Base { + using Base::foo; + template <int n> Opaque<2> foo() { return Opaque<2>(); } + }; + + struct Derived2 : Base { + template <int n> Opaque<2> foo() { return Opaque<2>(); } + using Base::foo; + }; + + struct Derived3 : Base { + using Base::foo; + template <class T> Opaque<3> foo() { return Opaque<3>(); } + }; + + struct Derived4 : Base { + template <class T> Opaque<3> foo() { return Opaque<3>(); } + using Base::foo; + }; + + void test() { + expect<0>(Base().foo<int>()); + expect<1>(Base().foo<0>()); + expect<0>(Derived1().foo<int>()); + expect<2>(Derived1().foo<0>()); + expect<0>(Derived2().foo<int>()); + expect<2>(Derived2().foo<0>()); + expect<3>(Derived3().foo<int>()); + expect<1>(Derived3().foo<0>()); + expect<3>(Derived4().foo<int>()); + expect<1>(Derived4().foo<0>()); + } +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp new file mode 100644 index 0000000000000..1a05aae3afd68 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp @@ -0,0 +1,63 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// C++03 [namespace.udecl]p3: +// For the purpose of overload resolution, the functions which are +// introduced by a using-declaration into a derived class will be +// treated as though they were members of the derived class. In +// particular, the implicit this parameter shall be treated as if it +// were a pointer to the derived class rather than to the base +// class. This has no effect on the type of the function, and in all +// other respects the function remains a member of the base class. + +namespace test0 { + struct Opaque0 {}; + struct Opaque1 {}; + + struct Base { + Opaque0 test0(int*); + Opaque0 test1(const int*); + Opaque0 test2(int*); + Opaque0 test3(int*) const; + }; + + struct Derived : Base { + using Base::test0; + Opaque1 test0(const int*); + + using Base::test1; + Opaque1 test1(int*); + + using Base::test2; + Opaque1 test2(int*) const; + + using Base::test3; + Opaque1 test3(int*); + }; + + void test0() { + Opaque0 a = Derived().test0((int*) 0); + Opaque1 b = Derived().test0((const int*) 0); + } + + void test1() { + Opaque1 a = Derived().test1((int*) 0); + Opaque0 b = Derived().test1((const int*) 0); + } + + void test2() { + Opaque0 a = ((Derived*) 0)->test2((int*) 0); + Opaque1 b = ((const Derived*) 0)->test2((int*) 0); + } + + void test3() { + Opaque1 a = ((Derived*) 0)->test3((int*) 0); + Opaque0 b = ((const Derived*) 0)->test3((int*) 0); + } +} + +// Things to test: +// member operators +// conversion operators +// call operators +// call-surrogate conversion operators +// everything, but in dependent contexts 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 d701f885fba1e..8257330dcf35e 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-cc -fsyntax-only -verify %s +// RUN: clang-cc -std=c++0x -fsyntax-only -verify %s // C++0x N2914. struct B { @@ -18,3 +18,29 @@ class D2 : public B { using B::x; using C::g; // expected-error{{using declaration refers into 'C::', which is not a base class of 'D2'}} }; + +namespace test1 { + struct Base { + int foo(); + }; + + struct Unrelated { + int foo(); + }; + + struct Subclass : Base { + }; + + namespace InnerNS { + int foo(); + } + + // We should be able to diagnose these without instantiation. + template <class T> struct C : Base { + using InnerNS::foo; // expected-error {{not a class}} + using Base::bar; // expected-error {{no member named 'bar'}} + using Unrelated::foo; // expected-error {{not a base class}} + using C::foo; // expected-error {{refers to its own class}} + using Subclass::foo; // expected-error {{not a base class}} + }; +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp new file mode 100644 index 0000000000000..bf314c41b5fb4 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp @@ -0,0 +1,212 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// C++03 [namespace.udecl]p4: +// A using-declaration used as a member-declaration shall refer to a +// member of a base class of the class being defined, shall refer to +// a member of an anonymous union that is a member of a base class +// of the class being defined, or shall refer to an enumerator for +// an enumeration type that is a member of a base class of the class +// being defined. + +// There is no directly analogous paragraph in C++0x, and the feature +// works sufficiently differently there that it needs a separate test. + +namespace test0 { + namespace NonClass { + typedef int type; + struct hiding {}; + int hiding; + static union { double union_member; }; + enum tagname { enumerator }; + } + + class Test0 { + using NonClass::type; // expected-error {{not a class}} + using NonClass::hiding; // expected-error {{not a class}} + using NonClass::union_member; // expected-error {{not a class}} + using NonClass::enumerator; // expected-error {{not a class}} + }; +} + +struct Opaque0 {}; + +namespace test1 { + struct A { + typedef int type; + struct hiding {}; // expected-note {{previous use is here}} + Opaque0 hiding; + union { double union_member; }; + enum tagname { enumerator }; + }; + + struct B : A { + using A::type; + using A::hiding; + using A::union_member; + using A::enumerator; + using A::tagname; + + void test0() { + type t = 0; + } + + void test1() { + typedef struct A::hiding local; + struct hiding _ = local(); + } + + void test2() { + union hiding _; // expected-error {{tag type that does not match previous}} + } + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + + void test4() { + enum tagname _ = enumerator; + } + + void test5() { + Opaque0 _ = hiding; + } + }; +} + +namespace test2 { + struct A { + typedef int type; + struct hiding {}; // expected-note {{previous use is here}} + int hiding; + union { double union_member; }; + enum tagname { enumerator }; + }; + + template <class T> struct B : A { + using A::type; + using A::hiding; + using A::union_member; + using A::enumerator; + using A::tagname; + + void test0() { + type t = 0; + } + + void test1() { + typedef struct A::hiding local; + struct hiding _ = local(); + } + + void test2() { + union hiding _; // expected-error {{tag type that does not match previous}} + } + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + + void test4() { + enum tagname _ = enumerator; + } + + void test5() { + Opaque0 _ = hiding; + } + }; +} + +namespace test3 { + struct hiding {}; + + template <class T> struct A { + typedef int type; // expected-note {{target of using declaration}} + struct hiding {}; + Opaque0 hiding; // expected-note {{target of using declaration}} + union { double union_member; }; // expected-note {{target of using declaration}} + enum tagname { enumerator }; // expected-note 2 {{target of using declaration}} + }; + + template <class T> struct B : A<T> { + using A<T>::type; // expected-error {{dependent using declaration resolved to type without 'typename'}} + using A<T>::hiding; + using A<T>::union_member; + using A<T>::enumerator; + using A<T>::tagname; // expected-error {{dependent using declaration resolved to type without 'typename'}} + + // FIXME: re-enable these when the various bugs involving tags are fixed +#if 0 + void test1() { + typedef struct A<T>::hiding local; + struct hiding _ = local(); + } + + void test2() { + typedef struct A<T>::hiding local; + union hiding _ = local(); + } +#endif + + void test3() { + char array[sizeof(union_member) == sizeof(double) ? 1 : -1]; + } + +#if 0 + void test4() { + enum tagname _ = enumerator; + } +#endif + + void test5() { + Opaque0 _ = hiding; + } + }; + + template struct B<int>; // expected-note {{in instantiation}} + + template <class T> struct C : A<T> { + using typename A<T>::type; + using typename A<T>::hiding; // expected-error {{'typename' keyword used on a non-type}} + using typename A<T>::union_member; // expected-error {{'typename' keyword used on a non-type}} + using typename A<T>::enumerator; // expected-error {{'typename' keyword used on a non-type}} + + void test6() { + type t = 0; + } + + void test7() { + Opaque0 _ = hiding; // expected-error {{expected '(' for function-style cast or type construction}} + } + }; + + template struct C<int>; // expected-note {{in instantiation}} +} + +namespace test4 { + struct Base { + int foo(); + }; + + struct Unrelated { + int foo(); + }; + + struct Subclass : Base { + }; + + namespace InnerNS { + int foo(); + } + + // We should be able to diagnose these without instantiation. + template <class T> struct C : Base { + using InnerNS::foo; // expected-error {{not a class}} + using Base::bar; // expected-error {{no member named 'bar'}} + using Unrelated::foo; // expected-error {{not a base class}} + using C::foo; // legal in C++03 + using Subclass::foo; // legal in C++03 + + int bar(); //expected-note {{target of using declaration}} + using C::bar; // expected-error {{refers to its own class}} + }; +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp new file mode 100644 index 0000000000000..bf0f330777d11 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8.cpp @@ -0,0 +1,83 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct Opaque0 {}; +struct Opaque1 {}; + +// Redeclarations are okay in a namespace. +namespace test0 { + namespace ns { + void foo(Opaque0); // expected-note 2 {{candidate function}} + } + + using ns::foo; + using ns::foo; + + void test0() { + foo(Opaque1()); // expected-error {{no matching function for call}} + } + + namespace ns { + void foo(Opaque1); + } + + void test1() { + foo(Opaque1()); // expected-error {{no matching function for call}} + } + + using ns::foo; + + void test2() { + foo(Opaque1()); + } + + using ns::foo; +} + +// Make sure we handle transparent contexts the same way. +namespace test1 { + namespace ns { + void foo(Opaque0); // expected-note 2 {{candidate function}} + } + + extern "C++" { + using ns::foo; + } + + void test0() { + foo(Opaque1()); // expected-error {{no matching function for call}} + } + + namespace ns { + void foo(Opaque1); + } + + void test1() { + foo(Opaque1()); // expected-error {{no matching function for call}} + } + + extern "C++" { + using ns::foo; + } + + void test2() { + foo(Opaque1()); + } +} + +// Make sure we detect invalid redeclarations that can't be detected +// until template instantiation. +namespace test2 { + template <class T> struct Base { + typedef Base type; + void foo(); + }; + + template <class T> struct Derived : Base<T> { + // These are invalid redeclarations, detectable only after + // instantiation. + using Base<T>::foo; // expected-note {{previous using decl}} + using Base<T>::type::foo; //expected-error {{redeclaration of using decl}} + }; + + template struct Derived<int>; // expected-note {{in instantiation of template class}} +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp new file mode 100644 index 0000000000000..f62b4250eef0c --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/basic.cpp @@ -0,0 +1,5 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +void f0() { + int &ir = { 17 }; // expected-error{{reference to type 'int' cannot bind to an initializer list}} +} 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 new file mode 100644 index 0000000000000..66fa2d1398444 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s +int g(int); +void f() { + int i; + int& r = i; + r = 1; + int* p = &r; + int &rr=r; + int (&rg)(int) = g; + rg(i); + int a[3]; + int (&ra)[3] = a; + ra[1] = i; +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp new file mode 100644 index 0000000000000..54840f52663f2 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p3.cpp @@ -0,0 +1,3 @@ +// RUN: clang-cc -fsyntax-only -verify %s +int& r1; // expected-error{{declaration of reference variable 'r1' requires an initializer}} +extern int& r2; diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp new file mode 100644 index 0000000000000..5d34345c49fdd --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp @@ -0,0 +1,53 @@ +// RUN: clang-cc -ast-dump %s 2>&1 | FileCheck %s + +// CHECK: example0 +void example0() { + double d = 2.0; + // CHECK: double &rd = + // CHECK-NEXT: DeclRefExpr + double &rd = d; + // CHECK: double const &rcd = + // CHECK-NEXT: ImplicitCastExpr{{.*}}'double const' <NoOp> + const double &rcd = d; +} + +struct A { }; +struct B : A { } b; + +// CHECK: example1 +void example1() { + // CHECK: struct A &ra = + // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> lvalue + A &ra = b; + // CHECK: struct A const &rca = + // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> + // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> + const A& rca = b; +} + +extern B f(); + +struct X { + operator B(); +} x; + +// CHECK: example2 +void example2() { + // CHECK: struct A const &rca = + // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> + // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> + // CHECK: CallExpr{{.*}}struct B + const A &rca = f(); + // CHECK: struct A const &r = + // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> + // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> + // CHECK: CXXMemberCallExpr{{.*}}'struct B' + const A& r = x; +} + +// CHECK: example3 +void example3() { + // CHECK: double const &rcd2 = + // CHECK: ImplicitCastExpr{{.*}}<IntegralToFloating> + const double& rcd2 = 2; +} diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp new file mode 100644 index 0000000000000..5fa1fff8c86e9 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp @@ -0,0 +1,129 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct Base { }; // expected-note{{candidate function}} +struct Derived : Base { }; // expected-note{{candidate function}} +struct Unrelated { }; +struct Derived2 : Base { }; +struct Diamond : Derived, Derived2 { }; + +struct ConvertibleToBaseRef { + operator Base&() const; +}; + +struct ConvertibleToDerivedRef { + operator Derived&() const; +}; + +struct ConvertibleToBothDerivedRef { + operator Derived&(); // expected-note{{candidate function}} + operator Derived2&(); // expected-note{{candidate function}} +}; + +struct ConvertibleToIntRef { + operator int&(); +}; + +struct ConvertibleToBase { + operator Base() const; +}; + +struct ConvertibleToDerived { + operator Derived() const; +}; + +struct ConvertibleToBothDerived { + operator Derived(); // expected-note{{candidate function}} + operator Derived2(); // expected-note{{candidate function}} +}; + +struct ConvertibleToInt { + operator int(); +}; + +template<typename T> T create(); + +// First bullet: lvalue references binding to lvalues (the simple cases). +void bind_lvalue_to_lvalue(Base b, Derived d, + const Base bc, const Derived dc, + Diamond diamond, + int i) { + // Reference-compatible + Base &br1 = b; + Base &br2 = d; + Derived &dr1 = d; + Derived &dr2 = b; // expected-error{{non-const lvalue reference to type 'struct Derived' cannot bind to a value of unrelated type 'struct Base'}} + Base &br3 = bc; // expected-error{{drops qualifiers}} + Base &br4 = dc; // expected-error{{drops qualifiers}} + Base &br5 = diamond; // expected-error{{ambiguous conversion from derived class 'struct Diamond' to base class 'struct Base'}} + int &ir = i; + long &lr = i; // expected-error{{non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int'}} +} + +void bind_lvalue_quals(volatile Base b, volatile Derived d, + volatile const Base bvc, volatile const Derived dvc, + volatile const int ivc) { + volatile Base &bvr1 = b; + volatile Base &bvr2 = d; + volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'struct Base volatile' to a value of type 'struct Base const volatile' drops qualifiers}} + volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'struct Base volatile' to a value of type 'struct Derived const volatile' drops qualifiers}} + + volatile int &ir = ivc; // expected-error{{binding of reference to type 'int volatile' to a value of type 'int const volatile' drops qualifiers}} +} + +void bind_lvalue_to_rvalue() { + Base &br1 = Base(); // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Base'}} + Base &br2 = Derived(); // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Derived'}} + + int &ir = 17; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}} +} + +void bind_lvalue_to_unrelated(Unrelated ur) { + Base &br1 = ur; // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a value of unrelated type 'struct Unrelated'}} +} + +void bind_lvalue_to_conv_lvalue() { + // Not reference-related, but convertible + Base &nbr1 = ConvertibleToBaseRef(); + Base &nbr2 = ConvertibleToDerivedRef(); + Derived &ndr1 = ConvertibleToDerivedRef(); + int &ir = ConvertibleToIntRef(); +} + +void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef both) { + Derived &dr1 = both; + Base &br1 = both; // expected-error{{error: conversion from 'struct ConvertibleToBothDerivedRef' to 'struct Base' is ambiguous}} +} + +struct IntBitfield { + int i : 17; // expected-note{{bit-field is declared here}} +}; + +void test_bitfield(IntBitfield ib) { + int & ir1 = (ib.i); // expected-error{{non-const reference cannot bind to bit-field 'i'}} +} + +// Second bullet: const lvalue reference binding to an rvalue with +// similar type (both of which are class types). +void bind_const_lvalue_to_rvalue() { + const Base &br1 = create<Base>(); + const Base &br2 = create<Derived>(); + const Derived &dr1 = create<Base>(); // expected-error{{no viable conversion}} + + const Base &br3 = create<const Base>(); + const Base &br4 = create<const Derived>(); + + const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'struct Base const' to a value of type 'struct Base const volatile' drops qualifiers}} + const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'struct Base const' to a value of type 'struct Derived const volatile' drops qualifiers}} + + const int &ir = create<int>(); +} + +// Second bullet: const lvalue reference binds to the result of a conversion. +void bind_const_lvalue_to_class_conv_temporary() { + const Base &br1 = ConvertibleToBase(); + const Base &br2 = ConvertibleToDerived(); +} +void bind_lvalue_to_conv_rvalue_ambig(ConvertibleToBothDerived both) { + const Derived &dr1 = both; + const Base &br1 = both; // expected-error{{error: conversion from 'struct ConvertibleToBothDerived' to 'struct Base const' is ambiguous}} +} diff --git a/test/CXX/special/class.free/p6.cpp b/test/CXX/special/class.free/p6.cpp index 8334817ca2b5f..b082b85d18c4b 100644 --- a/test/CXX/special/class.free/p6.cpp +++ b/test/CXX/special/class.free/p6.cpp @@ -2,7 +2,7 @@ #include <stddef.h> struct A { - void operator delete(size_t) { + void operator delete(void*) { (void)this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} } void operator delete[](void*) { diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp index 883cb71d5686c..06653044c3bb6 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p17.cpp @@ -10,3 +10,15 @@ template<> template<> class A<int>::B<double>; template<> template<> void A<char>::B<char>::mf(); template<> void A<char>::B<int>::mf(); // expected-error{{requires 'template<>'}} + +namespace test1 { + template <class> class A { + static int foo; + static int bar; + }; + typedef A<int> AA; + + template <> int AA::foo = 0; // expected-error {{cannot use typedef}} + int AA::bar = 1; // expected-error {{cannot use typedef}} expected-error {{template specialization requires 'template<>'}} + int A<float>::bar = 2; // expected-error {{template specialization requires 'template<>'}} +} diff --git a/test/CodeCompletion/function-templates.cpp b/test/CodeCompletion/function-templates.cpp index d291bbe12bad2..302b95516f3b4 100644 --- a/test/CodeCompletion/function-templates.cpp +++ b/test/CodeCompletion/function-templates.cpp @@ -6,9 +6,18 @@ namespace std { X* dyn_cast(Y *Val); } +class Foo { +public: + template<typename T> T &getAs(); +}; + void f() { - std:: - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s + std::sort(1, 2); + Foo().getAs<int>(); + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>) - // CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>) + // CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#> + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s + // CHECK-CC2: getAs<<#typename T#>>() +) diff --git a/test/CodeCompletion/member-access.cpp b/test/CodeCompletion/member-access.cpp index e445b4503aa30..d03180b182de7 100644 --- a/test/CodeCompletion/member-access.cpp +++ b/test/CodeCompletion/member-access.cpp @@ -11,7 +11,7 @@ struct Base2 { struct Base3 : Base1, Base2 { void memfun1(float); - void memfun1(double); + void memfun1(double) const; void memfun2(int); }; @@ -34,9 +34,9 @@ void test(const Proxy &p) { // CHECK-CC1: member3 : 0 // CHECK-CC1: member4 : 0 // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#float#>) - // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#double#>) + // CHECK-CC1: memfun1 : 0 : [#Base3::#]memfun1(<#double#>)[# const#] // CHECK-CC1: memfun2 : 0 : [#Base3::#]memfun2(<#int#>) // CHECK-CC1: memfun3 : 0 : memfun3(<#int#>) - // CHECK-CC1: Base1 : 0 : Base1:: // CHECK-CC1: memfun1 : 0 (Hidden) : Base2::memfun1(<#int#>) + // CHECK-CC1: Base1 : 3 : Base1:: diff --git a/test/CodeCompletion/objc-message.m b/test/CodeCompletion/objc-message.m index d16a745b71f5f..58fc4f5d68f2e 100644 --- a/test/CodeCompletion/objc-message.m +++ b/test/CodeCompletion/objc-message.m @@ -23,13 +23,13 @@ void func() { Foo *obj = [Foo new]; [obj xx]; } -// RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: clang -cc1 -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: categoryClassMethod : 0 // CHECK-CC1: classMethod1:withKeyword: : 0 // CHECK-CC1: classMethod2 : 0 // CHECK-CC1: new : 0 // CHECK-CC1: protocolClassMethod : 0 -// RUN: clang-cc -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s +// RUN: clang -cc1 -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: categoryInstanceMethod : 0 // CHECK-CC2: instanceMethod1 : 0 // CHECK-CC2: protocolInstanceMethod : 0 diff --git a/test/CodeCompletion/templates.cpp b/test/CodeCompletion/templates.cpp index d35e0bb8dcdea..ff5611823d728 100644 --- a/test/CodeCompletion/templates.cpp +++ b/test/CodeCompletion/templates.cpp @@ -1,16 +1,28 @@ namespace std { template<typename T> - class allocator; + class allocator { + public: + void in_base(); + }; template<typename T, typename Alloc = std::allocator<T> > - class vector; + class vector : Alloc { + public: + void foo(); + void stop(); + }; + template<typename Alloc> class vector<bool, Alloc>; } void f() { - std:: - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s + std::vector<int> v; + v.foo(); + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:18:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: allocator<<#typename T#>> - // CHECK-CC1: vector<<#typename T#>{#, <#typename Alloc#>#}> - + // CHECK-CC1-NEXT: vector<<#typename T#>{#, <#typename Alloc#>#}> + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:5 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s + // CHECK-CC2: foo + // CHECK-CC2: in_base + // CHECK-CC2: stop diff --git a/test/CodeGen/2008-08-25-incompatible-cond-expr.m b/test/CodeGen/2008-08-25-incompatible-cond-expr.m index 3cc42d89f6fa8..fa9b1970f7fd3 100644 --- a/test/CodeGen/2008-08-25-incompatible-cond-expr.m +++ b/test/CodeGen/2008-08-25-incompatible-cond-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @protocol P0 @end diff --git a/test/CodeGen/2009-01-21-invalid-debug-info.m b/test/CodeGen/2009-01-21-invalid-debug-info.m index 2662b922a03c1..1c1028b4ea981 100644 --- a/test/CodeGen/2009-01-21-invalid-debug-info.m +++ b/test/CodeGen/2009-01-21-invalid-debug-info.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -S -g -o %t.s %s +// RUN: clang -cc1 -S -g -o %t.s %s // FIXME: This test case can be removed at some point (since it will // no longer effectively test anything). The reason it was causing diff --git a/test/CodeGen/arm_asm_clobber.c b/test/CodeGen/arm_asm_clobber.c index 34e2517aefabc..05eb2e211f24d 100644 --- a/test/CodeGen/arm_asm_clobber.c +++ b/test/CodeGen/arm_asm_clobber.c @@ -1,4 +1,4 @@ -// RUN: clang -ccc-host-triple armv6-unknown-unknown -emit-llvm -S -o %t %s +// RUN: clang-cc -triple armv6-unknown-unknown -emit-llvm -o %t %s void test0(void) { asm volatile("mov r0, r0" :: ); diff --git a/test/CodeGen/cast-to-union.c b/test/CodeGen/cast-to-union.c deleted file mode 100644 index 1f7e0457706d6..0000000000000 --- a/test/CodeGen/cast-to-union.c +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s -// CHECK: w = global %0 { i32 2, [4 x i8] undef } -// CHECK: y = global %union.u { double 7.300000e+0{{[0]*}}1 } -// CHECK: store i32 351, i32 - -union u { int i; double d; }; - -void foo() { - union u ola = (union u) 351; - union u olb = (union u) 1.0; -} - -union u w = (union u)2; -union u y = (union u)73.0; diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c new file mode 100644 index 0000000000000..f7a001e47ce4a --- /dev/null +++ b/test/CodeGen/decl.c @@ -0,0 +1,61 @@ +// RUN: clang-cc -emit-llvm < %s | FileCheck %s + +// CHECK: @test1.x = internal constant [12 x i32] [i32 1 +// CHECK: @test2.x = internal constant [13 x i32] [i32 1, +// CHECK: @test5w = global %0 { i32 2, [4 x i8] undef } +// CHECK: @test5y = global %union.test5u { double 7.300000e+0{{[0]*}}1 } + +void test1() { + // This should codegen as a "@test1.x" global. + const int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23 }; + foo(x); + +// CHECK: @test1() +// CHECK: {{call.*@foo.*@test1.x}} +} + + +// rdar://7346691 +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 + // CHECK: call{{.*}}@foo{{.*}}i32* % +} + + +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 +} + +void test4(void) { + char a[10] = "asdf"; + char b[10] = { "asdf" }; + // CHECK: @test4() + // CHECK: %a = alloca [10 x i8] + // CHECK: %b = alloca [10 x i8] + // CHECK: call void @llvm.memcpy + // CHECK: call void @llvm.memcpy +} + + +union test5u { int i; double d; }; + +void test5() { + union test5u ola = (union test5u) 351; + union test5u olb = (union test5u) 1.0; +} + +union test5u test5w = (union test5u)2; +union test5u test5y = (union test5u)73.0; + diff --git a/test/CodeGen/exprs.c b/test/CodeGen/exprs.c index a0e5b7644aeb3..c1a5995dfc8db 100644 --- a/test/CodeGen/exprs.c +++ b/test/CodeGen/exprs.c @@ -116,3 +116,6 @@ void f9(struct S *x) { foo(((void)1, x->c).tab[0]); } +void f10() { + __builtin_sin(0); +} diff --git a/test/CodeGen/function-decay.m b/test/CodeGen/function-decay.m index 5652fdbb21eae..4b8e3602d4608 100644 --- a/test/CodeGen/function-decay.m +++ b/test/CodeGen/function-decay.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o - +// RUN: clang -cc1 %s -emit-llvm -o - @interface I0 @end @implementation I0 diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index 038d8f98e5d53..45747de6c9218 100644 --- a/test/CodeGen/object-size.c +++ b/test/CodeGen/object-size.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o - | FileCheck %s +// RUN: clang-cc -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s #define strcpy(dest, src) \ ((__builtin_object_size(dest, 0) != -1ULL) \ @@ -14,113 +14,98 @@ char *gp; int gi, gj; void test1() { - // CHECK: movabsq $59, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 4), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 59) strcpy(&gbuf[4], "Hi there"); } void test2() { - // CHECK: movabsq $63, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 63) strcpy(gbuf, "Hi there"); } void test3() { - // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i64 1, i64 37), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0) strcpy(&gbuf[100], "Hi there"); } void test4() { - // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 -1), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0) strcpy((char*)(void*)&gbuf[-1], "Hi there"); } void test5() { - // CHECK: movq $-1, %rax - // CHECK-NEXT: cmpq $-1, %rax - // CHECK: call ___inline_strcpy_chk + // CHECK: %tmp = load i8** @gp + // CHECK-NEXT:%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i32 0) + // CHECK-NEXT:%cmp = icmp ne i64 %0, -1 strcpy(gp, "Hi there"); } void test6() { char buf[57]; - // CHECK: movabsq $53, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* %arrayidx, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 53) strcpy(&buf[4], "Hi there"); } void test7() { int i; - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy((++i, gbuf), "Hi there"); } void test8() { char *buf[50]; - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(buf[++gi], "Hi there"); } void test9() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %0, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy((char *)((++gi) + gj), "Hi there"); } char **p; void test10() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(*(++p), "Hi there"); } void test11() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp = gbuf, "Hi there"); } void test12() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(++gp, "Hi there"); } void test13() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp++, "Hi there"); } void test14() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(--gp, "Hi there"); } void test15() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp--, "Hi there"); } void test16() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp += 1, "Hi there"); } diff --git a/test/CodeGen/palignr.c b/test/CodeGen/palignr.c new file mode 100644 index 0000000000000..41e48bd2854d9 --- /dev/null +++ b/test/CodeGen/palignr.c @@ -0,0 +1,19 @@ +// RUN: clang-cc %s -triple=i686-apple-darwin -target-feature +ssse3 -O1 -S -o - | FileCheck %s + +#define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n))) +#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n*8))) +typedef __attribute__((vector_size(8))) int int2; +typedef __attribute__((vector_size(16))) int int4; + +// CHECK: palignr +int2 mmx_align1(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 7); } +// CHECK: palignr +int4 align1(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 15); } +// CHECK: ret +// CHECK: ret +// CHECK-NOT: palignr +int4 align2(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 16); } +// CHECK: psrldq +int4 align3(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 17); } +// CHECK: xorps +int4 align4(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 32); } diff --git a/test/CodeGen/rdr-6732143-dangling-block-reference.m b/test/CodeGen/rdr-6732143-dangling-block-reference.m index 2d1baa6220093..90641dd083cb5 100644 --- a/test/CodeGen/rdr-6732143-dangling-block-reference.m +++ b/test/CodeGen/rdr-6732143-dangling-block-reference.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm %s -o - +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm %s -o - void f0(id x) { @synchronized (x) { diff --git a/test/CodeGen/string-init.c b/test/CodeGen/string-init.c deleted file mode 100644 index 0cb6afff611d5..0000000000000 --- a/test/CodeGen/string-init.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: clang-cc -emit-llvm %s -o %t -// RUN: grep 'private constant \[10 x i8\]' %t -// RUN: not grep -F "[5 x i8]" %t -// RUN: not grep "store " %t - -void test(void) { - char a[10] = "asdf"; - char b[10] = { "asdf" }; -} - diff --git a/test/CodeGen/vfprintf.c b/test/CodeGen/vfprintf.c new file mode 100644 index 0000000000000..89261c7469c65 --- /dev/null +++ b/test/CodeGen/vfprintf.c @@ -0,0 +1,8 @@ +// RUN: clang-cc -emit-llvm-only %s + +typedef struct _IO_FILE FILE; +int vfprintf(FILE*restrict,const char*restrict, __builtin_va_list); +void foo(__builtin_va_list ap) { + vfprintf(0, " ", ap); +} + diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp index 7663d2e541b2d..d4fc627082d25 100644 --- a/test/CodeGenCXX/class-layout.cpp +++ b/test/CodeGenCXX/class-layout.cpp @@ -1,5 +1,9 @@ -// RUN: clang-cc %s -emit-llvm -o %t +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s // An extra byte shoudl be allocated for an empty class. -// RUN: grep '%.truct.A = type { i8 }' %t +// CHECK: %struct.A = type { i8 } struct A { } a; + +// No need to add tail padding here. +// CHECK: %struct.B = type { i8*, i32 } +struct B { void *a; int b; } b; diff --git a/test/CodeGenCXX/constructor-convert.cpp b/test/CodeGenCXX/constructor-convert.cpp new file mode 100644 index 0000000000000..6fa6d556dc502 --- /dev/null +++ b/test/CodeGenCXX/constructor-convert.cpp @@ -0,0 +1,19 @@ +// RUN: clang -emit-llvm -S -o - %s + +// PR5775 +class Twine { + Twine(const char *Str) { } +}; + +static void error(const Twine &Message); + +template<typename> +struct opt_storage { + void f() { + error("cl::location(x) specified more than once!"); + } +}; + +void f(opt_storage<int> o) { + o.f(); +} diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp index 66ec9eac212c1..1142aac30e24b 100644 --- a/test/CodeGenCXX/constructor-template.cpp +++ b/test/CodeGenCXX/constructor-template.cpp @@ -44,12 +44,10 @@ int main() { delete node; } -// CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED1Ev: -// CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED2Ev: // CHECK-LP64: __ZN4NodeIP12BinomialNodeIiEEC1Ev: // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEEC1Ev: +// CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED1Ev: -// CHECK-LP32: __ZN4ListIP12BinomialNodeIiEED1Ev: -// CHECK-LP32: __ZN4ListIP12BinomialNodeIiEED2Ev: // CHECK-LP32: __ZN4NodeIP12BinomialNodeIiEEC1Ev: // CHECK-LP32: __ZN4ListIP12BinomialNodeIiEEC1Ev: +// CHECK-LP32: __ZN4ListIP12BinomialNodeIiEED1Ev: diff --git a/test/CodeGenCXX/conversion-operator-base.cpp b/test/CodeGenCXX/conversion-operator-base.cpp new file mode 100644 index 0000000000000..49796d08a87f6 --- /dev/null +++ b/test/CodeGenCXX/conversion-operator-base.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -emit-llvm-only %s -verify +// PR5730 + +struct A { operator int(); float y; }; +struct B : A { double z; }; +void a() { switch(B()) {} } + diff --git a/test/CodeGenCXX/copy-assign-synthesis-3.cpp b/test/CodeGenCXX/copy-assign-synthesis-3.cpp new file mode 100644 index 0000000000000..3dab0f2a81b35 --- /dev/null +++ b/test/CodeGenCXX/copy-assign-synthesis-3.cpp @@ -0,0 +1,16 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +struct A { + A& operator=(const A&); +}; + +struct B { + A a; + float b; + int (A::*c)(); + _Complex float d; +}; +void a(B& x, B& y) { + x = y; +} + diff --git a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp new file mode 100644 index 0000000000000..b4add46db85a8 --- /dev/null +++ b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s + +struct A { virtual void a(); }; +A x(A& y) { return y; } + +// CHECK: define linkonce_odr void @_ZN1AC1ERKS_( +// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2) diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index b89435a990449..c5e3c79b0aabe 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -11,3 +11,10 @@ template<typename T> struct A { A<T> *next; }; void f(A<int>) { } + +struct B { }; + +void f() { + int B::*a = 0; + void (B::*b)() = 0; +} diff --git a/test/CodeGenCXX/default-constructor-template-member.cpp b/test/CodeGenCXX/default-constructor-template-member.cpp new file mode 100644 index 0000000000000..e0a17e0e4f71f --- /dev/null +++ b/test/CodeGenCXX/default-constructor-template-member.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s + +template <class T> struct A { A(); }; +struct B { A<int> x; }; +void a() { + B b; +} +// CHECK: call void @_ZN1BC1Ev +// CHECK: define linkonce_odr void @_ZN1BC1Ev +// CHECK: call void @_ZN1AIiEC1Ev diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp index 3dd7219d9afdf..5570fb44c24c3 100644 --- a/test/CodeGenCXX/eh.cpp +++ b/test/CodeGenCXX/eh.cpp @@ -11,7 +11,9 @@ void test1() { // CHECK: define void @_Z5test1v() nounwind { // CHECK-NEXT:entry: +// CHECK-NEXT: %exception.ptr = alloca i8* // CHECK-NEXT: %exception = call i8* @__cxa_allocate_exception(i64 8) +// CHECK-NEXT: store i8* %exception, i8** %exception.ptr // CHECK-NEXT: %0 = bitcast i8* %exception to %struct.test1_D* // CHECK-NEXT: %tmp = bitcast %struct.test1_D* %0 to i8* // CHECK-NEXT: call void @llvm.memcpy.i64(i8* %tmp, i8* bitcast (%struct.test1_D* @d1 to i8*), i64 8, i32 8) @@ -32,10 +34,13 @@ void test2() { // CHECK: define void @_Z5test2v() nounwind { // CHECK-NEXT:entry: +// CHECK-NEXT: %exception.ptr = alloca i8* // CHECK-NEXT: %exception = call i8* @__cxa_allocate_exception(i64 16) +// CHECK-NEXT: store i8* %exception, i8** %exception.ptr // CHECK-NEXT: %0 = bitcast i8* %exception to %struct.test2_D* -// CHECK-NEXT: call void @_ZN7test2_DC1ERKS_(%struct.test2_D* %0, %struct.test2_D* @d2) -// CHECK-NEXT: call void @__cxa_throw(i8* %exception, i8* bitcast (%0* @_ZTI7test2_D to i8*), i8* null) noreturn +// CHECK: invoke void @_ZN7test2_DC1ERKS_(%struct.test2_D* %0, %struct.test2_D* @d2) +// CHECK-NEXT: to label %invoke.cont unwind label %terminate.handler +// CHECK: call void @__cxa_throw(i8* %exception, i8* bitcast (%0* @_ZTI7test2_D to i8*), i8* null) noreturn // CHECK-NEXT: unreachable @@ -51,7 +56,9 @@ void test3() { // CHECK: define void @_Z5test3v() nounwind { // CHECK-NEXT: entry: +// CHECK-NEXT: %exception.ptr = alloca i8* // CHECK-NEXT: %exception = call i8* @__cxa_allocate_exception(i64 8) +// CHECK-NEXT: store i8* %exception, i8** %exception.ptr // CHECK-NEXT: %0 = bitcast i8* %exception to %struct.test3_D** // CHECK-NEXT: store %struct.test3_D* null, %struct.test3_D** %0 // CHECK-NEXT: call void @__cxa_throw(i8* %exception, i8* bitcast (%1* @_ZTIPV7test3_D to i8*), i8* null) noreturn diff --git a/test/CodeGenCXX/elide-call-reference.cpp b/test/CodeGenCXX/elide-call-reference.cpp new file mode 100644 index 0000000000000..863e69c9cc022 --- /dev/null +++ b/test/CodeGenCXX/elide-call-reference.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s +// PR5695 + +struct A { A(const A&); ~A(); }; +A& a(); +void b() { + A x = a(); +} + +// CHECK: call void @_ZN1AC1ERKS_ +// CHECK: call void @_ZN1AD1Ev diff --git a/test/CodeGenCXX/enum.cpp b/test/CodeGenCXX/enum.cpp new file mode 100644 index 0000000000000..6ce04a3a532b9 --- /dev/null +++ b/test/CodeGenCXX/enum.cpp @@ -0,0 +1,4 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +enum A { a } __attribute((packed)); +int func(A x) { return x==a; } diff --git a/test/CodeGenCXX/eval-recursive-constant.cpp b/test/CodeGenCXX/eval-recursive-constant.cpp new file mode 100644 index 0000000000000..b60070fa1f4ee --- /dev/null +++ b/test/CodeGenCXX/eval-recursive-constant.cpp @@ -0,0 +1,5 @@ +// RUN: clang-cc %s -emit-llvm-only + +extern const int a,b; +const int a=b,b=a; +int c() { if (a) return 1; return 0; } diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp new file mode 100644 index 0000000000000..396ff441ef9ac --- /dev/null +++ b/test/CodeGenCXX/exceptions.cpp @@ -0,0 +1,18 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions + +struct allocator { + allocator(); + allocator(const allocator&); + ~allocator(); +}; + +void f(); +void g(bool b, bool c) { + if (b) { + if (!c) + throw allocator(); + + return; + } + f(); +} diff --git a/test/CodeGenCXX/function-template-explicit-specialization.cpp b/test/CodeGenCXX/function-template-explicit-specialization.cpp new file mode 100644 index 0000000000000..046bc325a5d94 --- /dev/null +++ b/test/CodeGenCXX/function-template-explicit-specialization.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s + +template<typename T> void a(T); +template<> void a(int) {} + +// CHECK: define void @_Z1aIiEvT_ + +namespace X { +template<typename T> void b(T); +template<> void b(int) {} +} + +// CHECK: define void @_ZN1X1bIiEEvT_ diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp new file mode 100644 index 0000000000000..bd4319667e8f0 --- /dev/null +++ b/test/CodeGenCXX/global-llvm-constant.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s + +struct A { + A() { x = 10; } + int x; +}; + +const A x; + +// CHECK: @x = internal global diff --git a/test/CodeGenCXX/inline-functions.cpp b/test/CodeGenCXX/inline-functions.cpp new file mode 100644 index 0000000000000..9af4c6e5bec77 --- /dev/null +++ b/test/CodeGenCXX/inline-functions.cpp @@ -0,0 +1,23 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// CHECK: ; ModuleID + +struct A { + inline void f(); +}; + +// CHECK-NOT: define void @_ZN1A1fEv +void A::f() { } + +template<typename> struct B { }; + +template<> struct B<char> { + inline void f(); +}; + +// CHECK-NOT: _ZN1BIcE1fEv +void B<char>::f() { } + +// We need a final CHECK line here. + +// CHECK: define void @_Z1fv +void f() { } diff --git a/test/CodeGenCXX/key-function-vtable.cpp b/test/CodeGenCXX/key-function-vtable.cpp new file mode 100644 index 0000000000000..e61f33a4cfc3a --- /dev/null +++ b/test/CodeGenCXX/key-function-vtable.cpp @@ -0,0 +1,42 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s + +// Simple key function test +struct testa { virtual void a(); }; +void testa::a() {} + +// Simple key function test +struct testb { virtual void a() {} }; +testb *testbvar = new testb; + +// Key function with out-of-line inline definition +struct testc { virtual void a(); }; +inline void testc::a() {} + +// Key functions with inline specifier (PR5705) +struct testd { inline virtual void a(); }; +void testd::a() {} + +// Key functions with inline specifier (PR5705) +struct teste { inline virtual void a(); }; +teste *testevar = new teste; + +// Key functions with namespace (PR5711) +namespace { + struct testf { virtual void a(); }; +} +void testf::a() {} + +// Key functions with namespace (PR5711) +namespace { + struct testg { virtual void a(); }; +} +testg *testgvar = new testg; + +// FIXME: The checks are extremely difficult to get right when the globals +// aren't alphabetized +// CHECK: @_ZTV5testa = constant [3 x i8*] [i8* null +// CHECK: @_ZTV5testc = weak_odr constant [3 x i8*] [i8* null +// CHECK: @_ZTVN12_GLOBAL__N_15testgE = internal constant [3 x i8*] [i8* null +// CHECK: @_ZTV5teste = weak_odr constant [3 x i8*] [i8* null +// CHECK: @_ZTV5testb = weak_odr constant [3 x i8*] [i8* null + diff --git a/test/CodeGenCXX/mangle-extern-local.cpp b/test/CodeGenCXX/mangle-extern-local.cpp new file mode 100644 index 0000000000000..7c25859a9a6cd --- /dev/null +++ b/test/CodeGenCXX/mangle-extern-local.cpp @@ -0,0 +1,45 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s + +// CHECK: @var1 = external global i32 +// CHECK: @_ZN1N4var2E = external global i32 +// CHECK: @var5 = external global i32 +// CHECK: @_ZN1N4var3E = external global i32 +// CHECK: @_ZN1N4var4E = external global i32 + +// CHECK: declare i32 @_Z5func1v() +// CHECK: declare i32 @_ZN1N5func2Ev() +// CHECK: declare i32 @func4() +// CHECK: declare i32 @_ZN1N5func3Ev() + +int f1() { + extern int var1, func1(); + return var1 + func1(); +} + +namespace N { + +int f2() { + extern int var2, func2(); + return var2 + func2(); +} + +struct S { + static int f3() { + extern int var3, func3(); + struct LC { int localfunc() { extern int var4; return var4; } }; + LC localobj; + return var3 + func3() + localobj.localfunc(); + } +}; + +int anchorf3() { return S::f3(); } + +extern "C" { +int f4() { + extern int var5, func4(); + return var5 + func4(); +} +} + +} + diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp index fbce20451264f..a2994c4abf238 100644 --- a/test/CodeGenCXX/mangle-subst-std.cpp +++ b/test/CodeGenCXX/mangle-subst-std.cpp @@ -32,8 +32,26 @@ namespace std { void f(std::string) { } namespace std { + template<typename, typename> struct basic_istream { }; template<typename, typename> struct basic_ostream { }; + template<typename, typename> struct basic_iostream { }; } +// CHECK: _Z1fSi +void f(std::basic_istream<char, std::char_traits<char> >) { } + // CHECK: _Z1fSo void f(std::basic_ostream<char, std::char_traits<char> >) { } + +// CHECK: _Z1fSd +void f(std::basic_iostream<char, std::char_traits<char> >) { } + +extern "C++" { +namespace std +{ + typedef void (*terminate_handler) (); + + // CHECK: _ZSt13set_terminatePFvvE + terminate_handler set_terminate(terminate_handler) { return 0; } +} +} diff --git a/test/CodeGenCXX/mangle-unnamed.cpp b/test/CodeGenCXX/mangle-unnamed.cpp new file mode 100644 index 0000000000000..66c81e5932254 --- /dev/null +++ b/test/CodeGenCXX/mangle-unnamed.cpp @@ -0,0 +1,39 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +struct S { + virtual ~S() { } +}; + +// PR5706 +// Make sure this doesn't crash; the mangling doesn't matter because the name +// doesn't have linkage. +static struct : S { } obj8; + +void f() { + // Make sure this doesn't crash; the mangling doesn't matter because the + // generated vtable/etc. aren't modifiable (although it would be nice for + // codesize to make it consistent inside inline functions). + static struct : S { } obj8; +} + +inline int f2() { + // FIXME: We don't mangle the names of a or x correctly! + static struct { int a() { static int x; return ++x; } } obj; + return obj.a(); +} + +int f3() { return f2(); } + +struct A { + typedef struct { int x; } *ptr; + ptr m; + int a() { + static struct x { + // FIXME: We don't mangle the names of a or x correctly! + int a(ptr A::*memp) { static int x; return ++x; } + } a; + return a.a(&A::m); + } +}; + +int f4() { return A().a(); } diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp index 03e405ecba1d0..62d8c6cc1e48a 100644 --- a/test/CodeGenCXX/mangle.cpp +++ b/test/CodeGenCXX/mangle.cpp @@ -208,8 +208,9 @@ void extern_f(void); void extern_f(void) { } struct S7 { - struct S { S(); }; + S7(); + struct S { S(); }; struct { S s; } a; @@ -227,3 +228,31 @@ template<typename T> typename __enable_if<(__is_scalar<T>::__value), void>::__ty template void ft8<int>(); // CHECK: @_Z3ft8IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv template void ft8<void*>(); + +namespace Expressions { +// Unary operators. + +// CHECK: define void @_ZN11Expressions2f1ILi1EEEvPAplngT_Li2E_i +template <int i> void f1(int (*)[(-i) + 2]) { }; +template void f1<1>(int (*)[1]); + +// CHECK: define void @_ZN11Expressions2f2ILi1EEEvPApsT__i +template <int i> void f2(int (*)[+i]) { }; +template void f2<1>(int (*)[1]); + +// Binary operators. + +// CHECK: define void @_ZN11Expressions2f3ILi1EEEvPAplT_T__i +template <int i> void f3(int (*)[i+i]) { }; +template void f3<1>(int (*)[2]); + +// CHECK: define void @_ZN11Expressions2f4ILi1EEEvPAplplLi2ET_T__i +template <int i> void f4(int (*)[2 + i+i]) { }; +template void f4<1>(int (*)[4]); + +// The ternary operator. +// CHECK: define void @_ZN11Expressions2f4ILb1EEEvPAquT_Li1ELi2E_i +template <bool b> void f4(int (*)[b ? 1 : 2]) { }; +template void f4<true>(int (*)[1]); + +} diff --git a/test/CodeGenCXX/member-call-parens.cpp b/test/CodeGenCXX/member-call-parens.cpp new file mode 100644 index 0000000000000..0b808e0444599 --- /dev/null +++ b/test/CodeGenCXX/member-call-parens.cpp @@ -0,0 +1,12 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +struct A { int a(); }; +typedef int B; +void a() { + A x; + ((x.a))(); + ((x.*&A::a))(); + B y; + // FIXME: Sema doesn't like this for some reason... + //(y.~B)(); +} diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp index 05bf39632517d..491ca5345afad 100644 --- a/test/CodeGenCXX/member-function-pointers.cpp +++ b/test/CodeGenCXX/member-function-pointers.cpp @@ -105,3 +105,26 @@ namespace PR5593 { return f && f; } } + +namespace PR5718 { + struct A { }; + + bool f(void (A::*f)(), void (A::*g)()) { + return f == g; + } +} + +namespace BoolMemberPointer { + struct A { }; + + bool f(void (A::*f)()) { + return !f; + } + + bool g(void (A::*f)()) { + if (!!f) + return true; + return false; + } +} + diff --git a/test/CodeGenCXX/member-pointer-type-convert.cpp b/test/CodeGenCXX/member-pointer-type-convert.cpp new file mode 100644 index 0000000000000..290daf2b4f12c --- /dev/null +++ b/test/CodeGenCXX/member-pointer-type-convert.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s + +struct A; +typedef int A::*param_t; +struct { + const char *name; + param_t par; +} *ptr; + +// CHECK: type { i8*, {{i..}} } diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp index 95bc255bdde09..45b4e9f5402f0 100644 --- a/test/CodeGenCXX/predefined-expr.cpp +++ b/test/CodeGenCXX/predefined-expr.cpp @@ -12,12 +12,12 @@ // CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00" // CHECK: private constant [12 x i8] c"~Destructor\00" -// CHECK: private constant [35 x i8] c"void NS::Destructor::~Destructor()\00" +// CHECK: private constant [30 x i8] c"NS::Destructor::~Destructor()\00" // CHECK: private constant [12 x i8] c"Constructor\00" -// CHECK: private constant [46 x i8] c"void NS::Constructor::Constructor(NS::Base *)\00" -// CHECK: private constant [39 x i8] c"void NS::Constructor::Constructor(int)\00" -// CHECK: private constant [36 x i8] c"void NS::Constructor::Constructor()\00" +// CHECK: private constant [41 x i8] c"NS::Constructor::Constructor(NS::Base *)\00" +// CHECK: private constant [34 x i8] c"NS::Constructor::Constructor(int)\00" +// CHECK: private constant [31 x i8] c"NS::Constructor::Constructor()\00" // CHECK: private constant [16 x i8] c"virtualFunction\00" // CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00" diff --git a/test/CodeGenCXX/reference-init.cpp b/test/CodeGenCXX/reference-init.cpp new file mode 100644 index 0000000000000..9baad94a96e76 --- /dev/null +++ b/test/CodeGenCXX/reference-init.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +struct XPTParamDescriptor {}; +struct nsXPTParamInfo { + nsXPTParamInfo(const XPTParamDescriptor& desc); +}; +void a(XPTParamDescriptor *params) { + const nsXPTParamInfo& paramInfo = params[0]; +} diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp index eaaf346d7ccdf..74dc0ea6d7b02 100644 --- a/test/CodeGenCXX/references.cpp +++ b/test/CodeGenCXX/references.cpp @@ -1,5 +1,4 @@ // RUN: clang-cc -verify -emit-llvm -o - %s | FileCheck %s - void t1() { extern int& a; int b = a; @@ -19,7 +18,6 @@ void t3() { // Test reference binding. struct C { int a; }; - void f(const bool&); void f(const int&); void f(const _Complex int&); diff --git a/test/CodeGenCXX/rtti-linkage.cpp b/test/CodeGenCXX/rtti-linkage.cpp new file mode 100644 index 0000000000000..a2a1cdd48c107 --- /dev/null +++ b/test/CodeGenCXX/rtti-linkage.cpp @@ -0,0 +1,16 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +// CHECK: _ZTS1B = constant +// CHECK: _ZTS1A = weak_odr constant +// CHECK: _ZTI1A = weak_odr constant +// CHECK: _ZTI1B = constant + +// A has no key function, so its RTTI data should be weak_odr. +struct A { }; + +// B has a key function defined in the translation unit, so the RTTI data should +// be emitted in this translation unit and have external linkage. +struct B : A { + virtual void f(); +}; +void B::f() { } diff --git a/test/CodeGenCXX/rtti.cpp b/test/CodeGenCXX/rtti.cpp index a1ff1ff68729e..7ba4d56b6633c 100644 --- a/test/CodeGenCXX/rtti.cpp +++ b/test/CodeGenCXX/rtti.cpp @@ -3,6 +3,7 @@ // RUN: clang-cc -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll // RUN: FileCheck -check-prefix LL --input-file=%t.ll %s +// XFAIL: * #include <typeinfo> @@ -31,6 +32,11 @@ class test1_D : public test1_B7 { virtual void foo() { } } d1; +// CHECK:__ZTI7test1_D: +// CHECK-NEXT: .quad (__ZTVN10__cxxabiv120__si_class_type_infoE) + 16 +// CHECK-NEXT: .quad __ZTS7test1_D +// CHECK-NEXT: .quad __ZTI8test1_B7 + // CHECK: __ZTSPVi: // CHECK-NEXT: .asciz "PVi" @@ -77,13 +83,6 @@ class test1_D : public test1_B7 { // CHECK-NEXT: .quad __ZTIFvvE // CHECK-NEXT: .quad __ZTI7test3_A - - -// CHECK:__ZTI7test1_D: -// CHECK-NEXT: .quad (__ZTVN10__cxxabiv120__si_class_type_infoE) + 16 -// CHECK-NEXT: .quad __ZTS7test1_D -// CHECK-NEXT: .quad __ZTI8test1_B7 - // CHECK:__ZTI8test1_B7: // CHECK-NEXT: .quad (__ZTVN10__cxxabiv121__vmi_class_type_infoE) + 16 // CHECK-NEXT: .quad __ZTS8test1_B7 @@ -141,7 +140,6 @@ class test1_D : public test1_B7 { // CHECK-NEXT: .quad __ZTS8test1_B2 // CHECK-NEXT: .quad __ZTI8test1_B1 - class NP { }; void test2_1(); void test2_2(test1_D *dp) { @@ -166,7 +164,7 @@ void test2_2(test1_D *dp) { // CHECK-LL-NEXT: %2 = load %"class.std::type_info"** %1 // CHECK-LL-NEXT: %call = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* %2, %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*)) -// CHECK-LL: %call2 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* bitcast (%0* @_ZTI2NP to %"class.std::type_info"*), %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*)) +// CHECK-LL: %call2 = call zeroext i1 @_ZNKSt9type_infoeqERKS_(%"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI2NP to %"class.std::type_info"*), %"class.std::type_info"* bitcast (%{{[0-9]*}}* @_ZTI7test1_D to %"class.std::type_info"*)) // CHECK-LL: %3 = bitcast %class.test1_B7* %tmp5 to %"class.std::type_info"*** // CHECK-LL-NEXT: %4 = icmp ne %"class.std::type_info"*** %3, null diff --git a/test/CodeGenCXX/static-assert.cpp b/test/CodeGenCXX/static-assert.cpp index 7757acd83887d..e103b9906257f 100644 --- a/test/CodeGenCXX/static-assert.cpp +++ b/test/CodeGenCXX/static-assert.cpp @@ -1,3 +1,7 @@ -// RUN: clang-cc %s -emit-llvm -o - -std=c++0x +// RUN: clang-cc %s -emit-llvm -o - -std=c++0x -verify static_assert(true, ""); + +void f() { + static_assert(true, ""); +} diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp index 55877b2a71a99..91085440ae78d 100644 --- a/test/CodeGenCXX/static-init.cpp +++ b/test/CodeGenCXX/static-init.cpp @@ -1,13 +1,17 @@ -// RUN: clang-cc -triple=x86_64-apple-darwin9 -emit-llvm %s -o %t -// RUN: grep "call void @_ZN1AC1Ev" %t | count 1 -// RUN: grep "call i32 @__cxa_atexit(void (i8\*)\* bitcast (void (%.truct.A\*)\* @_ZN1AD1Ev to void (i8\*)\*), i8\* getelementptr inbounds (%.truct.A\* @_ZZ1fvE1a, i32 0, i32 0), i8\* bitcast (i8\*\* @__dso_handle to i8\*))" %t | count 1 - +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s struct A { A(); ~A(); }; void f() { + // 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*)) static A a; } +void g() { + // CHECK: call i8* @_Znwm(i64 1) + // CHECK: call void @_ZN1AC1Ev( + static A& a = *new A; +} diff --git a/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp new file mode 100644 index 0000000000000..d439cbd500497 --- /dev/null +++ b/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// CHECK: ; ModuleID +template<typename> struct A { static int a; }; + +// CHECK-NOT: @_ZN1AIcE1aE +template<> int A<char>::a; + +// CHECK: @_ZN1AIbE1aE = global i32 10 +template<> int A<bool>::a = 10; + + diff --git a/test/CodeGenCXX/template-linkage.cpp b/test/CodeGenCXX/template-linkage.cpp new file mode 100644 index 0000000000000..8013ba44c5336 --- /dev/null +++ b/test/CodeGenCXX/template-linkage.cpp @@ -0,0 +1,24 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +template<typename T> struct A { + virtual void f(T) { } + inline void g() { } +}; + +// Explicit instantiations have external linkage. + +// CHECK: define void @_ZN1AIiE1gEv( +template void A<int>::g(); + +// CHECK: define void @_ZN1AIfE1fEf( +// CHECK: define void @_ZN1AIfE1gEv( +// FIXME: This should also emit the vtable. +template struct A<float>; + +// CHECK: define void @_Z1fIiEvT_ +template <typename T> void f(T) { } +template void f<int>(int); + +// CHECK: define void @_Z1gIiEvT_ +template <typename T> inline void g(T) { } +template void g<int>(int); + diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp new file mode 100644 index 0000000000000..7fe556312bab4 --- /dev/null +++ b/test/CodeGenCXX/throw-expressions.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +int val = 42; +int& test1() { + return throw val, val; +} + +int test2() { + return val ? throw val : val; +} diff --git a/test/CodeGenCXX/unary-type-trait.cpp b/test/CodeGenCXX/unary-type-trait.cpp new file mode 100644 index 0000000000000..b65b9f9d4f2f3 --- /dev/null +++ b/test/CodeGenCXX/unary-type-trait.cpp @@ -0,0 +1,3 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +bool a() { return __is_pod(int); } diff --git a/test/CodeGenCXX/virt-call-offsets.cpp b/test/CodeGenCXX/virt-call-offsets.cpp new file mode 100644 index 0000000000000..db0ba2f483b87 --- /dev/null +++ b/test/CodeGenCXX/virt-call-offsets.cpp @@ -0,0 +1,8 @@ +// RUN: clang -cc1 %s -emit-llvm -o - | FileCheck %s + +struct A { virtual void a(); }; +struct B : A {}; +struct C : B { virtual void a(); }; +void (C::*x)() = &C::a; + +// CHECK: @x = global %0 { i{{[0-9]+}} 1, i{{[0-9]+}} 0 } diff --git a/test/CodeGenCXX/virt-canonical-decl.cpp b/test/CodeGenCXX/virt-canonical-decl.cpp new file mode 100644 index 0000000000000..c1a8c236af8d6 --- /dev/null +++ b/test/CodeGenCXX/virt-canonical-decl.cpp @@ -0,0 +1,19 @@ +// RUN: clang-cc %s -emit-llvm-only + +class Base { +public: + virtual ~Base(); +}; + +Base::~Base() +{ +} + +class Foo : public Base { +public: + virtual ~Foo(); +}; + +Foo::~Foo() +{ +} diff --git a/test/CodeGenCXX/virt-dtor-key.cpp b/test/CodeGenCXX/virt-dtor-key.cpp index 30f3563d8a2f2..9cfd58dae2d35 100644 --- a/test/CodeGenCXX/virt-dtor-key.cpp +++ b/test/CodeGenCXX/virt-dtor-key.cpp @@ -1,5 +1,5 @@ // RUN: clang-cc -emit-llvm %s -o - | FileCheck %s -// CHECK: @_ZTI3foo = linkonce_odr constant +// CHECK: @_ZTI3foo = constant class foo { foo(); virtual ~foo(); diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp new file mode 100644 index 0000000000000..3fbdd2d9cde00 --- /dev/null +++ b/test/CodeGenCXX/virt-template-vtable.cpp @@ -0,0 +1,12 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s + +template<class T> class A { + A() {} + virtual void a() {} +}; +class B : A<int> { + B(); +}; +B::B() {} + +// CHECK: @_ZTV1AIiE = weak_odr constant diff --git a/test/CodeGenCXX/virt-thunk-reference.cpp b/test/CodeGenCXX/virt-thunk-reference.cpp new file mode 100644 index 0000000000000..4b361cfc3d2c9 --- /dev/null +++ b/test/CodeGenCXX/virt-thunk-reference.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -emit-llvm-only %s + +struct A { int a; virtual void aa(int&); }; +struct B { int b; virtual void bb(int&); }; +struct C : A,B { virtual void aa(int&), bb(int&); }; +void C::aa(int&) {} +void C::bb(int&) {} diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp index 7135aaf81ec7f..e3b2afe2f770d 100644 --- a/test/CodeGenCXX/virt.cpp +++ b/test/CodeGenCXX/virt.cpp @@ -768,7 +768,7 @@ struct test16_D : test16_NV1, virtual test16_B2 { // FIXME: This is the wrong thunk, but until these issues are fixed, better // than nothing. -// CHECK-LPLL64:define weak %class.test8_D* @_ZTcvn16_n72_v16_n32_N8test16_D4foo1Ev(%class.test8_D*) { +// CHECK-LPLL64:define weak %class.test8_D* @_ZTcvn16_n72_v16_n32_N8test16_D4foo1Ev(%class.test8_D*) // CHECK-LPLL64:entry: // CHECK-LPLL64: %retval = alloca %class.test8_D* // CHECK-LPLL64: %.addr = alloca %class.test8_D* @@ -790,7 +790,7 @@ struct test16_D : test16_NV1, virtual test16_B2 { // CHECK-LPLL64: ret %class.test8_D* %10 // CHECK-LPLL64:} -// CHECK-LPLL64:define weak %class.test8_D* @_ZTch0_v16_n32_N8test16_D4foo1Ev(%class.test8_D*) { +// CHECK-LPLL64:define weak %class.test8_D* @_ZTch0_v16_n32_N8test16_D4foo1Ev(%class.test8_D*) // CHECK-LPLL64:entry: // CHECK-LPLL64: %retval = alloca %class.test8_D* // CHECK-LPLL64: %.addr = alloca %class.test8_D* diff --git a/test/CodeGenCXX/virtual-destructor-calls.cpp b/test/CodeGenCXX/virtual-destructor-calls.cpp new file mode 100644 index 0000000000000..976f56278ee0e --- /dev/null +++ b/test/CodeGenCXX/virtual-destructor-calls.cpp @@ -0,0 +1,24 @@ +// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s + +struct A { + virtual ~A(); +}; + +struct B : A { + virtual ~B(); +}; + +// Deleting dtor. +// CHECK: define void @_ZN1BD0Ev +// CHECK: call void @_ZN1AD2Ev +// check: call void @_ZdlPv + +// Complete dtor. +// CHECK: define void @_ZN1BD1Ev +// CHECK: call void @_ZN1AD2Ev + +// Base dtor. +// CHECK: define void @_ZN1BD2Ev +// CHECK: call void @_ZN1AD2Ev + +B::~B() { } diff --git a/test/CodeGenCXX/virtual-destructor-synthesis.cpp b/test/CodeGenCXX/virtual-destructor-synthesis.cpp new file mode 100644 index 0000000000000..b95218a322f66 --- /dev/null +++ b/test/CodeGenCXX/virtual-destructor-synthesis.cpp @@ -0,0 +1,16 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s + +struct box { + virtual ~box(); +}; + +struct pile_box : public box { + pile_box(box *); +}; + +pile_box::pile_box(box *pp) +{ +} + +// CHECK: call void @_ZdlPv + diff --git a/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp new file mode 100644 index 0000000000000..d179e9b78607a --- /dev/null +++ b/test/CodeGenCXX/virtual-implicit-copy-assignment.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s + +struct D; +struct B { + virtual D& operator = (const D&); +}; +struct D : B { D(); virtual void a(); }; +void D::a() {} + +// CHECK: @_ZTV1D = {{.*}} @_ZN1DaSERKS_ +// CHECK: define linkonce_odr {{.*}} @_ZN1DaSERKS_ diff --git a/test/CodeGenCXX/virtual-inherited-destructor.cpp b/test/CodeGenCXX/virtual-inherited-destructor.cpp new file mode 100644 index 0000000000000..52b62edd29447 --- /dev/null +++ b/test/CodeGenCXX/virtual-inherited-destructor.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc %s -emit-llvm-only + +struct A { virtual ~A(); }; +struct B : A { + ~B() { } +}; +B x; + diff --git a/test/CodeGenCXX/vtable-key-function.cpp b/test/CodeGenCXX/vtable-key-function.cpp new file mode 100644 index 0000000000000..b0371c0e0ba7f --- /dev/null +++ b/test/CodeGenCXX/vtable-key-function.cpp @@ -0,0 +1,15 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// PR5697 +namespace PR5697 { +struct A { + virtual void f() { } + A(); + A(int); +}; + +// A does not have a key function, so the first constructor we emit should +// cause the vtable to be defined (without assertions.) +// CHECK: @_ZTVN6PR56971AE = weak_odr constant +A::A() { } +A::A(int) { } +} diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp new file mode 100644 index 0000000000000..f2d914feed9ed --- /dev/null +++ b/test/CodeGenCXX/vtable-linkage.cpp @@ -0,0 +1,58 @@ +// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +namespace { + struct A { + virtual void f() { } + }; +} + +void f() { A b; } + +struct B { + B(); + virtual void f(); +}; + +B::B() { } + +struct C { + C(); + virtual void f() { } +}; + +C::C() { } + +struct D { + virtual void f(); +}; + +void D::f() { } + +static struct : D { } e; + +// B has a key function that is not defined in this translation unit so its vtable +// has external linkage. +// CHECK: @_ZTV1B = external constant + +// C has no key function, so its vtable should have weak_odr linkage. +// CHECK: @_ZTS1C = weak_odr constant +// CHECK: @_ZTI1C = weak_odr constant +// CHECK: @_ZTV1C = weak_odr constant + +// D has a key function that is defined in this translation unit so its vtable is +// defined in the translation unit. +// CHECK: @_ZTS1D = constant +// CHECK: @_ZTI1D = constant +// CHECK: @_ZTV1D = constant + +// The anonymous struct for e has no linkage, so the vtable should have +// internal linkage. +// CHECK: @"_ZTS3$_0" = internal constant +// CHECK: @"_ZTI3$_0" = internal constant +// CHECK: @"_ZTV3$_0" = internal constant + +// The A vtable should have internal linkage since it is inside an anonymous +// namespace. +// CHECK: @_ZTSN12_GLOBAL__N_11AE = internal constant +// CHECK: @_ZTIN12_GLOBAL__N_11AE = internal constant +// CHECK: @_ZTVN12_GLOBAL__N_11AE = internal constant diff --git a/test/CodeGenObjC/2008-10-23-invalid-icmp.m b/test/CodeGenObjC/2008-10-23-invalid-icmp.m index 2c58b92176751..65fbf9bc092c0 100644 --- a/test/CodeGenObjC/2008-10-23-invalid-icmp.m +++ b/test/CodeGenObjC/2008-10-23-invalid-icmp.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @protocol P @end diff --git a/test/CodeGenObjC/PR4541.m b/test/CodeGenObjC/PR4541.m index 9a651162c1e1a..2d2adeb3d88e3 100644 --- a/test/CodeGenObjC/PR4541.m +++ b/test/CodeGenObjC/PR4541.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -o %t -w -g %s +// RUN: clang -cc1 -o %t -w -g %s @class NSString; diff --git a/test/CodeGenObjC/PR4894-recursive-debug-crash.m b/test/CodeGenObjC/PR4894-recursive-debug-crash.m index d7379111c11a2..91ae9b3c870fb 100644 --- a/test/CodeGenObjC/PR4894-recursive-debug-crash.m +++ b/test/CodeGenObjC/PR4894-recursive-debug-crash.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s // PR4894 // // This test is actually just making sure we can generate the debug info for the diff --git a/test/CodeGenObjC/bitfield-1.m b/test/CodeGenObjC/bitfield-1.m index 3f605ebc4e24d..107361f9975dc 100644 --- a/test/CodeGenObjC/bitfield-1.m +++ b/test/CodeGenObjC/bitfield-1.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s -// RUN: clang-cc -triple i386-pc-linux-gnu -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 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s @interface Object - (id) alloc; diff --git a/test/CodeGenObjC/bitfield-ivar-metadata.m b/test/CodeGenObjC/bitfield-ivar-metadata.m index f720bcc5b5b63..52fd3098bacf6 100644 --- a/test/CodeGenObjC/bitfield-ivar-metadata.m +++ b/test/CodeGenObjC/bitfield-ivar-metadata.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface INTF { diff --git a/test/CodeGenObjC/bitfield-ivar-offsets.m b/test/CodeGenObjC/bitfield-ivar-offsets.m index f4bc39d4fb057..2a8c31cde757d 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-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s // RUN: grep -F '@"OBJC_IVAR_$_I0._b0" = global i64 0, section "__DATA, __objc_const", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._b1" = global i64 0, section "__DATA, __objc_const", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._b2" = global i64 1, section "__DATA, __objc_const", align 8' %t diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m index ee1b97801b429..c1b001b66306f 100644 --- a/test/CodeGenObjC/blocks-1.m +++ b/test/CodeGenObjC/blocks-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %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 // 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 bb7af99416f35..4949b45cddeee 100644 --- a/test/CodeGenObjC/blocks-2.m +++ b/test/CodeGenObjC/blocks-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %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 // RUN: grep "objc_assign_strongCast" %t | count 2 // This should generate a strong cast. diff --git a/test/CodeGenObjC/blocks-3.m b/test/CodeGenObjC/blocks-3.m index 16da55ed6322c..279f21a528224 100644 --- a/test/CodeGenObjC/blocks-3.m +++ b/test/CodeGenObjC/blocks-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s // RUN: grep 'object_assign' %t | count 11 // RUN: grep 'object_dispose' %t | count 29 diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index def4c9dd7a70e..536d158046b0b 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s // rdar://6676764 struct S { diff --git a/test/CodeGenObjC/category-super-class-meth.m b/test/CodeGenObjC/category-super-class-meth.m index ce27e87bbf501..595d2af298577 100644 --- a/test/CodeGenObjC/category-super-class-meth.m +++ b/test/CodeGenObjC/category-super-class-meth.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface BASE + (int) BaseMeth; diff --git a/test/CodeGenObjC/class-getter-dotsyntax.m b/test/CodeGenObjC/class-getter-dotsyntax.m index 1e1a7596795ef..599e6e7154aa4 100644 --- a/test/CodeGenObjC/class-getter-dotsyntax.m +++ b/test/CodeGenObjC/class-getter-dotsyntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Test { } + (Test *)crash; diff --git a/test/CodeGenObjC/class-type.m b/test/CodeGenObjC/class-type.m index d63f8420d2807..45d7a8671ba7d 100644 --- a/test/CodeGenObjC/class-type.m +++ b/test/CodeGenObjC/class-type.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o - %s -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o - %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o - %s +// 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 @interface I0 { diff --git a/test/CodeGenObjC/compatibility-alias.m b/test/CodeGenObjC/compatibility-alias.m index 11e5a27ab7135..aca2745159407 100644 --- a/test/CodeGenObjC/compatibility-alias.m +++ b/test/CodeGenObjC/compatibility-alias.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Int1 @end diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m index 8204adc518866..08d30ba20f84f 100644 --- a/test/CodeGenObjC/constant-strings.m +++ b/test/CodeGenObjC/constant-strings.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -emit-llvm -o %t %s -// RUN: clang-cc -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1 -// RUN: clang-cc -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1 +// RUN: clang -cc1 -emit-llvm -o %t %s +// RUN: clang -cc1 -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1 +// RUN: clang -cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1 id a = @"Hello World!"; diff --git a/test/CodeGenObjC/continuation-class.m b/test/CodeGenObjC/continuation-class.m index c22231063afa7..9ee61028322e7 100644 --- a/test/CodeGenObjC/continuation-class.m +++ b/test/CodeGenObjC/continuation-class.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Object - (id)new; diff --git a/test/CodeGenObjC/deadcode_strip_used_var.m b/test/CodeGenObjC/deadcode_strip_used_var.m index d2548fdec85b8..679d6da661018 100644 --- a/test/CodeGenObjC/deadcode_strip_used_var.m +++ b/test/CodeGenObjC/deadcode_strip_used_var.m @@ -1,6 +1,6 @@ -// RUN: clang-cc %s -emit-llvm -o %t -triple i386-apple-darwin10 +// RUN: clang -cc1 %s -emit-llvm -o %t -triple i386-apple-darwin10 // RUN: grep "llvm.used" %t | count 1 -// RUN: clang-cc %s -emit-llvm -o %t -triple x86_64-apple-darwin10 +// RUN: clang -cc1 %s -emit-llvm -o %t -triple x86_64-apple-darwin10 // RUN: grep "llvm.used" %t | count 1 diff --git a/test/CodeGenObjC/debug-info-linkagename.m b/test/CodeGenObjC/debug-info-linkagename.m index bda98eec49b5f..bace9db1b8242 100644 --- a/test/CodeGenObjC/debug-info-linkagename.m +++ b/test/CodeGenObjC/debug-info-linkagename.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -g -S -o %t %s +// RUN: clang -cc1 -g -S -o %t %s // RUN: not grep 001 %t @interface F diff --git a/test/CodeGenObjC/dot-syntax-1.m b/test/CodeGenObjC/dot-syntax-1.m index 18b972f04850a..96d4cdf4b5008 100644 --- a/test/CodeGenObjC/dot-syntax-1.m +++ b/test/CodeGenObjC/dot-syntax-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s int printf(const char *, ...); diff --git a/test/CodeGenObjC/dot-syntax.m b/test/CodeGenObjC/dot-syntax.m index 01b71898a7a74..5a40fd8726d2c 100644 --- a/test/CodeGenObjC/dot-syntax.m +++ b/test/CodeGenObjC/dot-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s int printf(const char *, ...); diff --git a/test/CodeGenObjC/encode-test-1.m b/test/CodeGenObjC/encode-test-1.m index 8e6fd861f9ccf..dd4867cfb79e6 100644 --- a/test/CodeGenObjC/encode-test-1.m +++ b/test/CodeGenObjC/encode-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "{Base=b2b3b4b5}" %t | count 1 // RUN: grep -e "{Derived=b2b3b4b5b5b4b3}" %t | count 1 diff --git a/test/CodeGenObjC/encode-test-2.m b/test/CodeGenObjC/encode-test-2.m index b53ea6677ebd7..6c20c424058b9 100644 --- a/test/CodeGenObjC/encode-test-2.m +++ b/test/CodeGenObjC/encode-test-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "@\\\22<X>\\\22" %t // RUN: grep -e "@\\\22<X><Y>\\\22" %t // RUN: grep -e "@\\\22<X><Y><Z>\\\22" %t diff --git a/test/CodeGenObjC/encode-test-3.m b/test/CodeGenObjC/encode-test-3.m index 79a024fe1f7b9..3706ab6a26838 100644 --- a/test/CodeGenObjC/encode-test-3.m +++ b/test/CodeGenObjC/encode-test-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "\^i" %t | count 1 // RUN: grep -e "\[0i\]" %t | count 1 diff --git a/test/CodeGenObjC/encode-test-4.m b/test/CodeGenObjC/encode-test-4.m index 90b300200a066..149205cdecaa9 100644 --- a/test/CodeGenObjC/encode-test-4.m +++ b/test/CodeGenObjC/encode-test-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o - %s -O2 | grep "ret i32 1" +// RUN: clang -cc1 -emit-llvm -o - %s -O2 | grep "ret i32 1" int a() { return @encode(int) == @encode(int); diff --git a/test/CodeGenObjC/encode-test-5.m b/test/CodeGenObjC/encode-test-5.m index d5ec9b3909c74..a12d900589649 100644 --- a/test/CodeGenObjC/encode-test-5.m +++ b/test/CodeGenObjC/encode-test-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=x86_64-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=x86_64-apple-darwin9 -emit-llvm -o %t %s // RUN: grep ji.00 %t | count 1 char *a = @encode(_Complex int); diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index db8470b6bb2a1..060161d1a998d 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "\^{Innermost=CC}" %t | count 1 // RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 // RUN: grep -e "{B1=#@c}" %t | count 1 diff --git a/test/CodeGenObjC/for-in.m b/test/CodeGenObjC/for-in.m index 434ff796b3353..fab0ee47b501c 100644 --- a/test/CodeGenObjC/for-in.m +++ b/test/CodeGenObjC/for-in.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o %t +// RUN: clang -cc1 -emit-llvm %s -o %t void p(const char*, ...); diff --git a/test/CodeGenObjC/forward-class-impl-metadata.m b/test/CodeGenObjC/forward-class-impl-metadata.m index 5dfddde894867..fae745b1ff840 100644 --- a/test/CodeGenObjC/forward-class-impl-metadata.m +++ b/test/CodeGenObjC/forward-class-impl-metadata.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s @interface BASE { @private diff --git a/test/CodeGenObjC/hidden-visibility.m b/test/CodeGenObjC/hidden-visibility.m index 8596b41a79a77..e265e6f754e8b 100644 --- a/test/CodeGenObjC/hidden-visibility.m +++ b/test/CodeGenObjC/hidden-visibility.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fvisibility hidden -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: clang -cc1 -fvisibility hidden -fobjc-nonfragile-abi -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/hidden.m b/test/CodeGenObjC/hidden.m index 0c0dbb3aa50ee..502aaebb69643 100644 --- a/test/CodeGenObjC/hidden.m +++ b/test/CodeGenObjC/hidden.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s __attribute__((visibility("hidden"))) @interface Hidden diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m new file mode 100644 index 0000000000000..73b21b0c652de --- /dev/null +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -0,0 +1,27 @@ +// RUN: clang -cc1 -emit-llvm -o %t %s + +typedef struct objc_class *Class; + +typedef struct objc_object { + Class isa; +} *id; + +@interface I ++ (Class) class; +- (void)meth : (id)object : (id)src_object; ++ (unsigned char) isSubclassOfClass:(Class)aClass ; +@end + +@implementation I ++ (Class) class {return 0;} ++ (unsigned char) isSubclassOfClass:(Class)aClass {return 0;} +- (void)meth : (id)object : (id)src_object { + [object->isa isSubclassOfClass:[I class]]; + + [(*object).isa isSubclassOfClass:[I class]]; + + object->isa = src_object->isa; + (*src_object).isa = (*object).isa; +} +@end + diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m index c16f11d8bc015..8167ef68ca2e8 100644 --- a/test/CodeGenObjC/image-info.m +++ b/test/CodeGenObjC/image-info.m @@ -1,2 +1,2 @@ -// RUN: clang-cc -triple x86_64-apple-darwin-10 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin-10 -emit-llvm -o %t %s // RUN: grep -F '@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"' %t diff --git a/test/CodeGenObjC/implicit-objc_msgSend.m b/test/CodeGenObjC/implicit-objc_msgSend.m index f2fba58f4b579..25d0b8f66984c 100644 --- a/test/CodeGenObjC/implicit-objc_msgSend.m +++ b/test/CodeGenObjC/implicit-objc_msgSend.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -F 'declare i8* @objc_msgSend(...)' %t typedef struct objc_selector *SEL; diff --git a/test/CodeGenObjC/implicit-property.m b/test/CodeGenObjC/implicit-property.m index 206d496252d87..9d17d87451426 100644 --- a/test/CodeGenObjC/implicit-property.m +++ b/test/CodeGenObjC/implicit-property.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s -// RUNX: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s +// RUNX: clang -cc1 -emit-llvm -o %t %s @interface A -(void) setOk:(int)arg; diff --git a/test/CodeGenObjC/interface-layout-64.m b/test/CodeGenObjC/interface-layout-64.m index ac29839a79202..a8a7c63108639 100644 --- a/test/CodeGenObjC/interface-layout-64.m +++ b/test/CodeGenObjC/interface-layout-64.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -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_const", align 8' %t diff --git a/test/CodeGenObjC/interface.m b/test/CodeGenObjC/interface.m index 543c5354c372b..37efed0960503 100644 --- a/test/CodeGenObjC/interface.m +++ b/test/CodeGenObjC/interface.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -O3 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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 cb5611835f627..9a7d4aa8d3a6c 100644 --- a/test/CodeGenObjC/ivar-layout-64-bitfields.m +++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s @interface I { struct { diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m index 1905753169288..833f6dd072455 100644 --- a/test/CodeGenObjC/ivar-layout-64.m +++ b/test/CodeGenObjC/ivar-layout-64.m @@ -1,5 +1,5 @@ // RUNX: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o %t %s && -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -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-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m index 2e04d7eaecb1b..54c37e0ac0565 100644 --- a/test/CodeGenObjC/ivar-layout-no-optimize.m +++ b/test/CodeGenObjC/ivar-layout-no-optimize.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s +// RUN: clang -cc1 -fobjc-gc -triple x86_64-apple-darwin -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/ivars.m b/test/CodeGenObjC/ivars.m index c7fcafd5353d3..0f6e7ca91612e 100644 --- a/test/CodeGenObjC/ivars.m +++ b/test/CodeGenObjC/ivars.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o - %s -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o - %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s // rdar://6800926 @interface ITF { diff --git a/test/CodeGenObjC/link-errors.m b/test/CodeGenObjC/link-errors.m index 4944f1b0782a0..5ab66ae459502 100644 --- a/test/CodeGenObjC/link-errors.m +++ b/test/CodeGenObjC/link-errors.m @@ -1,8 +1,8 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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-cc -triple i386-apple-darwin9 -DWITH_IMPL -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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/message-arrays.m b/test/CodeGenObjC/message-arrays.m index 1ae6bf648c8a8..47d010f2f502e 100644 --- a/test/CodeGenObjC/message-arrays.m +++ b/test/CodeGenObjC/message-arrays.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s void f0(id a) { // This should have an implicit cast diff --git a/test/CodeGenObjC/messages-2.m b/test/CodeGenObjC/messages-2.m index 87f7cc6cc14af..55bc23324996a 100644 --- a/test/CodeGenObjC/messages-2.m +++ b/test/CodeGenObjC/messages-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s int printf(const char *, ...); diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m index ac3b81dead624..113486dde4520 100644 --- a/test/CodeGenObjC/messages.m +++ b/test/CodeGenObjC/messages.m @@ -1,8 +1,8 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s // RUN: grep "objc_msgSend" %t | count 6 -// RUN: clang-cc -fgnu-runtime -emit-llvm -o %t %s +// RUN: clang -cc1 -fgnu-runtime -emit-llvm -o %t %s // RUN: grep "objc_msg_lookup" %t | count 6 -// RUN: clang-cc -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s // RUN: grep "objc_msg_lookup_sender" %t | count 6 typedef struct { diff --git a/test/CodeGenObjC/metadata-symbols-32.m b/test/CodeGenObjC/metadata-symbols-32.m index 288fa8c65a80b..4956cdb8e4c33 100644 --- a/test/CodeGenObjC/metadata-symbols-32.m +++ b/test/CodeGenObjC/metadata-symbols-32.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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 1bc8be8fbba4a..7a3e341a312ad 100644 --- a/test/CodeGenObjC/metadata-symbols-64.m +++ b/test/CodeGenObjC/metadata-symbols-64.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -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 9cc2296dd1ba6..5d4841e366be8 100644 --- a/test/CodeGenObjC/metadata_symbols.m +++ b/test/CodeGenObjC/metadata_symbols.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s // RUN: grep '@"OBJC_METACLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t // RUN: grep '@"OBJC_CLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t @@ -10,7 +10,7 @@ // RUN: grep -F 'define internal void @"\01-[A im0]"' %t // RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t -// RUN: clang-cc -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s // RUN: grep '@"OBJC_METACLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t // RUN: grep '@"OBJC_CLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t diff --git a/test/CodeGenObjC/missing-atend-metadata.m b/test/CodeGenObjC/missing-atend-metadata.m index 664b6f0b16b72..fd759e351029a 100644 --- a/test/CodeGenObjC/missing-atend-metadata.m +++ b/test/CodeGenObjC/missing-atend-metadata.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s @interface I0 @end diff --git a/test/CodeGenObjC/nested-rethrow.m b/test/CodeGenObjC/nested-rethrow.m new file mode 100644 index 0000000000000..dd7439def218a --- /dev/null +++ b/test/CodeGenObjC/nested-rethrow.m @@ -0,0 +1,25 @@ +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s + + +extern int printf(const char*, ...); + +int main() +{ + @try { + @throw @"foo"; + } @catch (id e) { + @try { +// CHECK: call void @objc_exception_throw + @throw; + } @catch (id e) { + if (e) { + printf("caught \n"); + } else { + printf("caught (WRONG)\n"); + } + } @catch (...) { + printf("caught nothing (WRONG)\n"); + } + } +} + diff --git a/test/CodeGenObjC/newproperty-nested-synthesis-1.m b/test/CodeGenObjC/newproperty-nested-synthesis-1.m index 898c81add5e9d..3e8e5ba56e0c9 100644 --- a/test/CodeGenObjC/newproperty-nested-synthesis-1.m +++ b/test/CodeGenObjC/newproperty-nested-synthesis-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Object - (id) new; diff --git a/test/CodeGenObjC/no-category-class.m b/test/CodeGenObjC/no-category-class.m index 34bf603da57d5..38ea739053faa 100644 --- a/test/CodeGenObjC/no-category-class.m +++ b/test/CodeGenObjC/no-category-class.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s @interface NSObject @end diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m index 367705f26218f..0bca6401c9997 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-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -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/objc-align.m b/test/CodeGenObjC/objc-align.m index c029d48ea3a0a..785378ae5af81 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-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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 @@ -14,7 +14,7 @@ // 64-bit -// RUNX: clang-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s && +// RUNX: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s && // RUNX: grep '@"OBJC_CLASS_$_A" = global' %t && // RUNX: grep '@"OBJC_CLASS_$_C" = global' %t && // RUNX: grep '@"OBJC_METACLASS_$_A" = global' %t && diff --git a/test/CodeGenObjC/objc-assign-ivar.m b/test/CodeGenObjC/objc-assign-ivar.m index 795dec0d7ea1f..d54b8026414f6 100644 --- a/test/CodeGenObjC/objc-assign-ivar.m +++ b/test/CodeGenObjC/objc-assign-ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -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 1646cde892029..9ed6fdf0f04ea 100644 --- a/test/CodeGenObjC/objc-gc-aggr-assign.m +++ b/test/CodeGenObjC/objc-gc-aggr-assign.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_memmove_collectable %t | grep call | count 3 static int count; diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m index 3edaf4c749ed8..35854f234ef6e 100644 --- a/test/CodeGenObjC/objc-read-weak-byref.m +++ b/test/CodeGenObjC/objc-read-weak-byref.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -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 -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: clang-cc -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: clang -cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -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 6b34796983ffe..fab4f82f39ae1 100644 --- a/test/CodeGenObjC/objc2-assign-global.m +++ b/test/CodeGenObjC/objc2-assign-global.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -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 8e9a872f93f3b..1d5b97316b8db 100644 --- a/test/CodeGenObjC/objc2-ivar-assign.m +++ b/test/CodeGenObjC/objc2-ivar-assign.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 6 @interface I @end diff --git a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m index b6a0c03ac35ba..2992cef1ed807 100644 --- a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m +++ b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -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 -F '@objc_assign_strongCast' %t | count 4 @interface DSATextSearch @end diff --git a/test/CodeGenObjC/objc2-no-strong-cast.m b/test/CodeGenObjC/objc2-no-strong-cast.m index bce50cd4544ca..649c3e925e31c 100644 --- a/test/CodeGenObjC/objc2-no-strong-cast.m +++ b/test/CodeGenObjC/objc2-no-strong-cast.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface PDFViewPrivateVars { diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m index b41f63fe45287..17d4e1046e46f 100644 --- a/test/CodeGenObjC/objc2-no-write-barrier.m +++ b/test/CodeGenObjC/objc2-no-write-barrier.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s // RUN: grep 'objc_assign' %t | count 0 typedef struct { diff --git a/test/CodeGenObjC/objc2-property-encode.m b/test/CodeGenObjC/objc2-property-encode.m index f1c1024cece5e..c5f68d2c5b0ec 100644 --- a/test/CodeGenObjC/objc2-property-encode.m +++ b/test/CodeGenObjC/objc2-property-encode.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "T@\\\\22NSString\\\\22" %t @interface NSString @end diff --git a/test/CodeGenObjC/objc2-protocol-enc.m b/test/CodeGenObjC/objc2-protocol-enc.m index 2174792bd920f..d8b86bc72ff78 100644 --- a/test/CodeGenObjC/objc2-protocol-enc.m +++ b/test/CodeGenObjC/objc2-protocol-enc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: clang -cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s // RUN: grep -e "T@\\\22<X>\\\22" %t // RUN: grep -e "T@\\\22<X><Y>\\\22" %t // RUN: grep -e "T@\\\22<X><Y><Z>\\\22" %t diff --git a/test/CodeGenObjC/objc2-retain-codegen.m b/test/CodeGenObjC/objc2-retain-codegen.m index d78bc366d3983..2d49ef78d7cf8 100644 --- a/test/CodeGenObjC/objc2-retain-codegen.m +++ b/test/CodeGenObjC/objc2-retain-codegen.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-unknown-unknown -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 8cad08c88a60c..ed083c9de9291 100644 --- a/test/CodeGenObjC/objc2-strong-cast-1.m +++ b/test/CodeGenObjC/objc2-strong-cast-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-unknown-unknown -fobjc-gc -emit-llvm -o %t %s @interface I { __attribute__((objc_gc(strong))) int *i_IdocumentIDs; diff --git a/test/CodeGenObjC/objc2-strong-cast.m b/test/CodeGenObjC/objc2-strong-cast.m index 73fe16af4f73f..e8cacd1d6fb0d 100644 --- a/test/CodeGenObjC/objc2-strong-cast.m +++ b/test/CodeGenObjC/objc2-strong-cast.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-gc -emit-llvm -o %t %s @interface I { __attribute__((objc_gc(strong))) signed long *_documentIDs; diff --git a/test/CodeGenObjC/objc2-weak-assign.m b/test/CodeGenObjC/objc2-weak-assign.m index ea53b020124c3..41a76f0152eb9 100644 --- a/test/CodeGenObjC/objc2-weak-assign.m +++ b/test/CodeGenObjC/objc2-weak-assign.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -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-compare.m b/test/CodeGenObjC/objc2-weak-compare.m index 82cc558b567b1..346485a3668bf 100644 --- a/test/CodeGenObjC/objc2-weak-compare.m +++ b/test/CodeGenObjC/objc2-weak-compare.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -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 4a5f14e2e0f7c..b5bb87052e45b 100644 --- a/test/CodeGenObjC/objc2-weak-import-attribute.m +++ b/test/CodeGenObjC/objc2-weak-import-attribute.m @@ -1,6 +1,8 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s -__attribute__((weak_import)) @interface WeakClass +__attribute__((weak_import)) @interface WeakRootClass @end + +__attribute__((weak_import)) @interface WeakClass : WeakRootClass @end @interface MySubclass : WeakClass @end @@ -26,9 +28,21 @@ int main() { [WeakClass3 message]; } +// CHECK-X86-64: OBJC_METACLASS_$_WeakRootClass" = extern_weak global // CHECK-X86-64: OBJC_METACLASS_$_WeakClass" = extern_weak global // CHECK-X86-64: OBJC_CLASS_$_WeakClass" = extern_weak global // CHECK-X86-64: OBJC_CLASS_$_WeakClass1" = extern_weak global // CHECK-X86-64: OBJC_CLASS_$_WeakClass3" = extern_weak global +// Root is being implemented here. No extern_weak. +__attribute__((weak_import)) @interface Root @end + +@interface Super : Root @end + +@interface Sub : Super @end + +@implementation Sub @end + +@implementation Root @end +// CHECK-NOT-X86-64: OBJC_METACLASS_$_Root" = extern_weak global diff --git a/test/CodeGenObjC/objc2-weak-ivar-debug.m b/test/CodeGenObjC/objc2-weak-ivar-debug.m index 3930989f44dfe..dc8ced1b0c315 100644 --- a/test/CodeGenObjC/objc2-weak-ivar-debug.m +++ b/test/CodeGenObjC/objc2-weak-ivar-debug.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s -// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s +// 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 // rdar://7252252 @interface Loop { diff --git a/test/CodeGenObjC/objc2-weak-ivar.m b/test/CodeGenObjC/objc2-weak-ivar.m index 592c1f05474b4..bcdb25c03068f 100644 --- a/test/CodeGenObjC/objc2-weak-ivar.m +++ b/test/CodeGenObjC/objc2-weak-ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -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 cdb135f0150c4..35a812f9620c4 100644 --- a/test/CodeGenObjC/objc2-write-barrier-2.m +++ b/test/CodeGenObjC/objc2-write-barrier-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -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 7058302f98a8b..ecb038586cacd 100644 --- a/test/CodeGenObjC/objc2-write-barrier-3.m +++ b/test/CodeGenObjC/objc2-write-barrier-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -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 4c863f4a76393..8b672cc6f0fa0 100644 --- a/test/CodeGenObjC/objc2-write-barrier-4.m +++ b/test/CodeGenObjC/objc2-write-barrier-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -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 2e51b44093a3c..8241af7b3026a 100644 --- a/test/CodeGenObjC/objc2-write-barrier-5.m +++ b/test/CodeGenObjC/objc2-write-barrier-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s // RUN: grep objc_assign_ivar %t | count 0 // RUN: grep objc_assign_strongCast %t | count 5 diff --git a/test/CodeGenObjC/objc2-write-barrier.m b/test/CodeGenObjC/objc2-write-barrier.m index bff6d8fdd012f..5877064cf3109 100644 --- a/test/CodeGenObjC/objc2-write-barrier.m +++ b/test/CodeGenObjC/objc2-write-barrier.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -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 25b9698860232..7e1870e1e3460 100644 --- a/test/CodeGenObjC/object-incr-decr-1.m +++ b/test/CodeGenObjC/object-incr-decr-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o %t +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o %t @interface Foo { diff --git a/test/CodeGenObjC/overloadable.m b/test/CodeGenObjC/overloadable.m index bd3aff81b97d4..abf1e27e18b86 100644 --- a/test/CodeGenObjC/overloadable.m +++ b/test/CodeGenObjC/overloadable.m @@ -1,5 +1,5 @@ // rdar://6657613 -// RUN: clang-cc -emit-llvm %s -o %t +// RUN: clang -cc1 -emit-llvm %s -o %t @class C; diff --git a/test/CodeGenObjC/predefined-expr.m b/test/CodeGenObjC/predefined-expr.m index b27bb3488a5a6..f75eef320da18 100644 --- a/test/CodeGenObjC/predefined-expr.m +++ b/test/CodeGenObjC/predefined-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s +// RUN: clang -cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s // CHECK: @"__func__.-[Foo instanceTest1]" = private constant [21 x i8] c"-[Foo instanceTest1]\00" // CHECK: @"__func__.-[Foo instanceTest2:]" = private constant [22 x i8] c"-[Foo instanceTest2:]\00" diff --git a/test/CodeGenObjC/property-aggr-type.m b/test/CodeGenObjC/property-aggr-type.m index e2890b6ee80e7..263f76dda59c8 100644 --- a/test/CodeGenObjC/property-aggr-type.m +++ b/test/CodeGenObjC/property-aggr-type.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Object - (id) new; diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m index e25429ed75259..a5c95c7fba6f0 100644 --- a/test/CodeGenObjC/property-agrr-getter.m +++ b/test/CodeGenObjC/property-agrr-getter.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s typedef struct { unsigned f0; diff --git a/test/CodeGenObjC/property-complex.m b/test/CodeGenObjC/property-complex.m index aedb1fac6c2ff..6d1b775408c95 100644 --- a/test/CodeGenObjC/property-complex.m +++ b/test/CodeGenObjC/property-complex.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -S -o - %s -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm -S -o - %s +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s @interface I0 { @public diff --git a/test/CodeGenObjC/property-getter-dot-syntax.m b/test/CodeGenObjC/property-getter-dot-syntax.m index 8701b580af6e9..8d8ae90b35379 100644 --- a/test/CodeGenObjC/property-getter-dot-syntax.m +++ b/test/CodeGenObjC/property-getter-dot-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @protocol NSObject - (void *)description; diff --git a/test/CodeGenObjC/property-incr-decr-1.m b/test/CodeGenObjC/property-incr-decr-1.m index eb227dde19d59..f2660fe7a791e 100644 --- a/test/CodeGenObjC/property-incr-decr-1.m +++ b/test/CodeGenObjC/property-incr-decr-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface Object - (id) new; diff --git a/test/CodeGenObjC/property-list-in-class.m b/test/CodeGenObjC/property-list-in-class.m new file mode 100644 index 0000000000000..2d753b2bbb0d4 --- /dev/null +++ b/test/CodeGenObjC/property-list-in-class.m @@ -0,0 +1,32 @@ +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: grep -F 'l_OBJC_$_PROP_LIST_C2" = internal global %8 { i32 16, i32 3' %t + +@protocol P +@property int i; +@end + +@protocol P1 +@property int i1; +@end + +@protocol P2 < P1> +@property int i2; +@end + +@interface C1 { id isa; } @end + +@interface C2 : C1 <P, P2> { + int i; +} +@property int i2; +@end + +@implementation C1 ++(void)initialize { } +@end + +@implementation C2 +@synthesize i; +@synthesize i1; +@synthesize i2; +@end diff --git a/test/CodeGenObjC/property-setter-attr.m b/test/CodeGenObjC/property-setter-attr.m index 390392415d730..43f74fb07b43c 100644 --- a/test/CodeGenObjC/property-setter-attr.m +++ b/test/CodeGenObjC/property-setter-attr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s +// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s // RUN: grep -e "SiSetOtherThings:" %t @interface A diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index 2ab10541a7d09..d4868245156ac 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s int printf(const char *, ...); diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m index cad59b0fcdb97..ce1d0f3cea39c 100644 --- a/test/CodeGenObjC/protocol-in-extended-class.m +++ b/test/CodeGenObjC/protocol-in-extended-class.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S %s -o %t-64.s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S %s -o %t-64.s // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: clang -cc1 -triple i386-apple-darwin -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 ab230af232118..f59de81f8b377 100644 --- a/test/CodeGenObjC/protocol-property-synth.m +++ b/test/CodeGenObjC/protocol-property-synth.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s @interface BaseClass { id _delegate; diff --git a/test/CodeGenObjC/protocols-lazy.m b/test/CodeGenObjC/protocols-lazy.m index 54ca19ceb46a9..7e4c45d398e19 100644 --- a/test/CodeGenObjC/protocols-lazy.m +++ b/test/CodeGenObjC/protocols-lazy.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s +// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin8 -o %t %s // RUNX: llvm-gcc -S -emit-llvm -o %t %s && // No object generated diff --git a/test/CodeGenObjC/protocols.m b/test/CodeGenObjC/protocols.m index c510685e521de..1e765df14bef3 100644 --- a/test/CodeGenObjC/protocols.m +++ b/test/CodeGenObjC/protocols.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o %t +// RUN: clang -cc1 -emit-llvm %s -o %t void p(const char*, ...); diff --git a/test/CodeGenObjC/runtime-fns.m b/test/CodeGenObjC/runtime-fns.m index 3c6894dddd177..d5832bc878421 100644 --- a/test/CodeGenObjC/runtime-fns.m +++ b/test/CodeGenObjC/runtime-fns.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s // RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1 -// RUN: clang-cc -DWITHDEF -emit-llvm -o %t %s +// RUN: clang -cc1 -DWITHDEF -emit-llvm -o %t %s // RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1 id objc_msgSend(int x); diff --git a/test/CodeGenObjC/sel-as-builtin-type.m b/test/CodeGenObjC/sel-as-builtin-type.m index c65a5b280542d..317c5d3ca97cb 100644 --- a/test/CodeGenObjC/sel-as-builtin-type.m +++ b/test/CodeGenObjC/sel-as-builtin-type.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s // pr5025 // radar 7405040 diff --git a/test/CodeGenObjC/super-classmethod-category.m b/test/CodeGenObjC/super-classmethod-category.m index 033bc972a348a..64ba1419c0f4f 100644 --- a/test/CodeGenObjC/super-classmethod-category.m +++ b/test/CodeGenObjC/super-classmethod-category.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface SUPER + (void)Meth; diff --git a/test/CodeGenObjC/super-dotsyntax-property.m b/test/CodeGenObjC/super-dotsyntax-property.m index 6e4f176724c81..0f811040d5465 100644 --- a/test/CodeGenObjC/super-dotsyntax-property.m +++ b/test/CodeGenObjC/super-dotsyntax-property.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @interface B { diff --git a/test/CodeGenObjC/super-message-fragileabi.m b/test/CodeGenObjC/super-message-fragileabi.m index edc26a1157fd8..ebb443b81aff7 100644 --- a/test/CodeGenObjC/super-message-fragileabi.m +++ b/test/CodeGenObjC/super-message-fragileabi.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s @class Some; diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m index 8147cd1e235f2..8bb19142bdcde 100644 --- a/test/CodeGenObjC/synchronized.m +++ b/test/CodeGenObjC/synchronized.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2 +// RUN: clang -cc1 -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2 // RUN: grep 'ret i32' %t | count 1 // RUN: grep 'ret i32 1' %t | count 1 diff --git a/test/CodeGenObjC/synthesize_ivar-cont-class.m b/test/CodeGenObjC/synthesize_ivar-cont-class.m index dd444c358b7ed..fb61137df49df 100644 --- a/test/CodeGenObjC/synthesize_ivar-cont-class.m +++ b/test/CodeGenObjC/synthesize_ivar-cont-class.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -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 9ed08d9ce559e..ae21044a4ebe1 100644 --- a/test/CodeGenObjC/synthesize_ivar.m +++ b/test/CodeGenObjC/synthesize_ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s @interface I @property int IP; diff --git a/test/CodeGenObjC/try.m b/test/CodeGenObjC/try.m index eebc482e4608f..01106a9c2101a 100644 --- a/test/CodeGenObjC/try.m +++ b/test/CodeGenObjC/try.m @@ -1,5 +1,5 @@ -// RUN: clang-cc %s -S -o - -triple=i686-apple-darwin9 -// RUN: clang-cc %s -S -o - -triple=x86_64-apple-darwin9 +// RUN: clang -cc1 %s -S -o - -triple=i686-apple-darwin9 +// RUN: clang -cc1 %s -S -o - -triple=x86_64-apple-darwin9 // rdar://6757213 - Don't crash if the internal proto for // __objc_personality_v0 mismatches with an actual one. diff --git a/test/CodeGenObjC/undefined-protocol.m b/test/CodeGenObjC/undefined-protocol.m index 7fe0790032aa3..c57f53dd0b61b 100644 --- a/test/CodeGenObjC/undefined-protocol.m +++ b/test/CodeGenObjC/undefined-protocol.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm-only -fgnu-runtime %s +// RUN: clang -cc1 -emit-llvm-only -fgnu-runtime %s @protocol MadeUpProtocol; diff --git a/test/CodeGenObjC/unname-bf-metadata.m b/test/CodeGenObjC/unname-bf-metadata.m index 605d09b03322c..48d37f13ce70b 100644 --- a/test/CodeGenObjC/unname-bf-metadata.m +++ b/test/CodeGenObjC/unname-bf-metadata.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s // Test that meta-data for ivar lists with unnamed bitfield are generated. // @interface Foo { diff --git a/test/CodeGenObjC/variadic-sends.m b/test/CodeGenObjC/variadic-sends.m index ab0beef714536..1979e3fc293c7 100644 --- a/test/CodeGenObjC/variadic-sends.m +++ b/test/CodeGenObjC/variadic-sends.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s -// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s +// 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 @interface A -(void) im0; diff --git a/test/CodeGenObjCXX/mangle.mm b/test/CodeGenObjCXX/mangle.mm new file mode 100644 index 0000000000000..90d2407838ad7 --- /dev/null +++ b/test/CodeGenObjCXX/mangle.mm @@ -0,0 +1,32 @@ +// RUN: clang -cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +// CHECK: @"_ZZ11+[A shared]E1a" = internal global +// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global + +@interface A +@end + +@implementation A + ++ (A *)shared { + static A* a; + + return a; +} + +@end + +@interface A(Foo) +@end + +@implementation A(Foo) +- (int)f { + // FIXME: Add a member function to s and make sure that it's mangled correctly. + struct s { + }; + + static s a; + + return 0; +} +@end diff --git a/test/Coverage/ast-printing.m b/test/Coverage/ast-printing.m index 1b812288fed25..a864e2d72b881 100644 --- a/test/Coverage/ast-printing.m +++ b/test/Coverage/ast-printing.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -fsyntax-only %s -// RUN: clang-cc -ast-print %s -// RUN: clang-cc -ast-dump %s +// RUN: clang -cc1 -fsyntax-only %s +// RUN: clang -cc1 -ast-print %s +// RUN: clang -cc1 -ast-dump %s #include "objc-language-features.inc" diff --git a/test/Coverage/codegen-gnu.m b/test/Coverage/codegen-gnu.m index bc8d6d642e41b..194809261458a 100644 --- a/test/Coverage/codegen-gnu.m +++ b/test/Coverage/codegen-gnu.m @@ -1,3 +1,3 @@ -// RUN: clang-cc -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s +// RUN: clang -cc1 -triple i386-unknown-unknown -fgnu-runtime -emit-llvm -o %t %s #include "objc-language-features.inc" diff --git a/test/Coverage/codegen-next.m b/test/Coverage/codegen-next.m index f211a5914e55a..d78f93e61d2d7 100644 --- a/test/Coverage/codegen-next.m +++ b/test/Coverage/codegen-next.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s -// RUN: clang-cc -g -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s +// RUN: clang -cc1 -g -emit-llvm -o %t %s #include "objc-language-features.inc" diff --git a/test/Coverage/parse-callbacks.m b/test/Coverage/parse-callbacks.m index 310a1a6f6e288..7666d19432d38 100644 --- a/test/Coverage/parse-callbacks.m +++ b/test/Coverage/parse-callbacks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -parse-noop %s -// RUN: clang-cc -parse-print-callbacks %s +// RUN: clang -cc1 -parse-noop %s +// RUN: clang -cc1 -parse-print-callbacks %s #include "objc-language-features.inc" diff --git a/test/Driver/ccc-add-args.c b/test/Driver/ccc-add-args.c index 21e4471c12764..afd9bd6f7650e 100644 --- a/test/Driver/ccc-add-args.c +++ b/test/Driver/ccc-add-args.c @@ -1,3 +1,5 @@ // RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" clang -### 2>&1 | FileCheck %s -// CHECK: Option 0 - Name: "-v", Values: {} -// CHECK: Option 1 - Name: "-###", Values: {} +// CHECK: Option 0 - Name: "-ccc-echo", Values: {} +// CHECK: Option 1 - Name: "-ccc-print-options", Values: {} +// CHECK: Option 2 - Name: "-v", Values: {} +// CHECK: Option 3 - Name: "-###", Values: {} diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index f7f8b5ef5f80c..762ebb7944b22 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -1,4 +1,4 @@ -// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables 2> %t.log +// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2> %t.log // RUN: grep '"-triple" "i386-unknown-unknown"' %t.log // RUN: grep '"-S"' %t.log // RUN: grep '"-disable-free"' %t.log @@ -8,7 +8,37 @@ // RUN: grep '"-Os"' %t.log // RUN: grep '"-o" .*clang-translation.*' %t.log // RUN: grep '"-masm-verbose"' %t.log +// RUN: grep '"-fvisibility" "hidden"' %t.log // RUN: clang -ccc-host-triple i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log // RUN: grep '"-mcpu" "yonah"' %t.log // RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log // RUN: grep '"-mcpu" "core2"' %t.log + +// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \ +// RUN: -arch armv7 +// RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s < %t.log +// ARMV7_DEFAULT: clang +// ARMV7_DEFAULT: "-cc1" +// ARMV7_DEFAULT-NOT: "-msoft-float" +// ARMV7_DEFAULT: "-mfloat-abi" "soft" +// ARMV7_DEFAULT-NOT: "-msoft-float" +// ARMV7_DEFAULT: "-x" "c" + +// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \ +// RUN: -arch armv7 -msoft-float +// RUN: FileCheck -check-prefix=ARMV7_SOFTFLOAT %s < %t.log +// ARMV7_SOFTFLOAT: clang +// ARMV7_SOFTFLOAT: "-cc1" +// ARMV7_SOFTFLOAT: "-msoft-float" +// ARMV7_SOFTFLOAT: "-mfloat-abi" "soft" +// ARMV7_SOFTFLOAT: "-x" "c" + +// RUN: clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \ +// RUN: -arch armv7 -mhard-float +// RUN: FileCheck -check-prefix=ARMV7_HARDFLOAT %s < %t.log +// ARMV7_HARDFLOAT: clang +// ARMV7_HARDFLOAT: "-cc1" +// ARMV7_HARDFLOAT-NOT: "-msoft-float" +// ARMV7_HARDFLOAT: "-mfloat-abi" "hard" +// ARMV7_HARDFLOAT-NOT: "-msoft-float" +// ARMV7_HARDFLOAT: "-x" "c" diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 3756a2f4d163e..66853422dd1d6 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -1,9 +1,14 @@ -// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t -// RUN: grep -F '"-fblocks"' %t -// RUN: grep -F '"-fpascal-strings"' %t -// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2> %t -// RUN: grep -F '"-fno-builtin"' %t -// RUN: grep -F '"-fno-common"' %t -// RUN: grep -F '"-fno-math-errno"' %t -// RUN: grep -F '"-fno-show-source-location"' %t -// RUN: grep -F '"-fshort-wchar"' %t +// RUN: clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s +// RUN: clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s +// RUN: clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s + +// CHECK-OPTIONS1: -fblocks +// CHECK-OPTIONS1: -fpascal-strings + +// CHECK-OPTIONS2: -fno-math-errno +// CHECK-OPTIONS2: -fno-builtin +// CHECK-OPTIONS2: -fshort-wchar +// CHECK-OPTIONS2: -fno-common +// CHECK-OPTIONS2: -fno-show-source-location + +// CHECK-SHORT-ENUMS: compiler does not support '-fshort-enums' diff --git a/test/Driver/cxx-pth.cpp b/test/Driver/cxx-pth.cpp index 508696ade8859..e5b69c118fb37 100644 --- a/test/Driver/cxx-pth.cpp +++ b/test/Driver/cxx-pth.cpp @@ -3,10 +3,10 @@ // RUN: clang -x c++-header %s -### 2> %t.log // RUN: FileCheck -check-prefix EMIT -input-file %t.log %s -// EMIT: "{{.*}}/clang-cc{{.*}}" {{.*}} "-emit-pth" "{{.*}}.cpp.gch" "-x" "c++-header" "{{.*}}.cpp" +// EMIT: "{{.*}}/clang{{.*}}" {{.*}} "-emit-pth" "{{.*}}.cpp.gch" "-x" "c++-header" "{{.*}}.cpp" // RUN: touch %t.h.gch // RUN: clang -E -include %t.h %s -### 2> %t.log // RUN: FileCheck -check-prefix USE -input-file %t.log %s -// USE: "{{.*}}/clang-cc{{.*}}" {{.*}}"-include-pth" "{{.*}}.h.gch" {{.*}}"-x" "c++" "{{.*}}.cpp" +// USE: "{{.*}}/clang{{.*}}" {{.*}}"-include-pth" "{{.*}}.h.gch" {{.*}}"-x" "c++" "{{.*}}.cpp" diff --git a/test/Driver/dragonfly.c b/test/Driver/dragonfly.c index 40f12e4d7f862..2eb3b1808ee8d 100644 --- a/test/Driver/dragonfly.c +++ b/test/Driver/dragonfly.c @@ -1,7 +1,7 @@ // RUN: clang -ccc-host-triple amd64-pc-dragonfly %s -### 2> %t.log // RUN: FileCheck -input-file %t.log %s -// CHECK: clang-cc{{.*}}" "-triple" "amd64-pc-dragonfly" +// CHECK: clang{{.*}}" "-cc1" "-triple" "amd64-pc-dragonfly" // CHECK: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s // CHECK: ld{{.*}}" "-dynamic-linker" "{{.*}}ld-elf.{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}/gcc{{.*}}" {{.*}} "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o" diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c index 8c03bbcfe3d6f..9700540f46bb4 100644 --- a/test/Driver/freebsd.c +++ b/test/Driver/freebsd.c @@ -2,6 +2,6 @@ // RUN: cat %t.log // RUN: FileCheck -input-file %t.log %s -// CHECK: clang-cc{{.*}}" "-triple" "powerpc64-pc-freebsd8" +// CHECK: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8" // CHECK: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s // CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o" diff --git a/test/Driver/hello.c b/test/Driver/hello.c index 0df1341e4ea8a..e1b6f1a0fd7a5 100644 --- a/test/Driver/hello.c +++ b/test/Driver/hello.c @@ -1,7 +1,7 @@ // RUN: clang -ccc-echo -o %t %s 2> %t.log // Make sure we used clang. -// RUN: grep 'clang-cc" .*hello.c' %t.log +// RUN: grep 'clang" -cc1 .*hello.c' %t.log // RUN: %t > %t.out // RUN: grep "I'm a little driver, short and stout." %t.out diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c index 8b0706b28fdc7..97ba30bb69c23 100644 --- a/test/Driver/openbsd.c +++ b/test/Driver/openbsd.c @@ -1,6 +1,6 @@ // RUN: clang -ccc-clang-archs "" -ccc-host-triple i686-pc-openbsd %s -### 2> %t.log // RUN: FileCheck -input-file %t.log %s -// CHECK: clang-cc{{.*}}" "-triple" "i686-pc-openbsd" +// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" // CHECK: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s // CHECK: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" diff --git a/test/Driver/parsing.c b/test/Driver/parsing.c index 8e37128e3ed94..48b9d6a23f1fd 100644 --- a/test/Driver/parsing.c +++ b/test/Driver/parsing.c @@ -1,14 +1,15 @@ // RUN: clang -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 2> %t -// RUN: grep 'Option 0 - Name: "<input>", Values: {"input"}' %t -// RUN: grep 'Option 1 - Name: "<unknown>", Values: {"-Yunknown"}' %t -// RUN: grep 'Option 2 - Name: "-m32", Values: {}' %t -// RUN: grep 'Option 3 - Name: "-arch", Values: {"ppc"}' %t -// RUN: grep 'Option 4 - Name: "-d", Values: {"joined"}' %t -// RUN: grep 'Option 5 - Name: "-A", Values: {"separate"}' %t -// RUN: grep 'Option 6 - Name: "-A", Values: {"joined"}' %t -// RUN: grep 'Option 7 - Name: "-Wp,", Values: {"one", "two"}' %t -// RUN: grep 'Option 8 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t -// RUN: grep 'Option 9 - Name: "-sectalign", Values: {"1", "2", "3"}' %t +// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t +// RUN: grep 'Option 1 - Name: "<input>", Values: {"input"}' %t +// RUN: grep 'Option 2 - Name: "<unknown>", Values: {"-Yunknown"}' %t +// RUN: grep 'Option 3 - Name: "-m32", Values: {}' %t +// RUN: grep 'Option 4 - Name: "-arch", Values: {"ppc"}' %t +// RUN: grep 'Option 5 - Name: "-d", Values: {"joined"}' %t +// RUN: grep 'Option 6 - Name: "-A", Values: {"separate"}' %t +// RUN: grep 'Option 7 - Name: "-A", Values: {"joined"}' %t +// RUN: grep 'Option 8 - Name: "-Wp,", Values: {"one", "two"}' %t +// RUN: grep 'Option 9 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t +// RUN: grep 'Option 10 - Name: "-sectalign", Values: {"1", "2", "3"}' %t // RUN: not clang -V 2> %t // RUN: grep "error: argument to '-V' is missing (expected 1 value)" %t @@ -17,7 +18,8 @@ // Verify that search continues after find the first option. // RUN: clang -ccc-print-options -Wally 2> %t -// RUN: grep 'Option 0 - Name: "-W", Values: {"ally"}' %t +// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t +// RUN: grep 'Option 1 - Name: "-W", Values: {"ally"}' %t diff --git a/test/Driver/pth.c b/test/Driver/pth.c index 8e8b2dda32ba8..938675a900d84 100644 --- a/test/Driver/pth.c +++ b/test/Driver/pth.c @@ -3,10 +3,10 @@ // RUN: clang -ccc-pch-is-pth -x c-header %s -o %t.h.pth -### 2> %t.log // RUN: FileCheck -check-prefix CHECK1 -input-file %t.log %s -// CHECK1: "{{.*}}/clang-cc{{.*}}" {{.*}} "-o" "{{.*}}.h.pth" "-x" "c-header" "{{.*}}pth.c" +// CHECK1: "{{.*}}/clang{{.*}}" "-cc1" {{.*}} "-o" "{{.*}}.h.pth" "-x" "c-header" "{{.*}}pth.c" // RUN: touch %t.h.pth // RUN: clang -ccc-pch-is-pth -E -include %t.h %s -### 2> %t.log // RUN: FileCheck -check-prefix CHECK2 -input-file %t.log %s -// CHECK2: "{{.*}}/clang-cc{{.*}}" {{.*}}"-include-pth" "{{.*}}.h.pth" {{.*}}"-x" "c" "{{.*}}pth.c" +// CHECK2: "{{.*}}/clang{{.*}}" "-cc1" {{.*}}"-include-pth" "{{.*}}.h.pth" {{.*}}"-x" "c" "{{.*}}pth.c" diff --git a/test/Driver/qa_override.c b/test/Driver/qa_override.c index 6f72078f12af3..822410659ead7 100644 --- a/test/Driver/qa_override.c +++ b/test/Driver/qa_override.c @@ -1,5 +1,6 @@ // RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " clang x -O2 b -O3 2>&1 | FileCheck %s // CHECK-NOT: ### -// CHECK: Option 0 - Name: "<input>", Values: {"x"} -// CHECK-NEXT: Option 1 - Name: "-O", Values: {"ignore"} -// CHECK-NEXT: Option 2 - Name: "-O", Values: {"magic"} +// CHECK: Option 0 - Name: "-ccc-print-options", Values: {} +// CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"} +// CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"} +// CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"} diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m index 21aebfe3a968b..cdf2057290e37 100644 --- a/test/FixIt/fixit-objc.m +++ b/test/FixIt/fixit-objc.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -pedantic -fixit %s -o %t -// RUN: clang-cc -pedantic -x objective-c %t -verify +// RUN: clang -cc1 -pedantic -fixit %s -o %t +// RUN: clang -cc1 -pedantic -x objective-c %t -verify /* This is a test of the various code modification hints that are provided as part of warning or extension diagnostics. All of the diff --git a/test/Index/Inputs/remap-complete-to.c b/test/Index/Inputs/remap-complete-to.c new file mode 100644 index 0000000000000..9f8be2cbec294 --- /dev/null +++ b/test/Index/Inputs/remap-complete-to.c @@ -0,0 +1 @@ +void f0() { } diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index 9009f78e574e8..12ae4f4516201 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -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 -fobjc-nonfragile-abi -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 diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 31b7c6c170c03..db9a1eb5c7af9 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -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 -fobjc-nonfragile-abi -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 diff --git a/test/Index/c-index-api-fn-scan.m b/test/Index/c-index-api-fn-scan.m index 3e2c9c272a20c..0350d87b39e4c 100644 --- a/test/Index/c-index-api-fn-scan.m +++ b/test/Index/c-index-api-fn-scan.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -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 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-load-tu %t.ast scan-function | FileCheck %s diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index 1d5a9a8931561..446f588c4f9dc 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-cc -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 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-load-tu %t.ast all | FileCheck %s diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index 3653a9c2e2148..d6081bc9de8c6 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -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 -fobjc-nonfragile-abi -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck %s @interface Foo { diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m new file mode 100644 index 0000000000000..8d6a1de4bbdc4 --- /dev/null +++ b/test/Index/cindex-from-source.m @@ -0,0 +1,9 @@ +// RUN: echo 'typedef int t0;' > %t.pfx.h +// RUN: clang -x objective-c-header %t.pfx.h -o %t.pfx.h.gch +// RUN: c-index-test -test-load-source local %s -include %t.pfx.h > %t +// RUN: FileCheck %s < %t +// CHECK: cindex-from-source.m:{{.*}}:{{.*}}: StructDecl=s0:{{.*}}:{{.*}} [Context=cindex-from-source.m] +// CHECK: cindex-from-source.m:{{.*}}:{{.*}}: VarDecl=g0:{{.*}}:{{.*}} [Context=cindex-from-source.m] + +struct s0 {}; +t0 g0; diff --git a/test/Index/cindex-on-invalid.m b/test/Index/cindex-on-invalid.m new file mode 100644 index 0000000000000..651c40a33539e --- /dev/null +++ b/test/Index/cindex-on-invalid.m @@ -0,0 +1,8 @@ +// RUN: not c-index-test -test-load-source local %s > %t 2> %t.err +// RUN: FileCheck %s < %t.err + +// CHECK: error: expected identifier or '(' +// CHECK: Unable to load translation unit! + +int foo; +int diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index 44bd9d28932e5..c286c82d04800 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -33,20 +33,19 @@ void test_overloaded() { overloaded(Z(), 0); } -// CHECK-MEMBER: EnumDecl:{Informative X::}{TypedText E} // CHECK-MEMBER: FieldDecl:{TypedText member} // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} // CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1} // CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} // CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )} // CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} -// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} -// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} -// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} // CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member} // CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member} // CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} // CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} +// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} +// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} +// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m new file mode 100644 index 0000000000000..68d1ef42f863d --- /dev/null +++ b/test/Index/complete-at-directives.m @@ -0,0 +1,24 @@ +/* Run lines are at the end, since line/column matter in this test. */ +@interface MyClass { } +@end + +@implementation MyClass +@end + +// RUN: c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: {TypedText class}{Text }{Placeholder identifier}{Text ;} +// CHECK-CC1: {TypedText compatibility_alias}{Text }{Placeholder alias}{Text }{Placeholder class} +// CHECK-CC1: {TypedText implementation}{Text }{Placeholder class} +// CHECK-CC1: {TypedText interface}{Text }{Placeholder class} +// CHECK-CC1: {TypedText protocol}{Text }{Placeholder protocol} + +// RUN: c-index-test -code-completion-at=%s:3:2 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: {TypedText end} +// CHECK-CC2: {TypedText optional} +// CHECK-CC2: {TypedText property} +// CHECK-CC2: {TypedText required} + +// RUN: c-index-test -code-completion-at=%s:6:2 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: {TypedText dynamic}{Text }{Placeholder property} +// CHECK-CC3: {TypedText end} +// CHECK-CC3: {TypedText synthesize}{Text }{Placeholder property} diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m new file mode 100644 index 0000000000000..82c3983e82b2b --- /dev/null +++ b/test/Index/complete-at-exprstmt.m @@ -0,0 +1,23 @@ +/* The run lines are below, because this test is line- and + column-number sensitive. */ +@interface MyClass { } +- (int)myMethod:(int)arg; +@end + +@implementation MyClass +- (int)myMethod:(int)arg { + @synchronized (@encode(MyClass)) { } +} +@end +// RUN: c-index-test -code-completion-at=%s:9:4 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} +// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )} +// CHECK-CC1: {TypedText synchronized}{Text }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }} +// CHECK-CC1: {TypedText throw}{Text }{Placeholder expression}{Text ;} +// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }} +// RUN: c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} +// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )} + diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index b692986cfda91..1c03095e2a018 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -132,3 +132,14 @@ void test_overload(Overload *ovl) { // RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s // CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2} // CHECK-CC9: ObjCInstanceMethodDecl:{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj} +// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s +// CHECK-CCA: {TypedText _cmd} +// CHECK-CCA: {TypedText self} +// CHECK-CCA: TypedefDecl:{TypedText Class} +// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo} +// CHECK-CCA: FunctionDecl:{TypedText func}{LeftParen (}{RightParen )} +// CHECK-CCA: TypedefDecl:{TypedText id} +// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass} +// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} +// CHECK-CCA: TypedefDecl:{TypedText SEL} +// CHECK-CCA: {TypedText super} diff --git a/test/Index/objc-decls.m b/test/Index/objc-decls.m index ff396788771df..62a43da007b3a 100644 --- a/test/Index/objc-decls.m +++ b/test/Index/objc-decls.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-pch %S/Inputs/t1.m -o %t1.m.ast -// RUN: clang-cc -emit-pch %S/Inputs/t2.m -o %t2.m.ast +// RUN: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast +// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast // RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/t1.m:12:12 -print-decls > %t // RUN: cat %t | count 2 diff --git a/test/Index/objc-message.m b/test/Index/objc-message.m index de61278af87e8..568ca9494f557 100644 --- a/test/Index/objc-message.m +++ b/test/Index/objc-message.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-pch %S/Inputs/t1.m -o %t1.m.ast -// RUN: clang-cc -emit-pch %S/Inputs/t2.m -o %t2.m.ast +// RUN: clang -cc1 -emit-pch %S/Inputs/t1.m -o %t1.m.ast +// RUN: clang -cc1 -emit-pch %S/Inputs/t2.m -o %t2.m.ast // RUN: index-test %t1.m.ast %t2.m.ast -point-at %S/Inputs/objc.h:5:13 -print-refs > %t // RUN: cat %t | count 1 diff --git a/test/Index/remap-complete.c b/test/Index/remap-complete.c new file mode 100644 index 0000000000000..cfafd3051d8f5 --- /dev/null +++ b/test/Index/remap-complete.c @@ -0,0 +1,5 @@ +// RUN: c-index-test -code-completion-at=%s:1:12 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s +// XFAIL: win32 + +// CHECK: FunctionDecl:{TypedText f0}{LeftParen (}{RightParen )} +void f() { } diff --git a/test/Lexer/has_feature_exceptions.cpp b/test/Lexer/has_feature_exceptions.cpp new file mode 100644 index 0000000000000..231a6c56a45b6 --- /dev/null +++ b/test/Lexer/has_feature_exceptions.cpp @@ -0,0 +1,11 @@ +// RUN: clang -E -fexceptions %s -o - | FileCheck --check-prefix=CHECK-EXCEPTIONS %s +// RUN: clang -E -fno-exceptions %s -o - | FileCheck --check-prefix=CHECK-NO-EXCEPTIONS %s + +#if __has_feature(cxx_exceptions) +int foo(); +#else +int bar(); +#endif + +// CHECK-EXCEPTIONS: foo +// CHECK-NO-EXCEPTIONS: bar diff --git a/test/Lexer/has_feature_rtti.cpp b/test/Lexer/has_feature_rtti.cpp new file mode 100644 index 0000000000000..cc01f61cba67b --- /dev/null +++ b/test/Lexer/has_feature_rtti.cpp @@ -0,0 +1,11 @@ +// RUN: clang -E -frtti %s -o - | FileCheck --check-prefix=CHECK-RTTI %s +// RUN: clang -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s + +#if __has_feature(cxx_rtti) +int foo(); +#else +int bar(); +#endif + +// CHECK-RTTI: foo +// CHECK-NO-RTTI: bar diff --git a/test/Lexer/msdos-cpm-eof.c b/test/Lexer/msdos-cpm-eof.c new file mode 100644 index 0000000000000..e4dacd9802f2c --- /dev/null +++ b/test/Lexer/msdos-cpm-eof.c @@ -0,0 +1,5 @@ +// RUN: clang-cc -fsyntax-only -verify -fms-extensions %s + +int a; + + diff --git a/test/Misc/Inputs/remapped-file b/test/Misc/Inputs/remapped-file new file mode 100644 index 0000000000000..657613ed145af --- /dev/null +++ b/test/Misc/Inputs/remapped-file @@ -0,0 +1 @@ +int *f(float *fp) { return fp; } diff --git a/test/Misc/Inputs/remapped-file-2 b/test/Misc/Inputs/remapped-file-2 new file mode 100644 index 0000000000000..9ac034a3b9791 --- /dev/null +++ b/test/Misc/Inputs/remapped-file-2 @@ -0,0 +1,3 @@ +#include "nonexistent.h" + +int *f() { return fp; } diff --git a/test/Misc/Inputs/remapped-file-3 b/test/Misc/Inputs/remapped-file-3 new file mode 100644 index 0000000000000..b7ab613367df2 --- /dev/null +++ b/test/Misc/Inputs/remapped-file-3 @@ -0,0 +1,2 @@ +extern float *fp; + diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c index 841ffc9f615d1..24f623394d88a 100644 --- a/test/Misc/message-length.c +++ b/test/Misc/message-length.c @@ -1,5 +1,5 @@ -// RUN: clang -fsyntax-only -fmessage-length=72 %s 2>&1 | FileCheck -strict-whitespace %s -// RUN: clang -fsyntax-only -fmessage-length=1 %s +// RUN: clang-cc -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s +// RUN: clang-cc -fmessage-length 1 %s // Hack so we can check things better, force the file name and line. # 1 "FILE" 1 diff --git a/test/Misc/remap-file.c b/test/Misc/remap-file.c new file mode 100644 index 0000000000000..f12fe95012656 --- /dev/null +++ b/test/Misc/remap-file.c @@ -0,0 +1,8 @@ +// RUN: clang-cc -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s +// RUN: clang-cc -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-NONEXIST %s +// RUN: clang-cc -remap-file "%S/nonexistent.c;%S/Inputs/remapped-file-2" -remap-file "%S/nonexistent.h;%S/Inputs/remapped-file-3" -fsyntax-only %S/nonexistent.c 2>&1 | FileCheck -check-prefix=CHECK-HEADER %s + +// CHECK-EXIST: remap-file.c:1:28: warning: incompatible pointer types +// CHECK-NONEXIST: nonexistent.c:1:28: warning: incompatible pointer types +// CHECK-HEADER: nonexistent.c:3:19: warning: incompatible pointer types +int diff --git a/test/PCH/method_pool.m b/test/PCH/method_pool.m index 053438828e36c..17e2420081ff1 100644 --- a/test/PCH/method_pool.m +++ b/test/PCH/method_pool.m @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -include %S/method_pool.h -fsyntax-only -verify %s +// RUN: clang -cc1 -include %S/method_pool.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -x objective-c -emit-pch -o %t %S/method_pool.h -// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s +// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/method_pool.h +// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s int message_id(id x) { return [x instMethod:17]; // expected-warning{{multiple methods}} diff --git a/test/PCH/objc_exprs.m b/test/PCH/objc_exprs.m index 9eb5a113a2470..0c12b8e177fcc 100644 --- a/test/PCH/objc_exprs.m +++ b/test/PCH/objc_exprs.m @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -fblocks -include %S/objc_exprs.h -fsyntax-only -verify %s +// RUN: clang -cc1 -fblocks -include %S/objc_exprs.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -x objective-c-header -emit-pch -fblocks -o %t %S/objc_exprs.h -// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s +// RUN: clang -cc1 -x objective-c-header -emit-pch -fblocks -o %t %S/objc_exprs.h +// RUN: clang -cc1 -fblocks -include-pch %t -fsyntax-only -verify %s // Expressions int *A1 = (objc_string)0; // expected-warning {{aka 'id'}} diff --git a/test/PCH/objc_import.m b/test/PCH/objc_import.m index 12893861585aa..c109f4083660b 100644 --- a/test/PCH/objc_import.m +++ b/test/PCH/objc_import.m @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -include %S/objc_import.h -fsyntax-only -verify %s +// RUN: clang -cc1 -include %S/objc_import.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -x objective-c -emit-pch -o %t %S/objc_import.h -// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s +// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_import.h +// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s #import "objc_import.h" diff --git a/test/PCH/objc_methods.m b/test/PCH/objc_methods.m index 136e39706c82f..a60ffad4f2a15 100644 --- a/test/PCH/objc_methods.m +++ b/test/PCH/objc_methods.m @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -include %S/objc_methods.h -fsyntax-only -verify %s +// RUN: clang -cc1 -include %S/objc_methods.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -x objective-c -emit-pch -o %t %S/objc_methods.h -// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s +// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_methods.h +// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s void func() { TestPCH *xx; diff --git a/test/PCH/objc_property.m b/test/PCH/objc_property.m index 5992787fa4222..17c3a729c5c65 100644 --- a/test/PCH/objc_property.m +++ b/test/PCH/objc_property.m @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -include %S/objc_property.h -fsyntax-only -verify %s +// RUN: clang -cc1 -include %S/objc_property.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -x objective-c -emit-pch -o %t %S/objc_property.h -// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s +// RUN: clang -cc1 -x objective-c -emit-pch -o %t %S/objc_property.h +// RUN: clang -cc1 -include-pch %t -fsyntax-only -verify %s void func() { TestProperties *xx = [TestProperties alloc]; diff --git a/test/PCH/source-manager-stack.c b/test/PCH/source-manager-stack.c new file mode 100644 index 0000000000000..72084d9760edf --- /dev/null +++ b/test/PCH/source-manager-stack.c @@ -0,0 +1,12 @@ +// Test that the source manager has the "proper" idea about the include stack +// when using PCH. + +// RUN: echo 'int x;' > %t.prefix.h +// RUN: not clang-cc -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt +// RUN: clang-cc -emit-pch -o %t.prefix.pch %t.prefix.h +// RUN: not clang-cc -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt +// RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt +// XFAIL: * +// PR5662 + +float x; diff --git a/test/Parser/check-objc2-syntax-1.m b/test/Parser/check-objc2-syntax-1.m index f596e9ba0f37f..aafb2e090a6a3 100644 --- a/test/Parser/check-objc2-syntax-1.m +++ b/test/Parser/check-objc2-syntax-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Subclass + (int)magicNumber; diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m index af1b7a8b714ac..8ad207270c3ff 100644 --- a/test/Parser/check-syntax-1.m +++ b/test/Parser/check-syntax-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}} @end diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index 3fa284282ad6f..6f3fd391b95ac 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -1,3 +1,54 @@ // RUN: clang-cc -verify -fsyntax-only %s int x(*g); // expected-error {{use of undeclared identifier 'g'}} + +struct Type { + int Type; +}; + + +// PR4451 - We should recover well from the typo of '::' as ':' in a2. +namespace y { + struct a { }; + typedef int b; +} + +y::a a1; +y:a a2; // expected-error {{unexpected ':' in nested name specifier}} +y::a a3 = a2; + +// Some valid colons: +void foo() { +y: // label + y::a s; + + int a = 4; + a = a ? a : a+1; +} + +struct b : y::a {}; + +template <typename T> +class someclass { + + int bar() { + T *P; + return 1 ? P->x : P->y; + } +}; + +enum { fooenum = 1 }; + +struct a { + int Type : fooenum; +}; + +void test(struct Type *P) { + int Type; + Type = 1 ? P->Type : Type; + + Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}} + Type = 1 ? ( + (y:b) // expected-error {{unexpected ':' in nested name specifier}} + 4) : 5; +}
\ No newline at end of file diff --git a/test/Parser/cxx-extern-c-array.cpp b/test/Parser/cxx-extern-c-array.cpp new file mode 100644 index 0000000000000..1a04fa05c24e6 --- /dev/null +++ b/test/Parser/cxx-extern-c-array.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +extern "C" int myarray[]; +int myarray[12] = {0}; + +extern "C" int anotherarray[][3]; +int anotherarray[2][3] = {1,2,3,4,5,6}; diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp index 14b31af761d3d..6505ad0f6f761 100644 --- a/test/Parser/cxx-friend.cpp +++ b/test/Parser/cxx-friend.cpp @@ -30,3 +30,11 @@ class B { void f(A *a) { a->f(); } }; + + + + +template <typename t1, typename t2> class some_template; +friend // expected-error {{'friend' used outside of class}} +some_template<foo, bar>& // expected-error {{use of undeclared identifier 'foo'}} + ; // expected-error {{expected unqualified-id}} diff --git a/test/Parser/cxx-try.cpp b/test/Parser/cxx-stmt.cpp index 535f40d780572..cc35ba153f6b0 100644 --- a/test/Parser/cxx-try.cpp +++ b/test/Parser/cxx-stmt.cpp @@ -1,6 +1,6 @@ // RUN: clang-cc -fsyntax-only -verify %s -void f() +void f1() { try { ; @@ -10,7 +10,7 @@ void f() } } -void g() +void f2() { try; // expected-error {{expected '{'}} @@ -24,7 +24,7 @@ void g() catch {} // expected-error {{expected '('}} } -void h() try { +void f3() try { } catch(...) { } @@ -39,3 +39,16 @@ struct A { A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}} A::A(int j) try : i(j) {} catch(...) {} + + + +// PR5740 +struct Type { }; + +enum { Type } Kind; +void f4() { + int i = 0; + switch (Kind) { + case Type: i = 7; break; // no error. + } +}
\ No newline at end of file diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp index 461b9e597d256..20c9fb391a800 100644 --- a/test/Parser/cxx-using-declaration.cpp +++ b/test/Parser/cxx-using-declaration.cpp @@ -1,5 +1,4 @@ // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL: * namespace A { int VA; diff --git a/test/Parser/encode.m b/test/Parser/encode.m index 1e088a0115114..15e9fe9828be1 100644 --- a/test/Parser/encode.m +++ b/test/Parser/encode.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int main(void) { const char ch = @encode(char *)[2]; diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m index 1f42ec2efbb49..b80eb7d09d8fa 100644 --- a/test/Parser/enhanced-proto-1.m +++ b/test/Parser/enhanced-proto-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol MyProto1 @optional diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m index e9e41216f9862..9adc34af1fc7c 100644 --- a/test/Parser/expressions.m +++ b/test/Parser/expressions.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -parse-noop %s +// RUN: clang -cc1 -parse-noop %s void test1() { @"s"; // expected-warning {{expression result unused}} diff --git a/test/Parser/method-prototype-1.m b/test/Parser/method-prototype-1.m index 1d535de8c1404..86a912f46eb77 100644 --- a/test/Parser/method-prototype-1.m +++ b/test/Parser/method-prototype-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -parse-noop +// RUN: clang -cc1 %s -parse-noop @interface MyObject - (void) bycopy : (int) woodo, ... ; - (void) break : (int) woodo, ... ; diff --git a/test/Parser/objc-alias-printing.m b/test/Parser/objc-alias-printing.m index e121bed0aea86..afb522cfa3d9e 100644 --- a/test/Parser/objc-alias-printing.m +++ b/test/Parser/objc-alias-printing.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -ast-print %s +// RUN: clang -cc1 -ast-print %s @protocol P1 @end @protocol P2 @end diff --git a/test/Parser/objc-category-neg-1.m b/test/Parser/objc-category-neg-1.m index 6c1bd29517369..957dbde2d7fa5 100644 --- a/test/Parser/objc-category-neg-1.m +++ b/test/Parser/objc-category-neg-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__)); static __inline__ int __inline_isfinitef (float ) __attribute__ ((always_inline)); diff --git a/test/Parser/objc-forcollection-1.m b/test/Parser/objc-forcollection-1.m index 21ec308a28a1a..6075332dcd5bc 100644 --- a/test/Parser/objc-forcollection-1.m +++ b/test/Parser/objc-forcollection-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang -cc1 -fsyntax-only %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m index ddb279b6f7c14..9019d441a60ab 100644 --- a/test/Parser/objc-forcollection-neg-2.m +++ b/test/Parser/objc-forcollection-neg-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m index 0f2bb90df85f6..464759e0d1750 100644 --- a/test/Parser/objc-forcollection-neg.m +++ b/test/Parser/objc-forcollection-neg.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; typedef struct objc_object { diff --git a/test/Parser/objc-foreach-syntax.m b/test/Parser/objc-foreach-syntax.m index 977dccc88b1d2..294a6029378cd 100644 --- a/test/Parser/objc-foreach-syntax.m +++ b/test/Parser/objc-foreach-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m index bc88e33e3720b..b3f033ea25f1d 100644 --- a/test/Parser/objc-init.m +++ b/test/Parser/objc-init.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -pedantic +// RUN: clang -cc1 -fsyntax-only -verify %s -pedantic // rdar://5707001 @interface NSNumber; diff --git a/test/Parser/objc-interfaces.m b/test/Parser/objc-interfaces.m index 7aa672901fffb..fdb52e763f2c6 100644 --- a/test/Parser/objc-interfaces.m +++ b/test/Parser/objc-interfaces.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // Test features and error recovery for objc interfaces. diff --git a/test/Parser/objc-messaging-1.m b/test/Parser/objc-messaging-1.m index 4a36fc950fa8c..2ee3639b06cbe 100644 --- a/test/Parser/objc-messaging-1.m +++ b/test/Parser/objc-messaging-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -parse-noop +// RUN: clang -cc1 %s -parse-noop int main () { int i,j; diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m index 0344566aa87a8..4dcbb79a996ad 100644 --- a/test/Parser/objc-messaging-neg-1.m +++ b/test/Parser/objc-messaging-neg-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s int main() { id a; diff --git a/test/Parser/objc-missing-impl.m b/test/Parser/objc-missing-impl.m index 9108451f1bff8..392b26f63838c 100644 --- a/test/Parser/objc-missing-impl.m +++ b/test/Parser/objc-missing-impl.m @@ -1,2 +1,2 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @end // expected-warning {{@end must appear in an @implementation context}} diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m index cf75aaa2d5a2f..294fb541e4748 100644 --- a/test/Parser/objc-property-syntax.m +++ b/test/Parser/objc-property-syntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyClass { diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m index 2913b580c5fc6..233739bc38d0d 100644 --- a/test/Parser/objc-quirks.m +++ b/test/Parser/objc-quirks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // FIXME: This is a horrible error message here. Fix. int @"s" = 5; // expected-error {{prefix attribute must be}} diff --git a/test/Parser/objc-synthesized-recover.m b/test/Parser/objc-synthesized-recover.m index 7de1a57942226..dbe9b1d93b615 100644 --- a/test/Parser/objc-synthesized-recover.m +++ b/test/Parser/objc-synthesized-recover.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I1 { diff --git a/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m index 98c6d16ff6987..25b52794a77d1 100644 --- a/test/Parser/objc-try-catch-1.m +++ b/test/Parser/objc-try-catch-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -fsyntax-only -verify %s -// RUN: clang-cc -fsyntax-only -verify -x objective-c++ %s +// RUN: clang -cc1 -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify -x objective-c++ %s void * proc(); @interface NSConstantString diff --git a/test/Parser/objc-type-printing.m b/test/Parser/objc-type-printing.m index d9ad70474f2b7..e619b72ab6b19 100644 --- a/test/Parser/objc-type-printing.m +++ b/test/Parser/objc-type-printing.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -ast-print %s +// RUN: clang -cc1 -ast-print %s @protocol P1 @end @protocol P2 @end diff --git a/test/Parser/prefix-attributes.m b/test/Parser/prefix-attributes.m index bb6d04da2a082..31be34076fe34 100644 --- a/test/Parser/prefix-attributes.m +++ b/test/Parser/prefix-attributes.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -fsyntax-only %s +// RUN: clang -cc1 -verify -fsyntax-only %s __attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}} diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m index 85ef919689dfb..fdc74ff4b424c 100644 --- a/test/Parser/selector-1.m +++ b/test/Parser/selector-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -parse-noop %s +// RUN: clang -cc1 -parse-noop %s int main() { SEL s = @selector(retain); diff --git a/test/Preprocessor/dump_macros.c b/test/Preprocessor/dump_macros.c index bdc69536778de..5908fec4b6815 100644 --- a/test/Preprocessor/dump_macros.c +++ b/test/Preprocessor/dump_macros.c @@ -1,31 +1,38 @@ -// RUN: clang-cc -E -dM %s -o %t +// RUN: clang-cc -E -dM %s -o - | FileCheck %s -strict-whitespace -// Space even without expansion tokens -// RUN: grep "#define A(x) " %t +// Space at end even without expansion tokens +// CHECK: #define A(x) #define A(x) // Space before expansion list. -// RUN: grep "#define B(x,y) x y" %t +// CHECK: #define B(x,y) x y #define B(x,y)x y -// No space in expansion list. -// RUN: grep "#define C(x,y) x y" %t +// No space in argument list. +// CHECK: #define C(x,y) x y #define C(x, y) x y // No paste avoidance. -// RUN: grep "#define X() .." %t -#define X() .. +// CHECK: #define D() .. +#define D() .. // Simple test. -// RUN: grep "#define Y ." %t -// RUN: grep "#define Z X()Y" %t -#define Y . -#define Z X()Y +// CHECK: #define E . +// CHECK: #define F X()Y +#define E . +#define F X()Y // gcc prints macros at end of translation unit, so last one wins. -// RUN: grep "#define foo 2" %t -// RUN: not grep "#define foo 1" %t -#define foo 1 -#undef foo -#define foo 2 +// CHECK: #define G 2 +#define G 1 +#undef G +#define G 2 +// Variadic macros of various sorts. PR5699 + +// CHECK: H(x,...) __VA_ARGS__ +#define H(x, ...) __VA_ARGS__ +// CHECK: I(...) __VA_ARGS__ +#define I(...) __VA_ARGS__ +// CHECK: J(x...) __VA_ARGS__ +#define J(x ...) __VA_ARGS__ diff --git a/test/Preprocessor/header_lookup1.c b/test/Preprocessor/header_lookup1.c index 10049adcd374b..961e55161418d 100644 --- a/test/Preprocessor/header_lookup1.c +++ b/test/Preprocessor/header_lookup1.c @@ -1,2 +1,2 @@ -// RUN: clang -I /usr/include %s -E | grep 'stdio.h.*3.*4' +// RUN: clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4' #include <stdio.h> diff --git a/test/Preprocessor/macro_fn_disable_expand.c b/test/Preprocessor/macro_fn_disable_expand.c index c3b067dfc9656..d40ee2aa6ec7f 100644 --- a/test/Preprocessor/macro_fn_disable_expand.c +++ b/test/Preprocessor/macro_fn_disable_expand.c @@ -1,11 +1,30 @@ -// RUN: clang-cc %s -E | grep 'bar foo (2)' -// RUN: clang-cc %s -E | grep 'm(ABCD)' +// RUN: clang-cc %s -E | FileCheck %s #define foo(x) bar x foo(foo) (2) - +// CHECK: bar foo (2) #define m(a) a(w) #define w ABCD -m(m) // m(ABCD) +m(m) +// CHECK: m(ABCD) + + + +// rdar://7466570 PR4438, PR5163 + +// We should get '42' in the argument list for gcc compatibility. +#define A 1 +#define B 2 +#define C(x) (x + 1) +X: C( +#ifdef A +#if A == 1 +#if B + 42 +#endif +#endif +#endif + ) +// CHECK: X: (42 + 1) diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m index cb6bc012f1c27..dbf1f9a797e26 100644 --- a/test/Preprocessor/non_fragile_feature.m +++ b/test/Preprocessor/non_fragile_feature.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi %s +// RUN: clang -cc1 -fobjc-nonfragile-abi %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 59f665b546498..5943e01b517ee 100644 --- a/test/Preprocessor/non_fragile_feature1.m +++ b/test/Preprocessor/non_fragile_feature1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s +// RUN: clang -cc1 -triple i386-unknown-unknown %s #ifndef __has_feature #error Should have __has_feature #endif diff --git a/test/Preprocessor/objc-pp.m b/test/Preprocessor/objc-pp.m index 977789e38f1cd..9f375efec2c02 100644 --- a/test/Preprocessor/objc-pp.m +++ b/test/Preprocessor/objc-pp.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify -pedantic +// RUN: clang -cc1 %s -fsyntax-only -verify -pedantic #import <stdint.h> // no warning on #import in objc mode. diff --git a/test/Rewriter/block-test.c b/test/Rewriter/block-test.c index 9b24e6323d454..5057056eb3d04 100644 --- a/test/Rewriter/block-test.c +++ b/test/Rewriter/block-test.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-blocks %s -fblocks -o - +// RUN: clang -cc1 -rewrite-blocks %s -fblocks -o - static int (^block)(const void *, const void *) = (int (^)(const void *, const void *))0; static int (*func)(int (^block)(void *, void *)) = (int (*)(int (^block)(void *, void *)))0; diff --git a/test/Rewriter/crash.m b/test/Rewriter/crash.m index d4aba58c7b602..60d6d1534cdc4 100644 --- a/test/Rewriter/crash.m +++ b/test/Rewriter/crash.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc -o - %s +// RUN: clang -cc1 -rewrite-objc -o - %s // rdar://5950938 @interface NSArray {} + (id)arrayWithObjects:(id)firstObj, ...; diff --git a/test/Rewriter/finally.m b/test/Rewriter/finally.m index bdc5a34fdf2df..ae650568abf12 100644 --- a/test/Rewriter/finally.m +++ b/test/Rewriter/finally.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc -verify %s -o - +// RUN: clang -cc1 -rewrite-objc -verify %s -o - int main() { @try { @@ -11,7 +11,7 @@ int main() { while (1) { @try { printf("executing try"); - break; // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}} + break; } @finally { printf("executing finally"); } @@ -25,3 +25,18 @@ int main() { return 0; } +void test_sync_with_implicit_finally() { + id foo; + @synchronized (foo) { + return; // The rewriter knows how to generate code for implicit finally + } +} + +void test2_try_with_implicit_finally() { + @try { + return; // The rewriter knows how to generate code for implicit finally + } @catch (id e) { + + } +} + diff --git a/test/Rewriter/id-test-3.m b/test/Rewriter/id-test-3.m index aecabe6f30abf..0edd041197abe 100644 --- a/test/Rewriter/id-test-3.m +++ b/test/Rewriter/id-test-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol P - (id<P>) Meth: (id<P>) Arg; diff --git a/test/Rewriter/ivar-encoding-1.m b/test/Rewriter/ivar-encoding-1.m index 10665b838ff78..667c7270e8350 100644 --- a/test/Rewriter/ivar-encoding-1.m +++ b/test/Rewriter/ivar-encoding-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface Intf { diff --git a/test/Rewriter/ivar-encoding-2.m b/test/Rewriter/ivar-encoding-2.m index 6cd0e2729874b..6a4966bb2760c 100644 --- a/test/Rewriter/ivar-encoding-2.m +++ b/test/Rewriter/ivar-encoding-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @implementation Intf { diff --git a/test/Rewriter/metadata-test-1.m b/test/Rewriter/metadata-test-1.m index 54413f2650f78..bfbe486ea487a 100644 --- a/test/Rewriter/metadata-test-1.m +++ b/test/Rewriter/metadata-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface Intf @end diff --git a/test/Rewriter/metadata-test-2.m b/test/Rewriter/metadata-test-2.m index af26545fa69d4..c9f937f187980 100644 --- a/test/Rewriter/metadata-test-2.m +++ b/test/Rewriter/metadata-test-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - typedef struct _NSPoint { float x; diff --git a/test/Rewriter/method-encoding-1.m b/test/Rewriter/method-encoding-1.m index 4726061d1a61a..77bbd8c25cb22 100644 --- a/test/Rewriter/method-encoding-1.m +++ b/test/Rewriter/method-encoding-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol P1 - (void) MyProtoMeth : (int **) arg1 : (void*) arg2; diff --git a/test/Rewriter/objc-encoding-bug-1.m b/test/Rewriter/objc-encoding-bug-1.m index d2099883b1de6..797b5bbc03a4c 100644 --- a/test/Rewriter/objc-encoding-bug-1.m +++ b/test/Rewriter/objc-encoding-bug-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - typedef struct NSMethodFrameArgInfo { struct NSMethodFrameArgInfo *subInfo; diff --git a/test/Rewriter/objc-ivar-receiver-1.m b/test/Rewriter/objc-ivar-receiver-1.m index 3898f715b71f1..7bf3544a36eaa 100644 --- a/test/Rewriter/objc-ivar-receiver-1.m +++ b/test/Rewriter/objc-ivar-receiver-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -rewrite-objc %s -o - -// RUN: clang-cc -rewrite-objc %s -o - | grep 'newInv->_container' +// RUN: clang -cc1 -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - | grep 'newInv->_container' @interface NSMutableArray - (void)addObject:(id)addObject; diff --git a/test/Rewriter/objc-string-concat-1.m b/test/Rewriter/objc-string-concat-1.m index b1f95e052cb83..bf189beef251c 100644 --- a/test/Rewriter/objc-string-concat-1.m +++ b/test/Rewriter/objc-string-concat-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @class NSString; diff --git a/test/Rewriter/objc-super-test.m b/test/Rewriter/objc-super-test.m index 500933d835dad..7a3b3af656ae9 100644 --- a/test/Rewriter/objc-super-test.m +++ b/test/Rewriter/objc-super-test.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - | grep objc_msgSendSuper | grep MainMethod +// RUN: clang -cc1 -rewrite-objc %s -o - | grep objc_msgSendSuper | grep MainMethod typedef struct objc_selector *SEL; typedef struct objc_object *id; diff --git a/test/Rewriter/objc-synchronized-1.m b/test/Rewriter/objc-synchronized-1.m index df24518d65e49..3359660e112de 100644 --- a/test/Rewriter/objc-synchronized-1.m +++ b/test/Rewriter/objc-synchronized-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - id SYNCH_EXPR(); void SYNCH_BODY(); diff --git a/test/Rewriter/properties.m b/test/Rewriter/properties.m index ac8ee9ff8c97f..3b49c22f8e26a 100644 --- a/test/Rewriter/properties.m +++ b/test/Rewriter/properties.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface Foo { int i; diff --git a/test/Rewriter/protocol-rewrite-1.m b/test/Rewriter/protocol-rewrite-1.m index 3f2bb6f190cdd..66280ca1b0f20 100644 --- a/test/Rewriter/protocol-rewrite-1.m +++ b/test/Rewriter/protocol-rewrite-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - typedef struct MyWidget { int a; diff --git a/test/Rewriter/rewrite-api-bug.m b/test/Rewriter/rewrite-api-bug.m index e2dfe38afe448..745efec5bd9e2 100644 --- a/test/Rewriter/rewrite-api-bug.m +++ b/test/Rewriter/rewrite-api-bug.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface MyDerived - (void) instanceMethod; diff --git a/test/Rewriter/rewrite-foreach-1.m b/test/Rewriter/rewrite-foreach-1.m index 686d73fca5b4c..9cf084c502ae3 100644 --- a/test/Rewriter/rewrite-foreach-1.m +++ b/test/Rewriter/rewrite-foreach-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol P @end diff --git a/test/Rewriter/rewrite-foreach-2.m b/test/Rewriter/rewrite-foreach-2.m index 4de64bc87dedf..5567d0169b938 100644 --- a/test/Rewriter/rewrite-foreach-2.m +++ b/test/Rewriter/rewrite-foreach-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol P @end diff --git a/test/Rewriter/rewrite-foreach-3.m b/test/Rewriter/rewrite-foreach-3.m index 0de31021d8207..804f0204f5e9b 100644 --- a/test/Rewriter/rewrite-foreach-3.m +++ b/test/Rewriter/rewrite-foreach-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol P @end diff --git a/test/Rewriter/rewrite-foreach-4.m b/test/Rewriter/rewrite-foreach-4.m index 70f3eb8744976..9870690325b2b 100644 --- a/test/Rewriter/rewrite-foreach-4.m +++ b/test/Rewriter/rewrite-foreach-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface MyList - (id) allKeys; diff --git a/test/Rewriter/rewrite-foreach-5.m b/test/Rewriter/rewrite-foreach-5.m index 14d18d130d89e..141cb6a2c0aac 100644 --- a/test/Rewriter/rewrite-foreach-5.m +++ b/test/Rewriter/rewrite-foreach-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface MyList - (id) allKeys; diff --git a/test/Rewriter/rewrite-foreach-6.m b/test/Rewriter/rewrite-foreach-6.m index 66d411001e138..bbc9a94a13f92 100644 --- a/test/Rewriter/rewrite-foreach-6.m +++ b/test/Rewriter/rewrite-foreach-6.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -rewrite-objc -o - +// RUN: clang -cc1 %s -rewrite-objc -o - // rdar://5716356 // FIXME: Should be able to pipe into clang, but code is not // yet correct for other reasons: rdar://5716940 diff --git a/test/Rewriter/rewrite-nest.m b/test/Rewriter/rewrite-nest.m index e35baf6ce8529..594e1b1629a91 100644 --- a/test/Rewriter/rewrite-nest.m +++ b/test/Rewriter/rewrite-nest.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface NSMapTable @end @interface NSEnumerator @end diff --git a/test/Rewriter/rewrite-protocol-type-1.m b/test/Rewriter/rewrite-protocol-type-1.m index 63b605d7ed616..e46a3badfeef6 100644 --- a/test/Rewriter/rewrite-protocol-type-1.m +++ b/test/Rewriter/rewrite-protocol-type-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol MyProto1 @end diff --git a/test/Rewriter/rewrite-try-catch.m b/test/Rewriter/rewrite-try-catch.m index f69e8ef354968..e9b002b2be396 100644 --- a/test/Rewriter/rewrite-try-catch.m +++ b/test/Rewriter/rewrite-try-catch.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface Foo @end @interface GARF @end diff --git a/test/Rewriter/static-type-protocol-1.m b/test/Rewriter/static-type-protocol-1.m index 986627d37a891..735c94278dc56 100644 --- a/test/Rewriter/static-type-protocol-1.m +++ b/test/Rewriter/static-type-protocol-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @protocol Proto - (void) ProtoDidget; diff --git a/test/Rewriter/undecl-objc-h.m b/test/Rewriter/undecl-objc-h.m index 12f38112c9cdc..b68c6b1757056 100644 --- a/test/Rewriter/undecl-objc-h.m +++ b/test/Rewriter/undecl-objc-h.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - typedef struct S { int * pint; diff --git a/test/Rewriter/undeclared-method-1.m b/test/Rewriter/undeclared-method-1.m index 499d9114e1a76..6c1460d02ec81 100644 --- a/test/Rewriter/undeclared-method-1.m +++ b/test/Rewriter/undeclared-method-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface Derived @end diff --git a/test/Rewriter/undef-field-reference-1.m b/test/Rewriter/undef-field-reference-1.m index 17f448dcae206..ef80c26d7c505 100644 --- a/test/Rewriter/undef-field-reference-1.m +++ b/test/Rewriter/undef-field-reference-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - @interface MyDerived { diff --git a/test/Rewriter/va-method.m b/test/Rewriter/va-method.m index b4fdac553dedc..f808b8f596419 100644 --- a/test/Rewriter/va-method.m +++ b/test/Rewriter/va-method.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -rewrite-objc %s -o - +// RUN: clang -cc1 -rewrite-objc %s -o - #include <stdarg.h> diff --git a/test/Sema/block-as-object.m b/test/Sema/block-as-object.m index 219b1a065325e..1197a1972feca 100644 --- a/test/Sema/block-as-object.m +++ b/test/Sema/block-as-object.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify -fblocks +// RUN: clang -cc1 %s -fsyntax-only -verify -fblocks @interface Whatever - copy; diff --git a/test/Sema/builtin-prefetch.c b/test/Sema/builtin-prefetch.c index bf28277acb81c..4ee9f8947bbb5 100644 --- a/test/Sema/builtin-prefetch.c +++ b/test/Sema/builtin-prefetch.c @@ -6,7 +6,8 @@ void foo() { __builtin_prefetch(&a, 1); __builtin_prefetch(&a, 1, 2); __builtin_prefetch(&a, 1, 9, 3); // expected-error{{too many arguments to function}} - __builtin_prefetch(&a, "hello", 2); // expected-error{{argument to __builtin_prefetch must be a constant integer}} + __builtin_prefetch(&a, "hello", 2); // expected-error{{argument to __builtin_prefetch must be of integer type}} + __builtin_prefetch(&a, a, 2); // expected-error{{argument to __builtin_prefetch must be a constant integer}} __builtin_prefetch(&a, 2); // expected-error{{argument should be a value from 0 to 1}} __builtin_prefetch(&a, 0, 4); // expected-error{{argument should be a value from 0 to 3}} __builtin_prefetch(&a, -1, 4); // expected-error{{argument should be a value from 0 to 1}} diff --git a/test/Sema/compare.c b/test/Sema/compare.c index 01a216ffec227..fa2d3a062ed15 100644 --- a/test/Sema/compare.c +++ b/test/Sema/compare.c @@ -225,3 +225,8 @@ int void_pointers(void* foo) { return foo == (void*) 0; return foo == (void*) 1; } + +int test1(int i) { + enum en { zero }; + return i > zero; +} diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index 299b0a267dc25..10fcde6e75769 100644 --- a/test/Sema/exprs.c +++ b/test/Sema/exprs.c @@ -111,4 +111,6 @@ test15_t test15(void) { return (test15_t)0 + (test15_t)0; // expected-error {{invalid operands to binary expression ('test15_t' (aka 'unsigned long *') and 'test15_t')}} } +// rdar://7446395 +void test16(float x) { x == ((void*) 0); } // expected-error {{invalid operands to binary expression}} diff --git a/test/Sema/init.c b/test/Sema/init.c index 840b24fd30b09..4ba6867d0b0f2 100644 --- a/test/Sema/init.c +++ b/test/Sema/init.c @@ -126,3 +126,7 @@ uintptr_t ptrasintadd3 = 4 + (uintptr_t)&a; // PR4285 const wchar_t widestr[] = L"asdf"; + +// PR5447 +const double pr5447 = (0.05 < -1.0) ? -1.0 : 0.0499878; + diff --git a/test/Sema/ms-fuzzy-asm.c b/test/Sema/ms-fuzzy-asm.c index 58dcbcfc52323..2113949f237be 100644 --- a/test/Sema/ms-fuzzy-asm.c +++ b/test/Sema/ms-fuzzy-asm.c @@ -6,4 +6,4 @@ 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/nested-redef.c b/test/Sema/nested-redef.c index ea180910128b9..54a970f044212 100644 --- a/test/Sema/nested-redef.c +++ b/test/Sema/nested-redef.c @@ -1,6 +1,7 @@ // RUN: clang-cc -fsyntax-only -verify %s struct X { // expected-note{{previous definition is here}} - struct X { } x; // expected-error{{nested redefinition of 'X'}} + struct X { } x; // expected-error{{nested redefinition of 'X'}} \ + // expected-error{{field has incomplete type}} }; struct Y { }; diff --git a/test/Sema/rdar6248119.m b/test/Sema/rdar6248119.m index 631c7b35a992f..d4ee305c2912a 100644 --- a/test/Sema/rdar6248119.m +++ b/test/Sema/rdar6248119.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s -verify +// RUN: clang -cc1 -fsyntax-only %s -verify // Test case for: // <rdar://problem/6248119> @finally doesn't introduce a new scope diff --git a/test/Sema/return.c b/test/Sema/return.c index ad75cf1a0b6d2..2e8120a7542e4 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -222,3 +222,7 @@ void test32() { void test33() { if (j) while (1) { } } + +int test34() { + asm("nop"); +} diff --git a/test/Sema/vector-init.c b/test/Sema/vector-init.c index 9dac6c7114da0..1eec6c57a68c9 100644 --- a/test/Sema/vector-init.c +++ b/test/Sema/vector-init.c @@ -16,10 +16,15 @@ float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0, 9.0 }; // expected-warning {{excess elements in array initializer}} +// PR5650 +__attribute__((vector_size(16))) float f1(void) { + __attribute__((vector_size(16))) float vec = {0.0f, 0.0f, 0.0f}; + return(vec); +} -// rdar://6881069 -__attribute__((vector_size(16))) // expected-error {{unsupported type 'float (void)' for vector_size attribute, please use on typedef}} -float f1(void) { +__attribute__((vector_size(16))) float f2( + __attribute__((vector_size(16))) float a1) { + return(a1); } diff --git a/test/SemaCXX/array-bound-merge.cpp b/test/SemaCXX/array-bound-merge.cpp new file mode 100644 index 0000000000000..579c7933684db --- /dev/null +++ b/test/SemaCXX/array-bound-merge.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// PR5515 + +extern int a[]; +int a[10]; +extern int b[10]; +int b[]; +extern int c[1]; +int c[] = {1,2}; // expected-error {{excess elements in array initializer}} diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp index da52d338cfbc4..d68779cc88869 100644 --- a/test/SemaCXX/attr-cxx0x.cpp +++ b/test/SemaCXX/attr-cxx0x.cpp @@ -2,7 +2,7 @@ int final_fail [[final]]; //expected-error {{'final' attribute only applies to virtual method or class types}} -struct [[final]] final_base { }; // expected-note {{struct final_base declared here}} +struct [[final]] final_base { }; // expected-note {{'struct final_base' declared here}} struct final_child : final_base { }; // expected-error {{derivation from 'final' struct final_base}} struct final_member { virtual void quux [[final]] (); }; // expected-note {{overridden virtual function is here}} @@ -33,4 +33,4 @@ struct base { }; struct [[base_check, base_check]] bc : base { // expected-error {{'base_check' attribute cannot be repeated}} -};
\ No newline at end of file +}; diff --git a/test/SemaCXX/attr-noreturn.cpp b/test/SemaCXX/attr-noreturn.cpp new file mode 100644 index 0000000000000..e4fdc08ae9e7b --- /dev/null +++ b/test/SemaCXX/attr-noreturn.cpp @@ -0,0 +1,30 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// PR5620 +void f0() __attribute__((__noreturn__)); +void f1(void (*)()); +void f2() { f1(f0); } + +// Taking the address of a noreturn function +void test_f0a() { + void (*fp)() = f0; + void (*fp1)() __attribute__((noreturn)) = f0; +} + +// Taking the address of an overloaded noreturn function +void f0(int) __attribute__((__noreturn__)); + +void test_f0b() { + void (*fp)() = f0; + void (*fp1)() __attribute__((noreturn)) = f0; +} + +// No-returned function pointers +typedef void (* noreturn_fp)() __attribute__((noreturn)); + +void f3(noreturn_fp); // expected-note{{candidate function}} + +void test_f3() { + f3(f0); // okay + f3(f2); // expected-error{{no matching function for call}} +} diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp index e38b6b312f98e..7188678b74db8 100644 --- a/test/SemaCXX/compare.cpp +++ b/test/SemaCXX/compare.cpp @@ -49,8 +49,8 @@ int test0(long a, unsigned long b) { ((signed char) A == (unsigned char) b) + (A < (unsigned long) b) + (A < (unsigned int) b) + - (A < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}} - (A < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}} + (A < (unsigned short) b) + + (A < (unsigned char) b) + ((long) A < b) + ((int) A < b) + ((short) A < b) + @@ -78,9 +78,9 @@ int test0(long a, unsigned long b) { (a < (unsigned short) B) + (a < (unsigned char) B) + ((long) a < B) + - ((int) a < B) + // expected-warning {{comparison of integers of different signs}} - ((short) a < B) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < B) + // expected-warning {{comparison of integers of different signs}} + ((int) a < B) + + ((short) a < B) + + ((signed char) a < B) + ((long) a < (unsigned long) B) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) B) + // expected-warning {{comparison of integers of different signs}} ((short) a < (unsigned short) B) + // expected-warning {{comparison of integers of different signs}} @@ -101,8 +101,8 @@ int test0(long a, unsigned long b) { ((signed char) C == (unsigned char) b) + (C < (unsigned long) b) + (C < (unsigned int) b) + - (C < (unsigned short) b) + // expected-warning {{comparison of integers of different signs}} - (C < (unsigned char) b) + // expected-warning {{comparison of integers of different signs}} + (C < (unsigned short) b) + + (C < (unsigned char) b) + ((long) C < b) + ((int) C < b) + ((short) C < b) + @@ -130,9 +130,9 @@ int test0(long a, unsigned long b) { (a < (unsigned short) C) + (a < (unsigned char) C) + ((long) a < C) + - ((int) a < C) + // expected-warning {{comparison of integers of different signs}} - ((short) a < C) + // expected-warning {{comparison of integers of different signs}} - ((signed char) a < C) + // expected-warning {{comparison of integers of different signs}} + ((int) a < C) + + ((short) a < C) + + ((signed char) a < C) + ((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}} ((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}} ((short) a < (unsigned short) C) + // expected-warning {{comparison of integers of different signs}} @@ -193,3 +193,8 @@ int test0(long a, unsigned long b) { 10 ; } + +int test1(int i) { + enum en { zero }; + return i > zero; +} diff --git a/test/SemaCXX/convert-to-bool.cpp b/test/SemaCXX/convert-to-bool.cpp index 937b2729d1c38..277bfc6c68884 100644 --- a/test/SemaCXX/convert-to-bool.cpp +++ b/test/SemaCXX/convert-to-bool.cpp @@ -49,7 +49,7 @@ void test_explicit_bool(ExplicitConvToBool ecb) { } void test_explicit_conv_to_ref(ExplicitConvToRef ecr) { - int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot be initialized with a value of type 'struct ExplicitConvToRef'}} + int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'struct ExplicitConvToRef'}} int& i2(ecr); // okay } @@ -57,11 +57,11 @@ struct A { }; struct B { }; struct C { explicit operator A&(); // expected-warning{{explicit conversion functions are a C++0x extension}} - operator B&(); + operator B&(); // expected-note{{candidate}} }; void test_copy_init_conversions(C c) { - A &a = c; // expected-error{{non-const lvalue reference to type 'struct A' cannot be initialized with a value of type 'struct C'}} + A &a = c; // expected-error{{no viable conversion from 'struct C' to 'struct A'}} B &b = b; // okay } diff --git a/test/SemaCXX/decl-init-ref.cpp b/test/SemaCXX/decl-init-ref.cpp index d7db647cd11ad..20eb91a608cad 100644 --- a/test/SemaCXX/decl-init-ref.cpp +++ b/test/SemaCXX/decl-init-ref.cpp @@ -1,6 +1,6 @@ // RUN: clang-cc -fsyntax-only -verify -std=c++0x %s -struct A {}; +struct A {}; // expected-note {{candidate function}} struct BASE { operator A(); // expected-note {{candidate function}} @@ -21,6 +21,6 @@ extern B f(); const int& ri = (void)0; // expected-error {{invalid initialization of reference of type 'int const &' from expression of type 'void'}} int main() { - const A& rca = f(); // expected-error {{rvalue reference cannot bind to lvalue due to multiple conversion functions}} - A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot be initialized with a temporary of type 'class B'}} + const A& rca = f(); // expected-error {{conversion from 'class B' to 'struct A const' is ambiguous}} + A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}} } diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp index e627fefdef6dd..0377657a82d24 100644 --- a/test/SemaCXX/default-assignment-operator.cpp +++ b/test/SemaCXX/default-assignment-operator.cpp @@ -1,7 +1,6 @@ // RUN: clang-cc -fsyntax-only -verify %s -class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} \ - // expected-note {{synthesized method is first required here}} +class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} int &ref; // expected-note {{declared at}} }; @@ -26,7 +25,7 @@ Z z2; // Test1 void f(X x, const X cx) { - x = cx; // expected-note {{synthesized method is first required here}} + x = cx; // expected-note 2 {{synthesized method is first required here}} x = cx; z1 = z2; } diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp index db256812ab807..3315de00ca83e 100644 --- a/test/SemaCXX/enum.cpp +++ b/test/SemaCXX/enum.cpp @@ -1,4 +1,5 @@ // RUN: clang-cc -fsyntax-only -verify %s + enum E { Val1, Val2 @@ -25,13 +26,42 @@ void bar() { /// PR3688 struct s1 { - enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}} expected-note{{forward declaration of 'enum s1::e1'}} + enum e1 (*bar)(void); // expected-error{{ISO C++ forbids forward references to 'enum' types}} }; enum e1 { YES, NO }; static enum e1 badfunc(struct s1 *q) { - return q->bar(); // expected-error{{calling function with incomplete return type 'enum s1::e1'}} + return q->bar(); } enum e2; // expected-error{{ISO C++ forbids forward references to 'enum' types}} + +namespace test1 { + template <class A, class B> struct is_same { static const int value = -1; }; + template <class A> struct is_same<A,A> { static const int value = 1; }; + + enum enum0 { v0 }; + int test0[is_same<typeof(+v0), int>::value]; + + enum enum1 { v1 = __INT_MAX__ }; + int test1[is_same<typeof(+v1), int>::value]; + + enum enum2 { v2 = __INT_MAX__ * 2U }; + int test2[is_same<typeof(+v2), unsigned int>::value]; + + // This kindof assumes that 'int' is smaller than 'long long'. +#if defined(__LP64__) + enum enum3 { v3 = __LONG_LONG_MAX__ }; + int test3[is_same<typeof(+v3), long>::value]; + + enum enum4 { v4 = __LONG_LONG_MAX__ * 2ULL }; + int test4[is_same<typeof(+v4), unsigned long>::value]; +#else + enum enum3 { v3 = __LONG_LONG_MAX__ }; + int test3[is_same<typeof(+v3), long long>::value]; + + enum enum4 { v4 = __LONG_LONG_MAX__ * 2ULL }; + int test4[is_same<typeof(+v4), unsigned long long>::value]; +#endif +} diff --git a/test/SemaCXX/exception-spec.cpp b/test/SemaCXX/exception-spec.cpp index 56cc435f7db3a..efc983322ae5d 100644 --- a/test/SemaCXX/exception-spec.cpp +++ b/test/SemaCXX/exception-spec.cpp @@ -186,5 +186,18 @@ template <typename T> struct TEx; // expected-note {{template is declared here}} void tf() throw(TEx<int>); // expected-error {{implicit instantiation of undefined template}} -// DR 437, class throws itself. FIXME: See Sema::CheckSpecifiedExceptionType. -//struct DR437 { void f() throw(DR437); }; +// DR 437, class throws itself. +struct DR437 { + void f() throw(DR437); + void g() throw(DR437*); + void h() throw(DR437&); +}; + +// DR 437 within a nested class +struct DR437_out { + struct DR437_in { + void f() throw(DR437_out); + void g() throw(DR437_out*); + void h() throw(DR437_out&); + }; +}; diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index 76e84e5fbe84b..d1c42eb9fbb53 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -4,3 +4,14 @@ friend class A; // expected-error {{'friend' used outside of class}} void f() { friend class A; } // expected-error {{'friend' used outside of class}} class C { friend class A; }; class D { void f() { friend class A; } }; // expected-error {{'friend' used outside of class}} + +// PR5760 +namespace test0 { + namespace ns { + void f(int); + } + + struct A { + friend void ns::f(int a); + }; +} diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp index 785ea0efa4013..b7db907e2216d 100644 --- a/test/SemaCXX/i-c-e-cxx.cpp +++ b/test/SemaCXX/i-c-e-cxx.cpp @@ -14,3 +14,10 @@ void f() { int array[value]; } } + +int a() { + const int t=t; // expected-note {{subexpression not valid}} + switch(1) { + case t:; // expected-error {{not an integer constant expression}} + } +} diff --git a/test/SemaCXX/implicit-member-functions.cpp b/test/SemaCXX/implicit-member-functions.cpp new file mode 100644 index 0000000000000..186780833d39d --- /dev/null +++ b/test/SemaCXX/implicit-member-functions.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct A { }; // expected-note {{previous implicit declaration is here}} +A::A() { } // expected-error {{definition of implicitly declared constructor}} + +struct B { }; // expected-note {{previous implicit declaration is here}} +B::B(const B&) { } // expected-error {{definition of implicitly declared copy constructor}} + +struct C { }; // expected-note {{previous implicit declaration is here}} +C& C::operator=(const C&) { return *this; } // expected-error {{definition of implicitly declared copy assignment operator}} + +struct D { }; // expected-note {{previous implicit declaration is here}} +D::~D() { } // expected-error {{definition of implicitly declared destructor}} + diff --git a/test/SemaCXX/implicit-virtual-member-functions.cpp b/test/SemaCXX/implicit-virtual-member-functions.cpp new file mode 100644 index 0000000000000..30fe2786ba461 --- /dev/null +++ b/test/SemaCXX/implicit-virtual-member-functions.cpp @@ -0,0 +1,29 @@ +// RUN: clang-cc -fsyntax-only -verify %s +struct A { + virtual ~A(); +}; + +struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}} + virtual void f(); + + void operator delete (void *, int); // expected-note {{'operator delete' declared here}} +}; + +void B::f() { // expected-note {{implicit default destructor for 'struct B' first required here}} +} + +struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}} + C(); + void operator delete(void *, int); // expected-note {{'operator delete' declared here}} +}; + +C::C() { } // expected-note {{implicit default destructor for 'struct C' first required here}} + +struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}} + void operator delete(void *, int); // expected-note {{'operator delete' declared here}} +}; + +void f() { + new D; // expected-note {{implicit default destructor for 'struct D' first required here}} +} + diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp index fc9b3ab51eadc..d19727ac0766c 100644 --- a/test/SemaCXX/linkage-spec.cpp +++ b/test/SemaCXX/linkage-spec.cpp @@ -40,3 +40,17 @@ namespace pr5430 { } using namespace pr5430; extern "C" void pr5430::func(void) { } + +// PR5404 +int f2(char *) +{ + return 0; +} + +extern "C" +{ + int f2(int) + { + return f2((char *)0); + } +} diff --git a/test/SemaCXX/literal-type.cpp b/test/SemaCXX/literal-type.cpp new file mode 100644 index 0000000000000..0dca9c9a92b31 --- /dev/null +++ b/test/SemaCXX/literal-type.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s + +static_assert(__is_literal(int), "fail"); +static_assert(__is_literal(void*), "fail"); +enum E { E1 }; +static_assert(__is_literal(E), "fail"); +static_assert(__is_literal(decltype(E1)), "fail"); +typedef int IAR[10]; +static_assert(__is_literal(IAR), "fail"); +// FIXME: Records diff --git a/test/SemaCXX/member-expr-anonymous-union.cpp b/test/SemaCXX/member-expr-anonymous-union.cpp new file mode 100644 index 0000000000000..9566df4a20ff9 --- /dev/null +++ b/test/SemaCXX/member-expr-anonymous-union.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc %s -fsyntax-only -verify +// PR5543 + +struct A { int x; union { int* y; float& z; }; }; struct B : A {int a;}; +int* a(B* x) { return x->y; } + +struct x { union { int y; }; }; x y; template <int X> int f() { return X+y.y; } +int g() { return f<2>(); } + diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp index cd13bcc3670ea..9cd6855ccd553 100644 --- a/test/SemaCXX/member-expr.cpp +++ b/test/SemaCXX/member-expr.cpp @@ -41,3 +41,18 @@ void test2(X *xp) { xp->::i = 7; // expected-error{{qualified member access refers to a member in the global namespace}} xp->C::i = 7; // expected-error{{qualified member access refers to a member in namespace 'C'}} } + + +namespace test3 { + struct NamespaceDecl; + + struct NamedDecl { + void *getIdentifier() const; + }; + + struct NamespaceDecl : NamedDecl { + bool isAnonymousNamespace() const { + return !getIdentifier(); + } + }; +} diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 83c72417d590b..6a51261e26fcf 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -186,12 +186,10 @@ class foo { }; -// PR4452 -// FIXME: This error recovery sucks. -foo<somens:a> a2; // expected-error {{unexpected namespace name 'somens': expected expression}} \ -expected-error {{C++ requires a type specifier for all declarations}} +// PR4452 / PR4451 +foo<somens:a> a2; // expected-error {{unexpected ':' in nested name specifier}} -somens::a a3 = a2; +somens::a a3 = a2; // expected-error {{cannot initialize 'a3' with an lvalue of type 'foo<somens::a>'}} diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index f2fe0a78e388a..8a3ec8b16a262 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -140,10 +140,8 @@ public: class Base { public: - static int operator new(signed char) throw(); // expected-error {{'operator new' takes type size_t}} \ - // expected-error {{operator new' must return type 'void *'}} - static int operator new[] (signed char) throw(); // expected-error {{'operator new[]' takes type size_t}} \ - // expected-error {{operator new[]' must return type 'void *'}} + static void *operator new(signed char) throw(); // expected-error {{'operator new' takes type size_t}} + static int operator new[] (size_t) throw(); // expected-error {{operator new[]' must return type 'void *'}} }; class Tier {}; @@ -160,9 +158,11 @@ void loadEngineFor() { } template <class T> struct TBase { - void* operator new(T size, int); // expected-error {{'operator new' takes type size_t}} + void* operator new(T size, int); // expected-error {{'operator new' cannot take a dependent type as first parameter; use size_t}}\ + // expected-error {{'operator new' takes type size_t}} }; +// FIXME: We should not try to instantiate operator new, since it is invalid. TBase<int> t1; // expected-note {{in instantiation of template class 'struct TBase<int>' requested here}} class X6 { @@ -202,3 +202,17 @@ struct X11 : X10 { // expected-error {{no suitable member 'operator delete' in ' void f() { X11 x11; // expected-note {{implicit default destructor for 'struct X11' first required here}} } + +struct X12 { + void* operator new(size_t, void*); +}; + +struct X13 : X12 { + using X12::operator new; +}; + +static void* f(void* g) +{ + return new (g) X13(); +} + diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp index f0290e889a298..bc7a707ee546b 100644 --- a/test/SemaCXX/offsetof.cpp +++ b/test/SemaCXX/offsetof.cpp @@ -13,3 +13,8 @@ void f() { int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'struct P'}} } +struct Base { int x; }; +struct Derived : Base { int y; }; +int o = __builtin_offsetof(Derived, x); // expected-warning{{offset of on non-POD type}} + +const int o2 = sizeof(__builtin_offsetof(Derived, x)); diff --git a/test/SemaCXX/overload-call-copycon.cpp b/test/SemaCXX/overload-call-copycon.cpp index 755e27adbac8a..6436236b81e98 100644 --- a/test/SemaCXX/overload-call-copycon.cpp +++ b/test/SemaCXX/overload-call-copycon.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang-cc -fsyntax-only %s -Wnon-pod-varargs class X { }; int& copycon(X x); @@ -23,10 +23,10 @@ float& copycon2(...); void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) { int& i1 = copycon2(b); - float& f1 = copycon2(bc); - float& f2 = copycon2(bv); + float& f1 = copycon2(bc); // expected-warning {{cannot pass object of non-POD type}} + float& f2 = copycon2(bv); // expected-warning {{cannot pass object of non-POD type}} short& s1 = copycon2(a); - float& f3 = copycon2(ac); + float& f3 = copycon2(ac); // expected-warning {{cannot pass object of non-POD type}} } int& copycon3(A a); @@ -34,7 +34,7 @@ float& copycon3(...); void test_copycon3(B b, const B bc) { int& i1 = copycon3(b); - float& f1 = copycon3(bc); + float& f1 = copycon3(bc); // expected-warning {{cannot pass object of non-POD type}} } diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 3a0bf3008d6cb..5d2718208f2bc 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -92,7 +92,7 @@ enum PromotesToInt { }; enum PromotesToUnsignedInt { - PromotesToUnsignedIntValue = 1u + PromotesToUnsignedIntValue = __INT_MAX__ * 2U }; int* o(int); @@ -291,3 +291,13 @@ void f(SR) { } void g(opt o) { f(o); } + + +namespace PR5756 { + int &a(void*, int); + float &a(void*, float); + void b() { + int &ir = a(0,0); + (void)ir; + } +} diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 16d37040f1405..672b8b4fc2669 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -67,7 +67,7 @@ void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) { float &f1 = (e1 == e2); float &f2 = (enum1 == e2); float &f3 = (e1 == enum2); - float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a temporary of type 'bool'}} + float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}} } // PR5244 - Argument-dependent lookup would include the two operators below, diff --git a/test/SemaCXX/prefetch-enum.cpp b/test/SemaCXX/prefetch-enum.cpp new file mode 100644 index 0000000000000..829321fb0e91d --- /dev/null +++ b/test/SemaCXX/prefetch-enum.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc -fsyntax-only %s -verify +// PR5679 + +enum X { A = 3 }; + +void Test() { + char ch; + __builtin_prefetch(&ch, 0, A); +} diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp index 254a18de1f32a..5a11a0cd07b83 100644 --- a/test/SemaCXX/qualified-id-lookup.cpp +++ b/test/SemaCXX/qualified-id-lookup.cpp @@ -109,3 +109,18 @@ struct Undef { // expected-note{{definition of 'struct Undef' is not complete un int Undef::f() { return sizeof(Undef); } + +// PR clang/5667 +namespace test1 { + template <typename T> struct is_class { + enum { value = 0 }; + }; + + template <typename T> class ClassChecker { + bool isClass() { + return is_class<T>::value; + } + }; + + template class ClassChecker<int>; +} diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp index dda1ead7b622e..60620993b43c1 100644 --- a/test/SemaCXX/ref-init-ambiguous.cpp +++ b/test/SemaCXX/ref-init-ambiguous.cpp @@ -3,18 +3,19 @@ enum E2 { }; struct A { - operator E2&(); // expected-note 3 {{candidate function}} + operator E2&(); // expected-note 2 {{candidate function}} }; struct B { - operator E2&(); // expected-note 3 {{candidate function}} + operator E2&(); // expected-note 2 {{candidate function}} }; struct C : B, A { }; void test(C c) { - const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} + // FIXME: state that there was an ambiguity in the conversion! + const E2 &e2 = c; // expected-error {{reference to type 'enum E2 const' could not bind to an lvalue of type 'struct C'}} } void foo(const E2 &); diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp index e03abf4300a3a..45d3923ff0ad5 100644 --- a/test/SemaCXX/references.cpp +++ b/test/SemaCXX/references.cpp @@ -44,17 +44,17 @@ B fB(); // C++ [dcl.init.ref]p5b2 void test4() { - double& rd2 = 2.0; // expected-error{{non-const lvalue reference to type 'double' cannot be initialized with a temporary of type 'double'}} + double& rd2 = 2.0; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'}} int i = 2; - double& rd3 = i; // expected-error{{non-const lvalue reference to type 'double' cannot be initialized with a value of type 'int'}} + double& rd3 = i; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}} const A& rca = fB(); } void test5() { - const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0 + // const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0 const volatile int cvi = 1; - const int& r = cvi; // expected-error{{initialization of reference to type 'int const' with a value of type 'int const volatile' drops qualifiers}} + const int& r = cvi; // expected-error{{binding of reference to type 'int const' to a value of type 'int const volatile' drops qualifiers}} } // C++ [dcl.init.ref]p3 diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index 5132c2a69bebf..7a71607707c88 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -44,7 +44,7 @@ void f() { conv_to_not_int_rvalue cnir; not_int &&ni4 = cnir; // expected-error {{rvalue reference cannot bind to lvalue}} - not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'struct not_int' cannot be initialized with a value of type 'struct conv_to_not_int_rvalue'}} + not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'struct not_int' cannot bind to a value of unrelated type 'struct conv_to_not_int_rvalue'}} not_int &&ni6 = conv_to_not_int_rvalue(); diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp index 340c0ae4899b4..dfb4edce67c8e 100644 --- a/test/SemaCXX/type-traits.cpp +++ b/test/SemaCXX/type-traits.cpp @@ -250,3 +250,11 @@ void has_trivial_destructor() { int t17[T(__has_trivial_destructor(NonPODAr))]; int t18[T(__has_trivial_destructor(VirtAr))]; } + +struct A { ~A() {} }; +template<typename> struct B : A { }; + +void f() { + int t01[T(!__has_trivial_destructor(A))]; + int t02[T(!__has_trivial_destructor(B<int>))]; +}
\ No newline at end of file diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp index 42deb27027bf5..0235624a8ea5e 100644 --- a/test/SemaCXX/using-decl-1.cpp +++ b/test/SemaCXX/using-decl-1.cpp @@ -38,3 +38,7 @@ struct X1 : X0 { (*this)(1); } }; + +struct A { void f(); }; +struct B : A { }; +class C : B { using B::f; }; diff --git a/test/SemaCXX/using-decl-templates.cpp b/test/SemaCXX/using-decl-templates.cpp index 684009b78a43f..a19223d479d00 100644 --- a/test/SemaCXX/using-decl-templates.cpp +++ b/test/SemaCXX/using-decl-templates.cpp @@ -10,7 +10,7 @@ template<typename T> struct B : A<T> { using A<T>::N; // expected-error{{dependent using declaration resolved to type without 'typename'}} using A<T>::foo; // expected-error{{no member named 'foo'}} - using A<double>::f; // expected-error{{using declaration refers into 'A<double>::', which is not a base class of 'B'}} + using A<double>::f; // expected-error{{using declaration refers into 'A<double>::', which is not a base class of 'B<int>'}} }; B<int> a; // expected-note{{in instantiation of template class 'struct B<int>' requested here}} @@ -34,3 +34,14 @@ template<typename T> struct E : A<T> { void g() { f(); } }; + +namespace test0 { + struct Base { + int foo; + }; + template<typename T> struct E : Base { + using Base::foo; + }; + + template struct E<int>; +} diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp index 51f347dc7a73a..b7583f27cb64e 100644 --- a/test/SemaCXX/using-directive.cpp +++ b/test/SemaCXX/using-directive.cpp @@ -112,3 +112,12 @@ using namespace Alias; void testAlias() { inAliased(); } + +namespace N { void f2(int); } + +extern "C++" { + using namespace N; + void f3() { f2(1); } +} + +void f4() { f2(1); } diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp index 977df144fa11b..f913531a27d06 100644 --- a/test/SemaCXX/vararg-non-pod.cpp +++ b/test/SemaCXX/vararg-non-pod.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fblocks %s +// RUN: clang-cc -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs extern char version[]; @@ -66,3 +66,25 @@ void t5() E e(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} } + +// PR5761: unevaluated operands and the non-POD warning +class Foo { + public: + Foo() {} +}; + +int Helper(...); +const int size = sizeof(Helper(Foo())); + +namespace std { + class type_info { }; +} + +struct Base { virtual ~Base(); }; +Base &get_base(...); +int eat_base(...); + +void test_typeid(Base &base) { + (void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'struct Base' through variadic function; call will abort at runtime}} + (void)typeid(eat_base(base)); // okay +} diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp new file mode 100644 index 0000000000000..4e7ff69b2edfc --- /dev/null +++ b/test/SemaCXX/virtual-member-functions-key-function.cpp @@ -0,0 +1,22 @@ +// RUN: clang-cc -fsyntax-only -verify %s +struct A { + virtual ~A(); +}; + +struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}} + B() { } // expected-note {{implicit default destructor for 'struct B' first required here}} + void operator delete(void *, int); // expected-note {{'operator delete' declared here}} +}; + +struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}} + void operator delete(void *, int); // expected-note {{'operator delete' declared here}} +}; + +void f() { + // new B should mark the constructor as used, which then marks + // all the virtual members as used, because B has no key function. + (void)new B; + + // Same here, except that C has an implicit constructor. + (void)new C; // expected-note {{implicit default destructor for 'struct C' first required here}} +} diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp index 4a3b10fa97646..c18a77f036bb6 100644 --- a/test/SemaCXX/virtual-override.cpp +++ b/test/SemaCXX/virtual-override.cpp @@ -1,5 +1,4 @@ // RUN: clang-cc -fsyntax-only -faccess-control -verify %s - namespace T1 { class A { @@ -104,3 +103,50 @@ namespace T7 { virtual b* f(); }; } + +// PR5656 +class X0 { + virtual void f0(); +}; +class X1 : public X0 { + void f0() = 0; +}; + +template <typename Base> +struct Foo : Base { + void f(int) = 0; // expected-error{{not virtual and cannot be declared pure}} +}; + +struct Base1 { virtual void f(int); }; +struct Base2 { }; + +void test() { + (void)sizeof(Foo<Base1>); + (void)sizeof(Foo<Base2>); // expected-note{{instantiation}} +} + +template<typename Base> +struct Foo2 : Base { + template<typename T> int f(T); +}; + +void test2() { + Foo2<Base1> f1; + Foo2<Base2> f2; + f1.f(17); + f2.f(17); +}; + +struct Foo3 { + virtual void f(int) = 0; // expected-note{{pure virtual function}} +}; + +template<typename T> +struct Bar3 : Foo3 { + void f(T); +}; + +void test3() { + Bar3<int> b3i; // okay + Bar3<float> b3f; // expected-error{{is an abstract class}} +} diff --git a/test/SemaCXX/warn-missing-prototypes.cpp b/test/SemaCXX/warn-missing-prototypes.cpp new file mode 100644 index 0000000000000..079a83725223f --- /dev/null +++ b/test/SemaCXX/warn-missing-prototypes.cpp @@ -0,0 +1,26 @@ +// RUN: clang-cc -fsyntax-only -verify -Wmissing-prototypes %s + +void f() { } // expected-warning {{no previous prototype for function 'f'}} + +namespace NS { + void f() { } // expected-warning {{no previous prototype for function 'f'}} +} + +namespace { + // Don't warn about functions in anonymous namespaces. + void f() { } +} + +struct A { + // Don't warn about member functions. + void f() { } +}; + +// Don't warn about inline functions. +inline void g() { } + +// Don't warn about function templates. +template<typename> void h() { } + +// Don't warn when instantiating function templates. +template void h<int>(); diff --git a/test/SemaObjC/ContClassPropertyLookup.m b/test/SemaObjC/ContClassPropertyLookup.m index aa5afa7854f04..46bcc5365fdd8 100644 --- a/test/SemaObjC/ContClassPropertyLookup.m +++ b/test/SemaObjC/ContClassPropertyLookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyObject { int _foo; diff --git a/test/SemaObjC/DoubleMethod.m b/test/SemaObjC/DoubleMethod.m index e43c1a0ab0325..e92a017f29304 100644 --- a/test/SemaObjC/DoubleMethod.m +++ b/test/SemaObjC/DoubleMethod.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Subclass { diff --git a/test/SemaObjC/access-property-getter.m b/test/SemaObjC/access-property-getter.m index 225d63b0173c7..1bd5c33f51061 100644 --- a/test/SemaObjC/access-property-getter.m +++ b/test/SemaObjC/access-property-getter.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @protocol NSObject - (oneway void)release; diff --git a/test/SemaObjC/alias-test-1.m b/test/SemaObjC/alias-test-1.m index 39358cd62a6c4..e946c3eb1ecb6 100644 --- a/test/SemaObjC/alias-test-1.m +++ b/test/SemaObjC/alias-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @compatibility_alias alias4 foo; // expected-warning {{cannot find interface declaration for 'foo'}} diff --git a/test/SemaObjC/alias-test-2.m b/test/SemaObjC/alias-test-2.m index e0baf4e4d374e..976e2a3758c75 100644 --- a/test/SemaObjC/alias-test-2.m +++ b/test/SemaObjC/alias-test-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // Note: GCC doesn't produce any of the following errors. @interface Super @end // expected-note {{previous definition is here}} diff --git a/test/SemaObjC/argument-checking.m b/test/SemaObjC/argument-checking.m index 1b6c10d29c6b6..c4ada44c5122a 100644 --- a/test/SemaObjC/argument-checking.m +++ b/test/SemaObjC/argument-checking.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s struct S { int a; }; diff --git a/test/SemaObjC/at-defs.m b/test/SemaObjC/at-defs.m index 78ce63cd52998..03c9c76e3b2c1 100644 --- a/test/SemaObjC/at-defs.m +++ b/test/SemaObjC/at-defs.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -fsyntax-only +// RUN: clang -cc1 -triple i386-unknown-unknown %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 429d6c0f804d1..42b173b787041 100644 --- a/test/SemaObjC/atomoic-property-synnthesis-rules.m +++ b/test/SemaObjC/atomoic-property-synnthesis-rules.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s /* Conditions for warning: diff --git a/test/SemaObjC/attr-cleanup.m b/test/SemaObjC/attr-cleanup.m index f4d057b2b8303..821da000a3c1d 100644 --- a/test/SemaObjC/attr-cleanup.m +++ b/test/SemaObjC/attr-cleanup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only @class NSString; diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m index e385a977f55b3..675f969632803 100644 --- a/test/SemaObjC/attr-deprecated.m +++ b/test/SemaObjC/attr-deprecated.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify @interface A { int X __attribute__((deprecated)); diff --git a/test/SemaObjC/attr-malloc.m b/test/SemaObjC/attr-malloc.m index 6cd6be00a8cf1..4d2093fa3d4f6 100644 --- a/test/SemaObjC/attr-malloc.m +++ b/test/SemaObjC/attr-malloc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -fsyntax-only -fblocks %s +// RUN: clang -cc1 -verify -fsyntax-only -fblocks %s @interface TestAttrMallocOnMethods {} - (id) test1 __attribute((malloc)); // expected-warning {{functions returning a pointer type}} diff --git a/test/SemaObjC/attr-objc-exception.m b/test/SemaObjC/attr-objc-exception.m index 3efb8cfa40ce4..3e012c748230a 100644 --- a/test/SemaObjC/attr-objc-exception.m +++ b/test/SemaObjC/attr-objc-exception.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify __attribute__((__objc_exception__)) @interface NSException { diff --git a/test/SemaObjC/attr-objc-gc.m b/test/SemaObjC/attr-objc-gc.m index 20da639c3cb9c..90ca4e3280c20 100644 --- a/test/SemaObjC/attr-objc-gc.m +++ b/test/SemaObjC/attr-objc-gc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s static id __attribute((objc_gc(weak))) a; static id __attribute((objc_gc(strong))) b; diff --git a/test/SemaObjC/bad-receiver-1.m b/test/SemaObjC/bad-receiver-1.m index 64ff3d199314b..52509753d8a2d 100644 --- a/test/SemaObjC/bad-receiver-1.m +++ b/test/SemaObjC/bad-receiver-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I - (id) retain; diff --git a/test/SemaObjC/block-attr.m b/test/SemaObjC/block-attr.m index d67fd35435487..885a94649393f 100644 --- a/test/SemaObjC/block-attr.m +++ b/test/SemaObjC/block-attr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s @interface Thing {} diff --git a/test/SemaObjC/block-explicit-return-type.m b/test/SemaObjC/block-explicit-return-type.m index cfe72de39523d..6e9728613a8e1 100644 --- a/test/SemaObjC/block-explicit-return-type.m +++ b/test/SemaObjC/block-explicit-return-type.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s -verify -fblocks +// RUN: clang -cc1 -fsyntax-only %s -verify -fblocks // FIXME: should compile // Test for blocks with explicit return type specified. diff --git a/test/SemaObjC/block-ivar.m b/test/SemaObjC/block-ivar.m index 231c9a23f8ad5..5dbefdcbaad92 100644 --- a/test/SemaObjC/block-ivar.m +++ b/test/SemaObjC/block-ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s -fblocks +// RUN: clang -cc1 -fsyntax-only -verify %s -fblocks @interface NSObject { struct objc_object *isa; diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m index aecdfd1f5e4e7..c16372bcc421e 100644 --- a/test/SemaObjC/blocks.m +++ b/test/SemaObjC/blocks.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fblocks %s +// RUN: clang -cc1 -fsyntax-only -verify -fblocks %s @protocol NSObject; void bar(id(^)(void)); diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m index afd35a8e26308..f3d0a9676039a 100644 --- a/test/SemaObjC/call-super-2.m +++ b/test/SemaObjC/call-super-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #include <stddef.h> diff --git a/test/SemaObjC/catch-stmt.m b/test/SemaObjC/catch-stmt.m index 6dcbcdebfba44..eb570c02edfc7 100644 --- a/test/SemaObjC/catch-stmt.m +++ b/test/SemaObjC/catch-stmt.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @protocol P; diff --git a/test/SemaObjC/category-1.m b/test/SemaObjC/category-1.m index dcbda42cd1364..588261891131c 100644 --- a/test/SemaObjC/category-1.m +++ b/test/SemaObjC/category-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyClass1 @end diff --git a/test/SemaObjC/category-method-lookup-2.m b/test/SemaObjC/category-method-lookup-2.m index 15da63783fee6..ea828d9a3bcb9 100644 --- a/test/SemaObjC/category-method-lookup-2.m +++ b/test/SemaObjC/category-method-lookup-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; @interface NSObject diff --git a/test/SemaObjC/category-method-lookup.m b/test/SemaObjC/category-method-lookup.m index bda465783b5dc..9b880c4ac7071 100644 --- a/test/SemaObjC/category-method-lookup.m +++ b/test/SemaObjC/category-method-lookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo @end diff --git a/test/SemaObjC/check-dup-decl-methods-1.m b/test/SemaObjC/check-dup-decl-methods-1.m index ae0cab0b5d41f..edcd3be518a3a 100644 --- a/test/SemaObjC/check-dup-decl-methods-1.m +++ b/test/SemaObjC/check-dup-decl-methods-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface SUPER - (int) meth; diff --git a/test/SemaObjC/check-dup-objc-decls-1.m b/test/SemaObjC/check-dup-objc-decls-1.m index 1dfaf0905083c..434f8ddae51e6 100644 --- a/test/SemaObjC/check-dup-objc-decls-1.m +++ b/test/SemaObjC/check-dup-objc-decls-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo // expected-note {{previous definition is here}} @end diff --git a/test/SemaObjC/class-bitfield.m b/test/SemaObjC/class-bitfield.m index 82209121b1836..d6d9855b2952f 100644 --- a/test/SemaObjC/class-bitfield.m +++ b/test/SemaObjC/class-bitfield.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify @interface X { diff --git a/test/SemaObjC/class-conforming-protocol-1.m b/test/SemaObjC/class-conforming-protocol-1.m index a9712b23a6a8d..e2889c3f9d3b1 100644 --- a/test/SemaObjC/class-conforming-protocol-1.m +++ b/test/SemaObjC/class-conforming-protocol-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P1 @end @protocol P2 @end diff --git a/test/SemaObjC/class-conforming-protocol-2.m b/test/SemaObjC/class-conforming-protocol-2.m index 7b218bdbd8035..550bafd60f71a 100644 --- a/test/SemaObjC/class-conforming-protocol-2.m +++ b/test/SemaObjC/class-conforming-protocol-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol NSWindowDelegate @end diff --git a/test/SemaObjC/class-def-test-1.m b/test/SemaObjC/class-def-test-1.m index da8a3267662f6..0cf49ddd1b9ae 100644 --- a/test/SemaObjC/class-def-test-1.m +++ b/test/SemaObjC/class-def-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol SUPER; diff --git a/test/SemaObjC/class-extension-dup-methods.m b/test/SemaObjC/class-extension-dup-methods.m index f50b293ade36b..929ad0665a892 100644 --- a/test/SemaObjC/class-extension-dup-methods.m +++ b/test/SemaObjC/class-extension-dup-methods.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo - (int) garf; // expected-note {{ previous declaration is here}} diff --git a/test/SemaObjC/class-getter-using-dotsyntax.m b/test/SemaObjC/class-getter-using-dotsyntax.m index ba42590c3419d..049c6ce62737d 100644 --- a/test/SemaObjC/class-getter-using-dotsyntax.m +++ b/test/SemaObjC/class-getter-using-dotsyntax.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_class *Class; diff --git a/test/SemaObjC/class-impl-1.m b/test/SemaObjC/class-impl-1.m index 09ad1556c035d..80d6915d75570 100644 --- a/test/SemaObjC/class-impl-1.m +++ b/test/SemaObjC/class-impl-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef int INTF3; // expected-note {{previous definition is here}} diff --git a/test/SemaObjC/class-method-lookup.m b/test/SemaObjC/class-method-lookup.m index 6f745d48ab625..ef9df5a1461b1 100644 --- a/test/SemaObjC/class-method-lookup.m +++ b/test/SemaObjC/class-method-lookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyBase - (void) rootInstanceMethod; diff --git a/test/SemaObjC/class-method-self.m b/test/SemaObjC/class-method-self.m index d36bc8cbc91b1..ea4de84dae919 100644 --- a/test/SemaObjC/class-method-self.m +++ b/test/SemaObjC/class-method-self.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s typedef struct objc_class *Class; @interface XX diff --git a/test/SemaObjC/class-property-access.m b/test/SemaObjC/class-property-access.m index 663b87d2ff189..ce34a233f7b4f 100644 --- a/test/SemaObjC/class-property-access.m +++ b/test/SemaObjC/class-property-access.m @@ -1,4 +1,4 @@ -// RUN: clang -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Test {} + (Test*)one; diff --git a/test/SemaObjC/class-proto-1.m b/test/SemaObjC/class-proto-1.m index 8f0f3d8826c2d..5e9ee6063e74e 100644 --- a/test/SemaObjC/class-proto-1.m +++ b/test/SemaObjC/class-proto-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface INTF1 @end diff --git a/test/SemaObjC/class-protocol.m b/test/SemaObjC/class-protocol.m index 12b638175137c..c2eded75f97a7 100644 --- a/test/SemaObjC/class-protocol.m +++ b/test/SemaObjC/class-protocol.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // pr5552 @interface Protocol diff --git a/test/SemaObjC/cocoa.m b/test/SemaObjC/cocoa.m index 7dab9f55e734a..a0715453dffff 100644 --- a/test/SemaObjC/cocoa.m +++ b/test/SemaObjC/cocoa.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -mcpu pentium4 %s -print-stats +// RUN: clang -cc1 -mcpu pentium4 %s -print-stats #ifdef __APPLE__ #include <Cocoa/Cocoa.h> #endif diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m index 22bec504a558e..c9776d0f41c39 100644 --- a/test/SemaObjC/compare-qualified-id.m +++ b/test/SemaObjC/compare-qualified-id.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/compatible-protocol-qualified-types.m b/test/SemaObjC/compatible-protocol-qualified-types.m index 71f00542b1c63..54d6a04085d9a 100644 --- a/test/SemaObjC/compatible-protocol-qualified-types.m +++ b/test/SemaObjC/compatible-protocol-qualified-types.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fsyntax-only -verify %s +// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; diff --git a/test/SemaObjC/comptypes-1.m b/test/SemaObjC/comptypes-1.m index df0785bf89e11..bffbd763ad985 100644 --- a/test/SemaObjC/comptypes-1.m +++ b/test/SemaObjC/comptypes-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s #define nil (void *)0; #define Nil (void *)0; diff --git a/test/SemaObjC/comptypes-2.m b/test/SemaObjC/comptypes-2.m index c24b67b15ed1d..a53b942930e5a 100644 --- a/test/SemaObjC/comptypes-2.m +++ b/test/SemaObjC/comptypes-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #define nil (void *)0; #define Nil (void *)0; diff --git a/test/SemaObjC/comptypes-3.m b/test/SemaObjC/comptypes-3.m index 0506bce7ad1af..2d1b6236e3d73 100644 --- a/test/SemaObjC/comptypes-3.m +++ b/test/SemaObjC/comptypes-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #define nil (void *)0; diff --git a/test/SemaObjC/comptypes-4.m b/test/SemaObjC/comptypes-4.m index 598901148a8a3..794ede25962f4 100644 --- a/test/SemaObjC/comptypes-4.m +++ b/test/SemaObjC/comptypes-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s extern void foo(); diff --git a/test/SemaObjC/comptypes-5.m b/test/SemaObjC/comptypes-5.m index 478e8c8114ac6..4b8f489685141 100644 --- a/test/SemaObjC/comptypes-5.m +++ b/test/SemaObjC/comptypes-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -pedantic -verify %s +// RUN: clang -cc1 -fsyntax-only -pedantic -verify %s #define nil (void *)0; diff --git a/test/SemaObjC/comptypes-6.m b/test/SemaObjC/comptypes-6.m index 32176755ef76d..ad3da26185a75 100644 --- a/test/SemaObjC/comptypes-6.m +++ b/test/SemaObjC/comptypes-6.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s @interface Derived @end diff --git a/test/SemaObjC/comptypes-7.m b/test/SemaObjC/comptypes-7.m index 881fd2b5553b8..ea1aa06292de5 100644 --- a/test/SemaObjC/comptypes-7.m +++ b/test/SemaObjC/comptypes-7.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s #define nil (void *)0; #define Nil (void *)0; diff --git a/test/SemaObjC/comptypes-8.m b/test/SemaObjC/comptypes-8.m index af9267e499f60..b19bc302b223f 100644 --- a/test/SemaObjC/comptypes-8.m +++ b/test/SemaObjC/comptypes-8.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol MyProtocol @end diff --git a/test/SemaObjC/comptypes-9.m b/test/SemaObjC/comptypes-9.m index caa93b49e6f32..89647b5b98260 100644 --- a/test/SemaObjC/comptypes-9.m +++ b/test/SemaObjC/comptypes-9.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang -cc1 -fsyntax-only %s // FIXME: This test case tests the patch applied in: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080602/006017.html // Eventually that logic should be treated as an extension. diff --git a/test/SemaObjC/comptypes-a.m b/test/SemaObjC/comptypes-a.m index 5570d56b0b83b..4c7967d89c0a2 100644 --- a/test/SemaObjC/comptypes-a.m +++ b/test/SemaObjC/comptypes-a.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s typedef signed char BOOL; typedef int NSInteger; diff --git a/test/SemaObjC/comptypes-legal.m b/test/SemaObjC/comptypes-legal.m index cd7f89b61d0dd..6a837b6aa8fa9 100644 --- a/test/SemaObjC/comptypes-legal.m +++ b/test/SemaObjC/comptypes-legal.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s @protocol NSObject @end diff --git a/test/SemaObjC/conditional-expr-2.m b/test/SemaObjC/conditional-expr-2.m index 08758488c540c..9835f3ea31c2d 100644 --- a/test/SemaObjC/conditional-expr-2.m +++ b/test/SemaObjC/conditional-expr-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface A @end diff --git a/test/SemaObjC/conditional-expr-3.m b/test/SemaObjC/conditional-expr-3.m index 9f1ee68c6f94a..b7dae6bc48e7c 100644 --- a/test/SemaObjC/conditional-expr-3.m +++ b/test/SemaObjC/conditional-expr-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P0 @end diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m index 87209581534c5..19215e3c36cc6 100644 --- a/test/SemaObjC/conditional-expr-4.m +++ b/test/SemaObjC/conditional-expr-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // <rdar://problem/6212771> #define nil ((void*) 0) diff --git a/test/SemaObjC/conditional-expr-5.m b/test/SemaObjC/conditional-expr-5.m index d9c1a9474fe73..74f866be0034e 100644 --- a/test/SemaObjC/conditional-expr-5.m +++ b/test/SemaObjC/conditional-expr-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface PBXBuildSettingsDictionary { diff --git a/test/SemaObjC/conditional-expr-6.m b/test/SemaObjC/conditional-expr-6.m index bba51bb8178f4..dcd2f958f23a2 100644 --- a/test/SemaObjC/conditional-expr-6.m +++ b/test/SemaObjC/conditional-expr-6.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol MyProtocol @end diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m index 2043503ddf7bd..8fdb2810eddf8 100644 --- a/test/SemaObjC/conditional-expr.m +++ b/test/SemaObjC/conditional-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s +// RUN: clang -cc1 -fsyntax-only -verify -pedantic %s @protocol NSObject @end diff --git a/test/SemaObjC/conflicting-ivar-test-1.m b/test/SemaObjC/conflicting-ivar-test-1.m index 20ed15722477c..acba8e431ab87 100644 --- a/test/SemaObjC/conflicting-ivar-test-1.m +++ b/test/SemaObjC/conflicting-ivar-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface INTF { diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m index 4559696b7f2d0..c251d460cdf23 100644 --- a/test/SemaObjC/continuation-class-err.m +++ b/test/SemaObjC/continuation-class-err.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface ReadOnly { diff --git a/test/SemaObjC/crash-label.m b/test/SemaObjC/crash-label.m index ff40cc67c5dc6..477c9a12c142f 100644 --- a/test/SemaObjC/crash-label.m +++ b/test/SemaObjC/crash-label.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s - (NSDictionary*) _executeScript:(NSString *)source { // expected-error 2 {{expected a type}} \ // expected-error {{missing context for method declaration}} diff --git a/test/SemaObjC/deref-interface.m b/test/SemaObjC/deref-interface.m index 57750a5a43967..2308677ab825b 100644 --- a/test/SemaObjC/deref-interface.m +++ b/test/SemaObjC/deref-interface.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -verify -fsyntax-only %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s @interface NSView - (id)initWithView:(id)realView; diff --git a/test/SemaObjC/duplicate-ivar-check.m b/test/SemaObjC/duplicate-ivar-check.m index 7cab982e6e21d..b4a9df282d44d 100644 --- a/test/SemaObjC/duplicate-ivar-check.m +++ b/test/SemaObjC/duplicate-ivar-check.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface B1 { @public diff --git a/test/SemaObjC/enhanced-proto-2.m b/test/SemaObjC/enhanced-proto-2.m index 0450d7ba9debf..a83ef23afd5ad 100644 --- a/test/SemaObjC/enhanced-proto-2.m +++ b/test/SemaObjC/enhanced-proto-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @protocol MyProto1 @optional diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m index a44ba4f3768dc..da742e7f73312 100644 --- a/test/SemaObjC/error-property-gc-attr.m +++ b/test/SemaObjC/error-property-gc-attr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s @interface INTF { diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m index d51d135fa27a5..52bd618770800 100644 --- a/test/SemaObjC/exprs.m +++ b/test/SemaObjC/exprs.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // rdar://6597252 Class test1(Class X) { diff --git a/test/SemaObjC/foreach.m b/test/SemaObjC/foreach.m index 2b62b1744ce27..315202f5eba67 100644 --- a/test/SemaObjC/foreach.m +++ b/test/SemaObjC/foreach.m @@ -1,4 +1,4 @@ -/* RUN: clang-cc -Wall -fsyntax-only -verify -std=c89 -pedantic %s +/* RUN: clang -cc1 -Wall -fsyntax-only -verify -std=c89 -pedantic %s */ @class NSArray; diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m index dc5aa8932cdab..7de9e9f139c20 100644 --- a/test/SemaObjC/format-arg-attribute.m +++ b/test/SemaObjC/format-arg-attribute.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -fsyntax-only %s +// RUN: clang -cc1 -verify -fsyntax-only %s @class NSString; diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m index 4b8490291ad01..b0d5b513dc7a9 100644 --- a/test/SemaObjC/format-strings-objc.m +++ b/test/SemaObjC/format-strings-objc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/SemaObjC/forward-class-1.m b/test/SemaObjC/forward-class-1.m index f5f9505666726..e3d2c157d6ade 100644 --- a/test/SemaObjC/forward-class-1.m +++ b/test/SemaObjC/forward-class-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @class FOO, BAR; @class FOO, BAR; diff --git a/test/SemaObjC/forward-class-receiver.m b/test/SemaObjC/forward-class-receiver.m index ebba0fd896dc5..7f8aec9a39e2b 100644 --- a/test/SemaObjC/forward-class-receiver.m +++ b/test/SemaObjC/forward-class-receiver.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I + new; // expected-note {{method 'new' is used for the forward class}} diff --git a/test/SemaObjC/gcc-cast-ext.m b/test/SemaObjC/gcc-cast-ext.m index 5d6670e0f67ca..6b4cbafcf8171 100644 --- a/test/SemaObjC/gcc-cast-ext.m +++ b/test/SemaObjC/gcc-cast-ext.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fms-extensions +// RUN: clang -cc1 %s -verify -fms-extensions @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; typedef struct _NSRange { } NSRange; diff --git a/test/SemaObjC/id-isa-ref.m b/test/SemaObjC/id-isa-ref.m index fa3293ce79b57..c80f0809c53fc 100644 --- a/test/SemaObjC/id-isa-ref.m +++ b/test/SemaObjC/id-isa-ref.m @@ -1,7 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s - -// Failing currently due to Obj-C type representation changes. 2009-09-17 -// XFAIL: * +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_object { struct objc_class *isa; diff --git a/test/SemaObjC/id.m b/test/SemaObjC/id.m index 70d981c42b171..aa99cfa6471ee 100644 --- a/test/SemaObjC/id.m +++ b/test/SemaObjC/id.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol Foo; diff --git a/test/SemaObjC/id_builtin.m b/test/SemaObjC/id_builtin.m index 134753726cbb6..1ec049b9ff79a 100644 --- a/test/SemaObjC/id_builtin.m +++ b/test/SemaObjC/id_builtin.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // id is now builtin. There should be no errors. id obj; diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m index b4c52fa0d1462..ec1d3638410e7 100644 --- a/test/SemaObjC/idiomatic-parentheses.m +++ b/test/SemaObjC/idiomatic-parentheses.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // Don't warn about some common ObjC idioms unless we have -Wparentheses on. // <rdar://problem/7382435> diff --git a/test/SemaObjC/ignore-weakimport-method.m b/test/SemaObjC/ignore-weakimport-method.m index 369d9023acfbe..f745e443cf1e3 100644 --- a/test/SemaObjC/ignore-weakimport-method.m +++ b/test/SemaObjC/ignore-weakimport-method.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface foo + (void) cx __attribute__((weak_import)); diff --git a/test/SemaObjC/incompatible-protocol-qualified-types.m b/test/SemaObjC/incompatible-protocol-qualified-types.m index 862265ca64762..624377fbf9680 100644 --- a/test/SemaObjC/incompatible-protocol-qualified-types.m +++ b/test/SemaObjC/incompatible-protocol-qualified-types.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fsyntax-only -verify %s +// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s @protocol MyProto1 @end diff --git a/test/SemaObjC/inst-method-lookup-in-root.m b/test/SemaObjC/inst-method-lookup-in-root.m index 93f28e69f945e..8980d3709e470 100644 --- a/test/SemaObjC/inst-method-lookup-in-root.m +++ b/test/SemaObjC/inst-method-lookup-in-root.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P - (id) inst_in_proto; diff --git a/test/SemaObjC/interface-1.m b/test/SemaObjC/interface-1.m index 85a2a91a8c13b..9898936848742 100644 --- a/test/SemaObjC/interface-1.m +++ b/test/SemaObjC/interface-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 %s -fsyntax-only -verify +// RUN: clang -cc1 -triple i386-apple-darwin9 %s -fsyntax-only -verify // rdar://5957506 @interface NSWhatever : diff --git a/test/SemaObjC/interface-layout-2.m b/test/SemaObjC/interface-layout-2.m index ec03a00ca75ef..cad71428da457 100644 --- a/test/SemaObjC/interface-layout-2.m +++ b/test/SemaObjC/interface-layout-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify @interface A { int ivar; diff --git a/test/SemaObjC/interface-layout.m b/test/SemaObjC/interface-layout.m index 6ad8915548447..b2c6f0d95fc25 100644 --- a/test/SemaObjC/interface-layout.m +++ b/test/SemaObjC/interface-layout.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify -triple i386-apple-darwin9 +// RUN: clang -cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9 typedef struct objc_object {} *id; typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/interface-scope-2.m b/test/SemaObjC/interface-scope-2.m index c9025903940c9..bdf28f46360fe 100644 --- a/test/SemaObjC/interface-scope-2.m +++ b/test/SemaObjC/interface-scope-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -triple i686-apple-darwin9 %s +// RUN: clang -cc1 -fsyntax-only -verify -triple i686-apple-darwin9 %s // FIXME: must also compile as Objective-C++ // <rdar://problem/6487662> diff --git a/test/SemaObjC/interface-scope.m b/test/SemaObjC/interface-scope.m index b4dfff683bb12..bc80722febfb9 100644 --- a/test/SemaObjC/interface-scope.m +++ b/test/SemaObjC/interface-scope.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I1 { @private diff --git a/test/SemaObjC/interface-tu-variable.m b/test/SemaObjC/interface-tu-variable.m index 9bf816ab69fb4..b451d3634929e 100644 --- a/test/SemaObjC/interface-tu-variable.m +++ b/test/SemaObjC/interface-tu-variable.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface XX int x; // expected-error {{cannot declare variable inside @interface or @protocol}} diff --git a/test/SemaObjC/invalid-code.m b/test/SemaObjC/invalid-code.m index 6eacba05f4ae8..d0679a3f98c5b 100644 --- a/test/SemaObjC/invalid-code.m +++ b/test/SemaObjC/invalid-code.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // rdar://6124613 void test1() { diff --git a/test/SemaObjC/invalid-objc-decls-1.m b/test/SemaObjC/invalid-objc-decls-1.m index 4a3732eff188a..b58fa68337be7 100644 --- a/test/SemaObjC/invalid-objc-decls-1.m +++ b/test/SemaObjC/invalid-objc-decls-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Super @end Super s1; // expected-error{{interface type cannot be statically allocated}} diff --git a/test/SemaObjC/invalid-receiver.m b/test/SemaObjC/invalid-receiver.m index e79df96942ccf..366f714008568 100644 --- a/test/SemaObjC/invalid-receiver.m +++ b/test/SemaObjC/invalid-receiver.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct NotAClass { int a, b; diff --git a/test/SemaObjC/invalid-typename.m b/test/SemaObjC/invalid-typename.m index 4077f91a9a667..ecc03ba9813a6 100644 --- a/test/SemaObjC/invalid-typename.m +++ b/test/SemaObjC/invalid-typename.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @class NSString, NSArray; diff --git a/test/SemaObjC/ivar-access-package.m b/test/SemaObjC/ivar-access-package.m index 77a15cca51420..077b0cf57c68b 100644 --- a/test/SemaObjC/ivar-access-package.m +++ b/test/SemaObjC/ivar-access-package.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef unsigned char BOOL; diff --git a/test/SemaObjC/ivar-access-tests.m b/test/SemaObjC/ivar-access-tests.m index ca3cc4cf1d46a..1dc33db5b1e81 100644 --- a/test/SemaObjC/ivar-access-tests.m +++ b/test/SemaObjC/ivar-access-tests.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MySuperClass { diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m index b168976da1367..63bf040d636fd 100644 --- a/test/SemaObjC/ivar-lookup.m +++ b/test/SemaObjC/ivar-lookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify @interface Test { int x; diff --git a/test/SemaObjC/ivar-ref-misuse.m b/test/SemaObjC/ivar-ref-misuse.m index 707e1893bf8ea..04047533af43f 100644 --- a/test/SemaObjC/ivar-ref-misuse.m +++ b/test/SemaObjC/ivar-ref-misuse.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Sprite { int sprite, spree; diff --git a/test/SemaObjC/ivar-sem-check-1.m b/test/SemaObjC/ivar-sem-check-1.m index 957abc397e898..318f510672ce5 100644 --- a/test/SemaObjC/ivar-sem-check-1.m +++ b/test/SemaObjC/ivar-sem-check-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s struct S; // expected-note{{forward declaration of 'struct S'}} typedef int FOO(); @@ -9,7 +9,8 @@ typedef int FOO(); int arr[]; // expected-error {{field has incomplete type}} struct S IC; // expected-error {{field has incomplete type}} struct T { // expected-note {{previous definition is here}} - struct T {} X; // expected-error {{nested redefinition of 'T'}} + struct T {} X; // expected-error {{nested redefinition of 'T'}} \ + // expected-error {{field has incomplete type}} }YYY; FOO BADFUNC; // expected-error {{field 'BADFUNC' declared as a function}} int kaka; // expected-note {{previous declaration is here}} diff --git a/test/SemaObjC/ivar-sem-check-2.m b/test/SemaObjC/ivar-sem-check-2.m index a5a830d6a3f6e..242504f0a1771 100644 --- a/test/SemaObjC/ivar-sem-check-2.m +++ b/test/SemaObjC/ivar-sem-check-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s @interface Super { id value2; // expected-note {{previously declared 'value2' here}} diff --git a/test/SemaObjC/legacy-implementation-1.m b/test/SemaObjC/legacy-implementation-1.m index 63768ffb50ea2..e480561693a41 100644 --- a/test/SemaObjC/legacy-implementation-1.m +++ b/test/SemaObjC/legacy-implementation-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @implementation INTF // expected-warning {{cannot find interface declaration for 'INTF'}} @end diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m index 02901238f17f8..244f5d7b74e6d 100644 --- a/test/SemaObjC/message.m +++ b/test/SemaObjC/message.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct objc_object { Class isa; diff --git a/test/SemaObjC/method-arg-decay.m b/test/SemaObjC/method-arg-decay.m index e81bcdf7b75fe..09949de3293d2 100644 --- a/test/SemaObjC/method-arg-decay.m +++ b/test/SemaObjC/method-arg-decay.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -checker-cfref -verify %s +// RUN: clang -cc1 -checker-cfref -verify %s typedef signed char BOOL; typedef int NSInteger; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m new file mode 100644 index 0000000000000..2d9499f2fdbe7 --- /dev/null +++ b/test/SemaObjC/method-arg-qualifier-warning.m @@ -0,0 +1,20 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +typedef signed char BOOL; + +@interface NSString +- (BOOL)isEqualToString:(NSString *)aString; +@end + +static const NSString * Identifier1 = @"Identifier1"; +static NSString const * Identifier2 = @"Identifier2"; +static NSString * const Identifier3 = @"Identifier3"; + +int main () { + + [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}} + [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}} + [@"Identifier3" isEqualToString:Identifier3]; + return 0; +} + diff --git a/test/SemaObjC/method-attributes.m b/test/SemaObjC/method-attributes.m index c4d4fba25d6ec..d5f92edee40cc 100644 --- a/test/SemaObjC/method-attributes.m +++ b/test/SemaObjC/method-attributes.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -fsyntax-only %s +// RUN: clang -cc1 -verify -fsyntax-only %s @class NSString; diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m index f797188669ade..8ef7be9d403bc 100644 --- a/test/SemaObjC/method-bad-param.m +++ b/test/SemaObjC/method-bad-param.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface foo @end diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m index a4213f6c63c9e..0f7fd61fe164f 100644 --- a/test/SemaObjC/method-conflict.m +++ b/test/SemaObjC/method-conflict.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/method-def-1.m b/test/SemaObjC/method-def-1.m index 3eb94b9153d95..f98ba896db40f 100644 --- a/test/SemaObjC/method-def-1.m +++ b/test/SemaObjC/method-def-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface foo - (int)meth; diff --git a/test/SemaObjC/method-def-2.m b/test/SemaObjC/method-def-2.m index 84cdd70259fad..e595589695ea2 100644 --- a/test/SemaObjC/method-def-2.m +++ b/test/SemaObjC/method-def-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -ast-print %s +// RUN: clang -cc1 -ast-print %s extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort() diff --git a/test/SemaObjC/method-encoding-2.m b/test/SemaObjC/method-encoding-2.m index b3ffdcd0585c2..50d2d9250dd4a 100644 --- a/test/SemaObjC/method-encoding-2.m +++ b/test/SemaObjC/method-encoding-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s +// RUN: clang -cc1 %s // TODO: We don't support rewrite of method definitions @interface Intf diff --git a/test/SemaObjC/method-lookup-2.m b/test/SemaObjC/method-lookup-2.m index cca757509ad19..5493653f3ecaf 100644 --- a/test/SemaObjC/method-lookup-2.m +++ b/test/SemaObjC/method-lookup-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; @protocol NSObject diff --git a/test/SemaObjC/method-lookup-3.m b/test/SemaObjC/method-lookup-3.m index 8ed583faebc77..9e7c4c93abeb3 100644 --- a/test/SemaObjC/method-lookup-3.m +++ b/test/SemaObjC/method-lookup-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct { int y; } Abstract; diff --git a/test/SemaObjC/method-lookup-4.m b/test/SemaObjC/method-lookup-4.m index 3b2548b92c116..20b4e60b018f0 100644 --- a/test/SemaObjC/method-lookup-4.m +++ b/test/SemaObjC/method-lookup-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface NSObject {} diff --git a/test/SemaObjC/method-lookup.m b/test/SemaObjC/method-lookup.m index 49dc789af7832..b9607eb690c33 100644 --- a/test/SemaObjC/method-lookup.m +++ b/test/SemaObjC/method-lookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef int NSInteger; diff --git a/test/SemaObjC/method-no-context.m b/test/SemaObjC/method-no-context.m index 9351cb91579ae..63caa7e399ccb 100644 --- a/test/SemaObjC/method-no-context.m +++ b/test/SemaObjC/method-no-context.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s - im0 { int a; return 0; // expected-error{{missing context for method declaration}} // expected-error{{expected '}'}} diff --git a/test/SemaObjC/method-not-defined.m b/test/SemaObjC/method-not-defined.m index 3848fa28c9273..37171af2e8893 100644 --- a/test/SemaObjC/method-not-defined.m +++ b/test/SemaObjC/method-not-defined.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo @end diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m index 8f31e9ab5e418..080d6649cc04e 100644 --- a/test/SemaObjC/method-sentinel-attr.m +++ b/test/SemaObjC/method-sentinel-attr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #define NULL (void*)0 diff --git a/test/SemaObjC/method-typecheck-1.m b/test/SemaObjC/method-typecheck-1.m index a53c4d9f416a8..bd62ded3c413c 100644 --- a/test/SemaObjC/method-typecheck-1.m +++ b/test/SemaObjC/method-typecheck-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface A - (void) setMoo: (int) x; // expected-note {{previous definition is here}} diff --git a/test/SemaObjC/method-typecheck-2.m b/test/SemaObjC/method-typecheck-2.m index d0a091d856155..642893da804d2 100644 --- a/test/SemaObjC/method-typecheck-2.m +++ b/test/SemaObjC/method-typecheck-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P - (void) doSomethingInProtocol: (float) x; // expected-note {{previous definition is here}} diff --git a/test/SemaObjC/method-undef-category-warn-1.m b/test/SemaObjC/method-undef-category-warn-1.m index 82fd3c8ba6ff9..8f5d1ace4c881 100644 --- a/test/SemaObjC/method-undef-category-warn-1.m +++ b/test/SemaObjC/method-undef-category-warn-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyClass1 @end diff --git a/test/SemaObjC/method-undef-extension-warn-1.m b/test/SemaObjC/method-undef-extension-warn-1.m index 7ce015f886ecb..c1efe5a44fdc0 100644 --- a/test/SemaObjC/method-undef-extension-warn-1.m +++ b/test/SemaObjC/method-undef-extension-warn-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MyClass @end diff --git a/test/SemaObjC/method-undefined-warn-1.m b/test/SemaObjC/method-undefined-warn-1.m index fbb01dfb1f797..bbf993f136651 100644 --- a/test/SemaObjC/method-undefined-warn-1.m +++ b/test/SemaObjC/method-undefined-warn-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface INTF - (void) meth; diff --git a/test/SemaObjC/missing-method-context.m b/test/SemaObjC/missing-method-context.m index 2d0758b1fa8db..506cccf512a91 100644 --- a/test/SemaObjC/missing-method-context.m +++ b/test/SemaObjC/missing-method-context.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only - (void)compilerTestAgainst; // expected-error {{missing context for method declaration}} void xx(); // expected-error {{expected method body}} diff --git a/test/SemaObjC/newproperty-class-method-1.m b/test/SemaObjC/newproperty-class-method-1.m index 4946210c8dcc6..972f0909693da 100644 --- a/test/SemaObjC/newproperty-class-method-1.m +++ b/test/SemaObjC/newproperty-class-method-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only @interface Subclass + (int)magicNumber; diff --git a/test/SemaObjC/no-gc-weak-test.m b/test/SemaObjC/no-gc-weak-test.m index f494929ce02dc..498278ec91d73 100644 --- a/test/SemaObjC/no-gc-weak-test.m +++ b/test/SemaObjC/no-gc-weak-test.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s @interface Subtask { diff --git a/test/SemaObjC/no-warn-qual-mismatch.m b/test/SemaObjC/no-warn-qual-mismatch.m index 3bd4dba545f53..73b56711e388f 100644 --- a/test/SemaObjC/no-warn-qual-mismatch.m +++ b/test/SemaObjC/no-warn-qual-mismatch.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // radar 7211563 @interface X diff --git a/test/SemaObjC/no-warn-synth-protocol-meth.m b/test/SemaObjC/no-warn-synth-protocol-meth.m index 860a0ca2befe3..8c8f33b560580 100644 --- a/test/SemaObjC/no-warn-synth-protocol-meth.m +++ b/test/SemaObjC/no-warn-synth-protocol-meth.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol CYCdef - (int)name; diff --git a/test/SemaObjC/no-warn-unimpl-method.m b/test/SemaObjC/no-warn-unimpl-method.m index 2fcb06ff5e92d..4345914092af0 100644 --- a/test/SemaObjC/no-warn-unimpl-method.m +++ b/test/SemaObjC/no-warn-unimpl-method.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -fsyntax-only -verify %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s // This program tests that if class implements the forwardInvocation method, then // every method possible is implemented in the class and should not issue // warning of the "Method definition not found" kind. */ diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m index 869bbbd57e85e..e657707790d55 100644 --- a/test/SemaObjC/nonnull.m +++ b/test/SemaObjC/nonnull.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fblocks -fsyntax-only -verify %s +// RUN: clang -cc1 -fblocks -fsyntax-only -verify %s @class NSObject; diff --git a/test/SemaObjC/nsobject-attribute-1.m b/test/SemaObjC/nsobject-attribute-1.m index d1f673a9fba9c..6eb5d63db2d17 100644 --- a/test/SemaObjC/nsobject-attribute-1.m +++ b/test/SemaObjC/nsobject-attribute-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fblocks -fsyntax-only -verify %s +// RUN: clang -cc1 -fblocks -fsyntax-only -verify %s @interface NSObject - (id)self; diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m index c47b909846c1b..896c44a3dc745 100644 --- a/test/SemaObjC/nsobject-attribute.m +++ b/test/SemaObjC/nsobject-attribute.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef; static int count; diff --git a/test/SemaObjC/objc-string-constant.m b/test/SemaObjC/objc-string-constant.m index c6461dd1c25b5..46d1242cc5e5d 100644 --- a/test/SemaObjC/objc-string-constant.m +++ b/test/SemaObjC/objc-string-constant.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -Wsemicolon-before-method-body %s -verify -fsyntax-only +// RUN: clang -cc1 -Wsemicolon-before-method-body %s -verify -fsyntax-only #define nil 0 /* id of Nil instance */ diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m index 0da0ce876d3e9..c15e10781a3d4 100644 --- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m +++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s @interface INTF @end extern INTF* p2; diff --git a/test/SemaObjC/objc2-warn-weak-decl.m b/test/SemaObjC/objc2-warn-weak-decl.m index 5de52ba2203c4..bd59c6613304a 100644 --- a/test/SemaObjC/objc2-warn-weak-decl.m +++ b/test/SemaObjC/objc2-warn-weak-decl.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s struct S { __weak id p; // expected-warning {{__weak attribute cannot be specified on a field declaration}} }; diff --git a/test/SemaObjC/property-10.m b/test/SemaObjC/property-10.m index 81b8ee199cb29..cf615bcde7cd8 100644 --- a/test/SemaObjC/property-10.m +++ b/test/SemaObjC/property-10.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wreadonly-setter-attrs -verify %s -fblocks +// RUN: clang -cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s -fblocks // Check property attribute consistency. diff --git a/test/SemaObjC/property-11.m b/test/SemaObjC/property-11.m index bb36c2766e75a..c9b35402ae77a 100644 --- a/test/SemaObjC/property-11.m +++ b/test/SemaObjC/property-11.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface NSSound @end diff --git a/test/SemaObjC/property-12.m b/test/SemaObjC/property-12.m index 50fb63bc006bb..f022dcda43891 100644 --- a/test/SemaObjC/property-12.m +++ b/test/SemaObjC/property-12.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wreadonly-setter-attrs -verify %s +// RUN: clang -cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s @protocol P0 @property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}} diff --git a/test/SemaObjC/property-13.m b/test/SemaObjC/property-13.m index d0e40dcf86ed2..23e3714accf96 100644 --- a/test/SemaObjC/property-13.m +++ b/test/SemaObjC/property-13.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface NSObject + alloc; diff --git a/test/SemaObjC/property-2.m b/test/SemaObjC/property-2.m index 159e06b07afaf..01fcdb9fa8813 100644 --- a/test/SemaObjC/property-2.m +++ b/test/SemaObjC/property-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Tester @property char PropertyAtomic_char; diff --git a/test/SemaObjC/property-3.m b/test/SemaObjC/property-3.m index a66b3d5e1e166..c79efc823a138 100644 --- a/test/SemaObjC/property-3.m +++ b/test/SemaObjC/property-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @interface I { diff --git a/test/SemaObjC/property-4.m b/test/SemaObjC/property-4.m index 56db28274c1a8..b70514f1ae630 100644 --- a/test/SemaObjC/property-4.m +++ b/test/SemaObjC/property-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @interface Object @end diff --git a/test/SemaObjC/property-5.m b/test/SemaObjC/property-5.m index f463aae629108..40b9e67f6311c 100644 --- a/test/SemaObjC/property-5.m +++ b/test/SemaObjC/property-5.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @protocol P1 @end @protocol P2 @end diff --git a/test/SemaObjC/property-6.m b/test/SemaObjC/property-6.m index 8f77cf1ad212c..0253fe889b1a2 100644 --- a/test/SemaObjC/property-6.m +++ b/test/SemaObjC/property-6.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s # 1 "<command line>" # 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3 typedef signed char BOOL; diff --git a/test/SemaObjC/property-7.m b/test/SemaObjC/property-7.m index 99c16cef73d80..63eb3cf2cb80c 100644 --- a/test/SemaObjC/property-7.m +++ b/test/SemaObjC/property-7.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef struct _NSZone NSZone; diff --git a/test/SemaObjC/property-8.m b/test/SemaObjC/property-8.m index 49bd409f27c50..82d8c6b00208d 100644 --- a/test/SemaObjC/property-8.m +++ b/test/SemaObjC/property-8.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; typedef struct _NSZone NSZone; diff --git a/test/SemaObjC/property-9-impl-method.m b/test/SemaObjC/property-9-impl-method.m index 06cb30482c826..c7b149717ec5f 100644 --- a/test/SemaObjC/property-9-impl-method.m +++ b/test/SemaObjC/property-9-impl-method.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // rdar://5967199 typedef signed char BOOL; diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m index 752f9c09ebf68..a3faa4822f315 100644 --- a/test/SemaObjC/property-9.m +++ b/test/SemaObjC/property-9.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; @protocol NSObject - (BOOL)isEqual:(id)object; @end diff --git a/test/SemaObjC/property-category-1.m b/test/SemaObjC/property-category-1.m index fa9d4c8c4bb9c..d6b580080d483 100644 --- a/test/SemaObjC/property-category-1.m +++ b/test/SemaObjC/property-category-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Object + (id)new; diff --git a/test/SemaObjC/property-category-2.m b/test/SemaObjC/property-category-2.m index c245e36819cc9..6a3883a35b770 100644 --- a/test/SemaObjC/property-category-2.m +++ b/test/SemaObjC/property-category-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // Test that a property can be synthesize in a category // implementation with no error. diff --git a/test/SemaObjC/property-category-3.m b/test/SemaObjC/property-category-3.m index bf9e8cbd9d9f0..de0f302bc5d75 100644 --- a/test/SemaObjC/property-category-3.m +++ b/test/SemaObjC/property-category-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P @property(readonly) int X; diff --git a/test/SemaObjC/property-category-4.m b/test/SemaObjC/property-category-4.m index ee08b09c01376..c807f394544ba 100644 --- a/test/SemaObjC/property-category-4.m +++ b/test/SemaObjC/property-category-4.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface IDELogNavigator { diff --git a/test/SemaObjC/property-error-readonly-assign.m b/test/SemaObjC/property-error-readonly-assign.m index d5cef78f18f4a..482ae2cb81893 100644 --- a/test/SemaObjC/property-error-readonly-assign.m +++ b/test/SemaObjC/property-error-readonly-assign.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface A -(int) x; diff --git a/test/SemaObjC/property-expression-error.m b/test/SemaObjC/property-expression-error.m index b648ee939dbed..f03244dc79fb3 100644 --- a/test/SemaObjC/property-expression-error.m +++ b/test/SemaObjC/property-expression-error.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface AddressMyProperties { diff --git a/test/SemaObjC/property-impl-misuse.m b/test/SemaObjC/property-impl-misuse.m index 7b956b5f7b4d0..5bbc3f19c090e 100644 --- a/test/SemaObjC/property-impl-misuse.m +++ b/test/SemaObjC/property-impl-misuse.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I { int Y; diff --git a/test/SemaObjC/property-inherited.m b/test/SemaObjC/property-inherited.m index 6c06b90a9f0a7..67897526224d0 100644 --- a/test/SemaObjC/property-inherited.m +++ b/test/SemaObjC/property-inherited.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang -cc1 %s -fsyntax-only -verify // <rdar://problem/6497242> Inherited overridden protocol declared objects don't work diff --git a/test/SemaObjC/property-ivar-mismatch.m b/test/SemaObjC/property-ivar-mismatch.m index 75c1e97c4ee97..d4f6e1a4f4e11 100644 --- a/test/SemaObjC/property-ivar-mismatch.m +++ b/test/SemaObjC/property-ivar-mismatch.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // Test that arithmatic types on property and its ivar have exact match. @interface Test4 diff --git a/test/SemaObjC/property-method-lookup-impl.m b/test/SemaObjC/property-method-lookup-impl.m index 295bba524009c..f85babafbdbde 100644 --- a/test/SemaObjC/property-method-lookup-impl.m +++ b/test/SemaObjC/property-method-lookup-impl.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface SSyncCEList { diff --git a/test/SemaObjC/property-missing.m b/test/SemaObjC/property-missing.m index 301907ad1c7d7..a74cf6236dbe8 100644 --- a/test/SemaObjC/property-missing.m +++ b/test/SemaObjC/property-missing.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // PR3234 diff --git a/test/SemaObjC/property-nonfragile-abi.m b/test/SemaObjC/property-nonfragile-abi.m index 835209102199f..ede9515123c1a 100644 --- a/test/SemaObjC/property-nonfragile-abi.m +++ b/test/SemaObjC/property-nonfragile-abi.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s typedef signed char BOOL; diff --git a/test/SemaObjC/property-noprotocol-warning.m b/test/SemaObjC/property-noprotocol-warning.m index 95ec15aa1e0cc..20234a0b2ab35 100644 --- a/test/SemaObjC/property-noprotocol-warning.m +++ b/test/SemaObjC/property-noprotocol-warning.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Object diff --git a/test/SemaObjC/property-redundant-decl-accessor.m b/test/SemaObjC/property-redundant-decl-accessor.m index ffd5129c8e5ae..84fc8fa3be4fb 100644 --- a/test/SemaObjC/property-redundant-decl-accessor.m +++ b/test/SemaObjC/property-redundant-decl-accessor.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Werror -verify %s +// RUN: clang -cc1 -fsyntax-only -Werror -verify %s @interface MyClass { const char *_myName; diff --git a/test/SemaObjC/property-typecheck-1.m b/test/SemaObjC/property-typecheck-1.m index ca8a1393b01bc..c9562787983a8 100644 --- a/test/SemaObjC/property-typecheck-1.m +++ b/test/SemaObjC/property-typecheck-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface A -(float) x; // expected-note {{declared at}} diff --git a/test/SemaObjC/property-user-setter.m b/test/SemaObjC/property-user-setter.m index 9b0380ede88ed..94458dca6ee0d 100644 --- a/test/SemaObjC/property-user-setter.m +++ b/test/SemaObjC/property-user-setter.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface I0 @property(readonly) int x; diff --git a/test/SemaObjC/property-weak.m b/test/SemaObjC/property-weak.m index 293432fc828f7..2e4e1f0044fd0 100644 --- a/test/SemaObjC/property-weak.m +++ b/test/SemaObjC/property-weak.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s @interface foo @property(nonatomic) int foo __attribute__((weak_import)); diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m index cf2624f8204d6..b2f594fe32017 100644 --- a/test/SemaObjC/property.m +++ b/test/SemaObjC/property.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s @interface I { diff --git a/test/SemaObjC/props-on-prots.m b/test/SemaObjC/props-on-prots.m index 7bee8a0bc3197..dd92bfac49c1a 100644 --- a/test/SemaObjC/props-on-prots.m +++ b/test/SemaObjC/props-on-prots.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 05f5103178f2b..c24e9fb5ed168 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // rdar://5986251 @protocol SomeProtocol diff --git a/test/SemaObjC/protocol-attribute.m b/test/SemaObjC/protocol-attribute.m index 6bd58dd9a03ad..1bce37e49d84d 100644 --- a/test/SemaObjC/protocol-attribute.m +++ b/test/SemaObjC/protocol-attribute.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s __attribute ((unavailable)) @protocol FwProto; // expected-note{{marked unavailable}} diff --git a/test/SemaObjC/protocol-expr-1.m b/test/SemaObjC/protocol-expr-1.m index cc1c3231d5e51..22c0ed0ba4c3f 100644 --- a/test/SemaObjC/protocol-expr-1.m +++ b/test/SemaObjC/protocol-expr-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol fproto; diff --git a/test/SemaObjC/protocol-expr-neg-1.m b/test/SemaObjC/protocol-expr-neg-1.m index 9393fde3c3c75..2928a46bc07ae 100644 --- a/test/SemaObjC/protocol-expr-neg-1.m +++ b/test/SemaObjC/protocol-expr-neg-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @class Protocol; diff --git a/test/SemaObjC/protocol-id-test-1.m b/test/SemaObjC/protocol-id-test-1.m index 5e737a8fae079..79220ea1a4590 100644 --- a/test/SemaObjC/protocol-id-test-1.m +++ b/test/SemaObjC/protocol-id-test-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @interface FF - (void) Meth; diff --git a/test/SemaObjC/protocol-id-test-2.m b/test/SemaObjC/protocol-id-test-2.m index a55923c210583..b8f94a6d75798 100644 --- a/test/SemaObjC/protocol-id-test-2.m +++ b/test/SemaObjC/protocol-id-test-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @protocol P @end diff --git a/test/SemaObjC/protocol-id-test-3.m b/test/SemaObjC/protocol-id-test-3.m index 3c7f84a181f1a..54c55cd4845eb 100644 --- a/test/SemaObjC/protocol-id-test-3.m +++ b/test/SemaObjC/protocol-id-test-3.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -pedantic -fsyntax-only -verify %s +// RUN: clang -cc1 -pedantic -fsyntax-only -verify %s @protocol MyProto1 @end diff --git a/test/SemaObjC/protocol-implementation-inherited.m b/test/SemaObjC/protocol-implementation-inherited.m index 55b92ae6684af..4fc60fe5c98f4 100644 --- a/test/SemaObjC/protocol-implementation-inherited.m +++ b/test/SemaObjC/protocol-implementation-inherited.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P0 -bar; diff --git a/test/SemaObjC/protocol-lookup-2.m b/test/SemaObjC/protocol-lookup-2.m index 64d0c3acf036c..744fbee9828d0 100644 --- a/test/SemaObjC/protocol-lookup-2.m +++ b/test/SemaObjC/protocol-lookup-2.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface NSObject @end @protocol ProtocolA diff --git a/test/SemaObjC/protocol-lookup.m b/test/SemaObjC/protocol-lookup.m index 87655bd9e7a01..b2b354b7782d9 100644 --- a/test/SemaObjC/protocol-lookup.m +++ b/test/SemaObjC/protocol-lookup.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol NSObject - retain; - release; diff --git a/test/SemaObjC/protocol-qualified-class-unsupported.m b/test/SemaObjC/protocol-qualified-class-unsupported.m index 6e344c1f44143..e4e12d6a39d40 100644 --- a/test/SemaObjC/protocol-qualified-class-unsupported.m +++ b/test/SemaObjC/protocol-qualified-class-unsupported.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #include <stddef.h> diff --git a/test/SemaObjC/protocol-typecheck.m b/test/SemaObjC/protocol-typecheck.m index de66dedda70a2..e91cdfefb7284 100644 --- a/test/SemaObjC/protocol-typecheck.m +++ b/test/SemaObjC/protocol-typecheck.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface NSObject @end @protocol XCElementP @end diff --git a/test/SemaObjC/protocols.m b/test/SemaObjC/protocols.m index 9fbdc16759dd3..579feee7b9c22 100644 --- a/test/SemaObjC/protocols.m +++ b/test/SemaObjC/protocols.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface INTF1 @required // expected-error {{directive may only be specified in protocols only}} diff --git a/test/SemaObjC/rdr-6211479-array-property.m b/test/SemaObjC/rdr-6211479-array-property.m index 1781c5a404028..a5d177335ceeb 100644 --- a/test/SemaObjC/rdr-6211479-array-property.m +++ b/test/SemaObjC/rdr-6211479-array-property.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // <rdar://problem/6211479> typedef int T[2]; diff --git a/test/SemaObjC/restrict-id-type.m b/test/SemaObjC/restrict-id-type.m new file mode 100644 index 0000000000000..9bd5612aba335 --- /dev/null +++ b/test/SemaObjC/restrict-id-type.m @@ -0,0 +1,9 @@ +// RUN: clang -cc1 -std=gnu99 -fsyntax-only -verify %s + +void f0(restrict id a0) {} + +void f1(restrict id *a0) {} + +void f2(restrict Class a0) {} + +void f3(restrict Class *a0) {} diff --git a/test/SemaObjC/return.m b/test/SemaObjC/return.m index ff64994794581..743f0f9fca30d 100644 --- a/test/SemaObjC/return.m +++ b/test/SemaObjC/return.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify -Wmissing-noreturn +// RUN: clang -cc1 %s -fsyntax-only -verify -Wmissing-noreturn int test1() { id a; diff --git a/test/SemaObjC/scope-check.m b/test/SemaObjC/scope-check.m index 0835373ba7484..618bcd7bf1e30 100644 --- a/test/SemaObjC/scope-check.m +++ b/test/SemaObjC/scope-check.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @class A, B, C; diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m index a969b100cc68f..7df2bdaeb7015 100644 --- a/test/SemaObjC/selector-1.m +++ b/test/SemaObjC/selector-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify %s +// RUN: clang -cc1 -verify %s @interface Lancelot @end @implementation Lancelot diff --git a/test/SemaObjC/selector-error.m b/test/SemaObjC/selector-error.m index cc2a404726403..0df5df0bcc107 100644 --- a/test/SemaObjC/selector-error.m +++ b/test/SemaObjC/selector-error.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo - (char*) foo; diff --git a/test/SemaObjC/selector-overload.m b/test/SemaObjC/selector-overload.m index 7c30f79ceaecd..65c907eacded0 100644 --- a/test/SemaObjC/selector-overload.m +++ b/test/SemaObjC/selector-overload.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only +// RUN: clang -cc1 %s -fsyntax-only @interface NSObject + alloc; diff --git a/test/SemaObjC/sizeof-interface.m b/test/SemaObjC/sizeof-interface.m index aeb1b3facb735..cb4195bbd99b0 100644 --- a/test/SemaObjC/sizeof-interface.m +++ b/test/SemaObjC/sizeof-interface.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi -verify -fsyntax-only %s +// RUN: clang -cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s @class I0; diff --git a/test/SemaObjC/static-ivar-ref-1.m b/test/SemaObjC/static-ivar-ref-1.m index 7e07c7cb99a24..5c977580e702f 100644 --- a/test/SemaObjC/static-ivar-ref-1.m +++ b/test/SemaObjC/static-ivar-ref-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown -ast-print %s -// RUN: clang-cc -triple x86_64-apple-darwin10 -ast-print %s +// RUN: clang -cc1 -triple i386-unknown-unknown -ast-print %s +// RUN: clang -cc1 -triple x86_64-apple-darwin10 -ast-print %s @interface current { diff --git a/test/SemaObjC/stmts.m b/test/SemaObjC/stmts.m index 1d4ea0a771897..1402b288b3e8f 100644 --- a/test/SemaObjC/stmts.m +++ b/test/SemaObjC/stmts.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only struct some_struct; diff --git a/test/SemaObjC/string.m b/test/SemaObjC/string.m index 3c09c3c036222..077ba7d93e014 100644 --- a/test/SemaObjC/string.m +++ b/test/SemaObjC/string.m @@ -1,5 +1,5 @@ -// RUN: clang-cc %s -verify -fsyntax-only -// RUN: clang-cc %s -verify -fsyntax-only -DDECLAREIT +// RUN: clang -cc1 %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only -DDECLAREIT // a declaration of NSConstantString is not required. #ifdef DECLAREIT diff --git a/test/SemaObjC/super-cat-prot.m b/test/SemaObjC/super-cat-prot.m index 6ddc31fbb9e66..a7288bbc3babb 100644 --- a/test/SemaObjC/super-cat-prot.m +++ b/test/SemaObjC/super-cat-prot.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; diff --git a/test/SemaObjC/super-property-message-expr.m b/test/SemaObjC/super-property-message-expr.m index 082d8bd5b48a2..15d4db00414d9 100644 --- a/test/SemaObjC/super-property-message-expr.m +++ b/test/SemaObjC/super-property-message-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface SStoreNodeInfo diff --git a/test/SemaObjC/super-property-notation.m b/test/SemaObjC/super-property-notation.m index 3b0887f26eff8..d67bdcb8e6f0c 100644 --- a/test/SemaObjC/super-property-notation.m +++ b/test/SemaObjC/super-property-notation.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface B +(int) classGetter; diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m index 83842afb9c3f2..2896968e464da 100644 --- a/test/SemaObjC/super.m +++ b/test/SemaObjC/super.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Foo - iMethod; diff --git a/test/SemaObjC/synchronized.m b/test/SemaObjC/synchronized.m index 01f82c1686221..d1aa101c7dc26 100644 --- a/test/SemaObjC/synchronized.m +++ b/test/SemaObjC/synchronized.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface PBXTrackableTaskManager @end diff --git a/test/SemaObjC/synthesize-setter-contclass.m b/test/SemaObjC/synthesize-setter-contclass.m index 78490c8db0d31..184c4ead07856 100644 --- a/test/SemaObjC/synthesize-setter-contclass.m +++ b/test/SemaObjC/synthesize-setter-contclass.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface TestClass { diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m index 305629b43ce67..c41884eef712a 100644 --- a/test/SemaObjC/synthesized-ivar.m +++ b/test/SemaObjC/synthesized-ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -fobjc-nonfragile-abi -verify %s +// RUN: clang -cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s @interface I { } diff --git a/test/SemaObjC/try-catch.m b/test/SemaObjC/try-catch.m index 453d80fd59965..fb6182cc76d73 100644 --- a/test/SemaObjC/try-catch.m +++ b/test/SemaObjC/try-catch.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef struct _NSZone NSZone; diff --git a/test/SemaObjC/typedef-class.m b/test/SemaObjC/typedef-class.m index 128815602d4d2..0c48715f19bd0 100644 --- a/test/SemaObjC/typedef-class.m +++ b/test/SemaObjC/typedef-class.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; typedef struct _NSZone NSZone; diff --git a/test/SemaObjC/ucn-objc-string.m b/test/SemaObjC/ucn-objc-string.m index 1d94ea2363a12..7603199d0211a 100644 --- a/test/SemaObjC/ucn-objc-string.m +++ b/test/SemaObjC/ucn-objc-string.m @@ -1,4 +1,4 @@ -// RUN: clang %s -verify -fsyntax-only +// RUN: clang -cc1 %s -verify -fsyntax-only @class NSString; extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); diff --git a/test/SemaObjC/undeclared-selector.m b/test/SemaObjC/undeclared-selector.m index 354c3162c2454..6791aaf0f3618 100644 --- a/test/SemaObjC/undeclared-selector.m +++ b/test/SemaObjC/undeclared-selector.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wundeclared-selector -verify %s +// RUN: clang -cc1 -fsyntax-only -Wundeclared-selector -verify %s typedef struct objc_selector *SEL; diff --git a/test/SemaObjC/undef-class-messagin-error.m b/test/SemaObjC/undef-class-messagin-error.m index 114b6ca5f6f42..d8e50a0acd22b 100644 --- a/test/SemaObjC/undef-class-messagin-error.m +++ b/test/SemaObjC/undef-class-messagin-error.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface _Child + (int) flashCache; diff --git a/test/SemaObjC/undef-protocol-methods-1.m b/test/SemaObjC/undef-protocol-methods-1.m index 05245523fb6ae..066d53218bbfd 100644 --- a/test/SemaObjC/undef-protocol-methods-1.m +++ b/test/SemaObjC/undef-protocol-methods-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol P1 - (void) P1proto; diff --git a/test/SemaObjC/undef-superclass-1.m b/test/SemaObjC/undef-superclass-1.m index cb15dc39a3dcb..2deb0b1ae60f8 100644 --- a/test/SemaObjC/undef-superclass-1.m +++ b/test/SemaObjC/undef-superclass-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @class SUPER, Y; diff --git a/test/SemaObjC/undefined-protocol-type-1.m b/test/SemaObjC/undefined-protocol-type-1.m index 572d55f26854d..c2e2abc5bb604 100644 --- a/test/SemaObjC/undefined-protocol-type-1.m +++ b/test/SemaObjC/undefined-protocol-type-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol p1, p4; @protocol p2 @end diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m index 4e85894b0a1b9..f492ac5d37895 100644 --- a/test/SemaObjC/unused.m +++ b/test/SemaObjC/unused.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -Wunused -fsyntax-only +// RUN: clang -cc1 %s -verify -Wunused -fsyntax-only int printf(const char *, ...); diff --git a/test/SemaObjC/va-method-1.m b/test/SemaObjC/va-method-1.m index 3c8998f983cee..424ecab006d68 100644 --- a/test/SemaObjC/va-method-1.m +++ b/test/SemaObjC/va-method-1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s #include <stdarg.h> diff --git a/test/SemaObjC/warn-assign-property-nscopying.m b/test/SemaObjC/warn-assign-property-nscopying.m index cf1acc466a274..ecf2c6a00a624 100644 --- a/test/SemaObjC/warn-assign-property-nscopying.m +++ b/test/SemaObjC/warn-assign-property-nscopying.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-gc -fsyntax-only -verify %s +// RUN: clang -cc1 -fobjc-gc -fsyntax-only -verify %s @protocol NSCopying @end diff --git a/test/SemaObjC/warn-selector-selection.m b/test/SemaObjC/warn-selector-selection.m index 4918de77dc7b7..19c9154a36b28 100644 --- a/test/SemaObjC/warn-selector-selection.m +++ b/test/SemaObjC/warn-selector-selection.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface Object - (void)foo; diff --git a/test/SemaObjC/warn-superclass-method-mismatch.m b/test/SemaObjC/warn-superclass-method-mismatch.m index f123a3f2ddacd..acca86797e9da 100644 --- a/test/SemaObjC/warn-superclass-method-mismatch.m +++ b/test/SemaObjC/warn-superclass-method-mismatch.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -Wsuper-class-method-mismatch -verify %s +// RUN: clang -cc1 -fsyntax-only -Wsuper-class-method-mismatch -verify %s @interface Root -(void) method_r: (char)ch : (float*)f1 : (int*) x; // expected-note {{previous declaration is here}} diff --git a/test/SemaObjC/warn-weak-field.m b/test/SemaObjC/warn-weak-field.m index 3850f217beea8..b688a1fea0090 100644 --- a/test/SemaObjC/warn-weak-field.m +++ b/test/SemaObjC/warn-weak-field.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s +// RUN: clang -cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s struct S { __weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}} diff --git a/test/SemaObjC/weak-attr-ivar.m b/test/SemaObjC/weak-attr-ivar.m index 6af96ddb3c8b2..84bdb967262dc 100644 --- a/test/SemaObjC/weak-attr-ivar.m +++ b/test/SemaObjC/weak-attr-ivar.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/SemaObjC/writable-property-in-superclass.m b/test/SemaObjC/writable-property-in-superclass.m index 182b1c47bb392..cc9295a9bc014 100644 --- a/test/SemaObjC/writable-property-in-superclass.m +++ b/test/SemaObjC/writable-property-in-superclass.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface MessageStore @property (assign, readonly) int P; diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm index e3304a41b7308..92a909621421c 100644 --- a/test/SemaObjCXX/blocks.mm +++ b/test/SemaObjCXX/blocks.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fblocks %s +// RUN: clang -cc1 -fsyntax-only -verify -fblocks %s @protocol NSObject; void bar(id(^)(void)); @@ -44,3 +44,9 @@ namespace N { foo(N::X()); // okay } @end + +typedef signed char BOOL; +void foo6(void *block) { + void (^vb)(id obj, int idx, BOOL *stop) = (void (^)(id, int, BOOL *))block; + BOOL (^bb)(id obj, int idx, BOOL *stop) = (BOOL (^)(id, int, BOOL *))block; +} diff --git a/test/SemaObjCXX/category-lookup.mm b/test/SemaObjCXX/category-lookup.mm new file mode 100644 index 0000000000000..0458752d9338e --- /dev/null +++ b/test/SemaObjCXX/category-lookup.mm @@ -0,0 +1,10 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +@interface NSObject @end + +@interface NSObject (NSScriptClassDescription) +@end + +void f() { + NSScriptClassDescription *f; // expected-error {{use of undeclared identifier 'NSScriptClassDescription'}} +} diff --git a/test/SemaObjCXX/composite-objc-pointertype.mm b/test/SemaObjCXX/composite-objc-pointertype.mm new file mode 100644 index 0000000000000..786315e0e7a3b --- /dev/null +++ b/test/SemaObjCXX/composite-objc-pointertype.mm @@ -0,0 +1,18 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +@interface Foo +@end + +@implementation Foo +- (id)test { + id bar; + Class cl; + Foo *f; + + (void)((bar!= 0) ? bar : 0); + (void)((cl != 0) ? cl : 0); + (void)((f != 0) ? 0 : f); + return (0 == 1) ? 0 : bar; +} +@end + diff --git a/test/SemaObjCXX/conditional-expr.mm b/test/SemaObjCXX/conditional-expr.mm new file mode 100644 index 0000000000000..e1f92cded3ac8 --- /dev/null +++ b/test/SemaObjCXX/conditional-expr.mm @@ -0,0 +1,67 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +@protocol P0 +@end +@protocol P1 +@end +@protocol P2 +@end + +@interface A <P0> +@end + +@interface B : A +@end + +void bar(id x); +void barP0(id<P0> x); +void barP1(id<P1> x); +void barP2(id<P2> x); + +void f0(A *a) { + id l = a; +} + +void f1(id x, A *a) { + id<P0> l = a; +} + +void f2(id<P1> x) { + id<P0> l = x; // expected-error {{incompatible type initializing 'id<P1>', expected 'id<P0>'}} +} + +void f3(A *a) { + id<P1> l = a; // expected-error {{incompatible type initializing 'A *', expected 'id<P1>'}} +} + +void f4(int cond, id x, A *a) { + bar(cond ? x : a); +} + +void f5(int cond, A *a, B *b) { + bar(cond ? a : b); +} + +void f6(int cond, id x, A *a) { + bar(cond ? (id<P0, P1>) x : a); +} + +void f7(int cond, id x, A *a) { + bar(cond ? a : (id<P0, P1>) x); +} + +void f8(int cond, id<P0,P1> x0, id<P0,P2> x1) { + barP0(cond ? x0 : x1); // expected-warning {{incompatible operand types ('id<P0,P1>' and 'id<P0,P2>')}} +} + +void f9(int cond, id<P0,P1> x0, id<P0,P2> x1) { + barP1(cond ? x0 : x1); // expected-warning {{incompatible operand types ('id<P0,P1>' and 'id<P0,P2>')}} +} + +void f10(int cond, id<P0,P1> x0, id<P0,P2> x1) { + barP2(cond ? x0 : x1); // expected-warning {{incompatible operand types ('id<P0,P1>' and 'id<P0,P2>')}} +} + +int f11(int cond, A* a, B* b) { + return (cond? b : a)->x; // expected-error{{'A' does not have a member named 'x'}} +} diff --git a/test/SemaObjCXX/cstyle-cast.mm b/test/SemaObjCXX/cstyle-cast.mm new file mode 100644 index 0000000000000..fca2ef5cb613a --- /dev/null +++ b/test/SemaObjCXX/cstyle-cast.mm @@ -0,0 +1,40 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +@protocol P @end +@interface I @end + +struct X { X(); }; + +void test1(X x) { + void *cft; + id oct = (id)cft; + + Class ccct; + ccct = (Class)cft; + + I* iict = (I*)cft; + + id<P> qid = (id<P>)cft; + + I<P> *ip = (I<P>*)cft; + + (id)x; // expected-error {{C-style cast from 'struct X' to 'id' is not allowed}} + + id *pid = (id*)ccct; + + id<P> *qpid = (id<P>*)ccct; + + int **pii; + + ccct = (Class)pii; + + qpid = (id<P>*)pii; + + iict = (I*)pii; + + pii = (int **)ccct; + + pii = (int **)qpid; + +} + diff --git a/test/SemaObjCXX/linkage-spec.mm b/test/SemaObjCXX/linkage-spec.mm index 2cc0936b2ed27..bbdea7b25873e 100644 --- a/test/SemaObjCXX/linkage-spec.mm +++ b/test/SemaObjCXX/linkage-spec.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s extern "C" { @class Protocol; } diff --git a/test/SemaObjCXX/objc-decls-inside-namespace.mm b/test/SemaObjCXX/objc-decls-inside-namespace.mm index cedfcfdb9e4b2..464b2871c85d6 100644 --- a/test/SemaObjCXX/objc-decls-inside-namespace.mm +++ b/test/SemaObjCXX/objc-decls-inside-namespace.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s namespace C { diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm index 56dc5108eb957..a15907ce421f7 100644 --- a/test/SemaObjCXX/overload.mm +++ b/test/SemaObjCXX/overload.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // XFAIL: * @interface Foo @end diff --git a/test/SemaObjCXX/protocol-lookup.mm b/test/SemaObjCXX/protocol-lookup.mm index 87655bd9e7a01..b2b354b7782d9 100644 --- a/test/SemaObjCXX/protocol-lookup.mm +++ b/test/SemaObjCXX/protocol-lookup.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @protocol NSObject - retain; - release; diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm index e02f360f78760..c4961efc1a55e 100644 --- a/test/SemaObjCXX/references.mm +++ b/test/SemaObjCXX/references.mm @@ -1,5 +1,5 @@ // FIXME: This crashes, disable it until fixed. -// RN: clang-cc -verify -emit-llvm -o - %s +// RN: clang -cc1 -verify -emit-llvm -o - %s // RUN: false // XFAIL: * diff --git a/test/SemaObjCXX/reserved-keyword-selectors.mm b/test/SemaObjCXX/reserved-keyword-selectors.mm index 2875f9352737f..add8e75ef8063 100644 --- a/test/SemaObjCXX/reserved-keyword-selectors.mm +++ b/test/SemaObjCXX/reserved-keyword-selectors.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s @interface A - (void)asm; diff --git a/test/SemaObjCXX/standard-conversion-to-bool.mm b/test/SemaObjCXX/standard-conversion-to-bool.mm new file mode 100644 index 0000000000000..cb97546582d73 --- /dev/null +++ b/test/SemaObjCXX/standard-conversion-to-bool.mm @@ -0,0 +1,12 @@ +// RUN: clang -cc1 -fsyntax-only -verify %s + +@class NSString; +id a; +NSString *b; + +void f() { + bool b1 = a; + bool b2 = b; +} + + diff --git a/test/SemaObjCXX/vararg-non-pod.mm b/test/SemaObjCXX/vararg-non-pod.mm index eeed09e61637b..ee6462b0e027e 100644 --- a/test/SemaObjCXX/vararg-non-pod.mm +++ b/test/SemaObjCXX/vararg-non-pod.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s -Wnon-pod-varargs extern char version[]; diff --git a/test/SemaObjCXX/void_to_obj.mm b/test/SemaObjCXX/void_to_obj.mm index d1fbf6b69079c..851ecf5db6665 100644 --- a/test/SemaObjCXX/void_to_obj.mm +++ b/test/SemaObjCXX/void_to_obj.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // <rdar://problem/6463729> @class XX; diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp index e74a6f8dcca92..98ccbe7db6f85 100644 --- a/test/SemaTemplate/class-template-id.cpp +++ b/test/SemaTemplate/class-template-id.cpp @@ -36,3 +36,8 @@ namespace N { N::C<int> c1; typedef N::C<float> c2; + +// PR5655 +template<typename T> struct Foo { }; // expected-note{{template is declared here}} + +void f(void) { Foo bar; } // expected-error{{without a template argument list}} diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp index 203977e9edd70..0b6916fa485d3 100644 --- a/test/SemaTemplate/constructor-template.cpp +++ b/test/SemaTemplate/constructor-template.cpp @@ -82,3 +82,15 @@ X4 test_X4(bool Cond, X4 x4) { X4 b(x4); // okay, copy constructor return X4(); // expected-error{{no viable conversion}} } + +// Instantiation of a non-dependent use of a constructor +struct DefaultCtorHasDefaultArg { + explicit DefaultCtorHasDefaultArg(int i = 17); +}; + +template<typename T> +void default_ctor_inst() { + DefaultCtorHasDefaultArg def; +} + +template void default_ctor_inst<int>(); diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp index 84a8e899dbeab..98992f6f6078c 100644 --- a/test/SemaTemplate/friend-template.cpp +++ b/test/SemaTemplate/friend-template.cpp @@ -1,23 +1,20 @@ // RUN: clang-cc -fsyntax-only -verify %s // PR5057 -namespace std { - class X { - public: - template<typename T> - friend struct Y; - }; -} - -namespace std { - template<typename T> - struct Y - { - }; +namespace test0 { + namespace std { + class X { + public: + template<typename T> friend struct Y; + }; + } + + namespace std { + template<typename T> struct Y {}; + } } - -namespace N { +namespace test1 { template<typename T> void f1(T) { } // expected-note{{here}} class X { @@ -30,64 +27,73 @@ namespace N { } // PR4768 -template<typename T> -struct X0 { - template<typename U> friend struct X0; -}; - -template<typename T> -struct X0<T*> { - template<typename U> friend struct X0; -}; +namespace test2 { + template<typename T> struct X0 { + template<typename U> friend struct X0; + }; + + template<typename T> struct X0<T*> { + template<typename U> friend struct X0; + }; -template<> -struct X0<int> { - template<typename U> friend struct X0; -}; + template<> struct X0<int> { + template<typename U> friend struct X0; + }; -template<typename T> -struct X1 { - template<typename U> friend void f2(U); - template<typename U> friend void f3(U); -}; + template<typename T> struct X1 { + template<typename U> friend void f2(U); + template<typename U> friend void f3(U); + }; -template<typename U> void f2(U); + template<typename U> void f2(U); -X1<int> x1i; -X0<int*> x0ip; + X1<int> x1i; + X0<int*> x0ip; -template<> void f2(int); + template<> void f2(int); -// FIXME: Should this declaration of f3 be required for the specialization of -// f3<int> (further below) to work? GCC and EDG don't require it, we do... -template<typename U> void f3(U); + // FIXME: Should this declaration of f3 be required for the specialization of + // f3<int> (further below) to work? GCC and EDG don't require it, we do... + template<typename U> void f3(U); -template<> void f3(int); + template<> void f3(int); +} // PR5332 -template <typename T> -class Foo { - template <typename U> - friend class Foo; -}; +namespace test3 { + template <typename T> class Foo { + template <typename U> + friend class Foo; + }; + + Foo<int> foo; + + template<typename T, T Value> struct X2a; -Foo<int> foo; + template<typename T, int Size> struct X2b; -template<typename T, T Value> -struct X2a; + template<typename T> + class X3 { + template<typename U, U Value> friend struct X2a; + template<typename U, T Value> friend struct X2b; + }; -template<typename T, int Size> -struct X2b; + X3<int> x3i; // okay -template<typename T> -class X3 { - template<typename U, U Value> - friend struct X2a; + X3<long> x3l; // FIXME: should cause an instantiation-time failure +} - template<typename U, T Value> - friend struct X2b; -}; +// PR5716 +namespace test4 { + template<typename> struct A { + template<typename T> friend void f(const A<T>&); + }; -X3<int> x3i; // okay + template<typename T> void f(const A<T>&) { + int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}} + } -X3<long> x3l; // FIXME: should cause an instantiation-time failure + void f() { + f(A<int>()); // expected-note {{in instantiation of function template specialization}} + } +} diff --git a/test/SemaTemplate/instantiate-default-assignment-operator.cpp b/test/SemaTemplate/instantiate-default-assignment-operator.cpp new file mode 100644 index 0000000000000..b0ac078893de6 --- /dev/null +++ b/test/SemaTemplate/instantiate-default-assignment-operator.cpp @@ -0,0 +1,17 @@ +// RUN: clang-cc -fsyntax-only -verify %s +template<typename> struct PassRefPtr { }; +template<typename T> struct RefPtr { + RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array size is negative}} + RefPtr& operator=(const PassRefPtr<T>&); +}; + +struct A { RefPtr<int> a; }; +struct B : RefPtr<float> { }; + +void f() { + A a1, a2; + a1 = a2; // expected-note {{instantiation of member function 'RefPtr<int>::operator=' requested here}} + + B b1, b2; + b1 = b2; // expected-note {{in instantiation of member function 'RefPtr<float>::operator=' requested here}} +} diff --git a/test/SemaTemplate/instantiate-enum-2.cpp b/test/SemaTemplate/instantiate-enum-2.cpp new file mode 100644 index 0000000000000..2b56a036e9479 --- /dev/null +++ b/test/SemaTemplate/instantiate-enum-2.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc %s -fsyntax-only -verify + +template<int IntBits> struct X { + enum { + IntShift = (unsigned long long)IntBits, + ShiftedIntMask = (1 << IntShift) + }; +}; +X<1> x; diff --git a/test/SemaTemplate/instantiate-exception-spec.cpp b/test/SemaTemplate/instantiate-exception-spec.cpp new file mode 100644 index 0000000000000..31db4487a27a3 --- /dev/null +++ b/test/SemaTemplate/instantiate-exception-spec.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// FIXME: the "note" should be down at the call site! +template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'struct Incomplete' is not allowed in exception specification}} \ + // expected-note{{instantiation of}} +struct Incomplete; // expected-note{{forward}} + +void test_f1(Incomplete *incomplete_p, int *int_p) { + f1(int_p); + f1(incomplete_p); +} diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index fb88213c401be..1cd55d9ad257e 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -94,3 +94,21 @@ struct Addable { void test_add(Addable &a) { add(a); } + +struct CallOperator { + int &operator()(int); + double &operator()(double); +}; + +template<typename Result, typename F, typename Arg1> +Result test_call_operator(F f, Arg1 arg1) { + // PR5266: non-dependent invocations of a function call operator. + CallOperator call_op; + int &ir = call_op(17); + return f(arg1); +} + +void test_call_operator(CallOperator call_op, int i, double d) { + int &ir = test_call_operator<int&>(call_op, i); + double &dr = test_call_operator<double&>(call_op, d); +} diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index cd74a21d6dbca..b99ec3304c4dc 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -96,6 +96,18 @@ template struct Delete0<int*>; template struct Delete0<X*>; template struct Delete0<int>; // expected-note{{instantiation}} +namespace PR5755 { + template <class T> + void Foo() { + char* p = 0; + delete[] p; + } + + void Test() { + Foo<int>(); + } +} + // --------------------------------------------------------------------- // throw expressions // --------------------------------------------------------------------- @@ -185,7 +197,7 @@ template struct InitList2<APair, int*, double*>; // expected-note{{instantiation template<typename T, typename Result> struct DotMemRef0 { void f(T t) { - Result result = t.m; // expected-error{{cannot be initialized}} + Result result = t.m; // expected-error{{non-const lvalue reference to type}} } }; @@ -207,7 +219,7 @@ template struct DotMemRef0<MemInt, float&>; // expected-note{{instantiation}} template<typename T, typename Result> struct ArrowMemRef0 { void f(T t) { - Result result = t->m; // expected-error 2{{cannot be initialized}} + Result result = t->m; // expected-error 2{{non-const lvalue reference}} } }; @@ -269,7 +281,7 @@ template struct ThisMemberFuncCall0<int&>; template<typename T> struct NonDepMemberCall0 { void foo(HasMemFunc0<int&> x) { - T result = x.f(); // expected-error{{initialized}} + T result = x.f(); // expected-error{{non-const lvalue reference}} } }; diff --git a/test/SemaTemplate/instantiate-function-1.mm b/test/SemaTemplate/instantiate-function-1.mm index c119ab5da8b98..aa4b941d39cf8 100644 --- a/test/SemaTemplate/instantiate-function-1.mm +++ b/test/SemaTemplate/instantiate-function-1.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // XFAIL: * template<typename T> struct Member0 { diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp index 2351d882f9c2c..231e2812f6669 100644 --- a/test/SemaTemplate/instantiate-method.cpp +++ b/test/SemaTemplate/instantiate-method.cpp @@ -95,9 +95,7 @@ struct X0 : X0Base { template<typename U> struct X1 : X0<U> { int &f2() { - // FIXME: We should be able to do this lookup and diagnose the error - // *despite* the fact that we can't decide the relationship yet. - return X0Base::f(); // expected-FIXME-error{{call to non-static member function without an object argument}} + return X0Base::f(); } }; diff --git a/test/SemaTemplate/instantiate-objc-1.mm b/test/SemaTemplate/instantiate-objc-1.mm index 829acb2e199b1..093be4e271559 100644 --- a/test/SemaTemplate/instantiate-objc-1.mm +++ b/test/SemaTemplate/instantiate-objc-1.mm @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang -cc1 -fsyntax-only -verify %s // Obj-C string literal expressions template <typename T> struct StringTest { diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp index 452fccf2244d7..d4a7008b47bf7 100644 --- a/test/SemaTemplate/instantiate-static-var.cpp +++ b/test/SemaTemplate/instantiate-static-var.cpp @@ -72,3 +72,23 @@ void Test() { Z1<Y2<X2>::value> x2; int y2[Y2<X2>::value]; } + +// PR5672 +template <int n> +struct X3 {}; + +class Y3 { + public: + ~Y3(); // The error isn't triggered without this dtor. + + void Foo(X3<1>); +}; + +template <typename T> +struct SizeOf { + static const int value = sizeof(T); +}; + +void MyTest3() { + Y3().Foo(X3<SizeOf<char>::value>()); +} diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp index a1cf355c890e1..de66f79242fcb 100644 --- a/test/SemaTemplate/instantiate-using-decl.cpp +++ b/test/SemaTemplate/instantiate-using-decl.cpp @@ -1,20 +1,49 @@ // RUN: clang-cc -fsyntax-only -verify %s -namespace N { } - -template<typename T> -struct A { - void f(); -}; - -template<typename T> -struct B : A<T> { - using A<T>::f; - - void g() { - using namespace N; - f(); - } -}; +namespace test0 { + namespace N { } + + template<typename T> + struct A { + void f(); + }; + + template<typename T> + struct B : A<T> { + using A<T>::f; + + void g() { + using namespace N; + f(); + } + }; + + template struct B<int>; +} -template struct B<int>; +namespace test1 { + template <class Derived> struct Visitor1 { + void Visit(struct Object1*); + }; + template <class Derived> struct Visitor2 { + void Visit(struct Object2*); // expected-note {{candidate function}} + }; + + template <class Derived> struct JoinVisitor + : Visitor1<Derived>, Visitor2<Derived> { + typedef Visitor1<Derived> Base1; + typedef Visitor2<Derived> Base2; + + void Visit(struct Object1*); // expected-note {{candidate function}} + using Base2::Visit; + }; + + class Knot : JoinVisitor<Knot> { + }; + + void test() { + Knot().Visit((struct Object1*) 0); + Knot().Visit((struct Object2*) 0); + Knot().Visit((struct Object3*) 0); // expected-error {{no matching member function for call}} + } +} diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp index a07f05ca78ee5..ab57950acff2e 100644 --- a/test/SemaTemplate/qualified-id.cpp +++ b/test/SemaTemplate/qualified-id.cpp @@ -18,3 +18,14 @@ namespace test1 { } }; } + +namespace test2 { + class Impl { + int foo(); + }; + template <class T> class Magic : public Impl { + int foo() { + return Impl::foo(); + } + }; +} diff --git a/test/SemaTemplate/template-class-traits.cpp b/test/SemaTemplate/template-class-traits.cpp new file mode 100644 index 0000000000000..7cf2004e727f2 --- /dev/null +++ b/test/SemaTemplate/template-class-traits.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc -fsyntax-only -verify %s +#define T(b) (b) ? 1 : -1 +#define F(b) (b) ? -1 : 1 + +struct HasVirt { virtual void a(); }; +template<class T> struct InheritPolymorph : HasVirt {}; +int t01[T(__is_polymorphic(InheritPolymorph<int>))]; + diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp new file mode 100644 index 0000000000000..486c8b2051410 --- /dev/null +++ b/test/SemaTemplate/virtual-member-functions.cpp @@ -0,0 +1,22 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +namespace PR5557 { +template <class T> struct A { + A(); + virtual int a(T x); +}; +template<class T> A<T>::A() {} +template<class T> int A<T>::a(T x) { + return *x; // expected-error{{requires pointer operand}} +} + +A<int> x; // expected-note{{instantiation}} + +template<typename T> +struct X { + virtual void f(); +}; + +template<> +void X<int>::f() { } +} diff --git a/test/lit.cfg b/test/lit.cfg index 6fa6742a4ac57..1421ec1a80cfc 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -119,40 +119,8 @@ def inferClang(PATH): return clang -def inferClangCC(clang, PATH): - clangcc = os.getenv('CLANGCC') - - # If the user set clang in the environment, definitely use that and don't - # try to validate. - if clangcc: - return clangcc - - # Otherwise try adding -cc since we expect to be looking in a build - # directory. - if clang.endswith('.exe'): - clangccName = clang[:-4] + '-cc.exe' - else: - clangccName = clang + '-cc' - clangcc = lit.util.which(clangccName, PATH) - if not clangcc: - # Otherwise ask clang. - res = lit.util.capture([clang, '-print-prog-name=clang-cc']) - res = res.strip() - if res and os.path.exists(res): - clangcc = res - - if not clangcc: - lit.fatal("couldn't find 'clang-cc' program, try setting " - "CLANGCC in your environment") - - return clangcc - config.clang = inferClang(config.environment['PATH']) if not lit.quiet: lit.note('using clang: %r' % config.clang) config.substitutions.append( (' clang ', ' ' + config.clang + ' ') ) - -config.clang_cc = inferClangCC(config.clang, config.environment['PATH']) -if not lit.quiet: - lit.note('using clang-cc: %r' % config.clang_cc) -config.substitutions.append( (' clang-cc ', ' ' + config.clang_cc + ' ') ) +config.substitutions.append( (' clang-cc ', ' ' + config.clang + ' -cc1 ') ) |