2014-01-15 03:35:09 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - | FileCheck %s
|
2016-10-29 23:28:30 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple %itanium_abi_triple -std=c++11 -emit-llvm -o - -fstrict-vtable-pointers -O1 | FileCheck --check-prefix=CHECK-INVARIANT %s
|
2009-10-07 01:54:23 +08:00
|
|
|
|
|
|
|
// PR5021
|
2010-02-13 02:14:46 +08:00
|
|
|
namespace PR5021 {
|
|
|
|
|
2009-10-07 01:54:23 +08:00
|
|
|
struct A {
|
|
|
|
virtual void f(char);
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(A *a) {
|
2013-12-13 00:07:11 +08:00
|
|
|
// CHECK: call {{.*}}void %
|
2009-10-07 01:54:23 +08:00
|
|
|
a->f('c');
|
|
|
|
}
|
2009-12-19 10:13:41 +08:00
|
|
|
|
|
|
|
struct B : virtual A {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(B * b) {
|
|
|
|
b->f();
|
2010-02-13 02:14:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test1 {
|
|
|
|
struct A {
|
|
|
|
virtual ~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : A {
|
|
|
|
virtual ~B();
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(B *b) {
|
|
|
|
b->f();
|
|
|
|
}
|
|
|
|
}
|
2013-03-05 16:30:04 +08:00
|
|
|
|
|
|
|
namespace VirtualNoreturn {
|
|
|
|
struct A {
|
|
|
|
[[noreturn]] virtual void f();
|
|
|
|
};
|
|
|
|
|
2016-10-29 23:28:30 +08:00
|
|
|
// CHECK-LABEL: @_ZN15VirtualNoreturn1f
|
|
|
|
// CHECK-INVARIANT-LABEL: define void @_ZN15VirtualNoreturn1f
|
2013-03-05 16:30:04 +08:00
|
|
|
void f(A *p) {
|
|
|
|
p->f();
|
2013-12-13 00:07:11 +08:00
|
|
|
// CHECK: call {{.*}}void %{{[^#]*$}}
|
2013-03-05 16:30:04 +08:00
|
|
|
// CHECK-NOT: unreachable
|
2016-10-29 23:28:30 +08:00
|
|
|
// CHECK-INVARIANT: load {{.*}} !invariant.load ![[EMPTY_NODE:[0-9]+]]
|
2013-03-05 16:30:04 +08:00
|
|
|
}
|
|
|
|
}
|
2016-10-29 23:28:30 +08:00
|
|
|
|
|
|
|
// CHECK-INVARIANT: ![[EMPTY_NODE]] = !{}
|