LLVM  14.0.0git
TypeRecordHelpers.cpp
Go to the documentation of this file.
1 //===- TypeRecordHelpers.cpp ------------------------------------*- 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 
10 
11 #include "llvm/ADT/SmallVector.h"
14 
15 using namespace llvm;
16 using namespace llvm::codeview;
17 
18 template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
19  RecordT Record;
20  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
22  return ClassOptions::None;
23  }
24  return Record.getOptions();
25 }
26 
28  ClassOptions UdtOptions = ClassOptions::None;
29  switch (CVT.kind()) {
30  case LF_STRUCTURE:
31  case LF_CLASS:
32  case LF_INTERFACE:
33  UdtOptions = getUdtOptions<ClassRecord>(std::move(CVT));
34  break;
35  case LF_ENUM:
36  UdtOptions = getUdtOptions<EnumRecord>(std::move(CVT));
37  break;
38  case LF_UNION:
39  UdtOptions = getUdtOptions<UnionRecord>(std::move(CVT));
40  break;
41  default:
42  return false;
43  }
44  return (UdtOptions & ClassOptions::ForwardReference) != ClassOptions::None;
45 }
46 
48  assert(CVT.kind() == LF_MODIFIER);
50  discoverTypeIndices(CVT, Refs);
51  return Refs.front();
52 }
llvm::codeview::ClassOptions::ForwardReference
@ ForwardReference
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
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::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1045
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::ClassOptions::None
@ None
getUdtOptions
static ClassOptions getUdtOptions(CVType CVT)
Definition: TypeRecordHelpers.cpp:18
llvm::codeview::ClassOptions
ClassOptions
Definition: CodeView.h:204
llvm::codeview::CVRecord::kind
Kind kind() const
Definition: CVRecord.h:42
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
TypeRecordHelpers.h
llvm::codeview::CompileSym2Flags::EC
@ EC
llvm::Record
Definition: Record.h:1486
llvm::codeview::CVRecord< TypeLeafKind >
TypeDeserializer.h
llvm::codeview::discoverTypeIndices
void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)
Definition: TypeIndexDiscovery.cpp:493
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
SmallVector.h
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:96
TypeIndexDiscovery.h