| 1 |
// RUN: %clang_cc1 -triple x86_64-apple -emit-llvm -fobjc-arc -o - %s -std=c++11 | FileCheck %s --check-prefix=ITANIUM |
| 2 |
// RUN: %clang_cc1 -triple x86_64-windows -emit-llvm -fobjc-arc -o - %s -std=c++11 |
| 3 |
// |
| 4 |
// Test cases where we weren't properly adding extended parameter info, which |
| 5 |
// caused assertions to fire. Hence, minimal CHECKs. |
| 6 |
|
| 7 |
struct VirtualBase { |
| 8 |
VirtualBase(__attribute__((ns_consumed)) id x, |
| 9 |
void * __attribute__((pass_object_size(0)))); |
| 10 |
}; |
| 11 |
struct WithVirtualBase : virtual VirtualBase { |
| 12 |
WithVirtualBase(__attribute__((ns_consumed)) id x); |
| 13 |
}; |
| 14 |
|
| 15 |
WithVirtualBase::WithVirtualBase(__attribute__((ns_consumed)) id x) |
| 16 |
: VirtualBase(x, (void *)0) {} |
| 17 |
|
| 18 |
|
| 19 |
struct VirtualBase2 { |
| 20 |
VirtualBase2(__attribute__((ns_consumed)) id x, void *y); |
| 21 |
}; |
| 22 |
|
| 23 |
// In this case, we don't actually end up passing the `id` param from |
| 24 |
// WithVirtualBaseLast's ctor to WithVirtualBaseMid's. So, we shouldn't emit |
| 25 |
// ext param info for `id` to `Mid`. Itanium-only check since MSABI seems to |
| 26 |
// emit the construction code inline. |
| 27 |
struct WithVirtualBaseMid : virtual VirtualBase2 { |
| 28 |
// Ensure we only pass in `this` and a vtable. Otherwise this test is useless. |
| 29 |
// ITANIUM: define {{.*}} void @_ZN18WithVirtualBaseMidCI212VirtualBase2EP11objc_objectPv({{[^,]*}}, {{[^,]*}}) |
| 30 |
using VirtualBase2::VirtualBase2; |
| 31 |
}; |
| 32 |
struct WithVirtualBaseLast : WithVirtualBaseMid { |
| 33 |
using WithVirtualBaseMid::WithVirtualBaseMid; |
| 34 |
}; |
| 35 |
|
| 36 |
void callLast(__attribute__((ns_consumed)) id x) { |
| 37 |
WithVirtualBaseLast{x, (void*)0}; |
| 38 |
} |