| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -verify %s |
| 3 |
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -ast-dump-all %s | FileCheck %s |
| 4 |
// expected-no-diagnostics |
| 5 |
|
| 6 |
#pragma clang module build bounds_safety |
| 7 |
module bounds_safety {} |
| 8 |
#pragma clang module contents |
| 9 |
#pragma clang module begin bounds_safety |
| 10 |
struct Test { |
| 11 |
int count; |
| 12 |
int fam[] __attribute__((counted_by(count))); |
| 13 |
}; |
| 14 |
#pragma clang module end |
| 15 |
#pragma clang module endbuild |
| 16 |
|
| 17 |
#pragma clang module import bounds_safety |
| 18 |
|
| 19 |
struct Test *p; |
| 20 |
|
| 21 |
// CHECK: |-RecordDecl {{.*}}bounds_safety.map:4:1, line:7:1> line:4:8 imported in bounds_safety <undeserialized declarations> struct Test definition |
| 22 |
// CHECK: | |-FieldDecl {{.*}} imported in bounds_safety referenced count 'int' |
| 23 |
// CHECK: | `-FieldDecl {{.*}} imported in bounds_safety fam 'int[] __counted_by(count)':'int[]' |
| 24 |
|
| 25 |
// CHECK: |-ImportDecl {{.*}}bounds-safety-attributed-type.c:17:22> col:22 implicit bounds_safety |
| 26 |
// CHECK: |-RecordDecl {{.*}} struct Test |
| 27 |
// CHECK: `-VarDecl {{.*}} p 'struct Test *' |