LLVM  14.0.0git
TypeTableCollection.cpp
Go to the documentation of this file.
1 //===- TypeTableCollection.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 
14 
15 using namespace llvm;
16 using namespace llvm::codeview;
17 
19  : NameStorage(Allocator), Records(Records) {
20  Names.resize(Records.size());
21 }
22 
24  if (empty())
25  return None;
26  return TypeIndex::fromArrayIndex(0);
27 }
28 
30  assert(contains(Prev));
31  ++Prev;
32  if (Prev.toArrayIndex() == size())
33  return None;
34  return Prev;
35 }
36 
38  assert(Index.toArrayIndex() < Records.size());
39  return CVType(Records[Index.toArrayIndex()]);
40 }
41 
43  if (Index.isNoneType() || Index.isSimple())
45 
46  uint32_t I = Index.toArrayIndex();
47  if (Names[I].data() == nullptr) {
48  StringRef Result = NameStorage.save(computeTypeName(*this, Index));
49  Names[I] = Result;
50  }
51  return Names[I];
52 }
53 
55  return Index.toArrayIndex() <= size();
56 }
57 
58 uint32_t TypeTableCollection::size() { return Records.size(); }
59 
60 uint32_t TypeTableCollection::capacity() { return Records.size(); }
61 
63  bool Stabilize) {
64  llvm_unreachable("Method cannot be called");
65 }
BinaryStreamReader.h
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::codeview::computeTypeName
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
Definition: RecordName.cpp:250
llvm::codeview::TypeIndex::fromArrayIndex
static TypeIndex fromArrayIndex(uint32_t Index)
Definition: TypeIndex.h:123
llvm::codeview::TypeTableCollection::replaceType
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
Definition: TypeTableCollection.cpp:62
llvm::codeview::TypeTableCollection::TypeTableCollection
TypeTableCollection(ArrayRef< ArrayRef< uint8_t >> Records)
Definition: TypeTableCollection.cpp:18
RecordName.h
llvm::Optional
Definition: APInt.h:33
llvm::codeview::TypeTableCollection::size
uint32_t size() override
Definition: TypeTableCollection.cpp:58
llvm::codeview::TypeTableCollection::contains
bool contains(TypeIndex Index) override
Definition: TypeTableCollection.cpp:54
llvm::codeview::TypeTableCollection::getFirst
Optional< TypeIndex > getFirst() override
Definition: TypeTableCollection.cpp:23
llvm::None
const NoneType None
Definition: None.h:23
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
I
#define I(x, y, z)
Definition: MD5.cpp:59
TypeTableCollection.h
llvm::codeview::TypeCollection::empty
bool empty()
Definition: TypeCollection.h:22
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::codeview::TypeIndex::simpleTypeName
static StringRef simpleTypeName(TypeIndex TI)
Definition: TypeIndex.cpp:70
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::codeview::TypeIndex::toArrayIndex
uint32_t toArrayIndex() const
Definition: TypeIndex.h:118
llvm::codeview::CVRecord< TypeLeafKind >
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
uint32_t
llvm::codeview::TypeTableCollection::getTypeName
StringRef getTypeName(TypeIndex Index) override
Definition: TypeTableCollection.cpp:42
CVTypeVisitor.h
llvm::codeview::TypeTableCollection::capacity
uint32_t capacity() override
Definition: TypeTableCollection.cpp:60
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::TypeTableCollection::getType
CVType getType(TypeIndex Index) override
Definition: TypeTableCollection.cpp:37
llvm::codeview::TypeTableCollection::getNext
Optional< TypeIndex > getNext(TypeIndex Prev) override
Definition: TypeTableCollection.cpp:29
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
llvm::StringSaver::save
StringRef save(const char *S)
Definition: StringSaver.h:28
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:96
llvm::codeview::CVType
CVRecord< TypeLeafKind > CVType
Definition: CVRecord.h:64