Add comment for SelectionDAGBuilder::SL field.
[llvm-project.git] / libcxxabi / test / exception_object_alignment.pass.cpp
blobdf9f37b2e133706e362dfb80bdb723ac05e592eb
1 //===---------------- exception_object_alignment.pass.cpp -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // Check that the pointer __cxa_allocate_exception returns is aligned to the
12 // default alignment for the target architecture.
14 #include <cassert>
15 #include <cstdint>
16 #include <cxxabi.h>
17 #include <type_traits>
18 #include <__cxxabi_config.h>
20 struct S {
21 int a[4];
22 } __attribute__((aligned));
24 int main() {
25 #if !defined(_LIBCXXABI_ARM_EHABI)
26 void *p = __cxxabiv1::__cxa_allocate_exception(16);
27 auto i = reinterpret_cast<uintptr_t>(p);
28 auto a = std::alignment_of<S>::value;
29 assert(i % a == 0);
30 __cxxabiv1::__cxa_free_exception(p);
31 #endif
32 return 0;