Coverage Report

Created: 2017-05-06 02:30

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/DebugInfo/CodeView/TypeDatabase.h
Line
Count
Source
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
374
  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, const 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
  const CVType &getTypeRecord(TypeIndex Index) const;
38
  CVType &getTypeRecord(TypeIndex Index);
39
40
  bool containsTypeIndex(TypeIndex Index) const;
41
42
  uint32_t size() const;
43
44
private:
45
  BumpPtrAllocator Allocator;
46
47
  /// All user defined type records in .debug$T live in here. Type indices
48
  /// greater than 0x1000 are user defined. Subtract 0x1000 from the index to
49
  /// index into this vector.
50
  SmallVector<StringRef, 10> CVUDTNames;
51
  SmallVector<CVType, 10> TypeRecords;
52
53
  StringSaver TypeNameStorage;
54
};
55
}
56
}
57
58
#endif