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