]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/llvm/DebugInfo/CodeView/TypeDatabase.h
Vendor import of llvm release_40 branch r292009:
[FreeBSD/FreeBSD.git] / include / llvm / DebugInfo / CodeView / TypeDatabase.h
1 //===- TypeDatabase.h - A collection of CodeView type records ---*- 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_TYPEDATABASE_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H
12
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
16 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
17 #include "llvm/Support/Allocator.h"
18 #include "llvm/Support/StringSaver.h"
19
20 namespace llvm {
21 namespace codeview {
22 class TypeDatabase {
23 public:
24   TypeDatabase() : TypeNameStorage(Allocator) {}
25
26   /// Gets the type index for the next type record.
27   TypeIndex getNextTypeIndex() const;
28
29   /// Records the name of a type, and reserves its type index.
30   void recordType(StringRef Name, CVType Data);
31
32   /// Saves the name in a StringSet and creates a stable StringRef.
33   StringRef saveTypeName(StringRef TypeName);
34
35   StringRef getTypeName(TypeIndex Index) const;
36
37   bool containsTypeIndex(TypeIndex Index) const;
38
39   uint32_t size() const;
40
41 private:
42   BumpPtrAllocator Allocator;
43
44   /// All user defined type records in .debug$T live in here. Type indices
45   /// greater than 0x1000 are user defined. Subtract 0x1000 from the index to
46   /// index into this vector.
47   SmallVector<StringRef, 10> CVUDTNames;
48   SmallVector<CVType, 10> TypeRecords;
49
50   StringSaver TypeNameStorage;
51 };
52 }
53 }
54
55 #endif