2012-10-24 20:22:56 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fexceptions -fcxx-exceptions -std=c++11 -o - %s | FileCheck %s
|
2011-05-01 15:04:31 +08:00
|
|
|
|
|
|
|
struct non_trivial {
|
|
|
|
non_trivial();
|
2011-05-19 13:13:44 +08:00
|
|
|
~non_trivial() noexcept(false);
|
2011-05-01 15:04:31 +08:00
|
|
|
};
|
|
|
|
non_trivial::non_trivial() {}
|
2011-05-19 13:13:44 +08:00
|
|
|
non_trivial::~non_trivial() noexcept(false) {}
|
2011-05-01 15:04:31 +08:00
|
|
|
|
|
|
|
// We use a virtual base to ensure that the constructor
|
|
|
|
// delegation optimization (complete->base) can't be
|
|
|
|
// performed.
|
|
|
|
struct delegator {
|
|
|
|
non_trivial n;
|
|
|
|
delegator();
|
|
|
|
delegator(int);
|
|
|
|
delegator(char);
|
|
|
|
delegator(bool);
|
|
|
|
};
|
|
|
|
|
|
|
|
delegator::delegator() {
|
|
|
|
throw 0;
|
|
|
|
}
|
|
|
|
|
2011-05-04 07:05:34 +08:00
|
|
|
|
|
|
|
delegator::delegator(bool)
|
|
|
|
{}
|
|
|
|
|
2013-12-09 22:51:17 +08:00
|
|
|
// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ec
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC2Eb
|
2011-05-04 07:05:34 +08:00
|
|
|
// CHECK: void @__cxa_throw
|
2013-02-12 11:51:46 +08:00
|
|
|
// CHECK: void @__clang_call_terminate
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: {{.*}} @_ZN9delegatorD2Ev
|
2013-12-09 22:51:17 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ec
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC1Eb
|
|
|
|
// CHECK: void @__cxa_throw
|
|
|
|
// CHECK: void @__clang_call_terminate
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorD1Ev
|
2011-05-04 07:05:34 +08:00
|
|
|
delegator::delegator(char)
|
|
|
|
: delegator(true) {
|
|
|
|
throw 0;
|
|
|
|
}
|
|
|
|
|
2013-12-09 22:51:17 +08:00
|
|
|
// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ei
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC2Ev
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
// CHECK: ret
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2013-12-09 22:51:17 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ei
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC1Ev
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
// CHECK: ret
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
delegator::delegator(int)
|
|
|
|
: delegator()
|
|
|
|
{}
|
2012-05-20 08:46:05 +08:00
|
|
|
|
|
|
|
namespace PR12890 {
|
|
|
|
class X {
|
|
|
|
int x;
|
|
|
|
X() = default;
|
|
|
|
X(int);
|
|
|
|
};
|
|
|
|
X::X(int) : X() {}
|
|
|
|
}
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN7PR128901XC1Ei(%"class.PR12890::X"* %this, i32)
|
Change memcpy/memove/memset to have dest and source alignment attributes (Step 1).
Summary:
Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset
intrinsics. This change updates the Clang tests for this change.
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change removes the alignment argument in favour of placing the alignment
attribute on the source and destination pointers of the memory intrinsic call.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
At this time the source and destination alignments must be the same (Step 1).
Step 2 of the change, to be landed shortly, will relax that contraint and allow
the source and destination to have different alignments.
llvm-svn: 322964
2018-01-20 01:12:54 +08:00
|
|
|
// CHECK: call void @llvm.memset.p0i8.{{i32|i64}}(i8* align 4 {{.*}}, i8 0, {{i32|i64}} 4, i1 false)
|
2013-01-31 13:50:40 +08:00
|
|
|
|
|
|
|
namespace PR14588 {
|
|
|
|
void other();
|
|
|
|
|
|
|
|
class Base {
|
|
|
|
public:
|
|
|
|
Base() { squawk(); }
|
|
|
|
virtual ~Base() {}
|
|
|
|
|
|
|
|
virtual void squawk() { other(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Foo : public virtual Base {
|
|
|
|
public:
|
|
|
|
Foo();
|
|
|
|
Foo(const void * inVoid);
|
|
|
|
virtual ~Foo() {}
|
|
|
|
|
|
|
|
virtual void squawk() { other(); }
|
|
|
|
};
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_ZN7PR145883FooC1Ev(%"class.PR14588::Foo"*
|
2013-01-31 13:50:40 +08:00
|
|
|
// CHECK: call void @_ZN7PR145883FooC1EPKv(
|
|
|
|
// CHECK: invoke void @_ZN7PR145885otherEv()
|
|
|
|
// CHECK: call void @_ZN7PR145883FooD1Ev
|
|
|
|
// CHECK: resume
|
|
|
|
|
|
|
|
Foo::Foo() : Foo(__null) { other(); }
|
|
|
|
Foo::Foo(const void *inVoid) {
|
|
|
|
squawk();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|