diff --git a/lib/passes/typegen/dimeta/DimetaTypeGen.cpp b/lib/passes/typegen/dimeta/DimetaTypeGen.cpp index 31399e3e..0370640a 100644 --- a/lib/passes/typegen/dimeta/DimetaTypeGen.cpp +++ b/lib/passes/typegen/dimeta/DimetaTypeGen.cpp @@ -54,13 +54,25 @@ template std::pair, int> typeid_if_ptr(const Type& type) { using namespace dimeta; const auto& quals = type.qual; - int count{0}; - if (!quals.empty()) { - count = llvm::count_if(quals, [](auto& qual) { return qual == Qualifier::kPtr || qual == Qualifier::kRef; }); - if (count > 0) { - return {{TYPEART_POINTER}, count}; + const int count = + llvm::count_if(quals, [](auto& qual) { return qual == Qualifier::kPtr || qual == Qualifier::kRef; }); + + if constexpr (std::is_same_v) { + switch (type.type.encoding) { + case FundamentalType::Encoding::kVtablePtr: + return {TYPEART_VTABLE_POINTER, count}; + case FundamentalType::Encoding::kNullptr: + return {TYPEART_NULLPOINTER, count}; + case FundamentalType::Encoding::kVoid: + return {TYPEART_VOID, count}; + default: + break; } } + if (count > 0) { + return {{TYPEART_POINTER}, count}; + } + return {{}, count}; } @@ -220,6 +232,8 @@ std::optional get_builtin_typeid(const dimeta::QualifiedFu const auto encoding = type.type.encoding; switch (encoding) { + case FundamentalType::Encoding::kVtablePtr: + return TYPEART_VTABLE_POINTER; case FundamentalType::Encoding::kUnknown: return TYPEART_UNKNOWN_TYPE; case FundamentalType::Encoding::kVoid: diff --git a/lib/typelib/TypeDB.cpp b/lib/typelib/TypeDB.cpp index 96abef59..3d54d276 100644 --- a/lib/typelib/TypeDB.cpp +++ b/lib/typelib/TypeDB.cpp @@ -36,6 +36,7 @@ inline constexpr auto size_complex_long_double = sizeof(std::complex outlined should handle the internal struct.ident_t %s arg when following dataflow ; CHECK: @foo() ; CHECK: [[POINTER:%[0-9a-z]+]] = bitcast i32* %x to i8* -; CHECK: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 1) +; CHECK: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 1) %x = alloca i32, align 4 %0 = bitcast i32* %x to i8* %s = alloca %struct.ident_t, align 8 diff --git a/test/pass/malloc_free/01_simple_malloc_int.c b/test/pass/malloc_free/01_simple_malloc_int.c index 135b8db9..7e52a35b 100644 --- a/test/pass/malloc_free/01_simple_malloc_int.c +++ b/test/pass/malloc_free/01_simple_malloc_int.c @@ -12,4 +12,4 @@ void test() { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12, i64 42) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13, i64 42) diff --git a/test/pass/malloc_free/02_simple_malloc_free_int.c b/test/pass/malloc_free/02_simple_malloc_free_int.c index 402ea23b..80a58be1 100644 --- a/test/pass/malloc_free/02_simple_malloc_free_int.c +++ b/test/pass/malloc_free/02_simple_malloc_free_int.c @@ -13,7 +13,7 @@ void test() { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12 +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13 // CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]]) diff --git a/test/pass/malloc_free/03_simple_malloc_free_double.c b/test/pass/malloc_free/03_simple_malloc_free_double.c index 510edf6b..79ace56a 100644 --- a/test/pass/malloc_free/03_simple_malloc_free_double.c +++ b/test/pass/malloc_free/03_simple_malloc_free_double.c @@ -12,7 +12,7 @@ void test() { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23, i64 42) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24, i64 42) // CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]]) diff --git a/test/pass/malloc_free/04_simple_malloc_int_double.c b/test/pass/malloc_free/04_simple_malloc_int_double.c index 842489c5..b1326a8a 100644 --- a/test/pass/malloc_free/04_simple_malloc_int_double.c +++ b/test/pass/malloc_free/04_simple_malloc_int_double.c @@ -15,4 +15,4 @@ void test() { // CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23 +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24 diff --git a/test/pass/malloc_free/06_simple_malloc_void_type.c b/test/pass/malloc_free/06_simple_malloc_void_type.c index eae0511f..b32686d2 100644 --- a/test/pass/malloc_free/06_simple_malloc_void_type.c +++ b/test/pass/malloc_free/06_simple_malloc_void_type.c @@ -8,7 +8,7 @@ void test() { } // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 168) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 168) // PASS-OUT: TypeArtPass [Heap] // PASS-OUT-NEXT: Malloc{{[ ]*}}:{{[ ]*}}1 diff --git a/test/pass/malloc_free/08_simple_malloc_struct_void.c b/test/pass/malloc_free/08_simple_malloc_struct_void.c index 5d101035..f2661211 100644 --- a/test/pass/malloc_free/08_simple_malloc_struct_void.c +++ b/test/pass/malloc_free/08_simple_malloc_struct_void.c @@ -14,7 +14,7 @@ void test() { } // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{2|10}}, i64 16) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{3|11}}, i64 16) // CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]]) diff --git a/test/pass/malloc_free/09_malloc_with_disjunct_free.c b/test/pass/malloc_free/09_malloc_with_disjunct_free.c index e66baede..b4a55d9b 100644 --- a/test/pass/malloc_free/09_malloc_with_disjunct_free.c +++ b/test/pass/malloc_free/09_malloc_with_disjunct_free.c @@ -20,7 +20,7 @@ void foo(double* ptr) { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23 +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24 // CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]]) diff --git a/test/pass/malloc_free/11_calloc_realloc.c b/test/pass/malloc_free/11_calloc_realloc.c index 1b4e92f8..25e3d4d3 100644 --- a/test/pass/malloc_free/11_calloc_realloc.c +++ b/test/pass/malloc_free/11_calloc_realloc.c @@ -20,10 +20,10 @@ int main() { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE:[0-9]+]], i64{{( noundef)?}} 8) -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23, i64 [[SIZE]]) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24, i64 [[SIZE]]) // REALLOC: __typeart_free({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]]) // REALLOC-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} {{i8\*|ptr}} @realloc({{i8\*|ptr}}{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160) -// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 23, i64 20) +// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 24, i64 20) // clang-format on diff --git a/test/pass/malloc_free/12_malloc_memcpy.c b/test/pass/malloc_free/12_malloc_memcpy.c index bca21419..641b4343 100644 --- a/test/pass/malloc_free/12_malloc_memcpy.c +++ b/test/pass/malloc_free/12_malloc_memcpy.c @@ -18,7 +18,7 @@ typedef struct { // clang-format off // CHECK-OPT: tail call void @free // CHECK-OPT-NEXT: call void @__typeart_free -// CHECK-OPT: call void @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 {{(10|12)}}, +// CHECK-OPT: call void @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 {{(11|13)}}, // CHECK-OPT: call void @llvm.memcpy.p0{{(i8)?}}.p0{{(i8)?}}.i64({{i8\*|ptr}} {{(align[[:space:]]?(4|16)[[:space:]])?}}%{{[0-9a-z]+}}, // clang-format on void setVartypes(struct_grid* pgrid, int nvars, int* vartypes /* = i32 ptr */) { diff --git a/test/pass/malloc_free/13_calloc_void_type.c b/test/pass/malloc_free/13_calloc_void_type.c index 9afa1601..35018047 100644 --- a/test/pass/malloc_free/13_calloc_void_type.c +++ b/test/pass/malloc_free/13_calloc_void_type.c @@ -12,9 +12,9 @@ void foo(int n) { // clang-format off // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE:[0-9a-z]+]], i64{{( noundef)?}} 8) -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 80) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 80) // CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE2:%[0-9a-z]+]], i64{{( noundef)?}} 8) -// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(10|2)}}, i64 [[SIZE2]]) +// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(11|3)}}, i64 [[SIZE2]]) // clang-format on diff --git a/test/pass/malloc_free/14_aligned_alloc.c b/test/pass/malloc_free/14_aligned_alloc.c index 5bbf3085..333336bd 100644 --- a/test/pass/malloc_free/14_aligned_alloc.c +++ b/test/pass/malloc_free/14_aligned_alloc.c @@ -11,9 +11,9 @@ void foo(int n) { // clang-format off // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 64, i64{{( noundef)?}} 20) -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12, i64 5) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13, i64 5) // CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 128, i64{{( noundef)?}} [[SIZE:%[0-9a-z]+]]) -// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 12, i64 [[SIZE]]) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 12, i64 %{{[0-9a-z]+}}) +// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 13, i64 [[SIZE]]) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 13, i64 %{{[0-9a-z]+}}) // clang-format on diff --git a/test/pass/malloc_free/15_aligned_alloc_void_type.c b/test/pass/malloc_free/15_aligned_alloc_void_type.c index dcc8d137..dca85da5 100644 --- a/test/pass/malloc_free/15_aligned_alloc_void_type.c +++ b/test/pass/malloc_free/15_aligned_alloc_void_type.c @@ -11,8 +11,8 @@ void foo(int n) { // clang-format off // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 64, i64{{( noundef)?}} 20) -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 20) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 20) // CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 128, i64{{( noundef)?}} [[SIZE:%[0-9a-z]+]]) -// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(10|2)}}, i64 [[SIZE]]) +// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(11|3)}}, i64 [[SIZE]]) // clang-format on diff --git a/test/pass/malloc_free/16_omp_heap.c b/test/pass/malloc_free/16_omp_heap.c index eabf8fb5..13757a04 100644 --- a/test/pass/malloc_free/16_omp_heap.c +++ b/test/pass/malloc_free/16_omp_heap.c @@ -27,15 +27,15 @@ void foo(int** x) { // CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0 // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} i8* @calloc(i64{{( noundef)?}} [[SIZE:[0-9a-z]+]], i64{{( noundef)?}} 8) -// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 23, i64 [[SIZE]]) +// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 24, i64 [[SIZE]]) // CHECK-NEXT: bitcast i8* [[POINTER]] to double* // CHECK: __typeart_free_omp(i8* [[POINTER:%[0-9a-z]+]]) // CHECK-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} i8* @realloc(i8*{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160) -// CHECK-NEXT: __typeart_alloc_omp(i8* [[POINTER2]], i32 23, i64 20) +// CHECK-NEXT: __typeart_alloc_omp(i8* [[POINTER2]], i32 24, i64 20) // CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} i8* @malloc -// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 12, i64 8) +// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 13, i64 8) // CHECK-NEXT: bitcast i8* [[POINTER]] to i32* // CHECK: call void @free diff --git a/test/pass/malloc_free/17_realloc_void.c b/test/pass/malloc_free/17_realloc_void.c index f48494e6..624bca2c 100644 --- a/test/pass/malloc_free/17_realloc_void.c +++ b/test/pass/malloc_free/17_realloc_void.c @@ -12,6 +12,6 @@ void foo() { // REALLOC: __typeart_free({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]]) // REALLOC-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} {{i8\*|ptr}} @realloc({{i8\*|ptr}}{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160) -// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{2|10}}, i64 160) +// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{3|11}}, i64 160) // clang-format on diff --git a/test/pass/new_delete/01_inv_simple_new_int.cpp b/test/pass/new_delete/01_inv_simple_new_int.cpp index 5df7a952..e2cd9833 100644 --- a/test/pass/new_delete/01_inv_simple_new_int.cpp +++ b/test/pass/new_delete/01_inv_simple_new_int.cpp @@ -9,7 +9,7 @@ #include // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znwm(i64{{( noundef)?}} 4) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 12, i64 1) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 13, i64 1) int main() { try { auto s = new int; diff --git a/test/pass/new_delete/02_inv_simple_int_array.cpp b/test/pass/new_delete/02_inv_simple_int_array.cpp index bc175e32..f2893a38 100644 --- a/test/pass/new_delete/02_inv_simple_int_array.cpp +++ b/test/pass/new_delete/02_inv_simple_int_array.cpp @@ -9,7 +9,7 @@ #include // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 8) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 12, i64 2) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 13, i64 2) int main() { try { auto s = new int[2]; diff --git a/test/pass/new_delete/08_inv_double_array_delete.cpp b/test/pass/new_delete/08_inv_double_array_delete.cpp index 2d71467a..3de48a4b 100644 --- a/test/pass/new_delete/08_inv_double_array_delete.cpp +++ b/test/pass/new_delete/08_inv_double_array_delete.cpp @@ -9,7 +9,7 @@ #include // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 16) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 23, i64 2) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 24, i64 2) // CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} {{.*}}[[POINTER2]]) int main() { @@ -23,7 +23,7 @@ int main() { } // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 16) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 23, i64 2) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 24, i64 2) // CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} {{.*}}[[POINTER2]]) void foo() { diff --git a/test/pass/stack/01_stack_lifetime.c b/test/pass/stack/01_stack_lifetime.c index f022aa9b..ff0fc833 100644 --- a/test/pass/stack/01_stack_lifetime.c +++ b/test/pass/stack/01_stack_lifetime.c @@ -18,7 +18,7 @@ void correct(int rank) { // CHECK: [[POINTER:%[0-9a-z]+]] = bitcast [3 x [3 x i32]]* [[BUF:%[0-9a-z]+]] to i8* // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 36, i8* [[POINTER]]) -// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 9) +// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 9) // CHECK: call void @llvm.lifetime.start.p0i8(i64 12, i8* [[POINTER2:%[0-9a-z]+]]) -// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 12, i64 3) +// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 13, i64 3) diff --git a/test/runtime/19_softcounter.c b/test/runtime/19_softcounter.c index 66b209e5..4d744a9e 100644 --- a/test/runtime/19_softcounter.c +++ b/test/runtime/19_softcounter.c @@ -33,7 +33,7 @@ int main(void) { // CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Allocation type detail (heap, stack, global) -// CHECK-NEXT: 23 : 5 , 0 , 0 , double +// CHECK-NEXT: 24 : 5 , 0 , 0 , double // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) -// CHECK-NEXT: 23 : 5 , 0 , double \ No newline at end of file +// CHECK-NEXT: 24 : 5 , 0 , double \ No newline at end of file diff --git a/test/runtime/20_softcounter_max.c b/test/runtime/20_softcounter_max.c index 63b645ca..0edad9c6 100644 --- a/test/runtime/20_softcounter_max.c +++ b/test/runtime/20_softcounter_max.c @@ -33,7 +33,7 @@ int main(void) { // CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Allocation type detail (heap, stack, global) -// CHECK-NEXT: 23 : 6 , 0 , 0 , double +// CHECK-NEXT: 24 : 6 , 0 , 0 , double // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) -// CHECK-NEXT: 23 : 0 , 0 , double \ No newline at end of file +// CHECK-NEXT: 24 : 0 , 0 , double \ No newline at end of file diff --git a/test/runtime/21_runtime_manual.cpp b/test/runtime/21_runtime_manual.cpp index 0d5f5209..5b81bb9a 100644 --- a/test/runtime/21_runtime_manual.cpp +++ b/test/runtime/21_runtime_manual.cpp @@ -28,8 +28,8 @@ std::vector sorted_v(const std::unordered_set& set) { } void test_heap(softcounter::AccessRecorder& recorder) { - recorder.incHeapAlloc(10, 1); - recorder.incHeapAlloc(10, 1); + recorder.incHeapAlloc(11, 1); + recorder.incHeapAlloc(11, 1); // CHECK: 2 o_(getCurHeapAllocs()); @@ -39,7 +39,7 @@ void test_heap(softcounter::AccessRecorder& recorder) { auto hallocs = sorted_v(recorder.getHeapAlloc()); // CHECK: 1 std::cerr << hallocs.size() << '\n'; - // CHECK: 10 2 + // CHECK: 11 2 for (const auto& [id, count] : hallocs) { std::cerr << id << " " << count << '\n'; } @@ -123,7 +123,7 @@ void test_global(softcounter::AccessRecorder& recorder) { const auto& alloc = recorder.getGlobalAlloc(); // CHECK: 1 std::cerr << alloc.size() << '\n'; - // CHECK: 23 1 + // CHECK: 24 1 for (const auto& [id, count] : alloc) { std::cerr << id << " " << count << '\n'; } diff --git a/test/runtime/22_threads_stack.cpp b/test/runtime/22_threads_stack.cpp index 35563f6d..f42c522e 100644 --- a/test/runtime/22_threads_stack.cpp +++ b/test/runtime/22_threads_stack.cpp @@ -28,11 +28,11 @@ int main(int argc, char** argv) { // CHECK-NOT: Error - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 7 - // CHECK: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 7 + // CHECK: [Trace] Free 0x{{.*}} 24 double 8 1 - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 7 - // CHECK: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 7 + // CHECK: [Trace] Free 0x{{.*}} 24 double 8 1 return 0; } diff --git a/test/runtime/23_threads_heap.cpp b/test/runtime/23_threads_heap.cpp index 07e56e70..2fd615b3 100644 --- a/test/runtime/23_threads_heap.cpp +++ b/test/runtime/23_threads_heap.cpp @@ -32,9 +32,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } diff --git a/test/runtime/24_threads_type_check.cpp b/test/runtime/24_threads_type_check.cpp index aec7efca..f49b3d14 100644 --- a/test/runtime/24_threads_type_check.cpp +++ b/test/runtime/24_threads_type_check.cpp @@ -58,9 +58,9 @@ int main(int argc, char** argv) { // CHECK-TSAN-NOT: ThreadSanitizer // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } diff --git a/test/runtime/25_omp_stack.c b/test/runtime/25_omp_stack.c index f296af5f..c352a4b2 100644 --- a/test/runtime/25_omp_stack.c +++ b/test/runtime/25_omp_stack.c @@ -23,11 +23,11 @@ int main(int argc, char** argv) { // CHECK-NOT: Error - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 4 - // CHECK-DAG: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 4 + // CHECK-DAG: [Trace] Free 0x{{.*}} 24 double 8 1 - // CHECK-DAG: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 4 - // CHECK-DAG: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK-DAG: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 4 + // CHECK-DAG: [Trace] Free 0x{{.*}} 24 double 8 1 return 0; } diff --git a/test/runtime/26_omp_heap.c b/test/runtime/26_omp_heap.c index 2005c6df..706085f0 100644 --- a/test/runtime/26_omp_heap.c +++ b/test/runtime/26_omp_heap.c @@ -31,9 +31,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } \ No newline at end of file diff --git a/test/runtime/27_omp_softcounter.c b/test/runtime/27_omp_softcounter.c index d45548e1..7497df72 100644 --- a/test/runtime/27_omp_softcounter.c +++ b/test/runtime/27_omp_softcounter.c @@ -58,7 +58,7 @@ int main(int argc, char** argv) { // CHECK-NEXT: Allocation type detail (heap, stack, global) // CHECK: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) - // CHECK-NEXT: 23 : 200 , 0 , double + // CHECK-NEXT: 24 : 200 , 0 , double // CHECK: Per-thread counter values (2 threads) // CHECK-NEXT: Thread Heap Allocs : 100 , 100 // CHECK-NEXT: Thread Heap Arrays : 100 , 100 diff --git a/test/runtime/28_omp_softcounter_stack.c b/test/runtime/28_omp_softcounter_stack.c index 3d7b91ac..b5e2b9f5 100644 --- a/test/runtime/28_omp_softcounter_stack.c +++ b/test/runtime/28_omp_softcounter_stack.c @@ -55,8 +55,8 @@ int main(int argc, char** argv) { // CHECK-NEXT: Allocation type detail (heap, stack, global) // CHECK: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) - // CHECK: 22 : 0 , 200 , float - // CHECK: 23 : 0 , 200 , double + // CHECK: 23 : 0 , 200 , float + // CHECK: 24 : 0 , 200 , double // CHECK: Per-thread counter values (2 threads) // CHECK-NEXT: Thread Heap Allocs : 0 , 0 // CHECK-NEXT: Thread Heap Arrays : 0 , 0 diff --git a/test/runtime/30_omp_concurrent_w.cpp b/test/runtime/30_omp_concurrent_w.cpp index 314fa4fc..80690450 100644 --- a/test/runtime/30_omp_concurrent_w.cpp +++ b/test/runtime/30_omp_concurrent_w.cpp @@ -67,9 +67,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) -// CHECK: 23 : 300 , 0 , 0 , double +// CHECK: 24 : 300 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) -// CHECK: 23 : 300 , 0 , double +// CHECK: 24 : 300 , 0 , double return 0; } diff --git a/test/runtime/31_omp_overwrite.cpp b/test/runtime/31_omp_overwrite.cpp index 3c1ae505..84735101 100644 --- a/test/runtime/31_omp_overwrite.cpp +++ b/test/runtime/31_omp_overwrite.cpp @@ -53,6 +53,6 @@ int main(int argc, char** argv) { // CHECK: Addresses re-used : 200 // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 300 , 0 , 0 , double + // CHECK: 24 : 300 , 0 , 0 , double return 0; } diff --git a/test/runtime/32_addresses.c b/test/runtime/32_addresses.c index f4526162..680707e9 100644 --- a/test/runtime/32_addresses.c +++ b/test/runtime/32_addresses.c @@ -14,7 +14,7 @@ int main(int argc, char** argv) { } // TODO disable Trace logs for early return? -// CHECK: [Error]{{.*}}:Nullptr allocation 0x0 23 {{.*}} 8 1 -// CHECK: [Warning]{{.*}}:Zero-size allocation 0x1 22 {{.*}} 4 0 -// CHECK: [Error]{{.*}}:Zero-size and nullptr allocation 0x0 23 {{.*}} 8 0 -// CHECK: [Trace] Alloc 0x2 24 {{.*}} 16 1 \ No newline at end of file +// CHECK: [Error]{{.*}}:Nullptr allocation 0x0 23 {{.*}} {{.*}} 1 +// CHECK: [Warning]{{.*}}:Zero-size allocation 0x1 22 {{.*}} {{.*}} 0 +// CHECK: [Error]{{.*}}:Zero-size and nullptr allocation 0x0 23 {{.*}} {{.*}} 0 +// CHECK: [Trace] Alloc 0x2 24 {{.*}} {{.*}} 1 \ No newline at end of file diff --git a/test/runtime/34_off_by_n.cpp b/test/runtime/34_off_by_n.cpp index 4a3413f8..6b6f2862 100644 --- a/test/runtime/34_off_by_n.cpp +++ b/test/runtime/34_off_by_n.cpp @@ -42,10 +42,10 @@ int main(int argc, char** argv) { // CHECK-NOT: [Error] check(&d[0]); check(&d[1]); - // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 23 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 1 + // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 24 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 1 // CHECK: [Check]: Status: 1 check(&d[2]); // one off - // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 23 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 4 + // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 24 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 4 // CHECK: [Check]: Status: 1 check(&d[5]); // four off diff --git a/test/runtime/35_free_inexistant.cpp b/test/runtime/35_free_inexistant.cpp index b667ab6e..b5e3fc5a 100644 --- a/test/runtime/35_free_inexistant.cpp +++ b/test/runtime/35_free_inexistant.cpp @@ -40,13 +40,13 @@ int main(int argc, char** argv) { // CHECK: [Error]{{.*}}Free on unregistered address __typeart_free(reinterpret_cast(d)); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_alloc(reinterpret_cast(&d[0]), type, extent); // CHECK-NOT: [Error] // CHECK-NOT: [Check] check(&d[0]); - // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_free(reinterpret_cast(d)); // CHECK: [Error]{{.*}}Free on unregistered address __typeart_free(reinterpret_cast(d)); diff --git a/test/runtime/36_stack_dealloc.cpp b/test/runtime/36_stack_dealloc.cpp index eeb1cadc..29a87d73 100644 --- a/test/runtime/36_stack_dealloc.cpp +++ b/test/runtime/36_stack_dealloc.cpp @@ -18,20 +18,20 @@ int main(int argc, char** argv) { // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 12. size: 0 __typeart_leave_scope(12); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_alloc_stack(reinterpret_cast(&d[0]), type, extent); // CHECK: [Trace] Freeing stack (1) 1 - // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 24 double 8 6 // CHECK: [Trace] Stack after free: 0 __typeart_leave_scope(1); // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 1. size: 0 __typeart_leave_scope(1); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 1 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 1 __typeart_alloc_stack(reinterpret_cast(&d[0]), type, 1); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 1 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 1 __typeart_alloc_stack(reinterpret_cast(&d[1]), type, 1); // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 3. size: 2 // CHECK: [Trace] Freeing stack (2) 2 diff --git a/test/runtime/38_resolve_struct.c b/test/runtime/38_resolve_struct.c index 0554bf9e..1c3a5cf9 100644 --- a/test/runtime/38_resolve_struct.c +++ b/test/runtime/38_resolve_struct.c @@ -57,14 +57,14 @@ int main(int argc, char** argv) { struct Datastruct data; __typeart_alloc((const void*)&data, 259, 1); - // CHECK: Status OK: 23 1 + // CHECK: Status OK: 24 1 type_check((const void*)&data.middle); struct Datastruct data_2[3]; // CHECK: [Trace] Alloc [[POINTER:0x[0-9a-f]+]] 259 __typeart_alloc((const void*)&data_2[0], 259, 3); - // CHECK: Status OK: 22 2 + // CHECK: Status OK: 23 2 type_check((const void*)&data_2[2].end); // CHECK: Status OK: 259 1 16 [[POINTER]] type_check_containing((const void*)&data_2[2].end); diff --git a/test/runtime/50_global_skip.cpp b/test/runtime/50_global_skip.cpp index 58bf4d20..0387726a 100644 --- a/test/runtime/50_global_skip.cpp +++ b/test/runtime/50_global_skip.cpp @@ -18,11 +18,11 @@ int main(int argc, char** argv) { } // CHECK: Allocation type detail (heap, stack, global) -// CHECK: {{(10|5)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} -// CHECK: 12 : 0 , {{[0-9]}} , 1 , int -// CHECK: 23 : 0 , {{[0-9]}} , 1 , double +// CHECK: {{(11|6)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} +// CHECK: 13 : 0 , {{[0-9]}} , 1 , int +// CHECK: 24 : 0 , {{[0-9]}} , 1 , double // CHECK-SKIP: Allocation type detail (heap, stack, global) -// CHECK-SKIP: {{(10|5)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} -// CHECK-SKIP: 12 : 0 , {{[0-9]}} , 0 , int -// CHECK-SKIP: 23 : 0 , {{[0-9]}} , 0 , double +// CHECK-SKIP: {{(11|6)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} +// CHECK-SKIP: 13 : 0 , {{[0-9]}} , 0 , int +// CHECK-SKIP: 24 : 0 , {{[0-9]}} , 0 , double diff --git a/test/runtime/51_stack_lifetime.c b/test/runtime/51_stack_lifetime.c index 5dfe989f..ead1a64e 100644 --- a/test/runtime/51_stack_lifetime.c +++ b/test/runtime/51_stack_lifetime.c @@ -18,18 +18,18 @@ void type_check(const void* addr) { void correct(int rank) { if (rank == 1) { - // CHECK: Status OK: 12 9 - // CHECK: Status OK: 12 8 - // CHECK: Status OK: 12 7 - // CHECK: Status OK: 12 1 + // CHECK: Status OK: 13 9 + // CHECK: Status OK: 13 8 + // CHECK: Status OK: 13 7 + // CHECK: Status OK: 13 1 int buffer[3][3] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; type_check(buffer); type_check(&buffer[0][1]); type_check(&buffer[0][2]); type_check(&buffer[2][2]); } else { - // CHECK: Status OK: 12 3 - // CHECK: Status OK: 12 1 + // CHECK: Status OK: 13 3 + // CHECK: Status OK: 13 1 int rcv[3] = {0, 1, 2}; type_check(rcv); type_check(&rcv[2]); diff --git a/test/runtime/53_get_type.c b/test/runtime/53_get_type.c index f574dcee..269d8b0a 100644 --- a/test/runtime/53_get_type.c +++ b/test/runtime/53_get_type.c @@ -112,7 +112,7 @@ void type_check_sub(const void* addr, size_t offset) { void test_get_type() { DataStruct data[5]; - // CHECK: Status OK: type_id=22 count=2 + // CHECK: Status OK: type_id=23 count=2 type_check(&data[1].c[0]); } @@ -124,7 +124,7 @@ void test_get_containing() { void test_get_subtype() { DataStruct data[5]; - // CHECK: type_id=22 count=1 offset=0 + // CHECK: type_id=23 count=1 offset=0 type_check_sub(&data[1], offsetof(DataStruct, c[1])); } diff --git a/test/script/03_wrapper_cxx.cpp b/test/script/03_wrapper_cxx.cpp index 7dfe6400..b3afb147 100644 --- a/test/script/03_wrapper_cxx.cpp +++ b/test/script/03_wrapper_cxx.cpp @@ -14,4 +14,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/04_wrapper_cc.c b/test/script/04_wrapper_cc.c index 02cfe64a..82661013 100644 --- a/test/script/04_wrapper_cc.c +++ b/test/script/04_wrapper_cc.c @@ -14,4 +14,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/05_wrapper_mpicxx.cpp b/test/script/05_wrapper_mpicxx.cpp index cfac46c5..43dea2e7 100644 --- a/test/script/05_wrapper_mpicxx.cpp +++ b/test/script/05_wrapper_mpicxx.cpp @@ -21,4 +21,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/06_wrapper_mpicc.c b/test/script/06_wrapper_mpicc.c index 3b1cb5dc..31056714 100644 --- a/test/script/06_wrapper_mpicc.c +++ b/test/script/06_wrapper_mpicc.c @@ -21,4 +21,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/11_wrapper_emit_ir.c b/test/script/11_wrapper_emit_ir.c index 49c8f554..90007759 100644 --- a/test/script/11_wrapper_emit_ir.c +++ b/test/script/11_wrapper_emit_ir.c @@ -13,6 +13,6 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 // ir-out: source_filename = "{{.*}}11_wrapper_emit_ir.c" diff --git a/test/typemapping/01_simple_struct.c b/test/typemapping/01_simple_struct.c index 8946bcb7..e1c974b5 100644 --- a/test/typemapping/01_simple_struct.c +++ b/test/typemapping/01_simple_struct.c @@ -23,7 +23,7 @@ typedef struct s3_t { long b[2]; // 16 char c; // 32 unsigned int d[3]; // 36 - char e[5]; // 48 + char e[6]; // 48 unsigned long f; // 56 } s3; @@ -51,7 +51,7 @@ int main(int argc, char** argv) { // CHECK: extent: 4 // CHECK: member_count: 1 // CHECK: offsets: [ 0 ] -// CHECK: types: [ 12 ] +// CHECK: types: [ 13 ] // CHECK: sizes: [ 1 ] // CHECK: - id: 257 @@ -59,7 +59,7 @@ int main(int argc, char** argv) { // CHECK: extent: 16 // CHECK: member_count: 3 // CHECK: offsets: [ 0, 4, 8 ] -// CHECK: types: [ 12, {{(10|5)}}, 13 ] +// CHECK: types: [ 13, {{(11|6)}}, 14 ] // CHECK: sizes: [ 1, 1, 1 ] // CHECK: - id: 258 @@ -67,13 +67,13 @@ int main(int argc, char** argv) { // CHECK: extent: 64 // CHECK: member_count: 6 // CHECK: offsets: [ 0, 16, 32, 36, 48, 56 ] -// CHECK: types: [ 12, 13, {{(10|5)}}, {{(12|17)}}, {{(10|5)}}, {{(13|18)}} ] -// CHECK: sizes: [ 3, 2, 1, 3, 5, 1 ] +// CHECK: types: [ 13, 14, {{(11|6)}}, {{(13|18)}}, {{(11|6)}}, {{(14|19)}} ] +// CHECK: sizes: [ 3, 2, 1, 3, 6, 1 ] // CHECK: - id: 259 // CHECK: name: {{(struct.)?}}s4_t // CHECK: extent: 64 // CHECK: member_count: 4 // CHECK: offsets: [ 0, 8, 32, 56 ] -// CHECK: types: [ 12, 23, 23, 1 ] +// CHECK: types: [ 13, 24, 24, 1 ] // CHECK: sizes: [ 1, 3, 3, 1 ] diff --git a/test/typemapping/02_recursive_struct.c b/test/typemapping/02_recursive_struct.c index f95d9db3..7bc6c430 100644 --- a/test/typemapping/02_recursive_struct.c +++ b/test/typemapping/02_recursive_struct.c @@ -38,7 +38,7 @@ int main(int argc, char** argv) { // CHECK: extent: 16 // CHECK: member_count: 2 // CHECK: offsets: [ 0, 8 ] -// CHECK: types: [ {{(10|5)}}, 1 ] +// CHECK: types: [ {{(11|6)}}, 1 ] // CHECK: sizes: [ 3, 1 ] // CHECK: - id: 257 @@ -54,5 +54,5 @@ int main(int argc, char** argv) { // CHECK: extent: 64 // CHECK: member_count: 3 // CHECK: offsets: [ 0, 32, 40 ] -// CHECK: types: [ 256, {{(10|5)}}, 1 ] +// CHECK: types: [ 256, {{(11|6)}}, 1 ] // CHECK: sizes: [ 2, 1, 3 ] diff --git a/test/typemapping/04_milc_mock.c b/test/typemapping/04_milc_mock.c index f7a5f993..9c1c1f46 100644 --- a/test/typemapping/04_milc_mock.c +++ b/test/typemapping/04_milc_mock.c @@ -21,5 +21,5 @@ void foo() { // CHECK-NEXT: extent: 8 // CHECK-NEXT: member_count: 2 // CHECK-NEXT: offsets: [ 0, 4 ] -// CHECK-NEXT: types: [ 22, 22 ] +// CHECK-NEXT: types: [ 23, 23 ] // CHECK-NEXT: sizes: [ 1, 1 ] \ No newline at end of file diff --git a/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp b/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp index 71e0d619..f0675dc0 100644 --- a/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp +++ b/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp @@ -25,7 +25,7 @@ void foo() { // CHECK-NEXT: extent: 32 // CHECK-NEXT: member_count: 4 // CHECK-NEXT: offsets: [ 0, 8, 16, 24 ] -// CHECK-NEXT: types: [ 25{{[6-9]}}, 25{{[6-9]}}, 23, 1 ] +// CHECK-NEXT: types: [ 25{{[6-9]}}, 25{{[6-9]}}, 24, 1 ] // CHECK-NEXT: sizes: [ 1, 1, 1, 1 ] // CHECK-NEXT: flags: 1 diff --git a/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp b/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp index eedfc729..f023b57d 100644 --- a/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp +++ b/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp @@ -25,5 +25,5 @@ void foo() { // CHECK-NEXT: extent: 16 // CHECK-NEXT: member_count: 2 // CHECK-NEXT: offsets: [ 0, 8 ] -// CHECK-NEXT: types: [ 23, 1 ] +// CHECK-NEXT: types: [ 24, 1 ] // CHECK-NEXT: sizes: [ 1, 1 ] diff --git a/test/typemapping/09_stack_class_inheritance_virtual.cpp b/test/typemapping/09_stack_class_inheritance_virtual.cpp index f72e225a..8c058671 100644 --- a/test/typemapping/09_stack_class_inheritance_virtual.cpp +++ b/test/typemapping/09_stack_class_inheritance_virtual.cpp @@ -32,7 +32,7 @@ int foo() { // CHECK-NEXT: extent: 24 // CHECK-NEXT: member_count: 4 // CHECK-NEXT: offsets: [ 0, 16, 20, 21 ] -// CHECK-NEXT: types: [ 25{{[0-9]}}, 12, 5, 6 ] +// CHECK-NEXT: types: [ 25{{[0-9]}}, 13, 6, 7 ] // CHECK-NEXT: sizes: [ 1, 1, 1, 1 ] // CHECK-NEXT: flags: 1 diff --git a/test/typemapping/10_multi_inheritance_virtual.cpp b/test/typemapping/10_multi_inheritance_virtual.cpp index 5bb768e1..3d281349 100644 --- a/test/typemapping/10_multi_inheritance_virtual.cpp +++ b/test/typemapping/10_multi_inheritance_virtual.cpp @@ -29,11 +29,19 @@ void foo() { Y class_y; } +// CHECK: name: _ZTS1X +// CHECK-NEXT: extent: 16 +// CHECK-NEXT: member_count: 2 +// CHECK-NEXT: offsets: [ 0, 8 ] +// CHECK-NEXT: types: [ 2, 13 ] +// CHECK-NEXT: sizes: [ 1, 1 ] +// CHECK-NEXT: flags: 1 + // CHECK: name: _ZTS1Y // CHECK-NEXT: extent: 40 // CHECK-NEXT: member_count: 3 // CHECK-NEXT: offsets: [ 0, 16, 32 ] -// CHECK-NEXT: types: [ 257, 258, 22 ] +// CHECK-NEXT: types: [ 25{{[6-9]}}, 25{{[6-9]}}, 23 ] // CHECK-NEXT: sizes: [ 1, 1, 1 ] // CHECK-NEXT: flags: 1 diff --git a/test/typemapping/11_void_nullptr.cpp b/test/typemapping/11_void_nullptr.cpp new file mode 100644 index 00000000..3ffbe7b4 --- /dev/null +++ b/test/typemapping/11_void_nullptr.cpp @@ -0,0 +1,32 @@ +// RUN: %remove %tu_yaml +// RUN: %c-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: dimeta + +#include + +class Y { + public: + std::nullptr_t null_pointer; + void* void_pointer; + int* other_pointer; +}; + +void foo() { + Y class_y; +} + +// CHECK: name: _ZTS1Y +// CHECK-NEXT: extent: 24 +// CHECK-NEXT: member_count: 3 +// CHECK-NEXT: offsets: [ 0, 8, 16 ] +// CHECK-NEXT: types: [ 4, 3, 1 ] +// CHECK-NEXT: sizes: [ 1, 1, 1 ] + +// 0 | class Y +// 0 | std::nullptr_t null_pointer +// 8 | void * void_pointer +// 16 | int * other_pointer +// | [sizeof=24, dsize=24, align=8, +// | nvsize=24, nvalign=8]