Hal Finkel | 82504f0 | 2014-07-11 17:35:21 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm < %s | FileCheck %s |
| 2 | |
| 3 | // CHECK: define void @foo(i32* nonnull %x) |
| 4 | void foo(int * __attribute__((nonnull)) x) { |
| 5 | *x = 0; |
| 6 | } |
| 7 | |
| 8 | // CHECK: define void @bar(i32* nonnull %x) |
| 9 | void bar(int * x) __attribute__((nonnull(1))) { |
| 10 | *x = 0; |
| 11 | } |
| 12 | |
| 13 | // CHECK: define void @bar2(i32* %x, i32* nonnull %y) |
| 14 | void bar2(int * x, int * y) __attribute__((nonnull(2))) { |
| 15 | *x = 0; |
| 16 | } |
| 17 | |
Hal Finkel | d8442b1 | 2014-07-12 04:51:04 +0000 | [diff] [blame^] | 18 | static int a; |
| 19 | // CHECK: define nonnull i32* @bar3() |
| 20 | int * bar3() __attribute__((returns_nonnull)) { |
| 21 | return &a; |
| 22 | } |
| 23 | |