// REQUIRES: xcore-registered-target
// RUN: %clang_cc1 -no-opaque-pointers -triple xcore-unknown-unknown -fno-signed-char -fno-common -emit-llvm -o - %s | FileCheck %s
// CHECK: target triple = "xcore-unknown-unknown"
// In the tests below, some types are not supported by the ABI (_Complex,
// variable length arrays) and will thus emit no meta data.
// The 38 tests that do emit typestrings are gathered into '!xcore.typestrings'
// Please see 'Tools Development Guide' section 2.16.2 for format details:
// <https://www.xmos.com/download/public/Tools-Development-Guide%28X9114A%29.pdf>
// CHECK: !xcore.typestrings = !{
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}},
// CHECK: !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}
// CHECK-NOT: , !{{[0-9]+}}
// CHECK: }
// test BuiltinType
// CHECK: !{{[0-9]+}} = !{void (i1, i8, i8, i8, i16, i16, i16, i32, i32, i32,
// CHECK: i32, i32, i32, i64, i64, i64, float, double, double)*
// CHECK: @builtinType, !"f{0}(b,uc,uc,sc,ss,us,ss,si,ui,si,sl,
// CHECK: ul,sl,sll,ull,sll,ft,d,ld)"}
void
double _Complex Complex; // not supported
// test FunctionType & Qualifiers
// CHECK: !{{[0-9]+}} = !{void ()* @gI, !"f{0}()"}
// CHECK: !{{[0-9]+}} = !{void (...)* @eI, !"f{0}()"}
// CHECK: !{{[0-9]+}} = !{void ()* @gV, !"f{0}(0)"}
// CHECK: !{{[0-9]+}} = !{void ()* @eV, !"f{0}(0)"}
// CHECK: !{{[0-9]+}} = !{void (i32, ...)* @gVA, !"f{0}(si,va)"}
// CHECK: !{{[0-9]+}} = !{void (i32, ...)* @eVA, !"f{0}(si,va)"}
// CHECK: !{{[0-9]+}} = !{i32* (i32*)* @gQ, !"f{crv:p(cv:si)}(p(cv:si))"}
// CHECK: !{{[0-9]+}} = !{i32* (i32*)* @eQ, !"f{crv:p(cv:si)}(p(cv:si))"}
extern void ;
void ;
extern void ;
void
extern void ;
void
extern const volatile int* volatile restrict const
;
const volatile int* volatile restrict const
// test PointerType
// CHECK: !{{[0-9]+}} = !{i32* (i32*, i32* (i32*)*)*
// CHECK: @pointerType, !"f{p(si)}(p(si),p(f{p(si)}(p(si))))"}
// CHECK: !{{[0-9]+}} = !{i32** @EP, !"p(si)"}
// CHECK: !{{[0-9]+}} = !{i32** @GP, !"p(si)"}
extern int* EP;
int* GP;
int*
// test ArrayType
// CHECK: !{{[0-9]+}} = !{[2 x i32]* (i32*, i32*, [2 x i32]*, [2 x i32]*, i32*)*
// CHECK: @arrayType, !"f{p(a(2:si))}(p(si),p(cv:si),p(a(2:si)),
// CHECK: p(a(2:si)),p(si))"}
// CHECK: !{{[0-9]+}} = !{[0 x i32]* @EA1, !"a(*:cv:si)"}
// CHECK: !{{[0-9]+}} = !{[2 x i32]* @EA2, !"a(2:si)"}
// CHECK: !{{[0-9]+}} = !{[0 x [2 x i32]]* @EA3, !"a(*:a(2:si))"}
// CHECK: !{{[0-9]+}} = !{[3 x [2 x i32]]* @EA4, !"a(3:a(2:si))"}
// CHECK: !{{[0-9]+}} = !{[2 x i32]* @GA1, !"a(2:cv:si)"}
// CHECK: !{{[0-9]+}} = !{void ([2 x i32]*)* @arrayTypeVariable1,
// CHECK: !"f{0}(p(a(2:si)))"}
// CHECK: !{{[0-9]+}} = !{void (void ([2 x i32]*)*)* @arrayTypeVariable2,
// CHECK: !"f{0}(p(f{0}(p(a(2:si)))))"}
// CHECK: !{{[0-9]+}} = !{[3 x [2 x i32]]* @GA2, !"a(3:a(2:si))"}
extern int GA2;
extern const volatile int EA1;
extern int EA2;
extern int EA3;
extern int EA4;
const volatile int GA1;
extern void ;
extern void ;
extern void ; // not supported
extern void ; // not supported
typedef int RetType;
RetType*
// test StructureType
// CHECK: !{{[0-9]+}} = !{void (%struct.S1*)* @structureType1,
// CHECK: !"f{0}(s(S1){m(ps2){p(s(S2){m(ps3){p(s(S3){m(s1){s(S1){}}})}})}})"}
// CHECK: !{{[0-9]+}} = !{void (%struct.S2*)* @structureType2,
// CHECK: !"f{0}(s(S2){m(ps3){p(s(S3){m(s1){s(S1){m(ps2){p(s(S2){})}}}})}})"}
// CHECK: !{{[0-9]+}} = !{void (%struct.S3*)* @structureType3,
// CHECK: !"f{0}(s(S3){m(s1){s(S1){m(ps2){p(s(S2){m(ps3){p(s(S3){})}})}}}})"}
// CHECK: !{{[0-9]+}} = !{void (%struct.S4*)* @structureType4,
// CHECK: !"f{0}(s(S4){m(s1){s(S1){m(ps2){p(s(S2){m(ps3){p(s(S3){m(s1){s(S1){}}})}})}}}})"}
// CHECK: !{{[0-9]+}} = !{%struct.anon* @StructAnon, !"s(){m(A){si}}"}
// CHECK: !{{[0-9]+}} = !{i32 (%struct.SB*)* @structureTypeB,
// CHECK: !"f{si}(s(SB){m(){b(4:si)},m(){b(2:si)},m(N4){b(4:si)},
// CHECK: m(N2){b(2:si)},m(){b(4:ui)},m(){b(4:si)},m(){b(4:c:si)},
// CHECK: m(){b(4:c:si)},m(){b(4:cv:si)}})"}
;
;
;
;
;
;
void
void
void
void
StructAnon = ;
;
int
// test UnionType
// CHECK: !{{[0-9]+}} = !{void (%union.U1*)* @unionType1,
// CHECK: !"f{0}(u(U1){m(pu2){p(u(U2){m(pu3){p(u(U3){m(u1){u(U1){}}})}})}})"}
// CHECK: !{{[0-9]+}} = !{void (%union.U2*)* @unionType2,
// CHECK: !"f{0}(u(U2){m(pu3){p(u(U3){m(u1){u(U1){m(pu2){p(u(U2){})}}}})}})"}
// CHECK: !{{[0-9]+}} = !{void (%union.U3*)* @unionType3,
// CHECK: !"f{0}(u(U3){m(u1){u(U1){m(pu2){p(u(U2){m(pu3){p(u(U3){})}})}}}})"}
// CHECK: !{{[0-9]+}} = !{void (%union.U4*)* @unionType4,
// CHECK: !"f{0}(u(U4){m(u1){u(U1){m(pu2){p(u(U2){m(pu3){p(u(U3){m(u1){u(U1){}}})}})}}}})"}
// CHECK: !{{[0-9]+}} = !{%union.anon* @UnionAnon, !"u(){m(A){si}}"}
// CHECK: !{{[0-9]+}} = !{i32 (%union.UB*)* @unionTypeB,
// CHECK: !"f{si}(u(UB){m(N2){b(2:si)},m(N4){b(4:si)},m(){b(2:si)},
// CHECK: m(){b(4:c:si)},m(){b(4:c:si)},m(){b(4:cv:si)},m(){b(4:si)},
// CHECK: m(){b(4:si)},m(){b(4:ui)}})"}
;
;
;
;
;
;
void
void
void
void
;
UnionAnon = ;
int
// test EnumType
// CHECK: !{{[0-9]+}} = !{i32* @EnumAnon, !"e(){m(EA){3}}"}
// CHECK: !{{[0-9]+}} = !{i32 (i32)* @enumType,
// CHECK: !"f{si}(e(E){m(A){7},m(B){6},m(C){5},m(D){0}})"}
;
EnumAnon = EA;
int
// CHECK: !{{[0-9]+}} = !{i32 ()* @testReDecl, !"f{si}()"}
// CHECK: !{{[0-9]+}} = !{[10 x i32]* @After, !"a(10:si)"}
// CHECK: !{{[0-9]+}} = !{[10 x i32]* @Before, !"a(10:si)"}
extern int After;
extern int Before;
int
int After;
int Before;