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 | 5102a25bf876a8c0e85b9ed64296c47bf3069410 (patch) | |
tree | 28134ec01a8c24ca77ff4a435e7ab268ad724aa1 | |
parent | bb7386aff58112a8d64a67afc2c7187d5da185b3 (diff) | |
download | bcm5719-llvm-5102a25bf876a8c0e85b9ed64296c47bf3069410.tar.gz bcm5719-llvm-5102a25bf876a8c0e85b9ed64296c47bf3069410.zip |
Static analysis test case for noreturn on exceptions.
llvm-svn: 50580
-rw-r--r-- | clang/test/Analysis-Apple/NoReturn.m | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/clang/test/Analysis-Apple/NoReturn.m b/clang/test/Analysis-Apple/NoReturn.m new file mode 100644 index 00000000000..6d53003c3c1 --- /dev/null +++ b/clang/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 +} + |