[cfe-commits] r50580 - /cfe/trunk/test/Analysis-Apple/NoReturn.m
Ted Kremenek
kremenek at apple.com
Fri May 2 10:13:14 PDT 2008
Author: kremenek
Date: Fri May 2 12:13:14 2008
New Revision: 50580
URL: http://llvm.org/viewvc/llvm-project?rev=50580&view=rev
Log:
Static analysis test case for noreturn on exceptions.
Added:
cfe/trunk/test/Analysis-Apple/NoReturn.m
Added: cfe/trunk/test/Analysis-Apple/NoReturn.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis-Apple/NoReturn.m?rev=50580&view=auto
==============================================================================
--- cfe/trunk/test/Analysis-Apple/NoReturn.m (added)
+++ cfe/trunk/test/Analysis-Apple/NoReturn.m Fri May 2 12:13:14 2008
@@ -0,0 +1,36 @@
+// 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
+}
+
More information about the cfe-commits
mailing list