clang 24.0.0git
ItaniumCXXABIUtils.h
Go to the documentation of this file.
1//===--- ItaniumCXXABIUtils.h - Shared Itanium C++ ABI queries --*- 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 holds the Itanium C++ ABI type_info flag values, together with
10// the queries that both classic CodeGen and CIR CodeGen need while lowering
11// ABI constructs whose encoding the ABI specifies in terms of the AST.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_CODEGENUTILS_ITANIUMCXXABIUTILS_H
16#define LLVM_CLANG_CODEGENUTILS_ITANIUMCXXABIUTILS_H
17
19
20namespace clang::CodeGenUtils {
21
22/// Flags for abi::__pbase_type_info.
24 /// PTI_Const - Type has const qualifier.
25 PTI_Const = 0x1,
26
27 /// PTI_Volatile - Type has volatile qualifier.
29
30 /// PTI_Restrict - Type has restrict qualifier.
32
33 /// PTI_Incomplete - Type is incomplete.
35
36 /// PTI_ContainingClassIncomplete - Containing class is incomplete.
37 /// (in pointer to member).
39
40 /// PTI_TransactionSafe - Pointee is transaction_safe function (C++ TM TS).
41 // PTI_TransactionSafe = 0x20,
42
43 /// PTI_Noexcept - Pointee is noexcept function (C++1z).
45};
46
47/// Flags for abi::__vmi_class_type_info.
49 /// VMI_NonDiamondRepeat - Class has non-diamond repeated inheritance.
51
52 /// VMI_DiamondShaped - Class is diamond shaped.
54};
55
56/// Flags for abi::__base_class_type_info.
58 /// BCTI_Virtual - Base class is virtual.
60
61 /// BCTI_Public - Base class is public.
63};
64
65/// Return whether the given record decl has a "single, public, non-virtual
66/// base at offset zero (i.e. the derived class is dynamic iff the base is)",
67/// according to Itanium C++ ABI, 2.95p6b.
69
70/// Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7].
72 const CXXRecordDecl *Dst);
73
74/// Compute the value of the flags member in abi::__vmi_class_type_info.
76
77/// Returns whether the given type contains an incomplete class type. This is
78/// true if
79///
80/// * The given type is an incomplete class type.
81/// * The given type is a pointer type whose pointee type contains an
82/// incomplete class type.
83/// * The given type is a member pointer type whose class is an incomplete
84/// class type.
85/// * The given type is a member pointer type whose pointee type contains an
86/// incomplete class type.
88
89/// Compute the flags for a __pbase_type_info, and remove the corresponding
90/// pieces from \p Type.
91unsigned extractPBaseFlags(const ASTContext &Ctx, QualType &Type);
92
93} // namespace clang::CodeGenUtils
94
95#endif // LLVM_CLANG_CODEGENUTILS_ITANIUMCXXABIUTILS_H
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:245
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
A (possibly-)qualified type.
Definition TypeBase.h:938
The base class of the type hierarchy.
Definition TypeBase.h:1879
unsigned extractPBaseFlags(const ASTContext &Ctx, QualType &Type)
Compute the flags for a __pbase_type_info, and remove the corresponding pieces from Type.
VMIClassTypeInfoFlags
Flags for abi::__vmi_class_type_info.
@ VMI_NonDiamondRepeat
VMI_NonDiamondRepeat - Class has non-diamond repeated inheritance.
@ VMI_DiamondShaped
VMI_DiamondShaped - Class is diamond shaped.
bool containsIncompleteClassType(QualType Ty)
Returns whether the given type contains an incomplete class type.
bool canUseSingleInheritance(const CXXRecordDecl *RD)
Return whether the given record decl has a "single, public, non-virtual base at offset zero (i....
unsigned computeVMIClassTypeInfoFlags(const CXXRecordDecl *RD)
Compute the value of the flags member in abi::__vmi_class_type_info.
CharUnits computeOffsetHint(ASTContext &Ctx, const CXXRecordDecl *Src, const CXXRecordDecl *Dst)
Compute the src2dst_offset hint as described in the Itanium C++ ABI [2.9.7].
BaseClassTypeInfoFlags
Flags for abi::__base_class_type_info.
@ BCTI_Virtual
BCTI_Virtual - Base class is virtual.
@ BCTI_Public
BCTI_Public - Base class is public.
PointerTypeInfoFlags
Flags for abi::__pbase_type_info.
@ PTI_Restrict
PTI_Restrict - Type has restrict qualifier.
@ PTI_Const
PTI_Const - Type has const qualifier.
@ PTI_ContainingClassIncomplete
PTI_ContainingClassIncomplete - Containing class is incomplete.
@ PTI_Noexcept
PTI_TransactionSafe - Pointee is transaction_safe function (C++ TM TS).
@ PTI_Volatile
PTI_Volatile - Type has volatile qualifier.
@ PTI_Incomplete
PTI_Incomplete - Type is incomplete.