LLVM  8.0.0svn
AppendingTypeTableBuilder.h
Go to the documentation of this file.
1 //===- AppendingTypeTableBuilder.h -------------------------------*- 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 
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
11 #define LLVM_DEBUGINFO_CODEVIEW_APPENDINGTYPETABLEBUILDER_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/Support/Allocator.h"
20 #include <cassert>
21 #include <cstdint>
22 #include <memory>
23 #include <vector>
24 
25 namespace llvm {
26 namespace codeview {
27 
29 
31 
32  BumpPtrAllocator &RecordStorage;
33  SimpleTypeSerializer SimpleSerializer;
34 
35  /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
36  SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
37 
38 public:
41 
42  // TypeTableCollection overrides
43  Optional<TypeIndex> getFirst() override;
44  Optional<TypeIndex> getNext(TypeIndex Prev) override;
45  CVType getType(TypeIndex Index) override;
46  StringRef getTypeName(TypeIndex Index) override;
47  bool contains(TypeIndex Index) override;
48  uint32_t size() override;
49  uint32_t capacity() override;
50 
51  // public interface
52  void reset();
53  TypeIndex nextTypeIndex() const;
54 
55  BumpPtrAllocator &getAllocator() { return RecordStorage; }
56 
60 
61  template <typename T> TypeIndex writeLeafType(T &Record) {
62  ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
63  return insertRecordBytes(Data);
64  }
65 };
66 
67 } // end namespace codeview
68 } // end namespace llvm
69 
70 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
Optional< TypeIndex > getNext(TypeIndex Prev) override
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
ArrayRef< ArrayRef< uint8_t > > records() const
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
A 32-bit type reference.
Definition: TypeIndex.h:96
StringRef getTypeName(TypeIndex Index) override
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:141
ArrayRef< uint8_t > serialize(T &Record)
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
TypeIndex insertRecord(ContinuationRecordBuilder &Builder)
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49