comparison clang/test/CodeGen/object-size.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
2 2
3 // C++-specific tests for __builtin_object_size 3 // C++-specific tests for __builtin_object_size
4 4
5 int gi; 5 int gi;
6 6
7 // CHECK-LABEL: define void @_Z5test1v() 7 // CHECK-LABEL: define{{.*}} void @_Z5test1v()
8 void test1() { 8 void test1() {
9 // Guaranteeing that our cast removal logic doesn't break more interesting 9 // Guaranteeing that our cast removal logic doesn't break more interesting
10 // cases. 10 // cases.
11 struct A { int a; }; 11 struct A { int a; };
12 struct B { int b; }; 12 struct B { int b; };
27 gi = __builtin_object_size((char*)(A*)&c, 0); 27 gi = __builtin_object_size((char*)(A*)&c, 0);
28 // CHECK: store i32 4 28 // CHECK: store i32 4
29 gi = __builtin_object_size((char*)(B*)&c, 0); 29 gi = __builtin_object_size((char*)(B*)&c, 0);
30 } 30 }
31 31
32 // CHECK-LABEL: define void @_Z5test2v() 32 // CHECK-LABEL: define{{.*}} void @_Z5test2v()
33 void test2() { 33 void test2() {
34 struct A { char buf[16]; }; 34 struct A { char buf[16]; };
35 struct B : A {}; 35 struct B : A {};
36 struct C { int i; B bs[1]; } *c; 36 struct C { int i; B bs[1]; } *c;
37 37