It is generally inappropriate to pass -O flags to IRGen tests because it makes them sensitive to optimizer behavior. #186548 makes a change to optimizer behavior that would cause this test to fail without this change. Reviewers: Pull Request: https://github.com/llvm/llvm-project/pull/190417
41 lines
709 B
C++
41 lines
709 B
C++
// RUN: %clang_cc1 -triple aarch64-linux -fexperimental-pointer-field-protection-abi -fexperimental-pointer-field-protection-tagged -emit-llvm -o - %s | FileCheck %s
|
|
|
|
int val;
|
|
|
|
struct Pointer {
|
|
int* ptr;
|
|
private:
|
|
int private_data;
|
|
};
|
|
|
|
struct ArrayType {
|
|
int* array[3];
|
|
private:
|
|
int private_data;
|
|
};
|
|
|
|
struct Array {
|
|
ArrayType array;
|
|
private:
|
|
int private_data;
|
|
};
|
|
|
|
struct Struct {
|
|
Pointer ptr;
|
|
};
|
|
|
|
// CHECK-LABEL: test_pointer
|
|
Pointer test_pointer(Pointer t) {
|
|
t.ptr = &val;
|
|
return t;
|
|
}
|
|
// CHECK: call {{.*}} @llvm.protected.field.ptr.p0{{.*}}
|
|
|
|
|
|
|
|
// CHECK-LABEL: test_struct
|
|
int* test_struct(Struct *t) {
|
|
return (t->ptr).ptr;
|
|
}
|
|
// CHECK: call {{.*}} @llvm.protected.field.ptr.p0{{.*}}
|