LLVM 22.0.0git
TypeRecordHelpers.h
Go to the documentation of this file.
1//===- TypeRecordHelpers.h --------------------------------------*- 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#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORDHELPERS_H
10#define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDHELPERS_H
11
15
16namespace llvm {
17namespace codeview {
18
19/// Given an arbitrary codeview type, determine if it is an LF_STRUCTURE,
20/// LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class
21/// option.
23
24/// Given a CVType which is assumed to be an LF_MODIFIER, return the
25/// TypeIndex of the type that the LF_MODIFIER modifies.
26LLVM_ABI TypeIndex getModifiedType(const CVType &CVT);
27
28/// Return true if this record should be in the IPI stream of a PDB. In an
29/// object file, these record kinds will appear mixed into the .debug$T section.
30inline bool isIdRecord(TypeLeafKind K) {
31 switch (K) {
32 case TypeLeafKind::LF_FUNC_ID:
33 case TypeLeafKind::LF_MFUNC_ID:
34 case TypeLeafKind::LF_STRING_ID:
35 case TypeLeafKind::LF_SUBSTR_LIST:
36 case TypeLeafKind::LF_BUILDINFO:
37 case TypeLeafKind::LF_UDT_SRC_LINE:
38 case TypeLeafKind::LF_UDT_MOD_SRC_LINE:
39 return true;
40 default:
41 return false;
42 }
43}
44
45/// Given an arbitrary codeview type, determine if it is an LF_STRUCTURE,
46/// LF_CLASS, LF_INTERFACE, LF_UNION.
47inline bool isAggregate(CVType CVT) {
48 switch (CVT.kind()) {
49 case LF_STRUCTURE:
50 case LF_CLASS:
51 case LF_INTERFACE:
52 case LF_UNION:
53 return true;
54 default:
55 return false;
56 }
57}
58
59/// Given an arbitrary codeview type index, determine its size.
61
62/// Given an arbitrary codeview type, return the type's size in the case
63/// of aggregate (LF_STRUCTURE, LF_CLASS, LF_INTERFACE, LF_UNION).
65
66} // namespace codeview
67} // namespace llvm
68
69#endif
#define LLVM_ABI
Definition: Compiler.h:213
Kind kind() const
Definition: CVRecord.h:42
CVRecord< TypeLeafKind > CVType
Definition: CVRecord.h:64
LLVM_ABI bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE,...
bool isIdRecord(TypeLeafKind K)
Return true if this record should be in the IPI stream of a PDB.
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
Definition: CodeView.h:35
bool isAggregate(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE,...
LLVM_ABI uint64_t getSizeInBytesForTypeRecord(CVType CVT)
Given an arbitrary codeview type, return the type's size in the case of aggregate (LF_STRUCTURE,...
LLVM_ABI uint64_t getSizeInBytesForTypeIndex(TypeIndex TI)
Given an arbitrary codeview type index, determine its size.
LLVM_ABI TypeIndex getModifiedType(const CVType &CVT)
Given a CVType which is assumed to be an LF_MODIFIER, return the TypeIndex of the type that the LF_MO...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18