1 //===- TypeDatabase.h - A collection of CodeView type records ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H
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"
24 TypeDatabase() : TypeNameStorage(Allocator) {}
26 /// Gets the type index for the next type record.
27 TypeIndex getNextTypeIndex() const;
29 /// Records the name of a type, and reserves its type index.
30 void recordType(StringRef Name, CVType Data);
32 /// Saves the name in a StringSet and creates a stable StringRef.
33 StringRef saveTypeName(StringRef TypeName);
35 StringRef getTypeName(TypeIndex Index) const;
37 bool containsTypeIndex(TypeIndex Index) const;
39 uint32_t size() const;
42 BumpPtrAllocator Allocator;
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;
50 StringSaver TypeNameStorage;