LLVM
22.0.0git
include
llvm
Support
AlignOf.h
Go to the documentation of this file.
1
//===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===//
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
//===----------------------------------------------------------------------===//
8
//
9
// This file defines the AlignedCharArrayUnion class.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_SUPPORT_ALIGNOF_H
14
#define LLVM_SUPPORT_ALIGNOF_H
15
16
#include <algorithm>
17
18
namespace
llvm
{
19
20
/// A suitably aligned and sized character array member which can hold elements
21
/// of any type.
22
template
<
typename
T
,
typename
... Ts>
struct
AlignedCharArrayUnion
{
23
// Work around "internal compiler error: Segmentation fault" with GCC 7.5,
24
// apparently caused by alignas(Ts...).
25
static
constexpr
std::size_t
Align
= std::max({
alignof
(
T
),
alignof
(Ts)...});
26
alignas
(
Align
)
char
buffer
[std::max({
sizeof
(
T
),
sizeof
(Ts)...})];
27
};
28
29
}
// end namespace llvm
30
31
#endif
// LLVM_SUPPORT_ALIGNOF_H
T
#define T
Definition
Mips16ISelLowering.cpp:282
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
Types.h:26
llvm::AlignedCharArrayUnion
A suitably aligned and sized character array member which can hold elements of any type.
Definition
AlignOf.h:22
llvm::AlignedCharArrayUnion< DIEInteger, DIEString, DIEExpr, DIELabel, DIEDelta *, DIEEntry, DIEBlock *, DIELoc *, DIELocList, DIEBaseTypeRef *, DIEAddrOffset * >::Align
static constexpr std::size_t Align
Definition
AlignOf.h:25
llvm::AlignedCharArrayUnion< DIEInteger, DIEString, DIEExpr, DIELabel, DIEDelta *, DIEEntry, DIEBlock *, DIELoc *, DIELocList, DIEBaseTypeRef *, DIEAddrOffset * >::buffer
char buffer[std::max({sizeof(DIEInteger), sizeof(Ts)...})]
Definition
AlignOf.h:26
Generated on
for LLVM by
1.14.0