Some testcases are unexpectedly passing with NPM.
This is because the target functions are inlined in NPM.
I think we should add noinline attribute to keep these test points.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D79648
struct IntHolder {
explicit IntHolder(int *val = 0) : val_(val) { }
- ~IntHolder() {
+ __attribute__((noinline)) ~IntHolder() {
printf("Value: %d\n", *val_); // BOOM
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
// CHECK: #0 0x{{.*}} in IntHolder::~IntHolder{{.*}}.cpp:[[@LINE-2]]
const IntHolder *saved;
-void save(const IntHolder &holder) {
+__attribute__((noinline)) void save(const IntHolder &holder) {
saved = &holder;
}
struct IntHolder {
- const IntHolder& Self() const {
+ __attribute__((noinline)) const IntHolder &Self() const {
return *this;
}
int val = 3;