Follow up to https://github.com/llvm/llvm-project/pull/111902. Makes sure all the `no_unique_address` tests are in the same place and we don't rely on the host target triple (which means we don't need to account for `[[msvc::no_unique_address]]` on Windows). Now that we don't compile with the host compiler, this patch also adds `-c` to the compilation command since we don't actually need the linked binary in the test anyway (and on Darwin linking through Clang requires the `xcrun` prefix to set up the SDK paths, etc.). We already do this in `no_unique_address-with-bitfields.cpp` anyway.
31 lines
782 B
C++
31 lines
782 B
C++
// XFAIL: *
|
|
|
|
// RUN: %clang --target=x86_64-apple-macosx -c -gdwarf -o %t %s
|
|
// RUN: %lldb %t \
|
|
// RUN: -o "expr alignof(OverlappingDerived)" \
|
|
// RUN: -o "expr sizeof(OverlappingDerived)" \
|
|
// RUN: -o exit | FileCheck %s
|
|
|
|
struct Empty {};
|
|
|
|
struct OverlappingBase {
|
|
[[no_unique_address]] Empty e;
|
|
};
|
|
static_assert(sizeof(OverlappingBase) == 1);
|
|
static_assert(alignof(OverlappingBase) == 1);
|
|
|
|
struct Base {
|
|
int mem;
|
|
};
|
|
|
|
struct OverlappingDerived : Base, OverlappingBase {};
|
|
static_assert(alignof(OverlappingDerived) == 4);
|
|
static_assert(sizeof(OverlappingDerived) == 4);
|
|
|
|
// CHECK: (lldb) expr alignof(OverlappingDerived)
|
|
// CHECK-NEXT: ${{.*}} = 4
|
|
// CHECK: (lldb) expr sizeof(OverlappingDerived)
|
|
// CHECK-NEXT: ${{.*}} = 4
|
|
|
|
int main() { OverlappingDerived d; }
|