[cfe-commits] r52359 - in /cfe/trunk/test: Analysis-Apple/NoReturn.m Analysis/NoReturn.m

Ted Kremenek kremenek at apple.com
Mon Jun 16 14:05:04 PDT 2008


Author: kremenek
Date: Mon Jun 16 16:05:04 2008
New Revision: 52359

URL: http://llvm.org/viewvc/llvm-project?rev=52359&view=rev
Log:
Moved test case NoReturn.m from Analysis-Apple to Analysis (now works on all platforms).

Added:
    cfe/trunk/test/Analysis/NoReturn.m
Removed:
    cfe/trunk/test/Analysis-Apple/NoReturn.m

Removed: cfe/trunk/test/Analysis-Apple/NoReturn.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis-Apple/NoReturn.m?rev=52358&view=auto

==============================================================================
--- cfe/trunk/test/Analysis-Apple/NoReturn.m (original)
+++ cfe/trunk/test/Analysis-Apple/NoReturn.m (removed)
@@ -1,36 +0,0 @@
-// RUN: clang -checker-simple -verify %s
-// RUN: clang -checker-cfref -verify %s
-
-
-#include <Foundation/NSException.h>
-#include <Foundation/NSString.h>
-
-int f1(int *x, NSString* s) {
-  
-  if (x) ++x;
-  
-  [NSException raise:@"Blah" format:[NSString stringWithFormat:@"Blah %@", s]];
-  
-  return *x; // no-warning
-}
-
-int f2(int *x, ...) {
-  
-  if (x) ++x;
-  va_list alist;
-  va_start(alist, x);
-  
-  [NSException raise:@"Blah" format:@"Blah %@" arguments:alist];
-  
-  return *x; // no-warning
-}
-
-int f3(int* x) {
-  
-  if (x) ++x;
-  
-  [[NSException exceptionWithName:@"My Exception" reason:@"Want to test exceptions." userInfo:nil] raise];
-
-  return *x; // no-warning
-}
-

Added: cfe/trunk/test/Analysis/NoReturn.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NoReturn.m?rev=52359&view=auto

==============================================================================
--- cfe/trunk/test/Analysis/NoReturn.m (added)
+++ cfe/trunk/test/Analysis/NoReturn.m Mon Jun 16 16:05:04 2008
@@ -0,0 +1,78 @@
+// RUN: clang -checker-simple -verify %s
+// RUN: clang -checker-cfref -verify %s
+
+#include <stdarg.h>
+
+//===----------------------------------------------------------------------===//
+// 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.
+//===----------------------------------------------------------------------===//
+
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+ at protocol NSObject  - (BOOL)isEqual:(id)object;
+ at end  @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone;
+ at end  @protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone; @end
+ at protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
+ at interface NSObject <NSObject> {} @end
+extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
+ at interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
+- (NSUInteger)length;
++ (id)stringWithFormat:(NSString *)format, ...;
+ at end
+ at interface NSSimpleCString : NSString {} @end
+ at interface NSConstantString : NSSimpleCString @end
+extern void *_NSConstantStringClassReference;
+typedef double NSTimeInterval;
+ at interface NSDate : NSObject <NSCopying, NSCoding>  - (NSTimeInterval)timeIntervalSinceReferenceDate; @end
+ at class NSString, NSDictionary, NSArray;
+ at interface NSException : NSObject <NSCopying, NSCoding> {}
++ (NSException *)exceptionWithName:(NSString *)name reason:(NSString *)reason userInfo:(NSDictionary *)userInfo;
+- (void)raise;
+ at end
+ at interface NSException (NSExceptionRaisingConveniences)
++ (void)raise:(NSString *)name format:(NSString *)format, ...;
++ (void)raise:(NSString *)name format:(NSString *)format arguments:(va_list)argList;
+ at end
+
+enum {NSPointerFunctionsStrongMemory = (0 << 0),     NSPointerFunctionsZeroingWeakMemory = (1 << 0),     NSPointerFunctionsOpaqueMemory = (2 << 0),     NSPointerFunctionsMallocMemory = (3 << 0),     NSPointerFunctionsMachVirtualMemory = (4 << 0),        NSPointerFunctionsObjectPersonality = (0 << 8),     NSPointerFunctionsOpaquePersonality = (1 << 8),     NSPointerFunctionsObjectPointerPersonality = (2 << 8),     NSPointerFunctionsCStringPersonality = (3 << 8),     NSPointerFunctionsStructPersonality = (4 << 8),     NSPointerFunctionsIntegerPersonality = (5 << 8),      NSPointerFunctionsCopyIn = (1 << 16), };
+
+//===----------------------------------------------------------------------===//
+// Test cases.
+//===----------------------------------------------------------------------===//
+
+int f1(int *x, NSString* s) {
+  
+  if (x) ++x;
+  
+  [NSException raise:@"Blah" format:[NSString stringWithFormat:@"Blah %@", s]];
+  
+  return *x; // no-warning
+}
+
+int f2(int *x, ...) {
+  
+  if (x) ++x;
+  va_list alist;
+  va_start(alist, x);
+  
+  [NSException raise:@"Blah" format:@"Blah %@" arguments:alist];
+  
+  return *x; // no-warning
+}
+
+int f3(int* x) {
+  
+  if (x) ++x;
+  
+  [[NSException exceptionWithName:@"My Exception" reason:@"Want to test exceptions." userInfo:0] raise];
+
+  return *x; // no-warning
+}
+





More information about the cfe-commits mailing list