LLVM  8.0.1
TypeRecordHelpers.cpp
Go to the documentation of this file.
1 //===- TypeRecordHelpers.cpp ------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 
12 #include "llvm/ADT/SmallVector.h"
15 
16 using namespace llvm;
17 using namespace llvm::codeview;
18 
19 template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
20  RecordT Record;
21  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
22  consumeError(std::move(EC));
23  return ClassOptions::None;
24  }
25  return Record.getOptions();
26 }
27 
29  ClassOptions UdtOptions = ClassOptions::None;
30  switch (CVT.kind()) {
31  case LF_STRUCTURE:
32  case LF_CLASS:
33  case LF_INTERFACE:
34  UdtOptions = getUdtOptions<ClassRecord>(std::move(CVT));
35  break;
36  case LF_ENUM:
37  UdtOptions = getUdtOptions<EnumRecord>(std::move(CVT));
38  break;
39  case LF_UNION:
40  UdtOptions = getUdtOptions<UnionRecord>(std::move(CVT));
41  break;
42  default:
43  return false;
44  }
45  return (UdtOptions & ClassOptions::ForwardReference) != ClassOptions::None;
46 }
47 
49  assert(CVT.kind() == LF_MODIFIER);
51  discoverTypeIndices(CVT, Refs);
52  return Refs.front();
53 }
void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)
Kind kind() const
Definition: CVRecord.h:37
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class option.
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...
static ClassOptions getUdtOptions(CVType CVT)
A 32-bit type reference.
Definition: TypeIndex.h:96
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:982
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())