diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-05-02 17:13:14 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-05-02 17:13:14 +0000 |
commit | fd3344db26c9c6d886db2bd7f87bcd04b97f9d97 (patch) | |
tree | 70dcf0a8e562513e7c1ae91fdea727b0d31ced2c | |
parent | 6ff6f8b5e048d16bc042d6175dfb501ad4f62526 (diff) |
Static analysis test case for noreturn on exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50580 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis-Apple/NoReturn.m | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Analysis-Apple/NoReturn.m b/test/Analysis-Apple/NoReturn.m new file mode 100644 index 0000000000..6d53003c3c --- /dev/null +++ b/test/Analysis-Apple/NoReturn.m @@ -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 +} + |