diff options
Diffstat (limited to 'clang/test/CodeGen/nonnull.c')
-rw-r--r-- | clang/test/CodeGen/nonnull.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/nonnull.c b/clang/test/CodeGen/nonnull.c index 4d6cc4568d8..e234105d9ad 100644 --- a/clang/test/CodeGen/nonnull.c +++ b/clang/test/CodeGen/nonnull.c @@ -21,3 +21,23 @@ int * bar3() __attribute__((returns_nonnull)) { return &a; } +// CHECK: define i32 @bar4(i32 %n, i32* nonnull %p) +int bar4(int n, int *p) __attribute__((nonnull)) { + return n + *p; +} + +// CHECK: define i32 @bar5(i32 %n, i32* nonnull %p) +int bar5(int n, int *p) __attribute__((nonnull(1, 2))) { + return n + *p; +} + +typedef union { + unsigned long long n; + int *p; + double d; +} TransparentUnion __attribute__((transparent_union)); + +// CHECK: define i32 @bar6(i64 % +int bar6(TransparentUnion tu) __attribute__((nonnull(1))) { + return *tu.p; +} |