| 1 |
/// Test determinisim when serializing anonymous decls. Create enough Decls in |
| 2 |
/// DeclContext that can overflow the small storage of SmallPtrSet to make sure |
| 3 |
/// the serialization does not rely on iteration order of SmallPtrSet. |
| 4 |
// RUN: rm -rf %t.dir |
| 5 |
// RUN: split-file %s %t.dir |
| 6 |
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \ |
| 7 |
// RUN: -fmodules-cache-path=%t.dir/cache -triple x86_64-apple-macosx10.11.0 \ |
| 8 |
// RUN: -I%t.dir/headers %t.dir/main.m -fdisable-module-hash -Wno-visibility |
| 9 |
// RUN: mv %t.dir/cache/A.pcm %t1.pcm |
| 10 |
/// Check the order of the decls first. If LLVM_ENABLE_REVERSE_ITERATION is on, |
| 11 |
/// it will fail the test early if the output is depending on the order of items |
| 12 |
/// in containers that has non-deterministic orders. |
| 13 |
// RUN: llvm-bcanalyzer --dump --disable-histogram %t1.pcm | FileCheck %s |
| 14 |
// RUN: rm -rf %t.dir/cache |
| 15 |
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps \ |
| 16 |
// RUN: -fmodules-cache-path=%t.dir/cache -triple x86_64-apple-macosx10.11.0 \ |
| 17 |
// RUN: -I%t.dir/headers %t.dir/main.m -fdisable-module-hash -Wno-visibility |
| 18 |
// RUN: mv %t.dir/cache/A.pcm %t2.pcm |
| 19 |
// RUN: diff %t1.pcm %t2.pcm |
| 20 |
|
| 21 |
/// Spot check entries to make sure they are in current ordering. |
| 22 |
/// op6 encodes the anonymous decl number which should be in order. |
| 23 |
|
| 24 |
/// NOTE: This test case is on determinism of TypeID for function declaration. |
| 25 |
/// Change related to TypeID (or PredefinedTypeIDs) will affect the result and |
| 26 |
/// will require update for this test case. Currently, TypeID is at op6 and the |
| 27 |
/// test checks the IDs are in strict ordering. |
| 28 |
|
| 29 |
// CHECK: <TYPE_FUNCTION_PROTO |
| 30 |
// CHECK-NEXT: <DECL_PARM_VAR |
| 31 |
// CHECK-SAME: op5=13 |
| 32 |
// CHECK-NEXT: <DECL_PARM_VAR |
| 33 |
// CHECK-SAME: op5=14 |
| 34 |
// CHECK-NEXT: <DECL_PARM_VAR |
| 35 |
// CHECK-SAME: op5=15 |
| 36 |
// CHECK-NEXT: <DECL_PARM_VAR |
| 37 |
// CHECK-SAME: op5=16 |
| 38 |
|
| 39 |
/// Decl records start at 43 |
| 40 |
// CHECK: <DECL_RECORD |
| 41 |
// CHECK-SAME: op5=54 |
| 42 |
// CHECK-NEXT: <DECL_RECORD |
| 43 |
// CHECK-SAME: op5=55 |
| 44 |
// CHECK-NEXT: <DECL_RECORD |
| 45 |
// CHECK-SAME: op5=56 |
| 46 |
// CHECK-NEXT: <DECL_RECORD |
| 47 |
// CHECK-SAME: op5=57 |
| 48 |
|
| 49 |
//--- headers/a.h |
| 50 |
void f(struct A0 *a0, |
| 51 |
struct A1 *a1, |
| 52 |
struct A2 *a2, |
| 53 |
struct A3 *a3, |
| 54 |
struct A4 *a4, |
| 55 |
struct A5 *a5, |
| 56 |
struct A6 *a6, |
| 57 |
struct A7 *a7, |
| 58 |
struct A8 *a8, |
| 59 |
struct A9 *a9, |
| 60 |
struct A10 *a10, |
| 61 |
struct A11 *a11, |
| 62 |
struct A12 *a12, |
| 63 |
struct A13 *a13, |
| 64 |
struct A14 *a14, |
| 65 |
struct A15 *a15, |
| 66 |
struct A16 *a16, |
| 67 |
struct A17 *a17, |
| 68 |
struct A18 *a18, |
| 69 |
struct A19 *a19, |
| 70 |
struct A20 *a20, |
| 71 |
struct A21 *a21, |
| 72 |
struct A22 *a22, |
| 73 |
struct A23 *a23, |
| 74 |
struct A24 *a24, |
| 75 |
struct A25 *a25, |
| 76 |
struct A26 *a26, |
| 77 |
struct A27 *a27, |
| 78 |
struct A28 *a28, |
| 79 |
struct A29 *a29, |
| 80 |
struct A30 *a30, |
| 81 |
struct A31 *a31, |
| 82 |
struct A32 *a32, |
| 83 |
struct A33 *a33, |
| 84 |
struct A34 *a34, |
| 85 |
struct A35 *a35, |
| 86 |
struct A36 *a36, |
| 87 |
struct A37 *a37, |
| 88 |
struct A38 *a38, |
| 89 |
struct A39 *a39, |
| 90 |
struct A40 *a40); |
| 91 |
|
| 92 |
|
| 93 |
//--- headers/module.modulemap |
| 94 |
|
| 95 |
module A { |
| 96 |
header "a.h" |
| 97 |
} |
| 98 |
|
| 99 |
//--- main.m |
| 100 |
|
| 101 |
#import <a.h> |
| 102 |
|