LLVM  9.0.0svn
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)) {
21  consumeError(std::move(EC));
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 }
void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)
Kind kind() const
Definition: CVRecord.h:36
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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:95
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:981
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:839
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())