brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · db4ed33 Raw
103 lines · plain
1/// Test determinisim when serializing anonymous decls. Create enough Decls in2/// DeclContext that can overflow the small storage of SmallPtrSet to make sure3/// the serialization does not rely on iteration order of SmallPtrSet.4// RUN: rm -rf %t.dir5// RUN: split-file %s %t.dir6// 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-visibility9// RUN: mv %t.dir/cache/A.pcm %t1.pcm10/// 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 items12/// in containers that has non-deterministic orders.13// RUN: llvm-bcanalyzer --dump --disable-histogram %t1.pcm | FileCheck %s14// RUN: rm -rf %t.dir/cache15// 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-visibility18// RUN: mv %t.dir/cache/A.pcm %t2.pcm19// RUN: diff %t1.pcm %t2.pcm20 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 and26/// will require update for this test case. Currently, TypeID is at op6 and the27/// test checks the IDs are in strict ordering.28 29// CHECK: <TYPE_FUNCTION_PROTO30// CHECK-NEXT: <DECL_PARM_VAR31// CHECK-SAME: op5=1332// CHECK-NEXT: <DECL_PARM_VAR33// CHECK-SAME: op5=1434// CHECK-NEXT: <DECL_PARM_VAR35// CHECK-SAME: op5=1536// CHECK-NEXT: <DECL_PARM_VAR37// CHECK-SAME: op5=1638 39/// Decl records start at 4340// CHECK: <DECL_RECORD41// CHECK-SAME: op5=5442// CHECK-NEXT: <DECL_RECORD43// CHECK-SAME: op5=5544// CHECK-NEXT: <DECL_RECORD45// CHECK-SAME: op5=5646// CHECK-NEXT: <DECL_RECORD47// CHECK-SAME: op5=5748 49//--- headers/a.h50void 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.modulemap94 95module A {96  header "a.h"97}98 99//--- main.m100 101#import <a.h>102 103