diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
commit | 77212133072dc40f070a280af8217032f55a9eb4 (patch) | |
tree | 2fd5819f49caecc5f520219b6b9254fe94ebb138 /test | |
parent | 4b08eb6308ca90a6c08e2fc79d100821b1b1f6aa (diff) | |
download | FreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.zip FreeBSD-src-77212133072dc40f070a280af8217032f55a9eb4.tar.gz |
Update clang to 91430.
Diffstat (limited to 'test')
661 files changed, 4507 insertions, 990 deletions
diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index b23998c..3c11465 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 f3d371c..76d7ebb 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 04e9add..16f8db2 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 ae62898..d69f86e 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 219354b..ec44b22 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 21460a1..cb5339a 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 20e3eff..c98a685 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 0000000..b7f8be0 --- /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 481a940..d7804dc 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 5eb6cf1..6d01729 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 cf708b4..ad441a3 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 6c367f4..89d8f9b 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 60a85fd..416ef1c 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 fd5ae95..ea71ad2 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 8a94fe8..428997f 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 53a6b52..a1d4657 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 c3822cd..2a833c4 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 0000000..50a9d06 --- /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 bee337a..3c6b83b 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 69a4260..fb42520 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 d9367d4..48f757e 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 a2b7477..27b4c51 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 6b71a93..605255e 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 96080be..fdede4b 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 ed81d7b..4b03785 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 e29eefd..a0e889f 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 0bf3256..363cfdd 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 0a5c0f8..4ad3c0a 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 b854da6..df97866 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 b6873ad..f3eee26 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 098ec48..13f075d 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 7ea6111..e341918 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 390a279..449a4c2 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 6a17cba..0c5142b 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 f520784..ec4c3b4 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 2a98234..6af63f9 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 e702cb9..e636c21 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 058c903..92e20d6 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 7b0d61b..f9df552 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 8c865ab..01d99f2 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 e5113ba..e736e0f 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 42168b9..c97ef95 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 75cdf6e..2279456 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 af8db13..eb4fc8d 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 475a211..8aa194d 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 ab11513..8f5fe9f 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 c604653..8bfc1f3 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 d1a07ab..a866ad9 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 e8ce7bd..e17361e 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 971d476..7f49340 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 60161b1..3a32649 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 ebb6902..761448c 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 1768717..d38f4b3 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 b585c85..2adbbe2 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 1d8bbd3..28fa83a 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 4d191d2..7940fc6 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 5190a03..fbbf408 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 d5fc2e0..18dc3c8 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 0b837c6..95f876e 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 a4850c1..e1a0694 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 9d6fe5b..060a91a 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 6c34125..683dc74 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 a4c2904..417162b 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 6a8ae49..8d332cf 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 b16c231..744032b 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 ab52938..97fa612 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 eacac49..2b75ff9 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 bc9f0b7..969249c 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 bcdc65e..c63d589 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 e40c718..eace4f8 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 5d1ce25..a358165 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 46e441f..6a2ada5 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 7be32b4..594a6f0 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 e927a92..5bcf74d 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 c8632a5..a2824c0 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 8428ca4..c48544e 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 6d1561e..43bab9e 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 be4f185..1c48e79 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 bbbf6ae..55c482a 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 f39eb2a..6796bbf 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 0000000..ae5590c --- /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 0000000..c752cec --- /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 0000000..04af5bc --- /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 0000000..043a9bf --- /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 0000000..b90661d --- /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 0000000..00d109e --- /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 0000000..b4302d5 --- /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 0000000..4cbe1be --- /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 0000000..1a05aae --- /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 d701f88..8257330 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 0000000..bf314c4 --- /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 0000000..bf0f330 --- /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 0000000..f62b425 --- /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 0000000..66fa2d1 --- /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 0000000..54840f5 --- /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 0000000..5d34345 --- /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 0000000..5fa1fff --- /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 8334817..b082b85 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 883cb71..0665304 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 d291bbe..302b955 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 e445b45..d03180b 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 d16a745..58fc4f5 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 d35e0bb..ff56118 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 3cc42d8..fa9b197 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 2662b922..1c1028b 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 34e2517..05eb2e2 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 1f7e045..0000000 --- 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 0000000..f7a001e --- /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 a0e5b76..c1a5995 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 5652fdb..4b8e360 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 038d8f9..45747de 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 0000000..41e48bd --- /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 2d1baa6..90641dd 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 0cb6aff..0000000 --- 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 0000000..89261c7 --- /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 7663d2e..d4fc627 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 0000000..6fa6d55 --- /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 66ec9ea..1142aac 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 0000000..49796d0 --- /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 0000000..3dab0f2a --- /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 0000000..b4add46 --- /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 b89435a..c5e3c79 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 0000000..e0a17e0 --- /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 3dd7219..5570fb4 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 0000000..863e69c --- /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 0000000..6ce04a3 --- /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 0000000..b60070f --- /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 0000000..396ff44 --- /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 0000000..046bc32 --- /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 0000000..bd43196 --- /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 0000000..9af4c6e --- /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 0000000..e61f33a --- /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 0000000..7c25859 --- /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 fbce204..a2994c4 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 0000000..66c81e5 --- /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 03e405e..62d8c6c 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 0000000..0b808e0 --- /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 05bf396..491ca53 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 0000000..290daf2 --- /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 95bc255..45b4e9f 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 0000000..9baad94 --- /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 eaaf346..74dc0ea 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 0000000..a2a1cdd --- /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 a1ff1ff..7ba4d56 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 7757acd..e103b99 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 55877b2..9108544 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 0000000..d439cbd --- /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 0000000..8013ba4 --- /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 0000000..7fe5563 --- /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 0000000..b65b9f9 --- /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 0000000..db0ba2f --- /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 0000000..c1a8c23 --- /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 30f3563..9cfd58d 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 0000000..3fbdd2d --- /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 0000000..4b361cf --- /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 7135aaf..e3b2afe2 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 0000000..976f562 --- /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 0000000..b95218a --- /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 0000000..d179e9b --- /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 0000000..52b62ed --- /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 0000000..b0371c0 --- /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 0000000..f2d914f --- /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 2c58b92..65fbf9b 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 9a65116..2d2adeb 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 d737911..91ae9b3 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 3f605eb..107361f 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 f720bcc..52fd309 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 f4bc39d..2a8c31c 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 ee1b978..c1b001b 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 bb7af99..4949b45 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 16da55e..279f21a 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 def4c9d..536d158 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 ce27e87..595d2af 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 1e1a759..599e6e7 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 d63f842..45d7a86 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 11e5a27..aca2745 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 8204adc..08d30ba 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 c222310..9ee6102 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 d2548fd..679d6da 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 bda98ee..bace9db 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 18b972f..96d4cdf 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 01b7189..5a40fd8 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 8e6fd86..dd4867c 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 b53ea66..6c20c42 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 79a024f..3706ab6 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 90b3002..149205c 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 d5ec9b3..a12d900 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 db8470b..060161d 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 434ff79..fab0ee4 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 5dfddde..fae745b 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 8596b41..e265e6f 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 0c0dbb3..502aaeb 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 0000000..73b21b0 --- /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 c16f11d..8167ef6 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 f2fba58..25d0b8f 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 206d496..9d17d87 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 ac29839..a8a7c63 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 543c535..37efed0 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 cb56118..9a7d4aa 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 1905753..833f6dd 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 2e04d7e..54c37e0 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 c7fcafd5..0f6e7ca 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 4944f1b..5ab66ae 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 1ae6bf6..47d010f 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 87f7cc6..55bc233 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 ac3b81d..113486d 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 288fa8c..4956cdb 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 1bc8be8..7a3e341 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 9cc2296..5d4841e 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 664b6f0..fd759e3 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 0000000..dd7439d --- /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 898c81a..3e8e5ba 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 34bf603..38ea739 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 367705f..0bca640 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 c029d48..785378a 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 795dec0..d54b802 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 1646cde..9ed6fdf 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 3edaf4c..35854f2 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 6b34796..fab4f82 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 8e9a872..1d5b973 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 b6a0c03..2992cef 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 bce50cd..649c3e9 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 b41f63f..17d4e10 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 f1c1024..c5f68d2 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 2174792..d8b86bc 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 d78bc36..2d49ef7 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 8cad08c..ed083c9 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 73fe16a..e8cacd1 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 ea53b02..41a76f0 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 82cc558..346485a 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 4a5f14e..b5bb870 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 3930989..dc8ced1 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 592c1f0..bcdb25c 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 cdb135f..35a812f 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 7058302..ecb0385 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 4c863f4..8b672cc 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 2e51b44..8241af7 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 bff6d8f..5877064 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 25b9698..7e1870e 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 bd3aff8..abf1e27 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 b27bb34..f75eef3 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 e2890b6..263f76d 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 e25429e..a5c95c7 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 aedb1fa..6d1b775 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 8701b58..8d8ae90 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 eb227dd..f2660fe 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 0000000..2d753b2 --- /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 3903924..43f74fb 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 2ab1054..d486824 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 cad59b0..ce1d0f3 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 ab230af..f59de81 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 54ca19c..7e4c45d 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 c510685..1e765df 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 3c6894d..d5832bc 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 c65a5b2..317c5d3 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 033bc97..64ba141 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 6e4f176..0f81104 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 edc26a1..ebb443b 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 8147cd1..8bb1914 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 dd444c3..fb61137 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 9ed08d9..ae21044 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 eebc482..01106a9 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 7fe0790..c57f53d 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 605d09b..48d37f1 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 ab0beef..1979e3f 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 0000000..90d2407 --- /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 1b81228..a864e2d 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 bc8d6d6..1948092 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 f211a59..d78f93e 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 310a1a6..7666d19 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 21e4471..afd9bd6 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 f7f8b5e..762ebb7 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 3756a2f..6685342 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 508696a..e5b69c1 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 40f12e4..2eb3b18 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 8c03bbc..9700540 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 0df1341..e1b6f1a 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 8b0706b..97ba30b 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 8e37128..48b9d6a 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 8e8b2dd..938675a 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 6f72078..8224106 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 21aebfe..cdf2057 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 0000000..9f8be2c --- /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 9009f78..12ae4f4 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 31b7c6c..db9a1eb 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 3e2c9c2..0350d87 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 1d5a9a8..446f588 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 3653a9c..d6081bc 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 0000000..8d6a1de --- /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 0000000..651c40a --- /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 44bd9d2..c286c82 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 0000000..68d1ef4 --- /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 0000000..82c3983 --- /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 b692986c..1c03095 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 ff39678..62a43da 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 de61278..568ca94 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 0000000..cfafd30 --- /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 0000000..231a6c5 --- /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 0000000..cc01f61 --- /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 0000000..e4dacd9 --- /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 0000000..657613e --- /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 0000000..9ac034a --- /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 0000000..b7ab613 --- /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 841ffc9..24f6233 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 0000000..f12fe95 --- /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 0534388..17e2420 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 9eb5a11..0c12b8e 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 1289386..c109f40 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 136e397..a60ffad 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 5992787..17c3a72 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 0000000..72084d9 --- /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 f596e9b..aafb2e0 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 af1b7a8..8ad2072 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 3fa2842..6f3fd39 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 0000000..1a04fa0 --- /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 14b31af..6505ad0 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 535f40d..cc35ba1 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 461b9e5..20c9fb3 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 1e088a0..15e9fe9 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 1f42ec2..b80eb7d0 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 e9e4121..9adc34a 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 1d535de..86a912f 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 e121bed..afb522c 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 6c1bd29..957dbde 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 21ec308..6075332 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 ddb279b..9019d44 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 0f2bb90..464759e 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 977dccc..294a602 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 bc88e33..b3f033e 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 7aa6729..fdb52e7 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 4a36fc9..2ee3639 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 0344566..4dcbb79 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 9108451..392b26f 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 cf75aaa..294fb54 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 2913b58..233739b 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 7de1a57..dbe9b1d 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 98c6d16..25b5279 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 d9ad704..e619b72 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 bb6d04d..31be340 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 85ef919..fdc74ff 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 bdc6953..5908fec 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 10049ad..961e551 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 c3b067d..d40ee2a 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 cb6bc01..dbf1f9a 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 59f665b..5943e01 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 977789e..9f375ef 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 9b24e63..5057056 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 d4aba58..60d6d15 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 bdc5a34..ae65056 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 aecabe6..0edd041 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 10665b8..667c727 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 6cd0e27..6a4966b 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 54413f2..bfbe486 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 af26545..c9f937f 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 4726061..77bbd8c 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 d209988..797b5bb 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 3898f71..7bf3544 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 b1f95e0..bf189be 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 500933d..7a3b3af 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 df24518..3359660 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 ac8ee9f..3b49c22 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 3f2bb6f..66280ca 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 e2dfe38..745efec 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 686d73f..9cf084c 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 4de64bc..5567d01 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 0de3102..804f020 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 70f3eb8..9870690 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 14d18d1..141cb6a 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 66d4110..bbc9a94 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 e35baf6..594e1b1 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 63b605d..e46a3ba 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 f69e8ef..e9b002b 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 986627d..735c942 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 12f3811..b68c6b1 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 499d911..6c1460d 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 17f448d..ef80c26 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 b4fdac5..f808b8f 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 219b1a0..1197a19 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 bf28277..4ee9f89 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 01a216f..fa2d3a0 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 299b0a2..10fcde6 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 840b24f..4ba6867 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 58dcbcf..2113949 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 ea18091..54a970f 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 631c7b3..d4ee305 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 ad75cf1..2e8120a 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 9dac6c7..1eec6c5 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 0000000..579c793 --- /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 da52d33..d68779c 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 0000000..e4fdc08 --- /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 e38b6b3..7188678 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 937b272..277bfc6 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 d7db647..20eb91a 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 e627fef..0377657 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 db25681..3315de0 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 56cc435..efc9833 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 76e84e5..d1c42eb 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 785ea0e..b7db907 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 0000000..1867808 --- /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 0000000..30fe278 --- /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 fc9b3ab..d19727a 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 0000000..0dca9c9 --- /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 0000000..9566df4 --- /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 cd13bcc..9cd6855 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 83c72417..6a51261 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 f2fe0a7..8a3ec8b 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 f0290e8..bc7a707 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 755e27a..6436236 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 3a0bf30..5d27182 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 16d3704..672b8b4 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 0000000..829321f --- /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 254a18d..5a11a0c 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 dda1ead..6062099 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 e03abf4..45d3923 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 5132c2a..7a71607 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 340c0ae..dfb4edc 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 42deb27..0235624 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 684009b..a19223d 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 51f347d..b7583f2 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 977df14..f913531 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 0000000..4e7ff69 --- /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 4a3b10f..c18a77f 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 0000000..079a837 --- /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 aa5afa7..46bcc53 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 e43c1a0..e92a017 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 225d63b..1bd5c33 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 39358cd..e946c3e 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 e0baf4e..976e2a3 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 1b6c10d..c4ada44 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 78ce63c..03c9c76 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 429d6c0..42b173b 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 f4d057b..821da00 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 e385a97..675f969 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 6cd6be0..4d2093f 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 3efb8cf..3e012c7 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 20da639..90ca4e3 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 64ff3d1..5250975 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 d67fd35..885a946 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 cfe72de..6e97286 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 231c9a2..5dbefdc 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 aecdfd1..c16372b 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 afd35a8..f3d0a96 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 6dcbcde..eb570c0 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 dcbda42..5882618 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 15da637..ea828d9 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 bda4657..9b880c4 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 ae0cab0..edcd3be 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 1dfaf09..434f8dd 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 8220912..d6d9855 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 a9712b2..e2889c3 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 7b218bd..550bafd 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 da8a326..0cf49dd 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 f50b293..929ad06 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 ba42590..049c6ce 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 09ad155..80d6915 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 6f745d4..ef9df5a 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 d36bc8c..ea4de84 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 663b87d..ce34a23 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 8f0f3d8..5e9ee60 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 12b6381..c2eded7 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 7dab9f5..a071545 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 22bec50..c9776d0 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 71f0054..54d6a04 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 df0785b..bffbd76 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 c24b67b..a53b942 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 0506bce..2d1b623 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 5989011..794ede2 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 478e8c8..4b8f489 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 3217675..ad3da26 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 881fd2b..ea1aa06 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 af9267e..b19bc30 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 caa93b4..89647b5 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 5570d56..4c7967d 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 cd7f89b..6a837b6 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 0875848..9835f3e 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 9f1ee68..b7dae6b 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 8720958..19215e3 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 d9c1a94..74f866b 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 bba51bb..dcd2f95 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 2043503..8fdb281 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 20ed157..acba8e4 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 4559696..c251d46 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 ff40cc6..477c9a1 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 57750a5..2308677 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 7cab982..b4a9df2 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 0450d7b..a83ef23 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 a44ba4f..da742e7 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 d51d135..52bd618 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 2b62b17..315202f 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 dc5aa89..7de9e9f 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 4b84902..b0d5b51 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 f5f9505..e3d2c15 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 ebba0fd..7f8aec9 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 5d6670e..6b4cbaf 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 fa3293c..c80f080 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 70d981c..aa99cfa 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 1347537..1ec049b 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 b4c52fa..ec1d363 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 369d902..f745e44 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 862265c..624377f 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 93f28e6..8980d37 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 85a2a91..9898936 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 ec03a00..cad7142 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 6ad8915..b2c6f0d 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 c902590..bdf28f4 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 b4dfff6..bc80722 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 9bf816a..b451d36 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 6eacba0..d0679a3 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 4a3732e..b58fa68 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 e79df96..366f714 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 4077f91..ecc03ba 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 77a15cc..077b0cf 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 ca3cc4c..1dc33db 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 b168976..63bf040 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 707e189..0404753 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 957abc3..318f510 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 a5a830d..242504f 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 63768ff..e480561 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 0290123..244f5d7 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 e81bcdf..09949de 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 0000000..2d9499f --- /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 c4d4fba..d5f92ed 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 f797188..8ef7be9 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 a4213f6..0f7fd61 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 3eb94b9..f98ba89 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 84cdd70..e595589 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 b3ffdcd..50d2d92 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 cca7575..5493653 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 8ed583f..9e7c4c9 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 3b2548b..20b4e60 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 49dc789..b9607eb 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 9351cb9..63caa7e 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 3848fa2..37171af 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 8f31e9a..080d664 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 a53c4d9..bd62ded 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 d0a091d..642893d 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 82fd3c8..8f5d1ac 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 7ce015f..c1efe5a 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 fbb01df..bbf993f 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 2d0758b..506cccf 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 4946210..972f090 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 f494929..498278e 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 3bd4dba..73b5671 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 860a0ca..8c8f33b 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 2fcb06f..4345914 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 869bbbd..e657707 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 d1f673a..6eb5d63 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 c47b909..896c44a 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 c6461dd..46d1242 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 0da0ce8..c15e107 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 5de52ba..bd59c66 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 81b8ee1..cf615bc 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 bb36c27..c9b3540 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 50fb63b..f022dcd 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 d0e40dc..23e3714 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 159e06b..01fcdb9 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 a66b3d5..c79efc8 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 56db282..b70514f 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 f463aae..40b9e67 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 8f77cf1..0253fe8 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 99c16ce..63eb3cf 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 49bd409..82d8c6b 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 06cb304..c7b14971 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 752f9c0..a3faa48 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 fa9d4c8..d6b5800 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 c245e36..6a3883a 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 bf9e8cbd..de0f302 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 ee08b09..c807f39 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 d5cef78..482ae2c 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 b648ee9..f03244d 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 7b956b5..5bbc3f1 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 6c06b90..6789752 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 75c1e97..d4f6e1a 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 295bba5..f85baba 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 301907a..a74cf62 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 8352091..ede9515 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 95ec15a..20234a0 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 ffd5129..84fc8fa 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 ca8a139..c956278 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 9b0380e..94458dc 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 293432fc8..2e4e1f0 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 cf2624f..b2f594f 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 7bee8a0..dd92bfa 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 05f5103..c24e9fb 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 6bd58dd..1bce37e 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 cc1c323..22c0ed0 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 9393fde..2928a46 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 5e737a8..79220ea 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 a55923c..b8f94a6 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 3c7f84a..54c55cd 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 55b92ae..4fc60fe 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 64d0c3a..744fbee 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 87655bd..b2b354b 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 6e344c1..e4e12d6 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 de66ded..e91cdfe 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 9fbdc16..579feee 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 1781c5a..a5d1773 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 0000000..9bd5612 --- /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 ff64994..743f0f9 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 0835373..618bcd7 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 a969b10..7df2bda 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 cc2a404..0df5df0 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 7c30f79..65c907e 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 aeb1b3f..cb4195b 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 7e07c7c..5c97758 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 1d4ea0a..1402b28 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 3c09c3c..077ba7d 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 6ddc31f..a7288bb 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 082d8bd..15d4db0 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 3b0887f..d67bdcb 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 83842af..2896968 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 01f82c1..d1aa101 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 78490c8..184c4ea 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 305629b..c41884e 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 453d80f..fb6182c 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 1288156..0c48715 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 1d94ea2..7603199 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 354c316..6791aaf 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 114b6ca..d8e50a0 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 0524552..066d532 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 cb15dc3..2deb0b1 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 572d55f..c2e2abc 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 4e85894..f492ac5 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 3c8998f..424ecab 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 cf1acc4..ecf2c6a 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 4918de7..19c9154 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 f123a3f2..acca867 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 3850f21..b688a1f 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 6af96dd..84bdb96 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 182b1c4..cc9295a 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 e3304a4..92a9096 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 0000000..0458752 --- /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 0000000..786315e --- /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 0000000..e1f92cd --- /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 0000000..fca2ef5 --- /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 2cc0936..bbdea7b 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 cedfcfd..464b287 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 56dc510..a15907c 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 87655bd..b2b354b 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 e02f360f..c4961ef 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 2875f935..add8e75 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 0000000..cb97546 --- /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 eeed09e..ee6462b 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 d1fbf6b..851ecf5 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 e74a6f8..98ccbe7 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 203977e..0b6916f 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 84a8e89..98992f6 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 0000000..b0ac078 --- /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 0000000..2b56a03 --- /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 0000000..31db448 --- /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 fb88213..1cd55d9 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 cd74a21..b99ec33 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 c119ab5..aa4b941 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 2351d88..231e281 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 829acb2..093be4e 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 452fccf..d4a7008 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 a1cf355..de66f79 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 a07f05c..ab57950 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 0000000..7cf2004 --- /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 0000000..486c8b2 --- /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 6fa6742..1421ec1 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 ') ) |