diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 19:05:51 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 19:05:51 +0000 |
commit | cb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f (patch) | |
tree | d0baf2804035148aa4e177542089cf905801265c /clang/test/SemaObjC | |
parent | 415a7a6fec10d45de07c56ba693523d173028324 (diff) | |
download | bcm5719-llvm-cb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f.tar.gz bcm5719-llvm-cb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f.zip |
Issue warning for trivial cases of nonnull attributes
(on functions with no pointer arguments) but only when
the attribute has not been coming from a macro
instantiation in a header file. Fixes first part
of radar 6857843.
llvm-svn: 114860
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r-- | clang/test/SemaObjC/nonnull.h | 2 | ||||
-rw-r--r-- | clang/test/SemaObjC/nonnull.m | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/test/SemaObjC/nonnull.h b/clang/test/SemaObjC/nonnull.h new file mode 100644 index 00000000000..f5a038f5adf --- /dev/null +++ b/clang/test/SemaObjC/nonnull.h @@ -0,0 +1,2 @@ +// rdar: //6857843 +#define NONNULL_ATTR __attribute__((nonnull)) diff --git a/clang/test/SemaObjC/nonnull.m b/clang/test/SemaObjC/nonnull.m index 282fd21a140..cbafc37e8ec 100644 --- a/clang/test/SemaObjC/nonnull.m +++ b/clang/test/SemaObjC/nonnull.m @@ -1,8 +1,11 @@ +#include "nonnull.h" + // RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s @class NSObject; -int f1(int x) __attribute__((nonnull)); //no-warning +NONNULL_ATTR +int f1(int x); // no warning int f2(int *x) __attribute__ ((nonnull (1))); int f3(int *x) __attribute__ ((nonnull (0))); // expected-error {{'nonnull' attribute parameter 1 is out of bounds}} int f4(int *x, int *y) __attribute__ ((nonnull (1,2))); @@ -44,4 +47,4 @@ foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)()) func7((NSObject*) 0); // no-warning } -void func5(int) __attribute__((nonnull)); // no-warning +void func5(int) NONNULL_ATTR; // no warning |